STS (sts)
Primary Models
Primary models are models that you can act on directly. They are the models that represent resources in the AWS service, and are acted on by the managers.
- pydantic model botocraft.services.sts.AssumeRole[source]
Bases:
ReadonlyPrimaryBoto3ModelContains the response to a successful AssumeRole request, including temporary Amazon Web Services credentials that can be used to make Amazon Web Services requests.
Show JSON schema
{ "title": "AssumeRole", "description": "Contains the response to a successful AssumeRole request, including temporary Amazon\nWeb Services credentials that can be used to make Amazon Web Services requests.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "Credentials": { "anyOf": [ { "$ref": "#/$defs/STSCredentials" }, { "type": "null" } ], "default": null }, "AssumedRoleUser": { "anyOf": [ { "$ref": "#/$defs/STSAssumedRoleUser" }, { "type": "null" } ], "default": null }, "PackedPolicySize": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Packedpolicysize" }, "SourceIdentity": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Sourceidentity" }, "Subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subject" }, "SubjectType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subjecttype" }, "Issuer": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Issuer" }, "Provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Provider" }, "Audience": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Audience" }, "NameQualifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Namequalifier" }, "SubjectFromWebIdentityToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subjectfromwebidentitytoken" } }, "$defs": { "STSAssumedRoleUser": { "description": "The identifiers for the temporary security credentials that the operation returns.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AssumedRoleId": { "title": "Assumedroleid", "type": "string" }, "Arn": { "title": "Arn", "type": "string" } }, "required": [ "AssumedRoleId", "Arn" ], "title": "STSAssumedRoleUser", "type": "object" }, "STSCredentials": { "description": "Amazon Web Services credentials for API authentication.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AccessKeyId": { "title": "Accesskeyid", "type": "string" }, "SecretAccessKey": { "title": "Secretaccesskey", "type": "string" }, "SessionToken": { "title": "Sessiontoken", "type": "string" }, "Expiration": { "format": "date-time", "title": "Expiration", "type": "string" } }, "required": [ "AccessKeyId", "SecretAccessKey", "SessionToken", "Expiration" ], "title": "STSCredentials", "type": "object" } }, "additionalProperties": true }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
frozen: bool = True
extra: str = allow
- Fields:
- field AssumedRoleUser: STSAssumedRoleUser | None = None
The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials.
For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the
RoleSessionNamethat you specified when you calledAssumeRole.
- field Credentials: STSCredentials | None = None
The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.
- field PackedPolicySize: int | None = None
A percentage value that indicates the packed size of the session policies and session tags combined passed in the request.
The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.
- field SourceIdentity: str | None = None
The source identity specified by the principal that is calling the
AssumeRoleoperation.
- field SubjectFromWebIdentityToken: str | None = None
The subject from the web identity token (Web Identity Only).
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- manager_class
alias of
AssumeRoleManager
- delete()
Delete the model.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- save(**kwargs)
Save the model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- property arn: str | None
Return the ARN of the model. This is the value of the
AssumedRoleUser.Arnattribute.- Returns:
The ARN of the model instance.
- property name: str | None
Get the name of the model instance.
- Returns:
The name of the model instance.
- Raises:
ValueError – If the model has no name identity field.
- objects: ClassVar[classproperty] = <botocraft.services.sts.AssumeRoleManager object>
Get the manager for this model, and set it as a class property
- pydantic model botocraft.services.sts.CallerIdentity[source]
Bases:
ReadonlyPrimaryBoto3ModelContains the response to a successful GetCallerIdentity request, including information about the entity making the request.
Show JSON schema
{ "title": "CallerIdentity", "description": "Contains the response to a successful GetCallerIdentity request, including\ninformation about the entity making the request.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "UserId": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Userid" }, "Account": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Account" }, "Arn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Arn" } }, "additionalProperties": true }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
frozen: bool = True
extra: str = allow
- Fields:
- field Account: str | None = None
The Amazon Web Services account ID number of the account that owns or contains the calling entity.
- field UserId: str | None = None
The unique identifier of the calling entity.
The exact value depends on the type of entity that is making the call. The values returned are those listed in the aws:userid column in the Principal table found on the Policy Variables reference page in the IAM User Guide.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- manager_class
alias of
CallerIdentityManager
- delete()
Delete the model.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- save(**kwargs)
Save the model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- property arn: str | None
Return the ARN of the model. This is the value of the
Arnattribute.- Returns:
The ARN of the model instance.
- property name: str | None
Return the name of the model. This is the value of the
UserIdattribute.- Returns:
The name of the model instance.
- objects: ClassVar[classproperty] = <botocraft.services.sts.CallerIdentityManager object>
Get the manager for this model, and set it as a class property
Managers
Managers work with the primary models to provide a high-level interface to the AWS service. They are responsible for creating, updating, and deleting the resources in the service, as well as any additional operations that are available for those models.
- class botocraft.services.sts.AssumeRoleManager[source]
Bases:
Boto3ModelManager- assume(RoleArn: str, RoleSessionName: str, *, PolicyArns: list[botocraft.services.sts.STSPolicyDescriptorType] | None = None, Policy: str | None = None, DurationSeconds: int | None = None, Tags: list[botocraft.services.common.Tag] | None = None, TransitiveTagKeys: list[str] | None = None, ExternalId: str | None = None, SerialNumber: str | None = None, TokenCode: str | None = None, SourceIdentity: str | None = None, ProvidedContexts: list[botocraft.services.sts.STSProvidedContext] | None = None) AssumeRole[source]
Returns a set of temporary security credentials that you can use to access Amazon Web Services resources. These temporary credentials consist of an access key ID, a secret access key, and a security token. Typically, you use
AssumeRolewithin your account or for cross-account access. For a comparison ofAssumeRolewith other API operations that produce temporary credentials, see Requesting Temporary Security Credentials and Compare STS credentials in the IAM User Guide.- Parameters:
RoleArn – The Amazon Resource Name (ARN) of the role to assume.
RoleSessionName – An identifier for the assumed role session.
- Keyword Arguments:
PolicyArns – The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.
Policy – An IAM policy in JSON format that you want to use as an inline session policy.
DurationSeconds – The duration, in seconds, of the role session. The value specified can range from 900 seconds (15 minutes) up to the maximum session duration set for the role. The maximum session duration setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting or the administrator setting (whichever is lower), the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails.
Tags – A list of session tags that you want to pass. Each session tag consists of a key name and an associated value. For more information about session tags, see Tagging Amazon Web Services STS Sessions in the IAM User Guide.
TransitiveTagKeys – A list of keys for session tags that you want to set as transitive. If you set a tag key as transitive, the corresponding key and value passes to subsequent sessions in a role chain. For more information, see Chaining Roles with Session Tags in the IAM User Guide.
ExternalId – A unique identifier that might be required when you assume a role in another account. If the administrator of the account to which the role belongs provided you with an external ID, then provide that value in the
ExternalIdparameter. This value can be any string, such as a passphrase or account number. A cross-account role is usually set up to trust everyone in an account. Therefore, the administrator of the trusting account might send an external ID to the administrator of the trusted account. That way, only someone with the ID can assume the role, rather than everyone in the account. For more information about the external ID, see How to Use an External ID When Granting Access to Your Amazon Web Services Resources to a Third Party in the IAM User Guide.SerialNumber – The identification number of the MFA device that is associated with the user who is making the
AssumeRolecall. Specify this value if the trust policy of the role being assumed includes a condition that requires MFA authentication. The value is either the serial number for a hardware device (such asGAHT12345678) or an Amazon Resource Name (ARN) for a virtual device (such asarn:aws:iam::123456789012:mfa/user).TokenCode – The value provided by the MFA device, if the trust policy of the role being assumed requires MFA. (In other words, if the policy includes a condition that tests for MFA). If the role being assumed requires MFA and if the
TokenCodevalue is missing or expired, theAssumeRolecall returns an “access denied” error.SourceIdentity – The source identity specified by the principal that is calling the
AssumeRoleoperation. The source identity value persists across chained role sessions.ProvidedContexts – A list of previously acquired trusted context assertions in the format of a JSON array. The trusted context assertion is signed and encrypted by Amazon Web Services STS.
- assume_with_saml(RoleArn: str, PrincipalArn: str, SAMLAssertion: str, *, PolicyArns: list[botocraft.services.sts.STSPolicyDescriptorType] | None = None, Policy: str | None = None, DurationSeconds: int | None = None) AssumeRole | None[source]
Returns a set of temporary security credentials for users who have been authenticated via a SAML authentication response. This operation provides a mechanism for tying an enterprise identity store or directory to role-based Amazon Web Services access without user-specific credentials or configuration. For a comparison of
AssumeRoleWithSAMLwith the other API operations that produce temporary credentials, see Requesting Temporary Security Credentials and Compare STS credentials in the IAM User Guide.- Parameters:
RoleArn – The Amazon Resource Name (ARN) of the role that the caller is assuming.
PrincipalArn – The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the IdP.
SAMLAssertion – The base64 encoded SAML authentication response provided by the IdP.
- Keyword Arguments:
PolicyArns – The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.
Policy – An IAM policy in JSON format that you want to use as an inline session policy.
DurationSeconds – The duration, in seconds, of the role session. Your role session lasts for the duration that you specify for the
DurationSecondsparameter, or until the time specified in the SAML authentication response’sSessionNotOnOrAftervalue, whichever is shorter. You can provide aDurationSecondsvalue from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting, the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails. To learn how to view the maximum value for your role, see View the Maximum Session Duration Setting for a Role in the IAM User Guide.
- assume_with_web_identity(RoleArn: str, RoleSessionName: str, WebIdentityToken: str, *, ProviderId: str | None = None, PolicyArns: list[botocraft.services.sts.STSPolicyDescriptorType] | None = None, Policy: str | None = None, DurationSeconds: int | None = None) AssumeRole | None[source]
Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider. Example providers include the OAuth 2.0 providers Login with Amazon and Facebook, or any OpenID Connect-compatible identity provider such as Google or Amazon Cognito federated identities.
- Parameters:
RoleArn – The Amazon Resource Name (ARN) of the role that the caller is assuming.
RoleSessionName – An identifier for the assumed role session. Typically, you pass the name or identifier that is associated with the user who is using your application. That way, the temporary security credentials that your application will use are associated with that user. This session name is included as part of the ARN and assumed role ID in the
AssumedRoleUserresponse element.WebIdentityToken – The OAuth 2.0 access token or OpenID Connect ID token that is provided by the identity provider. Your application must get this token by authenticating the user who is using your application with a web identity provider before the application makes an
AssumeRoleWithWebIdentitycall. Timestamps in the token must be formatted as either an integer or a long integer. Tokens must be signed using either RSA keys (RS256, RS384, or RS512) or ECDSA keys (ES256, ES384, or ES512).
- Keyword Arguments:
ProviderId – The fully qualified host component of the domain name of the OAuth 2.0 identity provider. Do not specify this value for an OpenID Connect identity provider.
PolicyArns – The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as managed session policies. The policies must exist in the same account as the role.
Policy – An IAM policy in JSON format that you want to use as an inline session policy.
DurationSeconds –
The duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) up to the maximum session duration setting for the role. This setting can have a value from 1 hour to 12 hours. If you specify a value higher than this setting, the operation fails. For example, if you specify a session duration of 12 hours, but your administrator set the maximum session duration to 6 hours, your operation fails. To learn how to view the maximum value for your role, see View the Maximum Session Duration Setting for a Role in the IAM User Guide.
Secondary Models
Secondary models are models that are used by the primary models to organize their data. They are not acted on directly, but are used to describe the structure of the fields in the primary models or other secondary models.
- pydantic model botocraft.services.sts.STSAssumedRoleUser[source]
Bases:
Boto3ModelThe identifiers for the temporary security credentials that the operation returns.
Show JSON schema
{ "title": "STSAssumedRoleUser", "description": "The identifiers for the temporary security credentials that the operation returns.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AssumedRoleId": { "title": "Assumedroleid", "type": "string" }, "Arn": { "title": "Arn", "type": "string" } }, "required": [ "AssumedRoleId", "Arn" ] }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field Arn: str [Required]
The ARN of the temporary security credentials that are returned from the AssumeRole action.
For more information about ARNs and how to use them in policies, see IAM Identifiers in the IAM User Guide.
- field AssumedRoleId: str [Required]
A unique identifier that contains the role ID and the role session name of the role that is being assumed.
The role ID is generated by Amazon Web Services when the role is created.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- pydantic model botocraft.services.sts.STSCredentials[source]
Bases:
Boto3ModelAmazon Web Services credentials for API authentication.
Show JSON schema
{ "title": "STSCredentials", "description": "Amazon Web Services credentials for API authentication.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AccessKeyId": { "title": "Accesskeyid", "type": "string" }, "SecretAccessKey": { "title": "Secretaccesskey", "type": "string" }, "SessionToken": { "title": "Sessiontoken", "type": "string" }, "Expiration": { "format": "date-time", "title": "Expiration", "type": "string" } }, "required": [ "AccessKeyId", "SecretAccessKey", "SessionToken", "Expiration" ] }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field AccessKeyId: str [Required]
The access key ID that identifies the temporary security credentials.
- field SessionToken: str [Required]
The token that users must pass to the service API to use the temporary credentials.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
Request/Response Models
Request/response models are models that are used to describe the structure of the data that is sent to and received from the AWS service. They are used by the managers to send requests to the service and to parse the responses that are received.
You will not often use them directly – typically they are used by the managers internally to send requests and parse responses – but they are included here for completeness, and because occasionally we return them directly to you because they have some useful additional information.
- pydantic model botocraft.services.sts.AssumeRoleWithSAMLResponse[source]
Bases:
Boto3ModelContains the response to a successful AssumeRoleWithSAML request, including temporary Amazon Web Services credentials that can be used to make Amazon Web Services requests.
Show JSON schema
{ "title": "AssumeRoleWithSAMLResponse", "description": "Contains the response to a successful AssumeRoleWithSAML request, including\ntemporary Amazon Web Services credentials that can be used to make Amazon Web\nServices requests.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "Credentials": { "anyOf": [ { "$ref": "#/$defs/STSCredentials" }, { "type": "null" } ], "default": null }, "AssumedRoleUser": { "anyOf": [ { "$ref": "#/$defs/STSAssumedRoleUser" }, { "type": "null" } ], "default": null }, "PackedPolicySize": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Packedpolicysize" }, "Subject": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subject" }, "SubjectType": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subjecttype" }, "Issuer": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Issuer" }, "Audience": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Audience" }, "NameQualifier": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Namequalifier" }, "SourceIdentity": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Sourceidentity" } }, "$defs": { "STSAssumedRoleUser": { "description": "The identifiers for the temporary security credentials that the operation returns.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AssumedRoleId": { "title": "Assumedroleid", "type": "string" }, "Arn": { "title": "Arn", "type": "string" } }, "required": [ "AssumedRoleId", "Arn" ], "title": "STSAssumedRoleUser", "type": "object" }, "STSCredentials": { "description": "Amazon Web Services credentials for API authentication.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AccessKeyId": { "title": "Accesskeyid", "type": "string" }, "SecretAccessKey": { "title": "Secretaccesskey", "type": "string" }, "SessionToken": { "title": "Sessiontoken", "type": "string" }, "Expiration": { "format": "date-time", "title": "Expiration", "type": "string" } }, "required": [ "AccessKeyId", "SecretAccessKey", "SessionToken", "Expiration" ], "title": "STSCredentials", "type": "object" } } }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field AssumedRoleUser: STSAssumedRoleUser | None = None
The identifiers for the temporary security credentials that the operation returns.
- field Audience: str | None = None
The value of the
Recipientattribute of theSubjectConfirmationDataelement of the SAML assertion.
- field Credentials: STSCredentials | None = None
The temporary security credentials, which include an access key ID, a secret access key, and a security (or session) token.
- field PackedPolicySize: int | None = None
A percentage value that indicates the packed size of the session policies and session tags combined passed in the request.
The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.
- field SourceIdentity: str | None = None
The value in the
SourceIdentityattribute in the SAML assertion.The source identity value persists across chained role sessions.
- field Subject: str | None = None
The value of the
NameIDelement in theSubjectelement of the SAML assertion.
- field SubjectType: str | None = None
The format of the name ID, as defined by the
Formatattribute in theNameIDelement of the SAML assertion.Typical examples of the format are
transientorpersistent.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- pydantic model botocraft.services.sts.AssumeRoleWithWebIdentityResponse[source]
Bases:
Boto3ModelContains the response to a successful AssumeRoleWithWebIdentity request, including temporary Amazon Web Services credentials that can be used to make Amazon Web Services requests.
Show JSON schema
{ "title": "AssumeRoleWithWebIdentityResponse", "description": "Contains the response to a successful AssumeRoleWithWebIdentity request, including\ntemporary Amazon Web Services credentials that can be used to make Amazon Web\nServices requests.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "Credentials": { "anyOf": [ { "$ref": "#/$defs/STSCredentials" }, { "type": "null" } ], "default": null }, "SubjectFromWebIdentityToken": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Subjectfromwebidentitytoken" }, "AssumedRoleUser": { "anyOf": [ { "$ref": "#/$defs/STSAssumedRoleUser" }, { "type": "null" } ], "default": null }, "PackedPolicySize": { "anyOf": [ { "type": "integer" }, { "type": "null" } ], "default": null, "title": "Packedpolicysize" }, "Provider": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Provider" }, "Audience": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Audience" }, "SourceIdentity": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Sourceidentity" } }, "$defs": { "STSAssumedRoleUser": { "description": "The identifiers for the temporary security credentials that the operation returns.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AssumedRoleId": { "title": "Assumedroleid", "type": "string" }, "Arn": { "title": "Arn", "type": "string" } }, "required": [ "AssumedRoleId", "Arn" ], "title": "STSAssumedRoleUser", "type": "object" }, "STSCredentials": { "description": "Amazon Web Services credentials for API authentication.", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "AccessKeyId": { "title": "Accesskeyid", "type": "string" }, "SecretAccessKey": { "title": "Secretaccesskey", "type": "string" }, "SessionToken": { "title": "Sessiontoken", "type": "string" }, "Expiration": { "format": "date-time", "title": "Expiration", "type": "string" } }, "required": [ "AccessKeyId", "SecretAccessKey", "SessionToken", "Expiration" ], "title": "STSCredentials", "type": "object" } } }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field AssumedRoleUser: STSAssumedRoleUser | None = None
The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you can use to refer to the resulting temporary security credentials.
For example, you can reference these credentials as a principal in a resource-based policy by using the ARN or assumed role ID. The ARN and ID include the
RoleSessionNamethat you specified when you calledAssumeRole.
- field Audience: str | None = None
The intended audience (also known as client ID) of the web identity token.
This is traditionally the client identifier issued to the application that requested the web identity token.
- field Credentials: STSCredentials | None = None
The temporary security credentials, which include an access key ID, a secret access key, and a security token.
- field PackedPolicySize: int | None = None
A percentage value that indicates the packed size of the session policies and session tags combined passed in the request.
The request fails if the packed size is greater than 100 percent, which means the policies and tags exceeded the allowed space.
- field Provider: str | None = None
The issuing authority of the web identity token presented.
For OpenID Connect ID tokens, this contains the value of the
issfield. For OAuth 2.0 access tokens, this contains the value of theProviderIdparameter that was passed in theAssumeRoleWithWebIdentityrequest.
- field SourceIdentity: str | None = None
The value of the source identity that is returned in the JSON web token (JWT) from the identity provider.
- field SubjectFromWebIdentityToken: str | None = None
The unique user identifier that is returned by the identity provider.
This identifier is associated with the
WebIdentityTokenthat was submitted with theAssumeRoleWithWebIdentitycall. The identifier is typically unique to the user and the application that acquired theWebIdentityToken(pairwise identifier). For OpenID Connect ID tokens, this field contains the value returned by the identity provider as the token’ssub(Subject) claim.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- pydantic model botocraft.services.sts.STSPolicyDescriptorType[source]
Bases:
Boto3ModelA reference to the IAM managed policy that is passed as a session policy for a role session or a federated user session.
Show JSON schema
{ "title": "STSPolicyDescriptorType", "description": "A reference to the IAM managed policy that is passed as a session policy for a role\nsession or a federated user session.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "arn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Arn" } } }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field arn: str | None = None
The Amazon Resource Name (ARN) of the IAM managed policy to use as a session policy for the role.
For more information about ARNs, see Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces in the Amazon Web Services General Reference.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.
- pydantic model botocraft.services.sts.STSProvidedContext[source]
Bases:
Boto3ModelContains information about the provided context.
This includes the signed and encrypted trusted context assertion and the context provider ARN from which the trusted context assertion was generated.
Show JSON schema
{ "title": "STSProvidedContext", "description": "Contains information about the provided context.\n\nThis includes the signed and encrypted trusted context assertion and the context\nprovider ARN from which the trusted context assertion was generated.", "type": "object", "properties": { "session": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Session" }, "ProviderArn": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Providerarn" }, "ContextAssertion": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Contextassertion" } } }
- Config:
validate_assignment: bool = True
arbitrary_types_allowed: bool = True
- Fields:
- field ContextAssertion: str | None = None
The signed and encrypted trusted context assertion generated by the context provider.
The trusted context assertion is signed and encrypted by Amazon Web Services STS.
- field ProviderArn: str | None = None
The context provider ARN from which the trusted context assertion was generated.
- field session: Any | None = None
The boto3 session to use for this model. This is set by the manager, and is used in relationships. We have to use
Anyhere because we pydantic complains vociferously if we useboto3.session.Session. We exclude it from the model dump because it’s not something that should be serialized.
- classmethod model_construct(_fields_set: set[str] | None = None, **values: Any) Self
Creates a new instance of the Model class with validated data.
Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed.
- !!! note
model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == ‘allow’, then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == ‘ignore’ (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == ‘forbid’ does not result in an error if extra values are passed, but they will be ignored.
- Parameters:
_fields_set – A set of field names that were originally explicitly set during instantiation. If provided, this is directly used for the [model_fields_set][pydantic.BaseModel.model_fields_set] attribute. Otherwise, the field names from the values argument will be used.
values – Trusted or pre-validated data dictionary.
- Returns:
A new instance of the Model class with validated data.
- classmethod model_validate_strings(obj: Any, *, strict: bool | None = None, context: Any | None = None, by_alias: bool | None = None, by_name: bool | None = None) Self
Validate the given object with string data against the Pydantic model.
- Parameters:
obj – The object containing string data to validate.
strict – Whether to enforce types strictly.
context – Extra variables to pass to the validator.
by_alias – Whether to use the field’s alias when validating against the provided input data.
by_name – Whether to use the field’s name when validating against the provided input data.
- Returns:
The validated Pydantic model.
- set_session(session: Session) None
Set the boto3 session for this model.
- Parameters:
session – The boto3 session to use.
- Returns:
The model instance.
- transform(attribute: str, transformer: str | None) Any
Transform an attribute using a regular expression into something else before it is returned.
Important
This only makes sense for attributes that are strings.
transformeris a regular expression that will be used to transform the value of the attribute.If the attribute is
None, it will be returned verbatim.If
transformerisNone, the attribute will be returned verbatim.If
transformerhas no named groups, the attribute will be replaced with the value of the first group.If
transformerhas named groups, the attribute will be replaced with a dictionary of the named groups.
- Raises:
ValueError – If the attribute does not exist on the model.
RuntimeError – If the transformer fails to match the attribute value.
- Parameters:
attribute – The attribute to transform.
transformer – The regular expression to use to transform the attribute.
- Returns:
The transformed attribute.