diff --git a/codegen/test.json b/codegen/test.json
deleted file mode 100644
index 79e481f..0000000
--- a/codegen/test.json
+++ /dev/null
@@ -1,1256 +0,0 @@
-{
- "smithy": "1.0",
- "metadata": {
- "suppressions": [
- {
- "id": "HttpMethodSemantics",
- "namespace": "*"
- },
- {
- "id": "HttpResponseCodeSemantics",
- "namespace": "*"
- },
- {
- "id": "PaginatedTrait",
- "namespace": "*"
- },
- {
- "id": "HttpHeaderTrait",
- "namespace": "*"
- },
- {
- "id": "HttpUriConflict",
- "namespace": "*"
- },
- {
- "id": "Service",
- "namespace": "*"
- }
- ]
- },
- "shapes": {
- "com.amazonaws.sts#AWSSecurityTokenServiceV20110615": {
- "type": "service",
- "version": "2011-06-15",
- "operations": [
- {
- "target": "com.amazonaws.sts#AssumeRole"
- },
- {
- "target": "com.amazonaws.sts#AssumeRoleWithSAML"
- },
- {
- "target": "com.amazonaws.sts#AssumeRoleWithWebIdentity"
- },
- {
- "target": "com.amazonaws.sts#DecodeAuthorizationMessage"
- },
- {
- "target": "com.amazonaws.sts#GetAccessKeyInfo"
- },
- {
- "target": "com.amazonaws.sts#GetCallerIdentity"
- },
- {
- "target": "com.amazonaws.sts#GetFederationToken"
- },
- {
- "target": "com.amazonaws.sts#GetSessionToken"
- }
- ],
- "traits": {
- "aws.api#service": {
- "sdkId": "STS",
- "arnNamespace": "sts",
- "cloudFormationName": "STS",
- "cloudTrailEventSource": "sts.amazonaws.com",
- "endpointPrefix": "sts"
- },
- "aws.auth#sigv4": {
- "name": "sts"
- },
- "aws.protocols#awsQuery": {},
- "smithy.api#documentation": "
AWS Security Token Service (STS) enables you to request temporary, limited-privilege \n credentials for AWS Identity and Access Management (IAM) users or for users that you \n authenticate (federated users). This guide provides descriptions of the STS API. For \n more information about using this service, see Temporary Security Credentials.
", - "smithy.api#title": "AWS Security Token Service", - "smithy.api#xmlNamespace": { - "uri": "https://sts.amazonaws.com/doc/2011-06-15/" - } - } - }, - "com.amazonaws.sts#AssumeRole": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#AssumeRoleRequest" - }, - "output": { - "target": "com.amazonaws.sts#AssumeRoleResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#ExpiredTokenException" - }, - { - "target": "com.amazonaws.sts#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.sts#PackedPolicyTooLargeException" - }, - { - "target": "com.amazonaws.sts#RegionDisabledException" - } - ], - "traits": { - "smithy.api#documentation": "Returns a set of temporary security credentials that you can use to access AWS\n resources that you might not normally have access to. These temporary credentials\n consist of an access key ID, a secret access key, and a security token. Typically, you\n use AssumeRole
within your account or for cross-account access. For a\n comparison of AssumeRole
with other API operations that produce temporary\n credentials, see Requesting Temporary Security\n Credentials and Comparing\n the AWS STS API operations in the\n IAM User Guide.
\n Permissions\n
\nThe temporary security credentials created by AssumeRole
can be used to\n make API calls to any AWS service with the following exception: You cannot call the\n AWS STS GetFederationToken
or GetSessionToken
API\n operations.
(Optional) You can pass inline or managed session policies to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session policies.\n The plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\nTo assume a role from a different account, your AWS account must be trusted by the\n role. The trust relationship is defined in the role's trust policy when the role is\n created. That trust policy states which accounts are allowed to delegate that access to\n users in the account.
\nA user who wants to access a role in a different account must also have permissions that\n are delegated from the user account administrator. The administrator must attach a policy\n that allows the user to call AssumeRole
for the ARN of the role in the other\n account. If the user is in the same account as the role, then you can do either of the\n following:
Attach a policy to the user (identical to the previous user in a different\n account).
\nAdd the user as a principal directly in the role's trust policy.
\nIn this case, the trust policy acts as an IAM resource-based policy. Users in the same\n account as the role do not need explicit permission to assume the role. For more\n information about trust policies and resource-based policies, see IAM Policies in\n the IAM User Guide.
\n\n Tags\n
\n(Optional) You can pass tag key-value pairs to your session. These tags are called\n session tags. For more information about session tags, see Passing Session Tags in STS in the\n IAM User Guide.
\nAn administrator must grant you the permissions necessary to pass session tags. The\n administrator can also create granular permissions to allow you to pass only specific\n session tags. For more information, see Tutorial: Using Tags\n for Attribute-Based Access Control in the\n IAM User Guide.
\nYou can set the session tags as transitive. Transitive tags persist during role\n chaining. For more information, see Chaining Roles\n with Session Tags in the IAM User Guide.
\n\n Using MFA with AssumeRole\n
\n(Optional) You can include multi-factor authentication (MFA) information when you call\n AssumeRole
. This is useful for cross-account scenarios to ensure that the\n user that assumes the role has been authenticated with an AWS MFA device. In that\n scenario, the trust policy of the role being assumed includes a condition that tests for\n MFA authentication. If the caller does not include valid MFA information, the request to\n assume the role is denied. The condition in a trust policy that tests for MFA\n authentication might look like the following example.
\n \"Condition\": {\"Bool\": {\"aws:MultiFactorAuthPresent\": true}}
\n
For more information, see Configuring MFA-Protected API Access\n in the IAM User Guide guide.
\nTo use MFA with AssumeRole
, you pass values for the\n SerialNumber
and TokenCode
parameters. The\n SerialNumber
value identifies the user's hardware or virtual MFA device.\n The TokenCode
is the time-based one-time password (TOTP) that the MFA device\n produces.
The Amazon Resource Name (ARN) of the role to assume.
", - "smithy.api#required": {} - } - }, - "RoleSessionName": { - "target": "com.amazonaws.sts#roleSessionNameType", - "traits": { - "smithy.api#documentation": "An identifier for the assumed role session.
\nUse the role session name to uniquely identify a session when the same role is assumed\n by different principals or for different reasons. In cross-account scenarios, the role\n session name is visible to, and can be logged by the account that owns the role. The role\n session name is also used in the ARN of the assumed role principal. This means that\n subsequent cross-account API requests that use the temporary security credentials will\n expose the role session name to the external account in their AWS CloudTrail logs.
\nThe regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
", - "smithy.api#required": {} - } - }, - "PolicyArns": { - "target": "com.amazonaws.sts#policyDescriptorListType", - "traits": { - "smithy.api#documentation": "The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as\n managed session policies. The policies must exist in the same account as the role.
\nThis parameter is optional. You can provide up to 10 managed policy ARNs. However, the\n plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS\n Service Namespaces in the AWS General Reference.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
" - } - }, - "Policy": { - "target": "com.amazonaws.sts#sessionPolicyDocumentType", - "traits": { - "smithy.api#documentation": "An IAM policy in JSON format that you want to use as an inline session policy.
\nThis parameter is optional. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\nThe plaintext that you use for both inline and managed session policies can't exceed\n 2,048 characters. The JSON policy characters can be any ASCII character from the space\n character to the end of the valid character list (\\u0020 through \\u00FF). It can also\n include the tab (\\u0009), linefeed (\\u000A), and carriage return (\\u000D)\n characters.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
The duration, in seconds, of the role session. The value specified can can range from\n 900 seconds (15 minutes) up to the maximum session duration that is set for the role. The\n maximum session duration setting can have a value from 1 hour to 12 hours. If you specify a\n value higher than this setting or the administrator setting (whichever is lower), the\n operation fails. For example, if you specify a session duration of 12 hours, but your\n administrator set the maximum session duration to 6 hours, your operation fails. To learn\n how to view the maximum value for your role, see View the\n Maximum Session Duration Setting for a Role in the\n IAM User Guide.
\nBy default, the value is set to 3600
seconds.
The DurationSeconds
parameter is separate from the duration of a console\n session that you might request using the returned credentials. The request to the\n federation endpoint for a console sign-in token takes a SessionDuration
\n parameter that specifies the maximum length of the console session. For more\n information, see Creating a URL\n that Enables Federated Users to Access the AWS Management Console in the\n IAM User Guide.
A list of session tags that you want to pass. Each session tag consists of a key name\n and an associated value. For more information about session tags, see Tagging AWS STS\n Sessions in the IAM User Guide.
\nThis parameter is optional. You can pass up to 50 session tags. The plaintext session\n tag keys can’t exceed 128 characters, and the values can’t exceed 256 characters. For these\n and additional limits, see IAM\n and STS Character Limits in the IAM User Guide.
\n \nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
You can pass a session tag with the same key as a tag that is already\n attached to the role. When you do, session tags override a role tag with the same key.
\nTag key–value pairs are not case sensitive, but case is preserved. This means that you\n cannot have separate Department
and department
tag keys. Assume\n that the role has the Department
=Marketing
tag and you pass the\n department
=engineering
session tag. Department
\n and department
are not saved as separate tags, and the session tag passed in\n the request takes precedence over the role tag.
Additionally, if you used temporary credentials to perform this operation, the new\n session inherits any transitive session tags from the calling session. If you pass a\n session tag with the same key as an inherited tag, the operation fails. To view the\n inherited tags for a session, see the AWS CloudTrail logs. For more information, see Viewing Session Tags in CloudTrail in the\n IAM User Guide.
" - } - }, - "TransitiveTagKeys": { - "target": "com.amazonaws.sts#tagKeyListType", - "traits": { - "smithy.api#documentation": "A list of keys for session tags that you want to set as transitive. If you set a tag key\n as transitive, the corresponding key and value passes to subsequent sessions in a role\n chain. For more information, see Chaining Roles\n with Session Tags in the IAM User Guide.
\nThis parameter is optional. When you set session tags as transitive, the session policy\n and session tags packed binary limit is not affected.
\nIf you choose not to specify a transitive tag key, then no tags are passed from this\n session to any subsequent sessions.
" - } - }, - "ExternalId": { - "target": "com.amazonaws.sts#externalIdType", - "traits": { - "smithy.api#documentation": "A unique identifier that might be required when you assume a role in another account. If\n the administrator of the account to which the role belongs provided you with an external\n ID, then provide that value in the ExternalId
parameter. This value can be any\n string, such as a passphrase or account number. A cross-account role is usually set up to\n trust everyone in an account. Therefore, the administrator of the trusting account might\n send an external ID to the administrator of the trusted account. That way, only someone\n with the ID can assume the role, rather than everyone in the account. For more information\n about the external ID, see How to Use an External ID\n When Granting Access to Your AWS Resources to a Third Party in the\n IAM User Guide.
The regex used to validate this parameter is a string of \n characters consisting of upper- and lower-case alphanumeric characters with no spaces. \n You can also include underscores or any of the following characters: =,.@:/-
" - } - }, - "SerialNumber": { - "target": "com.amazonaws.sts#serialNumberType", - "traits": { - "smithy.api#documentation": "The identification number of the MFA device that is associated with the user who is\n making the AssumeRole
call. Specify this value if the trust policy of the role\n being assumed includes a condition that requires MFA authentication. The value is either\n the serial number for a hardware device (such as GAHT12345678
) or an Amazon\n Resource Name (ARN) for a virtual device (such as\n arn:aws:iam::123456789012:mfa/user
).
The regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
" - } - }, - "TokenCode": { - "target": "com.amazonaws.sts#tokenCodeType", - "traits": { - "smithy.api#documentation": "The value provided by the MFA device, if the trust policy of the role being assumed\n requires MFA. (In other words, if the policy includes a condition that tests for MFA). If\n the role being assumed requires MFA and if the TokenCode
value is missing or\n expired, the AssumeRole
call returns an \"access denied\" error.
The format for this parameter, as described by its regex pattern, is a sequence of six\n numeric digits.
" - } - }, - "SourceIdentity": { - "target": "com.amazonaws.sts#sourceIdentityType", - "traits": { - "smithy.api#documentation": "The source identity specified by the principal that is calling the\n AssumeRole
operation.
You can require users to specify a source identity when they assume a role. You do this\n by using the sts:SourceIdentity
condition key in a role trust policy. You can\n use source identity information in AWS CloudTrail logs to determine who took actions with a role.\n You can use the aws:SourceIdentity
condition key to further control access to\n AWS resources based on the value of source identity. For more information about using\n source identity, see Monitor and control\n actions taken with assumed roles in the\n IAM User Guide.
The regex used to validate this parameter is a string of characters consisting of upper-\n and lower-case alphanumeric characters with no spaces. You can also include underscores or\n any of the following characters: =,.@-. You cannot use a value that begins with the text\n aws:
. This prefix is reserved for AWS internal\n use.
The temporary security credentials, which include an access key ID, a secret access key,\n and a security (or session) token.
\nThe size of the security token that STS API operations return is not fixed. We\n strongly recommend that you make no assumptions about the maximum size.
\nThe Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you\n can use to refer to the resulting temporary security credentials. For example, you can\n reference these credentials as a principal in a resource-based policy by using the ARN or\n assumed role ID. The ARN and ID include the RoleSessionName
that you specified\n when you called AssumeRole
.
A percentage value that indicates the packed size of the session policies and session \n tags combined passed in the request. The request fails if the packed size is greater than 100 percent, \n which means the policies and tags exceeded the allowed space.
" - } - }, - "SourceIdentity": { - "target": "com.amazonaws.sts#sourceIdentityType", - "traits": { - "smithy.api#documentation": "The source identity specified by the principal that is calling the\n AssumeRole
operation.
You can require users to specify a source identity when they assume a role. You do this\n by using the sts:SourceIdentity
condition key in a role trust policy. You can\n use source identity information in AWS CloudTrail logs to determine who took actions with a role.\n You can use the aws:SourceIdentity
condition key to further control access to\n AWS resources based on the value of source identity. For more information about using\n source identity, see Monitor and control\n actions taken with assumed roles in the\n IAM User Guide.
The regex used to validate this parameter is a string of characters consisting of upper-\n and lower-case alphanumeric characters with no spaces. You can also include underscores or\n any of the following characters: =,.@-
" - } - } - }, - "traits": { - "smithy.api#documentation": "Contains the response to a successful AssumeRole request, including\n temporary AWS credentials that can be used to make AWS requests.
" - } - }, - "com.amazonaws.sts#AssumeRoleWithSAML": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#AssumeRoleWithSAMLRequest" - }, - "output": { - "target": "com.amazonaws.sts#AssumeRoleWithSAMLResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#ExpiredTokenException" - }, - { - "target": "com.amazonaws.sts#IDPRejectedClaimException" - }, - { - "target": "com.amazonaws.sts#InvalidIdentityTokenException" - }, - { - "target": "com.amazonaws.sts#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.sts#PackedPolicyTooLargeException" - }, - { - "target": "com.amazonaws.sts#RegionDisabledException" - } - ], - "traits": { - "smithy.api#documentation": "Returns a set of temporary security credentials for users who have been authenticated\n via a SAML authentication response. This operation provides a mechanism for tying an\n enterprise identity store or directory to role-based AWS access without user-specific\n credentials or configuration. For a comparison of AssumeRoleWithSAML
with the\n other API operations that produce temporary credentials, see Requesting Temporary Security\n Credentials and Comparing the\n AWS STS API operations in the IAM User Guide.
The temporary security credentials returned by this operation consist of an access key\n ID, a secret access key, and a security token. Applications can use these temporary\n security credentials to sign calls to AWS services.
\n\n Session Duration\n
\nBy default, the temporary security credentials created by\n AssumeRoleWithSAML
last for one hour. However, you can use the optional\n DurationSeconds
parameter to specify the duration of your session. Your\n role session lasts for the duration that you specify, or until the time specified in the\n SAML authentication response's SessionNotOnOrAfter
value, whichever is\n shorter. You can provide a DurationSeconds
value from 900 seconds (15 minutes)\n up to the maximum session duration setting for the role. This setting can have a value from\n 1 hour to 12 hours. To learn how to view the maximum value for your role, see View the\n Maximum Session Duration Setting for a Role in the\n IAM User Guide. The maximum session duration limit applies when\n you use the AssumeRole*
API operations or the assume-role*
CLI\n commands. However the limit does not apply when you use those operations to create a\n console URL. For more information, see Using IAM Roles in the\n IAM User Guide.
\n Role chaining limits your AWS CLI or AWS API\n role session to a maximum of one hour. When you use the AssumeRole
API\n operation to assume a role, you can specify the duration of your role session with\n the DurationSeconds
parameter. You can specify a parameter value of up\n to 43200 seconds (12 hours), depending on the maximum session duration setting for\n your role. However, if you assume a role using role chaining and provide a\n DurationSeconds
parameter value greater than one hour, the\n operation fails.
\n Permissions\n
\nThe temporary security credentials created by AssumeRoleWithSAML
can be\n used to make API calls to any AWS service with the following exception: you cannot call\n the STS GetFederationToken
or GetSessionToken
API\n operations.
(Optional) You can pass inline or managed session policies to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session policies.\n The plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\nCalling AssumeRoleWithSAML
does not require the use of AWS security\n credentials. The identity of the caller is validated by using keys in the metadata document\n that is uploaded for the SAML provider entity for your identity provider.
Calling AssumeRoleWithSAML
can result in an entry in your AWS CloudTrail logs.\n The entry includes the value in the NameID
element of the SAML assertion.\n We recommend that you use a NameIDType
that is not associated with any\n personally identifiable information (PII). For example, you could instead use the\n persistent identifier\n (urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
).
\n Tags\n
\n(Optional) You can configure your IdP to pass attributes into your SAML assertion as\n session tags. Each session tag consists of a key name and an associated value. For more\n information about session tags, see Passing Session Tags in STS in the\n IAM User Guide.
\nYou can pass up to 50 session tags. The plaintext session tag keys can’t exceed 128\n characters and the values can’t exceed 256 characters. For these and additional limits, see\n IAM\n and STS Character Limits in the IAM User Guide.
\n \nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
You can pass a session tag with the same key as a tag that is\n attached to the role. When you do, session tags override the role's tags with the same\n key.
\nAn administrator must grant you the permissions necessary to pass session tags. The\n administrator can also create granular permissions to allow you to pass only specific\n session tags. For more information, see Tutorial: Using Tags\n for Attribute-Based Access Control in the\n IAM User Guide.
\nYou can set the session tags as transitive. Transitive tags persist during role\n chaining. For more information, see Chaining Roles\n with Session Tags in the IAM User Guide.
\n\n SAML Configuration\n
\nBefore your application can call AssumeRoleWithSAML
, you must configure\n your SAML identity provider (IdP) to issue the claims required by AWS. Additionally, you\n must use AWS Identity and Access Management (IAM) to create a SAML provider entity in your AWS account that\n represents your identity provider. You must also create an IAM role that specifies this\n SAML provider in its trust policy.
For more information, see the following resources:
\n\n About\n SAML 2.0-based Federation in the IAM User Guide.\n
\n\n Creating SAML Identity Providers in the\n IAM User Guide.
\n\n Configuring\n a Relying Party and Claims in the IAM User Guide.\n
\n\n Creating a Role for SAML 2.0 Federation in the\n IAM User Guide.
\nThe Amazon Resource Name (ARN) of the role that the caller is assuming.
", - "smithy.api#required": {} - } - }, - "PrincipalArn": { - "target": "com.amazonaws.sts#arnType", - "traits": { - "smithy.api#documentation": "The Amazon Resource Name (ARN) of the SAML provider in IAM that describes the\n IdP.
", - "smithy.api#required": {} - } - }, - "SAMLAssertion": { - "target": "com.amazonaws.sts#SAMLAssertionType", - "traits": { - "smithy.api#documentation": "The base64 encoded SAML authentication response provided by the IdP.
\nFor more information, see Configuring a Relying Party and\n Adding Claims in the IAM User Guide.
", - "smithy.api#required": {} - } - }, - "PolicyArns": { - "target": "com.amazonaws.sts#policyDescriptorListType", - "traits": { - "smithy.api#documentation": "The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as\n managed session policies. The policies must exist in the same account as the role.
\nThis parameter is optional. You can provide up to 10 managed policy ARNs. However, the\n plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS\n Service Namespaces in the AWS General Reference.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
" - } - }, - "Policy": { - "target": "com.amazonaws.sts#sessionPolicyDocumentType", - "traits": { - "smithy.api#documentation": "An IAM policy in JSON format that you want to use as an inline session policy.
\nThis parameter is optional. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\nThe plaintext that you use for both inline and managed session policies can't exceed\n 2,048 characters. The JSON policy characters can be any ASCII character from the space\n character to the end of the valid character list (\\u0020 through \\u00FF). It can also\n include the tab (\\u0009), linefeed (\\u000A), and carriage return (\\u000D)\n characters.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
The duration, in seconds, of the role session. Your role session lasts for the duration\n that you specify for the DurationSeconds
parameter, or until the time\n specified in the SAML authentication response's SessionNotOnOrAfter
value,\n whichever is shorter. You can provide a DurationSeconds
value from 900 seconds\n (15 minutes) up to the maximum session duration setting for the role. This setting can have\n a value from 1 hour to 12 hours. If you specify a value higher than this setting, the\n operation fails. For example, if you specify a session duration of 12 hours, but your\n administrator set the maximum session duration to 6 hours, your operation fails. To learn\n how to view the maximum value for your role, see View the\n Maximum Session Duration Setting for a Role in the\n IAM User Guide.
By default, the value is set to 3600
seconds.
The DurationSeconds
parameter is separate from the duration of a console\n session that you might request using the returned credentials. The request to the\n federation endpoint for a console sign-in token takes a SessionDuration
\n parameter that specifies the maximum length of the console session. For more\n information, see Creating a URL\n that Enables Federated Users to Access the AWS Management Console in the\n IAM User Guide.
The temporary security credentials, which include an access key ID, a secret access key,\n and a security (or session) token.
\nThe size of the security token that STS API operations return is not fixed. We\n strongly recommend that you make no assumptions about the maximum size.
\nThe identifiers for the temporary security credentials that the operation\n returns.
" - } - }, - "PackedPolicySize": { - "target": "com.amazonaws.sts#nonNegativeIntegerType", - "traits": { - "smithy.api#documentation": "A percentage value that indicates the packed size of the session policies and session \n tags combined passed in the request. The request fails if the packed size is greater than 100 percent, \n which means the policies and tags exceeded the allowed space.
" - } - }, - "Subject": { - "target": "com.amazonaws.sts#Subject", - "traits": { - "smithy.api#documentation": "The value of the NameID
element in the Subject
element of the\n SAML assertion.
The format of the name ID, as defined by the Format
attribute in the\n NameID
element of the SAML assertion. Typical examples of the format are\n transient
or persistent
.
If the format includes the prefix\n urn:oasis:names:tc:SAML:2.0:nameid-format
, that prefix is removed. For\n example, urn:oasis:names:tc:SAML:2.0:nameid-format:transient
is returned as\n transient
. If the format includes any other prefix, the format is returned\n with no modifications.
The value of the Issuer
element of the SAML assertion.
The value of the Recipient
attribute of the\n SubjectConfirmationData
element of the SAML assertion.
A hash value based on the concatenation of the following:
\nThe Issuer
response value.
The AWS account ID.
\nThe friendly name (the last part of the ARN) of the SAML provider in IAM.
\nThe combination of NameQualifier
and Subject
can be used to\n uniquely identify a federated user.
The following pseudocode shows how the hash value is calculated:
\n\n BASE64 ( SHA1 ( \"https://example.com/saml\" + \"123456789012\" + \"/MySAMLIdP\" ) )
\n
The value in the SourceIdentity
attribute in the SAML assertion.
You can require users to set a source identity value when they assume a role. You do\n this by using the sts:SourceIdentity
condition key in a role trust policy.\n That way, actions that are taken with the role are associated with that user. After the\n source identity is set, the value cannot be changed. It is present in the request for all\n actions that are taken by the role and persists across chained\n role sessions. You can configure your SAML identity provider to use an attribute\n associated with your users, like user name or email, as the source identity when calling\n AssumeRoleWithSAML
. You do this by adding an attribute to the SAML\n assertion. For more information about using source identity, see Monitor and control\n actions taken with assumed roles in the\n IAM User Guide.
The regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
" - } - } - }, - "traits": { - "smithy.api#documentation": "Contains the response to a successful AssumeRoleWithSAML request,\n including temporary AWS credentials that can be used to make AWS requests.
" - } - }, - "com.amazonaws.sts#AssumeRoleWithWebIdentity": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#AssumeRoleWithWebIdentityRequest" - }, - "output": { - "target": "com.amazonaws.sts#AssumeRoleWithWebIdentityResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#ExpiredTokenException" - }, - { - "target": "com.amazonaws.sts#IDPCommunicationErrorException" - }, - { - "target": "com.amazonaws.sts#IDPRejectedClaimException" - }, - { - "target": "com.amazonaws.sts#InvalidIdentityTokenException" - }, - { - "target": "com.amazonaws.sts#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.sts#PackedPolicyTooLargeException" - }, - { - "target": "com.amazonaws.sts#RegionDisabledException" - } - ], - "traits": { - "smithy.api#documentation": "Returns a set of temporary security credentials for users who have been authenticated in\n a mobile or web application with a web identity provider. Example providers include Amazon Cognito,\n Login with Amazon, Facebook, Google, or any OpenID Connect-compatible identity\n provider.
\nFor mobile applications, we recommend that you use Amazon Cognito. You can use Amazon Cognito with the\n AWS SDK for iOS Developer Guide and the AWS SDK for Android Developer Guide to uniquely\n identify a user. You can also supply the user with a consistent identity throughout the\n lifetime of an application.
\nTo learn more about Amazon Cognito, see Amazon Cognito Overview in\n AWS SDK for Android Developer Guide and Amazon Cognito Overview in the\n AWS SDK for iOS Developer Guide.
\nCalling AssumeRoleWithWebIdentity
does not require the use of AWS\n security credentials. Therefore, you can distribute an application (for example, on mobile\n devices) that requests temporary security credentials without including long-term AWS\n credentials in the application. You also don't need to deploy server-based proxy services\n that use long-term AWS credentials. Instead, the identity of the caller is validated by\n using a token from the web identity provider. For a comparison of\n AssumeRoleWithWebIdentity
with the other API operations that produce\n temporary credentials, see Requesting Temporary Security\n Credentials and Comparing the\n AWS STS API operations in the IAM User Guide.
The temporary security credentials returned by this API consist of an access key ID, a\n secret access key, and a security token. Applications can use these temporary security\n credentials to sign calls to AWS service API operations.
\n\n Session Duration\n
\nBy default, the temporary security credentials created by\n AssumeRoleWithWebIdentity
last for one hour. However, you can use the\n optional DurationSeconds
parameter to specify the duration of your session.\n You can provide a value from 900 seconds (15 minutes) up to the maximum session duration\n setting for the role. This setting can have a value from 1 hour to 12 hours. To learn how\n to view the maximum value for your role, see View the\n Maximum Session Duration Setting for a Role in the\n IAM User Guide. The maximum session duration limit applies when\n you use the AssumeRole*
API operations or the assume-role*
CLI\n commands. However the limit does not apply when you use those operations to create a\n console URL. For more information, see Using IAM Roles in the\n IAM User Guide.
\n Permissions\n
\nThe temporary security credentials created by AssumeRoleWithWebIdentity
can\n be used to make API calls to any AWS service with the following exception: you cannot\n call the STS GetFederationToken
or GetSessionToken
API\n operations.
(Optional) You can pass inline or managed session policies to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session policies.\n The plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\n\n Tags\n
\n(Optional) You can configure your IdP to pass attributes into your web identity token as\n session tags. Each session tag consists of a key name and an associated value. For more\n information about session tags, see Passing Session Tags in STS in the\n IAM User Guide.
\nYou can pass up to 50 session tags. The plaintext session tag keys can’t exceed 128\n characters and the values can’t exceed 256 characters. For these and additional limits, see\n IAM\n and STS Character Limits in the IAM User Guide.
\n \nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
You can pass a session tag with the same key as a tag that is\n attached to the role. When you do, the session tag overrides the role tag with the same\n key.
\nAn administrator must grant you the permissions necessary to pass session tags. The\n administrator can also create granular permissions to allow you to pass only specific\n session tags. For more information, see Tutorial: Using Tags\n for Attribute-Based Access Control in the\n IAM User Guide.
\nYou can set the session tags as transitive. Transitive tags persist during role\n chaining. For more information, see Chaining Roles\n with Session Tags in the IAM User Guide.
\n\n Identities\n
\nBefore your application can call AssumeRoleWithWebIdentity
, you must have\n an identity token from a supported identity provider and create a role that the application\n can assume. The role that your application assumes must trust the identity provider that is\n associated with the identity token. In other words, the identity provider must be specified\n in the role's trust policy.
Calling AssumeRoleWithWebIdentity
can result in an entry in your\n AWS CloudTrail logs. The entry includes the Subject of\n the provided web identity token. We recommend that you avoid using any personally\n identifiable information (PII) in this field. For example, you could instead use a GUID\n or a pairwise identifier, as suggested\n in the OIDC specification.
For more information about how to use web identity federation and the\n AssumeRoleWithWebIdentity
API, see the following resources:
\n Using Web Identity Federation API Operations for Mobile Apps and Federation Through a Web-based Identity Provider.
\n\n Web Identity Federation Playground. Walk through the process of\n authenticating through Login with Amazon, Facebook, or Google, getting temporary\n security credentials, and then using those credentials to make a request to AWS.\n
\n\n AWS SDK for iOS Developer Guide and AWS SDK for Android Developer Guide. These toolkits\n contain sample apps that show how to invoke the identity providers. The toolkits then\n show how to use the information from these providers to get and use temporary\n security credentials.
\n\n Web Identity\n Federation with Mobile Applications. This article discusses web identity\n federation and shows an example of how to use web identity federation to get access\n to content in Amazon S3.
\nThe Amazon Resource Name (ARN) of the role that the caller is assuming.
", - "smithy.api#required": {} - } - }, - "RoleSessionName": { - "target": "com.amazonaws.sts#roleSessionNameType", - "traits": { - "smithy.api#documentation": "An identifier for the assumed role session. Typically, you pass the name or identifier\n that is associated with the user who is using your application. That way, the temporary\n security credentials that your application will use are associated with that user. This\n session name is included as part of the ARN and assumed role ID in the\n AssumedRoleUser
response element.
The regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
", - "smithy.api#required": {} - } - }, - "WebIdentityToken": { - "target": "com.amazonaws.sts#clientTokenType", - "traits": { - "smithy.api#documentation": "The OAuth 2.0 access token or OpenID Connect ID token that is provided by the identity\n provider. Your application must get this token by authenticating the user who is using your\n application with a web identity provider before the application makes an\n AssumeRoleWithWebIdentity
call.
The fully qualified host component of the domain name of the identity provider.
\nSpecify this value only for OAuth 2.0 access tokens. Currently\n www.amazon.com
and graph.facebook.com
are the only supported\n identity providers for OAuth 2.0 access tokens. Do not include URL schemes and port\n numbers.
Do not specify this value for OpenID Connect ID tokens.
" - } - }, - "PolicyArns": { - "target": "com.amazonaws.sts#policyDescriptorListType", - "traits": { - "smithy.api#documentation": "The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as\n managed session policies. The policies must exist in the same account as the role.
\nThis parameter is optional. You can provide up to 10 managed policy ARNs. However, the\n plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS\n Service Namespaces in the AWS General Reference.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
" - } - }, - "Policy": { - "target": "com.amazonaws.sts#sessionPolicyDocumentType", - "traits": { - "smithy.api#documentation": "An IAM policy in JSON format that you want to use as an inline session policy.
\nThis parameter is optional. Passing policies to this operation returns new \n temporary credentials. The resulting session's permissions are the intersection of the \n role's identity-based policy and the session policies. You can use the role's temporary \n credentials in subsequent AWS API calls to access resources in the account that owns \n the role. You cannot use session policies to grant more permissions than those allowed \n by the identity-based policy of the role that is being assumed. For more information, see\n Session\n Policies in the IAM User Guide.
\nThe plaintext that you use for both inline and managed session policies can't exceed\n 2,048 characters. The JSON policy characters can be any ASCII character from the space\n character to the end of the valid character list (\\u0020 through \\u00FF). It can also\n include the tab (\\u0009), linefeed (\\u000A), and carriage return (\\u000D)\n characters.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
The duration, in seconds, of the role session. The value can range from 900 seconds (15\n minutes) up to the maximum session duration setting for the role. This setting can have a\n value from 1 hour to 12 hours. If you specify a value higher than this setting, the\n operation fails. For example, if you specify a session duration of 12 hours, but your\n administrator set the maximum session duration to 6 hours, your operation fails. To learn\n how to view the maximum value for your role, see View the\n Maximum Session Duration Setting for a Role in the\n IAM User Guide.
\nBy default, the value is set to 3600
seconds.
The DurationSeconds
parameter is separate from the duration of a console\n session that you might request using the returned credentials. The request to the\n federation endpoint for a console sign-in token takes a SessionDuration
\n parameter that specifies the maximum length of the console session. For more\n information, see Creating a URL\n that Enables Federated Users to Access the AWS Management Console in the\n IAM User Guide.
The temporary security credentials, which include an access key ID, a secret access key,\n and a security token.
\nThe size of the security token that STS API operations return is not fixed. We\n strongly recommend that you make no assumptions about the maximum size.
\nThe unique user identifier that is returned by the identity provider. This identifier is\n associated with the WebIdentityToken
that was submitted with the\n AssumeRoleWithWebIdentity
call. The identifier is typically unique to the\n user and the application that acquired the WebIdentityToken
(pairwise\n identifier). For OpenID Connect ID tokens, this field contains the value returned by the\n identity provider as the token's sub
(Subject) claim.
The Amazon Resource Name (ARN) and the assumed role ID, which are identifiers that you\n can use to refer to the resulting temporary security credentials. For example, you can\n reference these credentials as a principal in a resource-based policy by using the ARN or\n assumed role ID. The ARN and ID include the RoleSessionName
that you specified\n when you called AssumeRole
.
A percentage value that indicates the packed size of the session policies and session \n tags combined passed in the request. The request fails if the packed size is greater than 100 percent, \n which means the policies and tags exceeded the allowed space.
" - } - }, - "Provider": { - "target": "com.amazonaws.sts#Issuer", - "traits": { - "smithy.api#documentation": " The issuing authority of the web identity token presented. For OpenID Connect ID\n tokens, this contains the value of the iss
field. For OAuth 2.0 access tokens,\n this contains the value of the ProviderId
parameter that was passed in the\n AssumeRoleWithWebIdentity
request.
The intended audience (also known as client ID) of the web identity token. This is\n traditionally the client identifier issued to the application that requested the web\n identity token.
" - } - }, - "SourceIdentity": { - "target": "com.amazonaws.sts#sourceIdentityType", - "traits": { - "smithy.api#documentation": "The value of the source identity that is returned in the JSON web token (JWT) from the\n identity provider.
\nYou can require users to set a source identity value when they assume a role. You do\n this by using the sts:SourceIdentity
condition key in a role trust policy.\n That way, actions that are taken with the role are associated with that user. After the\n source identity is set, the value cannot be changed. It is present in the request for all\n actions that are taken by the role and persists across chained\n role sessions. You can configure your identity provider to use an attribute\n associated with your users, like user name or email, as the source identity when calling\n AssumeRoleWithWebIdentity
. You do this by adding a claim to the JSON web\n token. To learn more about OIDC tokens and claims, see Using Tokens with User Pools in the Amazon Cognito Developer Guide.\n For more information about using source identity, see Monitor and control\n actions taken with assumed roles in the\n IAM User Guide.
The regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
" - } - } - }, - "traits": { - "smithy.api#documentation": "Contains the response to a successful AssumeRoleWithWebIdentity\n request, including temporary AWS credentials that can be used to make AWS requests.
" - } - }, - "com.amazonaws.sts#AssumedRoleUser": { - "type": "structure", - "members": { - "AssumedRoleId": { - "target": "com.amazonaws.sts#assumedRoleIdType", - "traits": { - "smithy.api#documentation": "A unique identifier that contains the role ID and the role session name of the role that\n is being assumed. The role ID is generated by AWS when the role is created.
", - "smithy.api#required": {} - } - }, - "Arn": { - "target": "com.amazonaws.sts#arnType", - "traits": { - "smithy.api#documentation": "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\n policies, see IAM Identifiers in the\n IAM User Guide.
", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "The identifiers for the temporary security credentials that the operation\n returns.
" - } - }, - "com.amazonaws.sts#Audience": { - "type": "string" - }, - "com.amazonaws.sts#Credentials": { - "type": "structure", - "members": { - "AccessKeyId": { - "target": "com.amazonaws.sts#accessKeyIdType", - "traits": { - "smithy.api#documentation": "The access key ID that identifies the temporary security credentials.
", - "smithy.api#required": {} - } - }, - "SecretAccessKey": { - "target": "com.amazonaws.sts#accessKeySecretType", - "traits": { - "smithy.api#documentation": "The secret access key that can be used to sign requests.
", - "smithy.api#required": {} - } - }, - "SessionToken": { - "target": "com.amazonaws.sts#tokenType", - "traits": { - "smithy.api#documentation": "The token that users must pass to the service API to use the temporary\n credentials.
", - "smithy.api#required": {} - } - }, - "Expiration": { - "target": "com.amazonaws.sts#dateType", - "traits": { - "smithy.api#documentation": "The date on which the current credentials expire.
", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "AWS credentials for API authentication.
" - } - }, - "com.amazonaws.sts#DecodeAuthorizationMessage": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#DecodeAuthorizationMessageRequest" - }, - "output": { - "target": "com.amazonaws.sts#DecodeAuthorizationMessageResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#InvalidAuthorizationMessageException" - } - ], - "traits": { - "smithy.api#documentation": "Decodes additional information about the authorization status of a request from an\n encoded message returned in response to an AWS request.
\nFor example, if a user is not authorized to perform an operation that he or she has\n requested, the request returns a Client.UnauthorizedOperation
response (an\n HTTP 403 response). Some AWS operations additionally return an encoded message that can\n provide details about this authorization failure.
Only certain AWS operations return an encoded authorization message. The\n documentation for an individual operation indicates whether that operation returns an\n encoded message in addition to returning an HTTP code.
\nThe message is encoded because the details of the authorization status can constitute\n privileged information that the user who requested the operation should not see. To decode\n an authorization status message, a user must be granted permissions via an IAM policy to\n request the DecodeAuthorizationMessage
\n (sts:DecodeAuthorizationMessage
) action.
The decoded message includes the following type of information:
\nWhether the request was denied due to an explicit deny or due to the absence of an\n explicit allow. For more information, see Determining Whether a Request is Allowed or Denied in the\n IAM User Guide.
\nThe principal who made the request.
\nThe requested action.
\nThe requested resource.
\nThe values of condition keys in the context of the user's request.
\nThe encoded message that was returned with the response.
", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.sts#DecodeAuthorizationMessageResponse": { - "type": "structure", - "members": { - "DecodedMessage": { - "target": "com.amazonaws.sts#decodedMessageType", - "traits": { - "smithy.api#documentation": "An XML document that contains the decoded message.
" - } - } - }, - "traits": { - "smithy.api#documentation": "A document that contains additional information about the authorization status of a\n request from an encoded message that is returned in response to an AWS request.
" - } - }, - "com.amazonaws.sts#ExpiredTokenException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#expiredIdentityTokenMessage" - } - }, - "traits": { - "smithy.api#documentation": "The web identity token that was passed is expired or is not valid. Get a new identity\n token from the identity provider and then retry the request.
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.sts#FederatedUser": { - "type": "structure", - "members": { - "FederatedUserId": { - "target": "com.amazonaws.sts#federatedIdType", - "traits": { - "smithy.api#documentation": "The string that identifies the federated user associated with the credentials, similar\n to the unique ID of an IAM user.
", - "smithy.api#required": {} - } - }, - "Arn": { - "target": "com.amazonaws.sts#arnType", - "traits": { - "smithy.api#documentation": "The ARN that specifies the federated user that is associated with the credentials. For\n more information about ARNs and how to use them in policies, see IAM\n Identifiers in the IAM User Guide.
", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "Identifiers for the federated user that is associated with the credentials.
" - } - }, - "com.amazonaws.sts#GetAccessKeyInfo": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#GetAccessKeyInfoRequest" - }, - "output": { - "target": "com.amazonaws.sts#GetAccessKeyInfoResponse" - }, - "traits": { - "smithy.api#documentation": "Returns the account identifier for the specified access key ID.
\nAccess keys consist of two parts: an access key ID (for example,\n AKIAIOSFODNN7EXAMPLE
) and a secret access key (for example,\n wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
). For more information about\n access keys, see Managing Access Keys for IAM\n Users in the IAM User Guide.
When you pass an access key ID to this operation, it returns the ID of the AWS\n account to which the keys belong. Access key IDs beginning with AKIA
are\n long-term credentials for an IAM user or the AWS account root user. Access key IDs\n beginning with ASIA
are temporary credentials that are created using STS\n operations. If the account in the response belongs to you, you can sign in as the root\n user and review your root user access keys. Then, you can pull a credentials report to learn which IAM user owns the keys. To learn who\n requested the temporary credentials for an ASIA
access key, view the STS\n events in your CloudTrail logs in the\n IAM User Guide.
This operation does not indicate the state of the access key. The key might be active,\n inactive, or deleted. Active keys might not have permissions to perform an operation.\n Providing a deleted access key might return an error that the key doesn't exist.
" - } - }, - "com.amazonaws.sts#GetAccessKeyInfoRequest": { - "type": "structure", - "members": { - "AccessKeyId": { - "target": "com.amazonaws.sts#accessKeyIdType", - "traits": { - "smithy.api#documentation": "The identifier of an access key.
\nThis parameter allows (through its regex pattern) a string of characters that can\n consist of any upper- or lowercase letter or digit.
", - "smithy.api#required": {} - } - } - } - }, - "com.amazonaws.sts#GetAccessKeyInfoResponse": { - "type": "structure", - "members": { - "Account": { - "target": "com.amazonaws.sts#accountType", - "traits": { - "smithy.api#documentation": "The number used to identify the AWS account.
" - } - } - } - }, - "com.amazonaws.sts#GetCallerIdentity": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#GetCallerIdentityRequest" - }, - "output": { - "target": "com.amazonaws.sts#GetCallerIdentityResponse" - }, - "traits": { - "smithy.api#documentation": "Returns details about the IAM user or role whose credentials are used to call the\n operation.
\nNo permissions are required to perform this operation. If an administrator adds a\n policy to your IAM user or role that explicitly denies access to the\n sts:GetCallerIdentity
action, you can still perform this operation.\n Permissions are not required because the same information is returned when an IAM\n user or role is denied access. To view an example response, see I Am Not Authorized to Perform: iam:DeleteVirtualMFADevice in the\n IAM User Guide.
The unique identifier of the calling entity. The exact value depends on the type of\n entity that is making the call. The values returned are those listed in the aws:userid column in the Principal\n table found on the Policy Variables reference\n page in the IAM User Guide.
" - } - }, - "Account": { - "target": "com.amazonaws.sts#accountType", - "traits": { - "smithy.api#documentation": "The AWS account ID number of the account that owns or contains the calling\n entity.
" - } - }, - "Arn": { - "target": "com.amazonaws.sts#arnType", - "traits": { - "smithy.api#documentation": "The AWS ARN associated with the calling entity.
" - } - } - }, - "traits": { - "smithy.api#documentation": "Contains the response to a successful GetCallerIdentity request,\n including information about the entity making the request.
" - } - }, - "com.amazonaws.sts#GetFederationToken": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#GetFederationTokenRequest" - }, - "output": { - "target": "com.amazonaws.sts#GetFederationTokenResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#MalformedPolicyDocumentException" - }, - { - "target": "com.amazonaws.sts#PackedPolicyTooLargeException" - }, - { - "target": "com.amazonaws.sts#RegionDisabledException" - } - ], - "traits": { - "smithy.api#documentation": "Returns a set of temporary security credentials (consisting of an access key ID, a\n secret access key, and a security token) for a federated user. A typical use is in a proxy\n application that gets temporary security credentials on behalf of distributed applications\n inside a corporate network. You must call the GetFederationToken
operation\n using the long-term security credentials of an IAM user. As a result, this call is\n appropriate in contexts where those credentials can be safely stored, usually in a\n server-based application. For a comparison of GetFederationToken
with the\n other API operations that produce temporary credentials, see Requesting Temporary Security\n Credentials and Comparing the\n AWS STS API operations in the IAM User Guide.
You can create a mobile-based or browser-based app that can authenticate users using\n a web identity provider like Login with Amazon, Facebook, Google, or an OpenID\n Connect-compatible identity provider. In this case, we recommend that you use Amazon Cognito or\n AssumeRoleWithWebIdentity
. For more information, see Federation Through a Web-based Identity Provider in the\n IAM User Guide.
You can also call GetFederationToken
using the security credentials of an\n AWS account root user, but we do not recommend it. Instead, we recommend that you create\n an IAM user for the purpose of the proxy application. Then attach a policy to the IAM\n user that limits federated users to only the actions and resources that they need to\n access. For more information, see IAM Best Practices in the\n IAM User Guide.
\n Session duration\n
\nThe temporary credentials are valid for the specified duration, from 900 seconds (15\n minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is\n 43,200 seconds (12 hours). Temporary credentials that are obtained by using AWS account\n root user credentials have a maximum duration of 3,600 seconds (1 hour).
\n\n Permissions\n
\nYou can use the temporary credentials created by GetFederationToken
in any\n AWS service except the following:
You cannot call any IAM operations using the AWS CLI or the AWS API.
\nYou cannot call any STS operations except GetCallerIdentity
.
You must pass an inline or managed session policy to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session policies.\n The plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters.
\nThough the session policy parameters are optional, if you do not pass a policy, then the\n resulting federated user session has no permissions. When you pass session policies, the\n session permissions are the intersection of the IAM user policies and the session\n policies that you pass. This gives you a way to further restrict the permissions for a\n federated user. You cannot use session policies to grant more permissions than those that\n are defined in the permissions policy of the IAM user. For more information, see Session\n Policies in the IAM User Guide. For information about\n using GetFederationToken
to create temporary security credentials, see GetFederationToken—Federation Through a Custom Identity Broker.
You can use the credentials to access a resource that has a resource-based policy. If\n that policy specifically references the federated user session in the\n Principal
element of the policy, the session has the permissions allowed by\n the policy. These permissions are granted in addition to the permissions granted by the\n session policies.
\n Tags\n
\n(Optional) You can pass tag key-value pairs to your session. These are called session\n tags. For more information about session tags, see Passing Session Tags in STS in the\n IAM User Guide.
\nYou can create a mobile-based or browser-based app that can authenticate users\n using a web identity provider like Login with Amazon, Facebook, Google, or an OpenID\n Connect-compatible identity provider. In this case, we recommend that you use Amazon Cognito or\n AssumeRoleWithWebIdentity
. For more information, see Federation Through a Web-based Identity Provider in the\n IAM User Guide.
You can also call GetFederationToken
using the security credentials of an\n AWS account root user, but we do not recommend it. Instead, we recommend that you\n create an IAM user for the purpose of the proxy application. Then attach a policy to\n the IAM user that limits federated users to only the actions and resources that they\n need to access. For more information, see IAM Best Practices in the\n IAM User Guide.
\n Session duration\n
\nThe temporary credentials are valid for the specified duration, from 900 seconds (15\n minutes) up to a maximum of 129,600 seconds (36 hours). The default session duration is\n 43,200 seconds (12 hours). Temporary credentials that are obtained by using AWS\n account root user credentials have a maximum duration of 3,600 seconds (1 hour).
\n\n Permissions\n
\nYou can use the temporary credentials created by GetFederationToken
in\n any AWS service except the following:
You cannot call any IAM operations using the AWS CLI or the AWS API.\n
\nYou cannot call any STS operations except\n GetCallerIdentity
.
You must pass an inline or managed session policy to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session\n policies. The plain text that you use for both inline and managed session policies can't\n exceed 2,048 characters.
\nThough the session policy parameters are optional, if you do not pass a policy, then\n the resulting federated user session has no permissions. When you pass session policies,\n the session permissions are the intersection of the IAM user policies and the session\n policies that you pass. This gives you a way to further restrict the permissions for a\n federated user. You cannot use session policies to grant more permissions than those\n that are defined in the permissions policy of the IAM user. For more information, see\n Session Policies\n in the IAM User Guide. For information about using\n GetFederationToken
to create temporary security credentials, see GetFederationToken—Federation Through a Custom Identity Broker.
You can use the credentials to access a resource that has a resource-based policy. If\n that policy specifically references the federated user session in the\n Principal
element of the policy, the session has the permissions\n allowed by the policy. These permissions are granted in addition to the permissions\n granted by the session policies.
\n Tags\n
\n(Optional) You can pass tag key-value pairs to your session. These are called session\n tags. For more information about session tags, see Passing Session Tags in STS in\n the IAM User Guide.
\nAn administrator must grant you the permissions necessary to pass session tags. The\n administrator can also create granular permissions to allow you to pass only specific\n session tags. For more information, see Tutorial: Using\n Tags for Attribute-Based Access Control in the\n IAM User Guide.
\nTag key–value pairs are not case sensitive, but case is preserved. This means that you\n cannot have separate Department
and department
tag keys.\n Assume that the user that you are federating has the\n Department
=Marketing
tag and you pass the\n department
=engineering
session tag.\n Department
and department
are not saved as separate tags,\n and the session tag passed in the request takes precedence over the user tag.
The name of the federated user. The name is used as an identifier for the temporary\n security credentials (such as Bob
). For example, you can reference the\n federated user name in a resource-based policy, such as in an Amazon S3 bucket policy.
The regex used to validate this parameter is a string of characters \n consisting of upper- and lower-case alphanumeric characters with no spaces. You can \n also include underscores or any of the following characters: =,.@-
", - "smithy.api#required": {} - } - }, - "Policy": { - "target": "com.amazonaws.sts#sessionPolicyDocumentType", - "traits": { - "smithy.api#documentation": "An IAM policy in JSON format that you want to use as an inline session policy.
\nYou must pass an inline or managed session policy to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session\n policies.
\nThis parameter is optional. However, if you do not pass any session policies, then the\n resulting federated user session has no permissions.
\nWhen you pass session policies, the session permissions are the intersection of the\n IAM user policies and the session policies that you pass. This gives you a way to further\n restrict the permissions for a federated user. You cannot use session policies to grant\n more permissions than those that are defined in the permissions policy of the IAM user.\n For more information, see Session Policies in\n the IAM User Guide.
\nThe resulting credentials can be used to access a resource that has a resource-based\n policy. If that policy specifically references the federated user session in the\n Principal
element of the policy, the session has the permissions allowed by\n the policy. These permissions are granted in addition to the permissions that are granted\n by the session policies.
The plaintext that you use for both inline and managed session policies can't exceed\n 2,048 characters. The JSON policy characters can be any ASCII character from the space\n character to the end of the valid character list (\\u0020 through \\u00FF). It can also\n include the tab (\\u0009), linefeed (\\u000A), and carriage return (\\u000D)\n characters.
\nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
The Amazon Resource Names (ARNs) of the IAM managed policies that you want to use as a\n managed session policy. The policies must exist in the same account as the IAM user that\n is requesting federated access.
\nYou must pass an inline or managed session policy to\n this operation. You can pass a single JSON policy document to use as an inline session\n policy. You can also specify up to 10 managed policies to use as managed session policies.\n The plaintext that you use for both inline and managed session policies can't exceed 2,048\n characters. You can provide up to 10 managed policy ARNs. For more information about ARNs,\n see Amazon\n Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference.
\nThis parameter is optional. However, if you do not pass any session policies, then the\n resulting federated user session has no permissions.
\nWhen you pass session policies, the session permissions are the intersection of the\n IAM user policies and the session policies that you pass. This gives you a way to further\n restrict the permissions for a federated user. You cannot use session policies to grant\n more permissions than those that are defined in the permissions policy of the IAM user.\n For more information, see Session Policies in\n the IAM User Guide.
\nThe resulting credentials can be used to access a resource that has a resource-based\n policy. If that policy specifically references the federated user session in the\n Principal
element of the policy, the session has the permissions allowed by\n the policy. These permissions are granted in addition to the permissions that are granted\n by the session policies.
An AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
The duration, in seconds, that the session should last. Acceptable durations for\n federation sessions range from 900 seconds (15 minutes) to 129,600 seconds (36 hours), with\n 43,200 seconds (12 hours) as the default. Sessions obtained using AWS account root user\n credentials are restricted to a maximum of 3,600 seconds (one hour). If the specified\n duration is longer than one hour, the session obtained by using root user credentials\n defaults to one hour.
" - } - }, - "Tags": { - "target": "com.amazonaws.sts#tagListType", - "traits": { - "smithy.api#documentation": "A list of session tags. Each session tag consists of a key name and an associated value.\n For more information about session tags, see Passing Session Tags in STS in the\n IAM User Guide.
\nThis parameter is optional. You can pass up to 50 session tags. The plaintext session\n tag keys can’t exceed 128 characters and the values can’t exceed 256 characters. For these\n and additional limits, see IAM\n and STS Character Limits in the IAM User Guide.
\n \nAn AWS conversion compresses the passed session policies and session tags into a\n packed binary format that has a separate limit. Your request can fail for this limit\n even if your plaintext meets the other requirements. The PackedPolicySize
\n response element indicates by percentage how close the policies and tags for your\n request are to the upper size limit.\n
You can pass a session tag with the same key as a tag that is already\n attached to the user you are federating. When you do, session tags override a user tag with\n the same key.
\nTag key–value pairs are not case sensitive, but case is preserved. This means that you\n cannot have separate Department
and department
tag keys. Assume\n that the role has the Department
=Marketing
tag and you pass the\n department
=engineering
session tag. Department
\n and department
are not saved as separate tags, and the session tag passed in\n the request takes precedence over the role tag.
The temporary security credentials, which include an access key ID, a secret access key,\n and a security (or session) token.
\nThe size of the security token that STS API operations return is not fixed. We\n strongly recommend that you make no assumptions about the maximum size.
\nIdentifiers for the federated user associated with the credentials (such as\n arn:aws:sts::123456789012:federated-user/Bob
or\n 123456789012:Bob
). You can use the federated user's ARN in your\n resource-based policies, such as an Amazon S3 bucket policy.
A percentage value that indicates the packed size of the session policies and session \n tags combined passed in the request. The request fails if the packed size is greater than 100 percent, \n which means the policies and tags exceeded the allowed space.
" - } - } - }, - "traits": { - "smithy.api#documentation": "Contains the response to a successful GetFederationToken request,\n including temporary AWS credentials that can be used to make AWS requests.
" - } - }, - "com.amazonaws.sts#GetSessionToken": { - "type": "operation", - "input": { - "target": "com.amazonaws.sts#GetSessionTokenRequest" - }, - "output": { - "target": "com.amazonaws.sts#GetSessionTokenResponse" - }, - "errors": [ - { - "target": "com.amazonaws.sts#RegionDisabledException" - } - ], - "traits": { - "smithy.api#documentation": "Returns a set of temporary credentials for an AWS account or IAM user. The\n credentials consist of an access key ID, a secret access key, and a security token.\n Typically, you use GetSessionToken
if you want to use MFA to protect\n programmatic calls to specific AWS API operations like Amazon EC2 StopInstances
.\n MFA-enabled IAM users would need to call GetSessionToken
and submit an MFA\n code that is associated with their MFA device. Using the temporary security credentials\n that are returned from the call, IAM users can then make programmatic calls to API\n operations that require MFA authentication. If you do not supply a correct MFA code, then\n the API returns an access denied error. For a comparison of GetSessionToken
\n with the other API operations that produce temporary credentials, see Requesting\n Temporary Security Credentials and Comparing the\n AWS STS API operations in the IAM User Guide.
\n Session Duration\n
\nThe GetSessionToken
operation must be called by using the long-term AWS\n security credentials of the AWS account root user or an IAM user. Credentials that are\n created by IAM users are valid for the duration that you specify. This duration can range\n from 900 seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours), with a default\n of 43,200 seconds (12 hours). Credentials based on account credentials can range from 900\n seconds (15 minutes) up to 3,600 seconds (1 hour), with a default of 1 hour.
\n Permissions\n
\nThe temporary security credentials created by GetSessionToken
can be used\n to make API calls to any AWS service with the following exceptions:
You cannot call any IAM API operations unless MFA authentication information is\n included in the request.
\nYou cannot call any STS API except\n AssumeRole
or GetCallerIdentity
.
We recommend that you do not call GetSessionToken
with AWS account\n root user credentials. Instead, follow our best practices by\n creating one or more IAM users, giving them the necessary permissions, and using IAM\n users for everyday interaction with AWS.
The credentials that are returned by GetSessionToken
are based on\n permissions associated with the user whose credentials were used to call the operation. If\n GetSessionToken
is called using AWS account root user credentials, the\n temporary credentials have root user permissions. Similarly, if\n GetSessionToken
is called using the credentials of an IAM user, the\n temporary credentials have the same permissions as the IAM user.
For more information about using GetSessionToken
to create temporary\n credentials, go to Temporary\n Credentials for Users in Untrusted Environments in the\n IAM User Guide.
The duration, in seconds, that the credentials should remain valid. Acceptable\n durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600 seconds\n (36 hours), with 43,200 seconds (12 hours) as the default. Sessions for AWS account\n owners are restricted to a maximum of 3,600 seconds (one hour). If the duration is\n longer than one hour, the session for AWS account owners defaults to one hour.
" - } - }, - "SerialNumber": { - "target": "com.amazonaws.sts#serialNumberType", - "traits": { - "smithy.api#documentation": "The identification number of the MFA device that is associated with the IAM user who\n is making the GetSessionToken
call. Specify this value if the IAM user\n has a policy that requires MFA authentication. The value is either the serial number for\n a hardware device (such as GAHT12345678
) or an Amazon Resource Name (ARN)\n for a virtual device (such as arn:aws:iam::123456789012:mfa/user
). You can\n find the device for an IAM user by going to the AWS Management Console and viewing the user's\n security credentials.
The regex used to validate this parameter is a string of \n characters consisting of upper- and lower-case alphanumeric characters with no spaces. \n You can also include underscores or any of the following characters: =,.@:/-
" - } - }, - "TokenCode": { - "target": "com.amazonaws.sts#tokenCodeType", - "traits": { - "smithy.api#documentation": "The value provided by the MFA device, if MFA is required. If any policy requires the\n IAM user to submit an MFA code, specify this value. If MFA authentication is required,\n the user must provide a code when requesting a set of temporary security credentials. A\n user who fails to provide the code receives an \"access denied\" response when requesting\n resources that require MFA authentication.
\nThe format for this parameter, as described by its regex pattern, is a sequence of six\n numeric digits.
" - } - } - } - }, - "com.amazonaws.sts#GetSessionTokenResponse": { - "type": "structure", - "members": { - "Credentials": { - "target": "com.amazonaws.sts#Credentials", - "traits": { - "smithy.api#documentation": "The temporary security credentials, which include an access key ID, a secret access\n key, and a security (or session) token.
\n \nThe size of the security token that STS API operations return is not fixed. We\n strongly recommend that you make no assumptions about the maximum size.
\nContains the response to a successful GetSessionToken request,\n including temporary AWS credentials that can be used to make AWS requests.
" - } - }, - "com.amazonaws.sts#IDPCommunicationErrorException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#idpCommunicationErrorMessage" - } - }, - "traits": { - "smithy.api#documentation": "The request could not be fulfilled because the identity provider (IDP) that\n was asked to verify the incoming identity token could not be reached. This is often a\n transient error caused by network conditions. Retry the request a limited number of\n times so that you don't exceed the request rate. If the error persists, the\n identity provider might be down or not responding.
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.sts#IDPRejectedClaimException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#idpRejectedClaimMessage" - } - }, - "traits": { - "smithy.api#documentation": "The identity provider (IdP) reported that authentication failed. This might be because\n the claim is invalid.
\nIf this error is returned for the AssumeRoleWithWebIdentity
operation, it\n can also mean that the claim has expired or has been explicitly revoked.
The error returned if the message passed to DecodeAuthorizationMessage
\n was invalid. This can happen if the token contains invalid characters, such as\n linebreaks.
The web identity token that was passed could not be validated by AWS. Get a new\n identity token from the identity provider and then retry the request.
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.sts#Issuer": { - "type": "string" - }, - "com.amazonaws.sts#MalformedPolicyDocumentException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#malformedPolicyDocumentMessage" - } - }, - "traits": { - "smithy.api#documentation": "The request was rejected because the policy document was malformed. The error message\n describes the specific error.
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.sts#NameQualifier": { - "type": "string" - }, - "com.amazonaws.sts#PackedPolicyTooLargeException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#packedPolicyTooLargeMessage" - } - }, - "traits": { - "smithy.api#documentation": "The request was rejected because the total packed size of the session policies and\n session tags combined was too large. An AWS conversion compresses the session policy\n document, session policy ARNs, and session tags into a packed binary format that has a\n separate limit. The error message indicates by percentage how close the policies and\n tags are to the upper size limit. For more information, see Passing Session Tags in STS in\n the IAM User Guide.
\nYou could receive this error even though you meet other defined session policy and\n session tag limits. For more information, see IAM and STS Entity\n Character Limits in the IAM User Guide.
", - "smithy.api#error": "client", - "smithy.api#httpError": 400 - } - }, - "com.amazonaws.sts#PolicyDescriptorType": { - "type": "structure", - "members": { - "arn": { - "target": "com.amazonaws.sts#arnType", - "traits": { - "smithy.api#documentation": "The Amazon Resource Name (ARN) of the IAM managed policy to use as a session policy\n for the role. For more information about ARNs, see Amazon Resource Names (ARNs) and AWS\n Service Namespaces in the AWS General Reference.
" - } - } - }, - "traits": { - "smithy.api#documentation": "A reference to the IAM managed policy that is passed as a session policy for a role\n session or a federated user session.
" - } - }, - "com.amazonaws.sts#RegionDisabledException": { - "type": "structure", - "members": { - "message": { - "target": "com.amazonaws.sts#regionDisabledMessage" - } - }, - "traits": { - "smithy.api#documentation": "STS is not activated in the requested region for the account that is being asked to\n generate credentials. The account administrator must use the IAM console to activate STS\n in that region. For more information, see Activating and\n Deactivating AWS STS in an AWS Region in the IAM User\n Guide.
", - "smithy.api#error": "client", - "smithy.api#httpError": 403 - } - }, - "com.amazonaws.sts#SAMLAssertionType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 4, - "max": 100000 - } - } - }, - "com.amazonaws.sts#Subject": { - "type": "string" - }, - "com.amazonaws.sts#SubjectType": { - "type": "string" - }, - "com.amazonaws.sts#Tag": { - "type": "structure", - "members": { - "Key": { - "target": "com.amazonaws.sts#tagKeyType", - "traits": { - "smithy.api#documentation": "The key for a session tag.
\nYou can pass up to 50 session tags. The plain text session tag keys can’t exceed 128\n characters. For these and additional limits, see IAM\n and STS Character Limits in the IAM User Guide.
", - "smithy.api#required": {} - } - }, - "Value": { - "target": "com.amazonaws.sts#tagValueType", - "traits": { - "smithy.api#documentation": "The value for a session tag.
\nYou can pass up to 50 session tags. The plain text session tag values can’t exceed 256\n characters. For these and additional limits, see IAM\n and STS Character Limits in the IAM User Guide.
", - "smithy.api#required": {} - } - } - }, - "traits": { - "smithy.api#documentation": "You can pass custom key-value pair attributes when you assume a role or federate a user.\n These are called session tags. You can then use the session tags to control access to\n resources. For more information, see Tagging AWS STS Sessions in the\n IAM User Guide.
" - } - }, - "com.amazonaws.sts#accessKeyIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 16, - "max": 128 - }, - "smithy.api#pattern": "[\\w]*" - } - }, - "com.amazonaws.sts#accessKeySecretType": { - "type": "string" - }, - "com.amazonaws.sts#accountType": { - "type": "string" - }, - "com.amazonaws.sts#arnType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 20, - "max": 2048 - }, - "smithy.api#pattern": "[\\u0009\\u000A\\u000D\\u0020-\\u007E\\u0085\\u00A0-\\uD7FF\\uE000-\\uFFFD\\u10000-\\u10FFFF]+" - } - }, - "com.amazonaws.sts#assumedRoleIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 193 - }, - "smithy.api#pattern": "[\\w+=,.@:-]*" - } - }, - "com.amazonaws.sts#clientTokenType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 4, - "max": 20000 - } - } - }, - "com.amazonaws.sts#dateType": { - "type": "timestamp" - }, - "com.amazonaws.sts#decodedMessageType": { - "type": "string" - }, - "com.amazonaws.sts#durationSecondsType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 900, - "max": 129600 - } - } - }, - "com.amazonaws.sts#encodedMessageType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 10240 - } - } - }, - "com.amazonaws.sts#expiredIdentityTokenMessage": { - "type": "string" - }, - "com.amazonaws.sts#externalIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 1224 - }, - "smithy.api#pattern": "[\\w+=,.@:\\/-]*" - } - }, - "com.amazonaws.sts#federatedIdType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 193 - }, - "smithy.api#pattern": "[\\w+=,.@\\:-]*" - } - }, - "com.amazonaws.sts#idpCommunicationErrorMessage": { - "type": "string" - }, - "com.amazonaws.sts#idpRejectedClaimMessage": { - "type": "string" - }, - "com.amazonaws.sts#invalidAuthorizationMessage": { - "type": "string" - }, - "com.amazonaws.sts#invalidIdentityTokenMessage": { - "type": "string" - }, - "com.amazonaws.sts#malformedPolicyDocumentMessage": { - "type": "string" - }, - "com.amazonaws.sts#nonNegativeIntegerType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 0 - } - } - }, - "com.amazonaws.sts#packedPolicyTooLargeMessage": { - "type": "string" - }, - "com.amazonaws.sts#policyDescriptorListType": { - "type": "list", - "member": { - "target": "com.amazonaws.sts#PolicyDescriptorType" - } - }, - "com.amazonaws.sts#regionDisabledMessage": { - "type": "string" - }, - "com.amazonaws.sts#roleDurationSecondsType": { - "type": "integer", - "traits": { - "smithy.api#box": {}, - "smithy.api#range": { - "min": 900, - "max": 43200 - } - } - }, - "com.amazonaws.sts#roleSessionNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 64 - }, - "smithy.api#pattern": "[\\w+=,.@-]*" - } - }, - "com.amazonaws.sts#serialNumberType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 9, - "max": 256 - }, - "smithy.api#pattern": "[\\w+=/:,.@-]*" - } - }, - "com.amazonaws.sts#sessionPolicyDocumentType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 2048 - }, - "smithy.api#pattern": "[\\u0009\\u000A\\u000D\\u0020-\\u00FF]+" - } - }, - "com.amazonaws.sts#sourceIdentityType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 64 - }, - "smithy.api#pattern": "[\\w+=,.@-]*" - } - }, - "com.amazonaws.sts#tagKeyListType": { - "type": "list", - "member": { - "target": "com.amazonaws.sts#tagKeyType" - }, - "traits": { - "smithy.api#length": { - "min": 0, - "max": 50 - } - } - }, - "com.amazonaws.sts#tagKeyType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 1, - "max": 128 - }, - "smithy.api#pattern": "[\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]+" - } - }, - "com.amazonaws.sts#tagListType": { - "type": "list", - "member": { - "target": "com.amazonaws.sts#Tag" - }, - "traits": { - "smithy.api#length": { - "min": 0, - "max": 50 - } - } - }, - "com.amazonaws.sts#tagValueType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 0, - "max": 256 - }, - "smithy.api#pattern": "[\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*" - } - }, - "com.amazonaws.sts#tokenCodeType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 6, - "max": 6 - }, - "smithy.api#pattern": "[\\d]*" - } - }, - "com.amazonaws.sts#tokenType": { - "type": "string" - }, - "com.amazonaws.sts#urlType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 4, - "max": 2048 - } - } - }, - "com.amazonaws.sts#userIdType": { - "type": "string" - }, - "com.amazonaws.sts#userNameType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 2, - "max": 32 - }, - "smithy.api#pattern": "[\\w+=,.@-]*" - } - }, - "com.amazonaws.sts#webIdentitySubjectType": { - "type": "string", - "traits": { - "smithy.api#length": { - "min": 6, - "max": 255 - } - } - } - } -} - diff --git a/smithy/build.zig b/smithy/build.zig deleted file mode 100644 index dab121d..0000000 --- a/smithy/build.zig +++ /dev/null @@ -1,17 +0,0 @@ -const std = @import("std"); - -pub fn build(b: *std.build.Builder) void { - // Standard release options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. - const mode = b.standardReleaseOptions(); - - const lib = b.addStaticLibrary("smithy", "src/smithy.zig"); - lib.setBuildMode(mode); - lib.install(); - - var main_tests = b.addTest("src/smithy.zig"); - main_tests.setBuildMode(mode); - - const test_step = b.step("test", "Run library tests"); - test_step.dependOn(&main_tests.step); -} diff --git a/smithy/src/smithy.zig b/smithy/src/smithy.zig deleted file mode 100644 index f5f9f71..0000000 --- a/smithy/src/smithy.zig +++ /dev/null @@ -1,802 +0,0 @@ -const std = @import("std"); -const expect = std.testing.expect; - -// TODO: validate this matches the schema -pub const Smithy = struct { - version: []const u8, - metadata: ModelMetadata, - shapes: []ShapeInfo, - allocator: std.mem.Allocator, - - const Self = @This(); - pub fn init(allocator: std.mem.Allocator, version: []const u8, metadata: ModelMetadata, shapeinfo: []ShapeInfo) Smithy { - return .{ - .version = version, - .metadata = metadata, - .shapes = shapeinfo, - .allocator = allocator, - }; - } - pub fn deinit(self: Self) void { - for (self.shapes) |s| { - switch (s.shape) { - .string, - .byte, - .short, - .integer, - .long, - .float, - .double, - .bigInteger, - .bigDecimal, - .blob, - .boolean, - .timestamp, - .document, - .member, - .resource, - => |v| self.allocator.free(v.traits), - .structure => |v| { - for (v.members) |m| self.allocator.free(m.traits); - self.allocator.free(v.members); - self.allocator.free(v.traits); - }, - .uniontype => |v| { - for (v.members) |m| self.allocator.free(m.traits); - self.allocator.free(v.members); - self.allocator.free(v.traits); - }, - .service => |v| { - self.allocator.free(v.traits); - self.allocator.free(v.operations); - }, - .operation => |v| { - if (v.errors) |e| self.allocator.free(e); - self.allocator.free(v.traits); - }, - .list => |v| { - self.allocator.free(v.traits); - }, - .set => |v| { - self.allocator.free(v.traits); - }, - .map => |v| { - self.allocator.free(v.key); - self.allocator.free(v.value); - self.allocator.free(v.traits); - }, - } - } - self.allocator.free(self.shapes); - } -}; -pub const ShapeInfo = struct { - id: []const u8, - namespace: []const u8, - name: []const u8, - member: ?[]const u8, - - shape: Shape, -}; - -const ModelMetadata = struct { - suppressions: []struct { - id: []const u8, - namespace: []const u8, - }, -}; - -pub const TraitType = enum { - aws_api_service, - aws_auth_sigv4, - aws_protocol, - ec2_query_name, - http, - http_header, - http_label, - http_query, - http_payload, - json_name, - xml_name, - required, - documentation, - pattern, - range, - length, - box, - sparse, -}; -pub const Trait = union(TraitType) { - aws_api_service: struct { - sdk_id: []const u8, - arn_namespace: []const u8, - cloudformation_name: []const u8, - cloudtrail_event_source: []const u8, - endpoint_prefix: []const u8, - }, - aws_auth_sigv4: struct { - name: []const u8, - }, - aws_protocol: AwsProtocol, - ec2_query_name: []const u8, - json_name: []const u8, - xml_name: []const u8, - http: struct { - method: []const u8, - uri: []const u8, - code: i64 = 200, - }, - http_header: []const u8, - http_label: []const u8, - http_query: []const u8, - http_payload: struct {}, - required: struct {}, - documentation: []const u8, - pattern: []const u8, - range: struct { // most data is actually integers, but as some are floats, we'll use that here - min: ?f64, - max: ?f64, - }, - length: struct { - min: ?f64, - max: ?f64, - }, - box: struct {}, - sparse: struct {}, -}; -const ShapeType = enum { - blob, - boolean, - string, - byte, - short, - integer, - long, - float, - double, - bigInteger, - bigDecimal, - timestamp, - document, - member, - list, - set, - map, - structure, - uniontype, - service, - operation, - resource, -}; -const TraitsOnly = struct { - traits: []Trait, -}; -pub const TypeMember = struct { - name: []const u8, - target: []const u8, - traits: []Trait, -}; -const Shape = union(ShapeType) { - blob: TraitsOnly, - boolean: TraitsOnly, - string: TraitsOnly, - byte: TraitsOnly, - short: TraitsOnly, - integer: TraitsOnly, - long: TraitsOnly, - float: TraitsOnly, - double: TraitsOnly, - bigInteger: TraitsOnly, - bigDecimal: TraitsOnly, - timestamp: TraitsOnly, - document: TraitsOnly, - member: TraitsOnly, - list: struct { - member_target: []const u8, - traits: []Trait, - }, - set: struct { - member_target: []const u8, - traits: []Trait, - }, - map: struct { - key: []const u8, - value: []const u8, - traits: []Trait, - }, - structure: struct { - members: []TypeMember, - traits: []Trait, - }, - uniontype: struct { - members: []TypeMember, - traits: []Trait, - }, - service: struct { - version: []const u8, - operations: [][]const u8, - resources: [][]const u8, - traits: []Trait, - }, - operation: struct { - input: ?[]const u8, - output: ?[]const u8, - errors: ?[][]const u8, - traits: []Trait, - }, - resource: TraitsOnly, -}; - -// https://awslabs.github.io/smithy/1.0/spec/aws/index.html -pub const AwsProtocol = enum { - query, - rest_xml, - json_1_1, - json_1_0, - rest_json_1, - ec2_query, -}; - -pub fn parse(allocator: std.mem.Allocator, json_model: []const u8) !Smithy { - // construct a parser. We're not copying strings here, but that may - // be a poor decision - var parser = std.json.Parser.init(allocator, false); - defer parser.deinit(); - var vt = try parser.parse(json_model); - defer vt.deinit(); - return Smithy.init( - allocator, - vt.root.Object.get("smithy").?.String, - ModelMetadata{ - // TODO: implement - .suppressions = &.{}, - }, - try shapes(allocator, vt.root.Object.get("shapes").?.Object), - ); -} - -// anytype: HashMap([]const u8, std.json.Value...) -// list must be deinitialized by caller -fn shapes(allocator: std.mem.Allocator, map: anytype) ![]ShapeInfo { - var list = try std.ArrayList(ShapeInfo).initCapacity(allocator, map.count()); - defer list.deinit(); - var iterator = map.iterator(); - while (iterator.next()) |kv| { - const id_info = try parseId(kv.key_ptr.*); - try list.append(.{ - .id = id_info.id, - .namespace = id_info.namespace, - .name = id_info.name, - .member = id_info.member, - .shape = try getShape(allocator, kv.value_ptr.*), - }); - } - // This seems to be a synonym for the simple type "string" - // https://awslabs.github.io/smithy/1.0/spec/core/model.html#simple-types - // But I don't see it in the spec. We might need to preload other similar - // simple types? - try list.append(.{ - .id = "smithy.api#String", - .namespace = "smithy.api", - .name = "String", - .member = null, - .shape = Shape{ - .string = .{ - .traits = &.{}, - }, - }, - }); - try list.append(.{ - .id = "smithy.api#Boolean", - .namespace = "smithy.api", - .name = "Boolean", - .member = null, - .shape = Shape{ - .boolean = .{ - .traits = &.{}, - }, - }, - }); - try list.append(.{ - .id = "smithy.api#Integer", - .namespace = "smithy.api", - .name = "Integer", - .member = null, - .shape = Shape{ - .integer = .{ - .traits = &.{}, - }, - }, - }); - try list.append(.{ - .id = "smithy.api#Double", - .namespace = "smithy.api", - .name = "Double", - .member = null, - .shape = Shape{ - .double = .{ - .traits = &.{}, - }, - }, - }); - try list.append(.{ - .id = "smithy.api#Timestamp", - .namespace = "smithy.api", - .name = "Timestamp", - .member = null, - .shape = Shape{ - .timestamp = .{ - .traits = &.{}, - }, - }, - }); - return list.toOwnedSlice(); -} - -fn getShape(allocator: std.mem.Allocator, shape: std.json.Value) SmithyParseError!Shape { - const shape_type = shape.Object.get("type").?.String; - if (std.mem.eql(u8, shape_type, "service")) - return Shape{ - .service = .{ - .version = shape.Object.get("version").?.String, - .operations = if (shape.Object.get("operations")) |ops| - try parseTargetList(allocator, ops.Array) - else - &.{}, // this doesn't make much sense, but it's happening - // TODO: implement. We need some sample data tho - .resources = &.{}, - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "structure")) - return Shape{ - .structure = .{ - .members = try parseMembers(allocator, shape.Object.get("members")), - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "union")) - return Shape{ - .uniontype = .{ - .members = try parseMembers(allocator, shape.Object.get("members")), - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "operation")) - return Shape{ - .operation = .{ - .input = if (shape.Object.get("input")) |member| member.Object.get("target").?.String else null, - .output = if (shape.Object.get("output")) |member| member.Object.get("target").?.String else null, - .errors = blk: { - if (shape.Object.get("errors")) |e| { - break :blk try parseTargetList(allocator, e.Array); - } - break :blk null; - }, - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "list")) - return Shape{ - .list = .{ - .member_target = shape.Object.get("member").?.Object.get("target").?.String, - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "set")) - return Shape{ - .set = .{ - .member_target = shape.Object.get("member").?.Object.get("target").?.String, - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "map")) - return Shape{ - .map = .{ - .key = shape.Object.get("key").?.Object.get("target").?.String, - .value = shape.Object.get("value").?.Object.get("target").?.String, - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }, - }; - if (std.mem.eql(u8, shape_type, "string")) - return Shape{ .string = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "byte")) - return Shape{ .byte = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "short")) - return Shape{ .short = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "integer")) - return Shape{ .integer = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "long")) - return Shape{ .long = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "float")) - return Shape{ .float = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "double")) - return Shape{ .double = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "bigInteger")) - return Shape{ .bigInteger = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "bigDecimal")) - return Shape{ .bigDecimal = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "boolean")) - return Shape{ .boolean = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "blob")) - return Shape{ .blob = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "timestamp")) - return Shape{ .timestamp = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "document")) - return Shape{ .document = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "member")) - return Shape{ .member = try parseTraitsOnly(allocator, shape) }; - if (std.mem.eql(u8, shape_type, "resource")) - return Shape{ .resource = try parseTraitsOnly(allocator, shape) }; - - std.debug.print("Invalid Type: {s}", .{shape_type}); - return SmithyParseError.InvalidType; -} - -fn parseMembers(allocator: std.mem.Allocator, shape: ?std.json.Value) SmithyParseError![]TypeMember { - var rc: []TypeMember = &.{}; - if (shape == null) - return rc; - - const map = shape.?.Object; - var list = std.ArrayList(TypeMember).initCapacity(allocator, map.count()) catch return SmithyParseError.OutOfMemory; - defer list.deinit(); - var iterator = map.iterator(); - while (iterator.next()) |kv| { - try list.append(TypeMember{ - .name = kv.key_ptr.*, - .target = kv.value_ptr.*.Object.get("target").?.String, - .traits = try parseTraits(allocator, kv.value_ptr.*.Object.get("traits")), - }); - } - return list.toOwnedSlice(); -} - -// ArrayList of std.Json.Value -fn parseTargetList(allocator: std.mem.Allocator, list: anytype) SmithyParseError![][]const u8 { - var array_list = std.ArrayList([]const u8).initCapacity(allocator, list.items.len) catch return SmithyParseError.OutOfMemory; - defer array_list.deinit(); - for (list.items) |i| { - try array_list.append(i.Object.get("target").?.String); - } - return array_list.toOwnedSlice(); -} -fn parseTraitsOnly(allocator: std.mem.Allocator, shape: std.json.Value) SmithyParseError!TraitsOnly { - return TraitsOnly{ - .traits = try parseTraits(allocator, shape.Object.get("traits")), - }; -} - -fn parseTraits(allocator: std.mem.Allocator, shape: ?std.json.Value) SmithyParseError![]Trait { - var rc: []Trait = &.{}; - if (shape == null) - return rc; - - const map = shape.?.Object; - var list = std.ArrayList(Trait).initCapacity(allocator, map.count()) catch return SmithyParseError.OutOfMemory; - defer list.deinit(); - var iterator = map.iterator(); - while (iterator.next()) |kv| { - if (try getTrait(kv.key_ptr.*, kv.value_ptr.*)) |t| - try list.append(t); - } - return list.toOwnedSlice(); -} - -fn getTrait(trait_type: []const u8, value: std.json.Value) SmithyParseError!?Trait { - if (std.mem.eql(u8, trait_type, "aws.api#service")) - return Trait{ - .aws_api_service = .{ - .sdk_id = value.Object.get("sdkId").?.String, - .arn_namespace = value.Object.get("arnNamespace").?.String, - .cloudformation_name = value.Object.get("cloudFormationName").?.String, - .cloudtrail_event_source = value.Object.get("cloudTrailEventSource").?.String, - // what good is a service without an endpoint? I don't know - ask amp - .endpoint_prefix = if (value.Object.get("endpointPrefix")) |endpoint| endpoint.String else "", - }, - }; - if (std.mem.eql(u8, trait_type, "aws.auth#sigv4")) - return Trait{ - .aws_auth_sigv4 = .{ - .name = value.Object.get("name").?.String, - }, - }; - if (std.mem.eql(u8, trait_type, "smithy.api#required")) - return Trait{ .required = .{} }; - if (std.mem.eql(u8, trait_type, "smithy.api#sparse")) - return Trait{ .sparse = .{} }; - if (std.mem.eql(u8, trait_type, "smithy.api#box")) - return Trait{ .box = .{} }; - - if (std.mem.eql(u8, trait_type, "smithy.api#range")) - return Trait{ - .range = .{ - .min = getOptionalNumber(value, "min"), - .max = getOptionalNumber(value, "max"), - }, - }; - if (std.mem.eql(u8, trait_type, "smithy.api#length")) - return Trait{ - .length = .{ - .min = getOptionalNumber(value, "min"), - .max = getOptionalNumber(value, "max"), - }, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#restJson1")) - return Trait{ - .aws_protocol = .rest_json_1, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#awsJson1_0")) - return Trait{ - .aws_protocol = .json_1_0, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#awsJson1_1")) - return Trait{ - .aws_protocol = .json_1_1, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#restXml")) - return Trait{ - .aws_protocol = .rest_xml, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#awsQuery")) - return Trait{ - .aws_protocol = .query, - }; - if (std.mem.eql(u8, trait_type, "aws.protocols#ec2Query")) - return Trait{ - .aws_protocol = .ec2_query, - }; - - if (std.mem.eql(u8, trait_type, "smithy.api#documentation")) - return Trait{ .documentation = value.String }; - if (std.mem.eql(u8, trait_type, "smithy.api#pattern")) - return Trait{ .pattern = value.String }; - - if (std.mem.eql(u8, trait_type, "aws.protocols#ec2QueryName")) - return Trait{ .ec2_query_name = value.String }; - - if (std.mem.eql(u8, trait_type, "smithy.api#http")) { - var code: i64 = 200; - if (value.Object.get("code")) |v| { - if (v == .Integer) - code = v.Integer; - } - return Trait{ .http = .{ - .method = value.Object.get("method").?.String, - .uri = value.Object.get("uri").?.String, - .code = code, - } }; - } - if (std.mem.eql(u8, trait_type, "smithy.api#jsonName")) - return Trait{ .json_name = value.String }; - if (std.mem.eql(u8, trait_type, "smithy.api#xmlName")) - return Trait{ .xml_name = value.String }; - if (std.mem.eql(u8, trait_type, "smithy.api#httpQuery")) - return Trait{ .http_query = value.String }; - if (std.mem.eql(u8, trait_type, "smithy.api#httpHeader")) - return Trait{ .http_header = value.String }; - if (std.mem.eql(u8, trait_type, "smithy.api#httpPayload")) - return Trait{ .http_payload = .{} }; - - // TODO: Maybe care about these traits? - if (std.mem.eql(u8, trait_type, "smithy.api#title")) - return null; - - if (std.mem.eql(u8, trait_type, "smithy.api#xmlNamespace")) - return null; - // TODO: win argument with compiler to get this comptime - const list = - \\aws.api#arnReference - \\aws.api#clientDiscoveredEndpoint - \\aws.api#clientEndpointDiscovery - \\aws.api#arn - \\aws.auth#unsignedPayload - \\aws.iam#disableConditionKeyInference - \\smithy.api#auth - \\smithy.api#cors - \\smithy.api#deprecated - \\smithy.api#endpoint - \\smithy.api#enum - \\smithy.api#error - \\smithy.api#eventPayload - \\smithy.api#externalDocumentation - \\smithy.api#hostLabel - \\smithy.api#httpError - \\smithy.api#httpChecksumRequired - \\smithy.api#httpLabel - \\smithy.api#httpPrefixHeaders - \\smithy.api#httpQueryParams - \\smithy.api#httpResponseCode - \\smithy.api#idempotencyToken - \\smithy.api#idempotent - \\smithy.api#mediaType - \\smithy.api#noReplace - \\smithy.api#optionalAuth - \\smithy.api#paginated - \\smithy.api#readonly - \\smithy.api#references - \\smithy.api#requiresLength - \\smithy.api#retryable - \\smithy.api#sensitive - \\smithy.api#streaming - \\smithy.api#suppress - \\smithy.api#tags - \\smithy.api#timestampFormat - \\smithy.api#xmlAttribute - \\smithy.api#xmlFlattened - \\smithy.waiters#waitable - ; - var iterator = std.mem.split(u8, list, "\n"); - while (iterator.next()) |known_but_unimplemented| { - if (std.mem.eql(u8, trait_type, known_but_unimplemented)) - return null; - } - - // Totally unknown type - std.log.err("Invalid Trait Type: {s}", .{trait_type}); - return null; -} -fn getOptionalNumber(value: std.json.Value, key: []const u8) ?f64 { - if (value.Object.get(key)) |v| - return switch (v) { - .Integer => @intToFloat(f64, v.Integer), - .Float => v.Float, - .Null, .Bool, .NumberString, .String, .Array, .Object => null, - }; - return null; -} -const IdInfo = struct { id: []const u8, namespace: []const u8, name: []const u8, member: ?[]const u8 }; -const SmithyParseError = error{ - NoHashtagFound, - InvalidType, - OutOfMemory, -}; -fn parseId(id: []const u8) SmithyParseError!IdInfo { - var hashtag: ?usize = null; - var dollar: ?usize = null; - var inx: usize = 0; - for (id) |ch| { - switch (ch) { - '#' => hashtag = inx, - '$' => dollar = inx, - else => {}, - } - inx = inx + 1; - } - if (hashtag == null) { - std.debug.print("no hashtag found on id: {s}\n", .{id}); - return SmithyParseError.NoHashtagFound; - } - const namespace = id[0..hashtag.?]; - var end = id.len; - var member: ?[]const u8 = null; - if (dollar) |d| { - member = id[dollar.? + 1 .. end]; - end = d; - } - const name = id[hashtag.? + 1 .. end]; - return IdInfo{ - .id = id, - .namespace = namespace, - .name = name, - .member = member, - }; -} -fn read_file_to_string(allocator: std.mem.Allocator, file_name: []const u8, max_bytes: usize) ![]const u8 { - const file = try std.fs.cwd().openFile(file_name, std.fs.File.OpenFlags{}); - defer file.close(); - return file.readToEndAlloc(allocator, max_bytes); -} -var test_data: ?[]const u8 = null; -const intrinsic_type_count: usize = 5; // 5 intrinsic types are added to every model - -fn getTestData(_: *std.mem.Allocator) []const u8 { - if (test_data) |d| return d; - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - test_data = read_file_to_string(gpa.allocator, "test.json", 150000) catch @panic("could not read test.json"); - return test_data.?; -} -test "read file" { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer if (gpa.deinit()) @panic("leak"); - const allocator = gpa.allocator; - _ = getTestData(allocator); - // test stuff -} -test "parse string" { - const test_string = - \\ { - \\ "smithy": "1.0", - \\ "shapes": { - \\ "com.amazonaws.sts#AWSSecurityTokenServiceV20110615": { - \\ "type": "service", - \\ "version": "2011-06-15", - \\ "operations": [ - \\ { - \\ "target": "op" - \\ } - \\ ] - \\ } - \\ } - \\ } - \\ - \\ - ; - - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer if (gpa.deinit()) @panic("leak"); - const allocator = gpa.allocator; - const model = try parse(allocator, test_string); - defer model.deinit(); - try expect(std.mem.eql(u8, model.version, "1.0")); - - try std.testing.expectEqual(intrinsic_type_count + 1, model.shapes.len); - try std.testing.expectEqualStrings("com.amazonaws.sts#AWSSecurityTokenServiceV20110615", model.shapes[0].id); - try std.testing.expectEqualStrings("com.amazonaws.sts", model.shapes[0].namespace); - try std.testing.expectEqualStrings("AWSSecurityTokenServiceV20110615", model.shapes[0].name); - try std.testing.expect(model.shapes[0].member == null); - try std.testing.expectEqualStrings("2011-06-15", model.shapes[0].shape.service.version); -} -test "parse shape with member" { - const test_string = - \\ { - \\ "smithy": "1.0", - \\ "shapes": { - \\ "com.amazonaws.sts#AWSSecurityTokenServiceV20110615$member": { - \\ "type": "service", - \\ "version": "2011-06-15", - \\ "operations": [ - \\ { - \\ "target": "op" - \\ } - \\ ] - \\ } - \\ } - \\ } - \\ - \\ - ; - - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer if (gpa.deinit()) @panic("leak"); - const allocator = gpa.allocator; - const model = try parse(allocator, test_string); - defer model.deinit(); - try expect(std.mem.eql(u8, model.version, "1.0")); - try std.testing.expectEqual(intrinsic_type_count + 1, model.shapes.len); - try std.testing.expectEqualStrings("com.amazonaws.sts#AWSSecurityTokenServiceV20110615$member", model.shapes[0].id); - try std.testing.expectEqualStrings("com.amazonaws.sts", model.shapes[0].namespace); - try std.testing.expectEqualStrings("AWSSecurityTokenServiceV20110615", model.shapes[0].name); - try std.testing.expectEqualStrings("2011-06-15", model.shapes[0].shape.service.version); - try std.testing.expectEqualStrings("member", model.shapes[0].member.?); -} -test "parse file" { - var gpa = std.heap.GeneralPurposeAllocator(.{}){}; - defer if (gpa.deinit()) @panic("leak"); - const allocator = gpa.allocator; - const test_string = getTestData(allocator); - const model = try parse(allocator, test_string); - defer model.deinit(); - try std.testing.expectEqualStrings(model.version, "1.0"); - // metadata expectations - // try expect(std.mem.eql(u8, model.version, "version 1.0")); - - // shape expectations - try std.testing.expectEqual(intrinsic_type_count + 81, model.shapes.len); - var optsvc: ?ShapeInfo = null; - for (model.shapes) |shape| { - if (std.mem.eql(u8, shape.id, "com.amazonaws.sts#AWSSecurityTokenServiceV20110615")) { - optsvc = shape; - break; - } - } - try std.testing.expect(optsvc != null); - const svc = optsvc.?; - try std.testing.expectEqualStrings("com.amazonaws.sts#AWSSecurityTokenServiceV20110615", svc.id); - try std.testing.expectEqualStrings("com.amazonaws.sts", svc.namespace); - try std.testing.expectEqualStrings("AWSSecurityTokenServiceV20110615", svc.name); - try std.testing.expectEqualStrings("2011-06-15", svc.shape.service.version); - // Should be 6, but we don't handle title or xml namespace - try std.testing.expectEqual(@as(usize, 4), svc.shape.service.traits.len); - try std.testing.expectEqual(@as(usize, 8), svc.shape.service.operations.len); -}