antimatter.builders
#
Submodules#
Package Contents#
Classes#
Builder class for creating a CapabilityRule. |
|
Builder class for creating a list of FactPolicyRulesInner. |
|
Builder class for creating a FactPolicyRulesInnerArgumentsInner. |
|
A builder class for constructing a ReadContext object. |
|
A builder class for constructing a Settings object. |
|
Builder class for creating WriteContext objects. |
|
Builder class for creating WriteContextConfigInfo objects. |
|
Builder class for creating a WriteContextRegexRule |
|
Enum class for defining the operator of the match expression. |
|
Enum class for defining the operation. |
|
Enum class for defining the result. |
|
Enum class for defining the source of a fact policy argument. |
|
Enum class for defining the operator of a fact policy. |
|
Enum representing the available hooks. |
|
Enum class for defining the principal type. |
|
Enum class for defining the type of identity provider. |
|
Enum class for defining the action of the rule. |
|
Enum class for defining the operator of the match expression. |
|
Enum class for defining the source of the match expression. |
|
Enum class for defining the format of the token. |
|
Enum class for defining the scope of the token. |
|
Class representing the mode of the WriteContextHook. |
|
Enum class for defining the operator of the match expression. |
|
Create a collection of name/value pairs. |
|
Enum class for defining the scope of the token. |
|
Enum class for defining the format of the token. |
|
Create a collection of name/value pairs. |
|
Create a collection of name/value pairs. |
|
Create a collection of name/value pairs. |
|
Functions#
Create a KeyInfos object with Antimatter delegated AWS key information |
|
|
Create a KeyInfos object with AWS service account key information |
|
Create a KeyInfos object with GCP service account key information |
- class antimatter.builders.CapabilityRulesBuilder(*rules)#
Builder class for creating a CapabilityRule.
- Parameters:
rules – A list of tuples containing the name, operator, and values of the match expression.
- with_rule(name: str, operator: antimatter.constants.CapabilityOperator | str | None, values: List[str] | None = None) CapabilityRulesBuilder #
Add a match expression to the rule.
- Parameters:
name – The name of the match expression.
operator – The operator of the match expression.
values – The values of the match expression.
- build() antimatter_api.CapabilityRule #
Build the rule.
- Returns:
The CapabilityRule which can be used to create a new capability.
- class antimatter.builders.FactPoliciesBuilder#
Builder class for creating a list of FactPolicyRulesInner.
- with_policy(name: str, operator: antimatter.constants.FactOperator | str, *policies: FactPolicyArgumentBuilder) FactPoliciesBuilder #
Add a policy to the list.
- Parameters:
name – The name of the policy.
operator – The operator of the policy.
policies – The arguments of the policy.
- Returns:
The builder instance.
- build() List[antimatter_api.FactPolicyRulesInner] #
Build the list of policies.
- Returns:
The built list of policies.
- class antimatter.builders.FactPolicyArgumentBuilder(source: str | antimatter.constants.FactArgumentSource, capability: str | None = None, any_value: bool | None = None, value: str | None = None)#
Builder class for creating a FactPolicyRulesInnerArgumentsInner.
- Parameters:
source – The source of the argument.
capability – The capability of the argument.
any_value – Whether the argument can be any value.
value – The value of the argument.
- build() antimatter_api.FactPolicyRulesInnerArgumentsInner #
Build the argument.
- Returns:
The built argument.
- class antimatter.builders.ReadContextBuilder#
A builder class for constructing a ReadContext object.
- set_summary(summary: str) ReadContextBuilder #
Sets the summary of the ReadContext.
- Parameters:
summary – The summary to set.
- Returns:
The instance of the builder.
- set_description(description: str) ReadContextBuilder #
Sets the description of the ReadContext.
- Parameters:
description – The description to set.
- Returns:
The instance of the builder.
- add_required_hook(name: antimatter.constants.Hook | str, constraint: str = '>1.0.0', write_context: str = None) ReadContextBuilder #
Adds a required hook to the ReadContext.
- Parameters:
name – The name of the hook.
constraint – The constraint of the hook.
write_context – The write context for the hook
- Returns:
The instance of the builder.
- add_read_parameter(key: str, required: bool, description: str) ReadContextBuilder #
Adds a read parameter to the ReadContext.
- Parameters:
key – The key of the parameter.
required – Whether the parameter is required.
description – The description of the parameter.
- Returns:
The instance of the builder.
- set_key_cache_ttl(ttl: int) ReadContextBuilder #
Sets the recommended TTL for client-side CapsuleOpenResponses associated with this ReadContext.
- Parameters:
ttl – The TTL to set.
- Returns:
The instance of the builder.
- set_disable_read_logging() ReadContextBuilder #
Instructs the client that read logging associated with this ReadContext can be skipped, which speeds up access to capsules.
- Returns:
This instance of the builder.
- build() antimatter_api.AddReadContext #
Builds the ReadContext and returns it.
- Returns:
The built ReadContext.
- class antimatter.builders.SettingsPutBuilder#
A builder class for constructing a Settings object.
- set_default_display_name(name: str) SettingsPutBuilder #
Sets the active_admin_contacts of the domain settings.
- Parameters:
name – The new default display name
- Returns:
The instance of the builder.
- set_default_token_lifetime(lifetime: int) SettingsPutBuilder #
Sets the set_default_token_lifetime of the domain settings.
- Parameters:
lifetime – The new default token lifetime
- Returns:
The instance of the builder.
- set_maximum_token_lifetime(lifetime: int) SettingsPutBuilder #
Sets the maximum_token_lifetime of the domain settings.
- Parameters:
lifetime – The new maximin token lifetime
- Returns:
The instance of the builder.
- set_active_admin_contacts(contacts: List[str]) SettingsPutBuilder #
Sets the set_active_admin_contacts of the domain settings. Note: this list cannot contain any new contacts and should only be used to remove current active admin contacts. To add new active admin contacts, fist add the contacts to the pending contacts list using set_pending_admin_contacts. Once updated, a verification request will then be sent to the contact, and once verified, the contact will be converted into an active admin contact.
- Parameters:
contacts – The new list of active admin contacts
- Returns:
The instance of the builder.
- set_pending_admin_contacts(contacts: List[str]) SettingsPutBuilder #
Sets the pending_admin_contacts of the domain settings.
- Parameters:
contacts – The new list of pending admin contacts
- Returns:
The instance of the builder.
- build() antimatter_api.NewDomainSettings #
Builds the NewDomainSettings and returns it.
- Returns:
The built NewDomainSettings.
- class antimatter.builders.WriteContextBuilder#
Builder class for creating WriteContext objects.
- set_summary(summary: str) WriteContextBuilder #
Set the summary of the WriteContext.
- Parameters:
summary – The summary to set.
- Returns:
The WriteContextBuilder instance.
- set_description(description: str) WriteContextBuilder #
Set the description of the WriteContext.
- Parameters:
description – The description to set.
- Returns:
The WriteContextBuilder instance.
- add_hook(name: antimatter.constants.Hook | str, constraint: str = '>1.0.0', mode: antimatter.constants.WriteContextHookMode | str = WriteContextHookMode.Sync) WriteContextBuilder #
Add a hook to the WriteContext.
- Parameters:
name – The name of the hook.
constraint – The constraint of the hook.
mode – The mode of the hook.
- Returns:
The WriteContextBuilder instance.
- set_key_reuse_ttl(seconds: int) WriteContextBuilder #
Set the recommended key reuse TTL, which instructs the client to reuse encryption keys (and associated capsule IDs) for up to this duration in seconds.
- Parameters:
seconds – The TTL in seconds to set.
- Returns:
The WriteContextBuilder instance.
- build() antimatter_api.AddWriteContext #
Build the WriteContext.
- Returns:
The built WriteContext.
- class antimatter.builders.WriteContextConfigurationBuilder#
Builder class for creating WriteContextConfigInfo objects.
- add_hook(name: antimatter.constants.Hook | str, constraint: str = '>1.0.0', mode: antimatter.constants.WriteContextHookMode | str = WriteContextHookMode.Sync) WriteContextConfigurationBuilder #
Add a hook to the WriteContextConfigurationBuilder.
- Parameters:
name – The name of the hook.
constraint – The constraint of the hook.
mode – The mode of the hook.
- Returns:
The WriteContextConfigurationBuilder instance.
- set_key_reuse_ttl(seconds: int) WriteContextConfigurationBuilder #
Set the recommended key reuse TTL, which instructs the client to reuse encryption keys (and associated capsule IDs) for up to this duration in seconds.
- Parameters:
seconds – The TTL in seconds to set.
- Returns:
The WriteContextConfigurationBuilder instance.
- build() antimatter_api.WriteContextConfigInfo #
Build the WriteContextConfigInfo.
- Returns:
The built WriteContextConfigInfo.
- class antimatter.builders.WriteContextClassifierRuleBuilder#
Builder class for creating a WriteContextRegexRule
- add_regex_rule(pattern: str, match_on_key: bool = False) WriteContextClassifierRuleBuilder #
Create a new regex rule builder.
- Parameters:
pattern – The regex pattern for matching
match_on_key – If True, match against the key instead of the field
- Returns:
The builder instance
- add_llm_config(model: str, prompt: str) WriteContextClassifierRuleBuilder #
Add LLM config to the rule
- Parameters:
model – The LLM model to use
prompt – The prompt to use
- Returns:
The builder instance
- add_span_tag(name: str, tag_type: str | antimatter.tags.TagType = TagType.Unary, value: str | None = None) WriteContextClassifierRuleBuilder #
The span tag to add when the regex rule matches
- Parameters:
name – The span tag name
tag_type – The span tag type; default ‘unary’
value – The span tag value, if the tag_type is not ‘unary’
- Returns:
The builder instance
- add_capsule_tag(name: str, tag_type: str | antimatter.tags.TagType = TagType.Unary, value: str | None = None) WriteContextClassifierRuleBuilder #
The capsule tag to add when the regex rule matches
- Parameters:
name – The capsule tag name
tag_type – The capsule tag type; default ‘unary’
value – The capsule tag value, if the tag_type is not ‘unary’
- Returns:
The builder instance
- build() antimatter_api.ClassifierRule #
Build the rule.
- Returns:
The built rule
- antimatter.builders.antimatter_delegated_aws_key_info(key_arn: str) antimatter_api.KeyInfos #
Create a KeyInfos object with Antimatter delegated AWS key information
Example usage:
key_info = antimatter_delegated_aws_key_info(key_arn="key_arn")
- Parameters:
key_arn – The key ARN
- Returns:
A KeyInfos object with the specified key information
- antimatter.builders.aws_service_account_key_info(access_key_id: str, secret_access_key: str, key_arn: str = '') antimatter_api.KeyInfos #
Create a KeyInfos object with AWS service account key information
Example usage:
key_info = aws_service_account_key_info( access_key_id="access_key_id", secret_access_key="secret_access_key", key_arn="key_arn" )
- Parameters:
access_key_id – The access key ID
secret_access_key – The secret access key
key_arn – The key ARN
- Returns:
A KeyInfos object with the specified key information
- antimatter.builders.gcp_service_account_key_info(project_id: str, location: str, key_ring_id: str = '', key_id: str = '', service_account_credentials: str = '', service_account_credentials_path: str = '') antimatter_api.KeyInfos #
Create a KeyInfos object with GCP service account key information
Example usage:
key_info = gcp_service_account_key_info( project_id="project_id", location="location", key_ring_id="key_ring_id", key_id="key_id", service_account_credentials="<service_account_credentials_as_json_string>", service_account_credentials_path="/path/to/service_account_credentials.json" )
Either service_account_credentials or service_account_credentials_path should be provided.
- Parameters:
project_id – The project ID
location – The location
key_ring_id – The key ring ID
key_id – The key ID
service_account_credentials – The service account credentials as JSON string
service_account_credentials_path – The path to the service account credentials
- Returns:
A KeyInfos object with the specified key information
- class antimatter.builders.CapabilityOperator#
Bases:
str
,enum.Enum
Enum class for defining the operator of the match expression.
- In = 'In'#
- NotIn = 'NotIn'#
- Exists = 'Exists'#
- NotExists = 'NotExists'#
- class antimatter.builders.Operation#
Bases:
str
,enum.Enum
Enum class for defining the operation.
- Edit = 'edit'#
- View = 'view'#
- Use = 'use'#
- class antimatter.builders.Result#
Bases:
str
,enum.Enum
Enum class for defining the result.
- Allow = 'allow'#
- Deny = 'deny'#
- class antimatter.builders.FactArgumentSource#
Bases:
str
,enum.Enum
Enum class for defining the source of a fact policy argument.
- DomainIdentity = 'domainIdentity'#
- Literal = 'literal'#
- Any = 'any'#
- class antimatter.builders.FactOperator#
Bases:
str
,enum.Enum
Enum class for defining the operator of a fact policy.
- Exists = 'Exists'#
- NotExists = 'NotExists'#
- class antimatter.builders.Hook#
Bases:
str
,enum.Enum
Enum representing the available hooks.
- Fast = 'fast-pii'#
- Accurate = 'accurate-pii'#
- Regex = 'regex-classifier'#
- Datastructure = 'data-structure-classifier'#
- LLM = 'llm-classifier'#
- class antimatter.builders.PrincipalType#
Bases:
str
,enum.Enum
Enum class for defining the principal type.
- ApiKey = 'APIKey'#
- Email = 'Email'#
- HostedDomain = 'HostedDomain'#
- class antimatter.builders.ProviderType#
Bases:
str
,enum.Enum
Enum class for defining the type of identity provider.
- GoogleOAuth = 'GoogleOAuth'#
- ApiKey = 'APIKey'#
- MicrosoftOAuth = 'MicrosoftOAuth'#
- class antimatter.builders.Action#
Bases:
str
,enum.Enum
Enum class for defining the action of the rule.
- DenyCapsule = 'DenyCapsule'#
- DenyRecord = 'DenyRecord'#
- Redact = 'Redact'#
- Tokenize = 'Tokenize'#
- Allow = 'Allow'#
- class antimatter.builders.Operator#
Bases:
str
,enum.Enum
Enum class for defining the operator of the match expression.
- In = 'In'#
- NotIn = 'NotIn'#
- Exists = 'Exists'#
- NotExists = 'NotExists'#
- DateDeltaLessThan = 'DateDeltaLessThan'#
- DateDeltaGreaterThan = 'DateDeltaGreaterThan'#
- Any = 'Any'#
- class antimatter.builders.Source#
Bases:
str
,enum.Enum
Enum class for defining the source of the match expression.
- DomainIdentity = 'domainIdentity'#
- ReadParameters = 'readParameters'#
- Tags = 'tags'#
- Literal = 'literal'#
- class antimatter.builders.TokenFormat#
Bases:
str
,enum.Enum
Enum class for defining the format of the token.
- Explicit = 'explicit'#
- Synthetic = 'synthetic'#
- class antimatter.builders.TokenScope#
Bases:
str
,enum.Enum
Enum class for defining the scope of the token.
- Unique = 'unique'#
- Capsule = 'capsule'#
- Domain = 'domain'#
- class antimatter.builders.WriteContextHookMode#
Bases:
str
,enum.Enum
Class representing the mode of the WriteContextHook.
- Sync = 'sync'#
- Async = 'async'#
- class antimatter.builders.Operator#
Bases:
str
,enum.Enum
Enum class for defining the operator of the match expression.
- In = 'In'#
- NotIn = 'NotIn'#
- Exists = 'Exists'#
- NotExists = 'NotExists'#
- DateDeltaLessThan = 'DateDeltaLessThan'#
- DateDeltaGreaterThan = 'DateDeltaGreaterThan'#
- Any = 'Any'#
- class antimatter.builders.RuleEffect(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- DENYCAPSULE#
- DENYRECORD#
- REDACT#
- TOKENIZE#
- ALLOW#
- class antimatter.builders.TokenScope(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- UNIQUE = 'unique'#
- CAPSULE = 'capsule'#
- DOMAIN = 'domain'#
- class antimatter.builders.TokenFormat(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- EXPLICIT = 'explicit'#
- SYNTHETIC = 'synthetic'#
- class antimatter.builders.AssignPriority(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- FIRST = 'first'#
- LAST = 'last'#
- class antimatter.builders.ClauseOperator(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- AllOf = 'AllOf'#
- NotAllOf = 'NotAllOf'#
- AnyOf = 'AnyOf'#
- NotAnyOf = 'NotAnyOf'#
- Always = 'Always'#
- class antimatter.builders.Attachment(*args, **kwds)#
Bases:
enum.Enum
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3
Access them by:
attribute access:
>>> Color.RED <Color.RED: 1>
value lookup:
>>> Color(1) <Color.RED: 1>
name lookup:
>>> Color['RED'] <Color.RED: 1>
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3
>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]
Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
- Inherit = 'Inherit'#
- NotAttached = 'NotAttached'#
- Attached = 'Attached'#
- class antimatter.builders.ExpressionBuilder#
- set_name(name: str) ExpressionBuilder #
- add_value(value: str) ExpressionBuilder #
- set_operator(operator: str) ExpressionBuilder #
- add_variable(variable: VariableBuilder) ExpressionBuilder #
- class antimatter.builders.TagExpressionBuilder#
Bases:
ExpressionBuilder
- build() antimatter_api.TagExpression #
- class antimatter.builders.CapabilityExpressionBuilder#
Bases:
ExpressionBuilder
- build() antimatter_api.CapabilityExpression #
- class antimatter.builders.ReadParameterExpressionBuilder#
Bases:
ExpressionBuilder
- build() antimatter_api.ReadParameterExpression #
- class antimatter.builders.FactExpressionBuilder#
- set_type(fact_type: str) FactExpressionBuilder #
- set_operator(operator: str) FactExpressionBuilder #
- add_argument(operator: antimatter.constants.Operator, values: List[str] = []) FactExpressionBuilder #
- add_variable(variable: VariableBuilder) FactExpressionBuilder #
- build() antimatter_api.FactExpression #
- class antimatter.builders.FactExpressionArgumentBuilder#
- set_operator(operator: str) FactExpressionArgumentBuilder #
- add_value(value: str) FactExpressionArgumentBuilder #
- build() antimatter_api.FactExpressionArgumentsInner #
- class antimatter.builders.VariableBuilder#
- set_variable_name(name: str) VariableBuilder #
- set_source(source: str) VariableBuilder #
- set_tag_name(tag_name: str) VariableBuilder #
- set_capability_name(capability_name: str) VariableBuilder #
- set_fact_type(fact_type: str) VariableBuilder #
- add_fact_argument(argument: FactExpressionArgumentBuilder) VariableBuilder #
- add_variable(variable: VariableBuilder) VariableBuilder #
- build() antimatter_api.VariableDefinition #
- class antimatter.builders.DataPolicyClauseBuilder(operator: ClauseOperator)#
- add_tag(tag: TagExpressionBuilder) DataPolicyClauseBuilder #
- add_capability(capability: CapabilityExpressionBuilder) DataPolicyClauseBuilder #
- add_fact(fact: FactExpressionBuilder) DataPolicyClauseBuilder #
- add_read_parameter(read_parameter: ReadParameterExpressionBuilder) DataPolicyClauseBuilder #
- build() antimatter_api.DataPolicyClause #
- class antimatter.builders.NewDataPolicyRuleBuilder(effect: RuleEffect, comment: str | None = None, token_scope: TokenScope | None = None, token_format: TokenFormat | None = None, assign_priority: AssignPriority | None = None, priority: int | None = None)#
- add_clause(clause: DataPolicyClauseBuilder) NewDataPolicyRuleBuilder #
- build() antimatter_api.NewDataPolicyRule #
- class antimatter.builders.DataPolicyRuleChangesBuilder#
- add_rule(rule: NewDataPolicyRuleBuilder) DataPolicyRuleChangesBuilder #
- delete_rules(rule_ids: List[str]) DataPolicyRuleChangesBuilder #
- build() antimatter_api.DataPolicyRuleChanges #