diff --git a/.changelog/077312ffb16a4dd2bf6eb1c2ee3dea5f.json b/.changelog/077312ffb16a4dd2bf6eb1c2ee3dea5f.json new file mode 100644 index 00000000000..627c7f9fef6 --- /dev/null +++ b/.changelog/077312ffb16a4dd2bf6eb1c2ee3dea5f.json @@ -0,0 +1,8 @@ +{ + "id": "077312ff-b16a-4dd2-bf6e-b1c2ee3dea5f", + "type": "documentation", + "description": "This release adds support for new webhook events (RELEASED and PRERELEASED) and filter types (TAG_NAME and RELEASE_NAME).", + "modules": [ + "service/codebuild" + ] +} \ No newline at end of file diff --git a/.changelog/70e987330d934ffb9fa160f5a4f72f81.json b/.changelog/70e987330d934ffb9fa160f5a4f72f81.json new file mode 100644 index 00000000000..371ae5721f6 --- /dev/null +++ b/.changelog/70e987330d934ffb9fa160f5a4f72f81.json @@ -0,0 +1,8 @@ +{ + "id": "70e98733-0d93-4ffb-9fa1-60f5a4f72f81", + "type": "feature", + "description": "Introducing the Savings Plans Return feature enabling customers to return their Savings Plans within 7 days of purchase.", + "modules": [ + "service/savingsplans" + ] +} \ No newline at end of file diff --git a/.changelog/8fa23c7a506448ad8d7f8c8d94f071fb.json b/.changelog/8fa23c7a506448ad8d7f8c8d94f071fb.json new file mode 100644 index 00000000000..ebe3090d7c7 --- /dev/null +++ b/.changelog/8fa23c7a506448ad8d7f8c8d94f071fb.json @@ -0,0 +1,8 @@ +{ + "id": "8fa23c7a-5064-48ad-8d7f-8c8d94f071fb", + "type": "feature", + "description": "AMB Query: update GetTransaction to include transactionId as input", + "modules": [ + "service/managedblockchainquery" + ] +} \ No newline at end of file diff --git a/.changelog/9974e4c65e1c4661bd2153b07fd49a6a.json b/.changelog/9974e4c65e1c4661bd2153b07fd49a6a.json new file mode 100644 index 00000000000..7fa98643457 --- /dev/null +++ b/.changelog/9974e4c65e1c4661bd2153b07fd49a6a.json @@ -0,0 +1,8 @@ +{ + "id": "9974e4c6-5e1c-4661-bd21-53b07fd49a6a", + "type": "feature", + "description": "This release adds support for policy validation and external access findings for DynamoDB tables and streams. IAM Access Analyzer helps you author functional and secure resource-based policies and identify cross-account access. Updated service API, documentation, and paginators.", + "modules": [ + "service/accessanalyzer" + ] +} \ No newline at end of file diff --git a/.changelog/be94678859674b2b81dc11fd62c1dee4.json b/.changelog/be94678859674b2b81dc11fd62c1dee4.json new file mode 100644 index 00000000000..369ffaddfa9 --- /dev/null +++ b/.changelog/be94678859674b2b81dc11fd62c1dee4.json @@ -0,0 +1,8 @@ +{ + "id": "be946788-5967-4b2b-81dc-11fd62c1dee4", + "type": "feature", + "description": "This release introduces 3 new APIs ('GetResourcePolicy', 'PutResourcePolicy' and 'DeleteResourcePolicy') and modifies the existing 'CreateTable' API for the resource-based policy support. It also modifies several APIs to accept a 'TableArn' for the 'TableName' parameter.", + "modules": [ + "service/dynamodb" + ] +} \ No newline at end of file diff --git a/.changelog/e9dcbafa502c4b35ae414add526347d5.json b/.changelog/e9dcbafa502c4b35ae414add526347d5.json new file mode 100644 index 00000000000..70a9c507d46 --- /dev/null +++ b/.changelog/e9dcbafa502c4b35ae414add526347d5.json @@ -0,0 +1,8 @@ +{ + "id": "e9dcbafa-502c-4b35-ae41-4add526347d5", + "type": "feature", + "description": "This release updates the *InstanceStorageConfig APIs to support a new ResourceType: REAL_TIME_CONTACT_ANALYSIS_CHAT_SEGMENTS. Use this resource type to enable streaming for real-time analysis of chat contacts and to associate a Kinesis stream where real-time analysis chat segments will be published.", + "modules": [ + "service/connect" + ] +} \ No newline at end of file diff --git a/service/accessanalyzer/deserializers.go b/service/accessanalyzer/deserializers.go index 83b3fd7939c..dfea0b439f4 100644 --- a/service/accessanalyzer/deserializers.go +++ b/service/accessanalyzer/deserializers.go @@ -6318,6 +6318,26 @@ loop: continue } switch key { + case "dynamodbStream": + var mv types.DynamodbStreamConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentDynamodbStreamConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.ConfigurationMemberDynamodbStream{Value: mv} + break loop + + case "dynamodbTable": + var mv types.DynamodbTableConfiguration + destAddr := &mv + if err := awsRestjson1_deserializeDocumentDynamodbTableConfiguration(&destAddr, value); err != nil { + return err + } + mv = *destAddr + uv = &types.ConfigurationMemberDynamodbTable{Value: mv} + break loop + case "ebsSnapshot": var mv types.EbsSnapshotConfiguration destAddr := &mv @@ -6595,6 +6615,86 @@ func awsRestjson1_deserializeDocumentCriterion(v **types.Criterion, value interf return nil } +func awsRestjson1_deserializeDocumentDynamodbStreamConfiguration(v **types.DynamodbStreamConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.DynamodbStreamConfiguration + if *v == nil { + sv = &types.DynamodbStreamConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "streamPolicy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DynamodbStreamPolicy to be of type string, got %T instead", value) + } + sv.StreamPolicy = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentDynamodbTableConfiguration(v **types.DynamodbTableConfiguration, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.DynamodbTableConfiguration + if *v == nil { + sv = &types.DynamodbTableConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "tablePolicy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected DynamodbTablePolicy to be of type string, got %T instead", value) + } + sv.TablePolicy = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentEbsGroupList(v *[]string, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/accessanalyzer/serializers.go b/service/accessanalyzer/serializers.go index 05c11e76789..33db96ebe11 100644 --- a/service/accessanalyzer/serializers.go +++ b/service/accessanalyzer/serializers.go @@ -2751,6 +2751,18 @@ func awsRestjson1_serializeDocumentConfiguration(v types.Configuration, value sm defer object.Close() switch uv := v.(type) { + case *types.ConfigurationMemberDynamodbStream: + av := object.Key("dynamodbStream") + if err := awsRestjson1_serializeDocumentDynamodbStreamConfiguration(&uv.Value, av); err != nil { + return err + } + + case *types.ConfigurationMemberDynamodbTable: + av := object.Key("dynamodbTable") + if err := awsRestjson1_serializeDocumentDynamodbTableConfiguration(&uv.Value, av); err != nil { + return err + } + case *types.ConfigurationMemberEbsSnapshot: av := object.Key("ebsSnapshot") if err := awsRestjson1_serializeDocumentEbsSnapshotConfiguration(&uv.Value, av); err != nil { @@ -2879,6 +2891,30 @@ func awsRestjson1_serializeDocumentCriterion(v *types.Criterion, value smithyjso return nil } +func awsRestjson1_serializeDocumentDynamodbStreamConfiguration(v *types.DynamodbStreamConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.StreamPolicy != nil { + ok := object.Key("streamPolicy") + ok.String(*v.StreamPolicy) + } + + return nil +} + +func awsRestjson1_serializeDocumentDynamodbTableConfiguration(v *types.DynamodbTableConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.TablePolicy != nil { + ok := object.Key("tablePolicy") + ok.String(*v.TablePolicy) + } + + return nil +} + func awsRestjson1_serializeDocumentEbsGroupList(v []string, value smithyjson.Value) error { array := value.Array() defer array.Close() diff --git a/service/accessanalyzer/types/enums.go b/service/accessanalyzer/types/enums.go index 7b5e280b3b3..7d55deb9bbd 100644 --- a/service/accessanalyzer/types/enums.go +++ b/service/accessanalyzer/types/enums.go @@ -443,6 +443,8 @@ const ( ResourceTypeAwsRdsDbclustersnapshot ResourceType = "AWS::RDS::DBClusterSnapshot" ResourceTypeAwsSnsTopic ResourceType = "AWS::SNS::Topic" ResourceTypeAwsS3expressDirectorybucket ResourceType = "AWS::S3Express::DirectoryBucket" + ResourceTypeAwsDynamodbTable ResourceType = "AWS::DynamoDB::Table" + ResourceTypeAwsDynamodbStream ResourceType = "AWS::DynamoDB::Stream" ) // Values returns all known values for ResourceType. Note that this can be @@ -464,6 +466,8 @@ func (ResourceType) Values() []ResourceType { "AWS::RDS::DBClusterSnapshot", "AWS::SNS::Topic", "AWS::S3Express::DirectoryBucket", + "AWS::DynamoDB::Table", + "AWS::DynamoDB::Stream", } } @@ -520,6 +524,7 @@ const ( ValidatePolicyResourceTypeS3MultiRegionAccessPoint ValidatePolicyResourceType = "AWS::S3::MultiRegionAccessPoint" ValidatePolicyResourceTypeS3ObjectLambdaAccessPoint ValidatePolicyResourceType = "AWS::S3ObjectLambda::AccessPoint" ValidatePolicyResourceTypeRoleTrust ValidatePolicyResourceType = "AWS::IAM::AssumeRolePolicyDocument" + ValidatePolicyResourceTypeDynamodbTable ValidatePolicyResourceType = "AWS::DynamoDB::Table" ) // Values returns all known values for ValidatePolicyResourceType. Note that this @@ -532,6 +537,7 @@ func (ValidatePolicyResourceType) Values() []ValidatePolicyResourceType { "AWS::S3::MultiRegionAccessPoint", "AWS::S3ObjectLambda::AccessPoint", "AWS::IAM::AssumeRolePolicyDocument", + "AWS::DynamoDB::Table", } } diff --git a/service/accessanalyzer/types/types.go b/service/accessanalyzer/types/types.go index 5f4123cc2fb..304dd435494 100644 --- a/service/accessanalyzer/types/types.go +++ b/service/accessanalyzer/types/types.go @@ -467,6 +467,8 @@ type CloudTrailProperties struct { // // The following types satisfy this interface: // +// ConfigurationMemberDynamodbStream +// ConfigurationMemberDynamodbTable // ConfigurationMemberEbsSnapshot // ConfigurationMemberEcrRepository // ConfigurationMemberEfsFileSystem @@ -483,6 +485,24 @@ type Configuration interface { isConfiguration() } +// The access control configuration is for a DynamoDB stream. +type ConfigurationMemberDynamodbStream struct { + Value DynamodbStreamConfiguration + + noSmithyDocumentSerde +} + +func (*ConfigurationMemberDynamodbStream) isConfiguration() {} + +// The access control configuration is for a DynamoDB table or index. +type ConfigurationMemberDynamodbTable struct { + Value DynamodbTableConfiguration + + noSmithyDocumentSerde +} + +func (*ConfigurationMemberDynamodbTable) isConfiguration() {} + // The access control configuration is for an Amazon EBS volume snapshot. type ConfigurationMemberEbsSnapshot struct { Value EbsSnapshotConfiguration @@ -611,6 +631,48 @@ type Criterion struct { noSmithyDocumentSerde } +// The proposed access control configuration for a DynamoDB stream. You can +// propose a configuration for a new DynamoDB stream or an existing DynamoDB stream +// that you own by specifying the policy for the DynamoDB stream. For more +// information, see PutResourcePolicy (https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutResourcePolicy.html) +// . +// - If the configuration is for an existing DynamoDB stream and you do not +// specify the DynamoDB policy, then the access preview uses the existing DynamoDB +// policy for the stream. +// - If the access preview is for a new resource and you do not specify the +// policy, then the access preview assumes a DynamoDB stream without a policy. +// - To propose deletion of an existing DynamoDB stream policy, you can specify +// an empty string for the DynamoDB policy. +type DynamodbStreamConfiguration struct { + + // The proposed resource policy defining who can access or manage the DynamoDB + // stream. + StreamPolicy *string + + noSmithyDocumentSerde +} + +// The proposed access control configuration for a DynamoDB table or index. You +// can propose a configuration for a new DynamoDB table or index or an existing +// DynamoDB table or index that you own by specifying the policy for the DynamoDB +// table or index. For more information, see PutResourcePolicy (https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutResourcePolicy.html) +// . +// - If the configuration is for an existing DynamoDB table or index and you do +// not specify the DynamoDB policy, then the access preview uses the existing +// DynamoDB policy for the table or index. +// - If the access preview is for a new resource and you do not specify the +// policy, then the access preview assumes a DynamoDB table without a policy. +// - To propose deletion of an existing DynamoDB table or index policy, you can +// specify an empty string for the DynamoDB policy. +type DynamodbTableConfiguration struct { + + // The proposed resource policy defining who can access or manage the DynamoDB + // table. + TablePolicy *string + + noSmithyDocumentSerde +} + // The proposed access control configuration for an Amazon EBS volume snapshot. // You can propose a configuration for a new Amazon EBS volume snapshot or an // Amazon EBS volume snapshot that you own by specifying the user IDs, groups, and diff --git a/service/accessanalyzer/types/types_exported_test.go b/service/accessanalyzer/types/types_exported_test.go index a2dd8fde7ec..c77e2b6bd05 100644 --- a/service/accessanalyzer/types/types_exported_test.go +++ b/service/accessanalyzer/types/types_exported_test.go @@ -51,6 +51,12 @@ func ExampleConfiguration_outputUsage() { var union types.Configuration // type switches can be used to check the union value switch v := union.(type) { + case *types.ConfigurationMemberDynamodbStream: + _ = v.Value // Value is types.DynamodbStreamConfiguration + + case *types.ConfigurationMemberDynamodbTable: + _ = v.Value // Value is types.DynamodbTableConfiguration + case *types.ConfigurationMemberEbsSnapshot: _ = v.Value // Value is types.EbsSnapshotConfiguration @@ -98,15 +104,17 @@ func ExampleConfiguration_outputUsage() { var _ *types.S3ExpressDirectoryBucketConfiguration var _ *types.SnsTopicConfiguration +var _ *types.IamRoleConfiguration +var _ *types.SecretsManagerSecretConfiguration +var _ *types.EfsFileSystemConfiguration +var _ *types.KmsKeyConfiguration +var _ *types.DynamodbStreamConfiguration var _ *types.SqsQueueConfiguration var _ *types.EcrRepositoryConfiguration -var _ *types.IamRoleConfiguration var _ *types.RdsDbClusterSnapshotConfiguration var _ *types.RdsDbSnapshotConfiguration -var _ *types.SecretsManagerSecretConfiguration -var _ *types.EfsFileSystemConfiguration +var _ *types.DynamodbTableConfiguration var _ *types.S3BucketConfiguration -var _ *types.KmsKeyConfiguration var _ *types.EbsSnapshotConfiguration func ExampleFindingDetails_outputUsage() { diff --git a/service/codebuild/types/types.go b/service/codebuild/types/types.go index d4dabe23c6a..d09ef6155d5 100644 --- a/service/codebuild/types/types.go +++ b/service/codebuild/types/types.go @@ -2115,16 +2115,18 @@ type WebhookFilter struct { // This member is required. Pattern *string - // The type of webhook filter. There are six webhook filter types: EVENT , - // ACTOR_ACCOUNT_ID , HEAD_REF , BASE_REF , FILE_PATH , and COMMIT_MESSAGE . + // The type of webhook filter. There are eight webhook filter types: EVENT , + // ACTOR_ACCOUNT_ID , HEAD_REF , BASE_REF , FILE_PATH , COMMIT_MESSAGE , TAG_NAME , + // and RELEASE_NAME . // - EVENT // - A webhook event triggers a build when the provided pattern matches one of - // six event types: PUSH , PULL_REQUEST_CREATED , PULL_REQUEST_UPDATED , - // PULL_REQUEST_CLOSED , PULL_REQUEST_REOPENED , and PULL_REQUEST_MERGED . The - // EVENT patterns are specified as a comma-separated string. For example, PUSH, - // PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED filters all push, pull request - // created, and pull request updated events. The PULL_REQUEST_REOPENED works with - // GitHub and GitHub Enterprise only. + // eight event types: PUSH , PULL_REQUEST_CREATED , PULL_REQUEST_UPDATED , + // PULL_REQUEST_CLOSED , PULL_REQUEST_REOPENED , PULL_REQUEST_MERGED , RELEASED , + // and PRERELEASED . The EVENT patterns are specified as a comma-separated + // string. For example, PUSH, PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED filters + // all push, pull request created, and pull request updated events. The + // PULL_REQUEST_REOPENED works with GitHub and GitHub Enterprise only. The + // RELEASED and PRERELEASED work with GitHub only. // - ACTOR_ACCOUNT_ID // - A webhook event triggers a build when a GitHub, GitHub Enterprise, or // Bitbucket account ID matches the regular expression pattern . @@ -2148,6 +2150,12 @@ type WebhookFilter struct { // expression pattern . Works with GitHub and Bitbucket events push and pull // requests events. Also works with GitHub Enterprise push events, but does not // work with GitHub Enterprise pull request events. + // - TAG_NAME + // - A webhook triggers a build when the tag name of the release matches the + // regular expression pattern . Works with RELEASED and PRERELEASED events only. + // - RELEASE_NAME + // - A webhook triggers a build when the release name matches the regular + // expression pattern . Works with RELEASED and PRERELEASED events only. // // This member is required. Type WebhookFilterType diff --git a/service/connect/api_op_AssociateInstanceStorageConfig.go b/service/connect/api_op_AssociateInstanceStorageConfig.go index c97b2a2f70a..fe862739df1 100644 --- a/service/connect/api_op_AssociateInstanceStorageConfig.go +++ b/service/connect/api_op_AssociateInstanceStorageConfig.go @@ -42,7 +42,16 @@ type AssociateInstanceStorageConfigInput struct { // This member is required. InstanceId *string - // A valid resource type. + // A valid resource type. To enable streaming for real-time analysis of contacts (https://docs.aws.amazon.com/connect/latest/adminguide/enable-contact-analysis-segment-streams.html) + // , use the following types: + // - For chat contacts, use REAL_TIME_CONTACT_ANALYSIS_CHAT_SEGMENTS . + // - For voice contacts, use REAL_TIME_CONTACT_ANALYSIS_VOICE_SEGMENTS . + // REAL_TIME_CONTACT_ANALYSIS_SEGMENTS is deprecated, but it is still supported + // and will apply only to VOICE channel contacts. Use + // REAL_TIME_CONTACT_ANALYSIS_VOICE_SEGMENTS for voice contacts moving forward. If + // you have previously associated a stream with REAL_TIME_CONTACT_ANALYSIS_SEGMENTS + // , no action is needed to update the stream to + // REAL_TIME_CONTACT_ANALYSIS_VOICE_SEGMENTS . // // This member is required. ResourceType types.InstanceStorageResourceType diff --git a/service/connect/types/enums.go b/service/connect/types/enums.go index 5ef32d15b61..3ba3499177d 100644 --- a/service/connect/types/enums.go +++ b/service/connect/types/enums.go @@ -815,16 +815,18 @@ type InstanceStorageResourceType string // Enum values for InstanceStorageResourceType const ( - InstanceStorageResourceTypeChatTranscripts InstanceStorageResourceType = "CHAT_TRANSCRIPTS" - InstanceStorageResourceTypeCallRecordings InstanceStorageResourceType = "CALL_RECORDINGS" - InstanceStorageResourceTypeScheduledReports InstanceStorageResourceType = "SCHEDULED_REPORTS" - InstanceStorageResourceTypeMediaStreams InstanceStorageResourceType = "MEDIA_STREAMS" - InstanceStorageResourceTypeContactTraceRecords InstanceStorageResourceType = "CONTACT_TRACE_RECORDS" - InstanceStorageResourceTypeAgentEvents InstanceStorageResourceType = "AGENT_EVENTS" - InstanceStorageResourceTypeRealTimeContactAnalysisSegments InstanceStorageResourceType = "REAL_TIME_CONTACT_ANALYSIS_SEGMENTS" - InstanceStorageResourceTypeAttachments InstanceStorageResourceType = "ATTACHMENTS" - InstanceStorageResourceTypeContactEvaluations InstanceStorageResourceType = "CONTACT_EVALUATIONS" - InstanceStorageResourceTypeScreenRecordings InstanceStorageResourceType = "SCREEN_RECORDINGS" + InstanceStorageResourceTypeChatTranscripts InstanceStorageResourceType = "CHAT_TRANSCRIPTS" + InstanceStorageResourceTypeCallRecordings InstanceStorageResourceType = "CALL_RECORDINGS" + InstanceStorageResourceTypeScheduledReports InstanceStorageResourceType = "SCHEDULED_REPORTS" + InstanceStorageResourceTypeMediaStreams InstanceStorageResourceType = "MEDIA_STREAMS" + InstanceStorageResourceTypeContactTraceRecords InstanceStorageResourceType = "CONTACT_TRACE_RECORDS" + InstanceStorageResourceTypeAgentEvents InstanceStorageResourceType = "AGENT_EVENTS" + InstanceStorageResourceTypeRealTimeContactAnalysisSegments InstanceStorageResourceType = "REAL_TIME_CONTACT_ANALYSIS_SEGMENTS" + InstanceStorageResourceTypeAttachments InstanceStorageResourceType = "ATTACHMENTS" + InstanceStorageResourceTypeContactEvaluations InstanceStorageResourceType = "CONTACT_EVALUATIONS" + InstanceStorageResourceTypeScreenRecordings InstanceStorageResourceType = "SCREEN_RECORDINGS" + InstanceStorageResourceTypeRealTimeContactAnalysisChatSegments InstanceStorageResourceType = "REAL_TIME_CONTACT_ANALYSIS_CHAT_SEGMENTS" + InstanceStorageResourceTypeRealTimeContactAnalysisVoiceSegments InstanceStorageResourceType = "REAL_TIME_CONTACT_ANALYSIS_VOICE_SEGMENTS" ) // Values returns all known values for InstanceStorageResourceType. Note that this @@ -842,6 +844,8 @@ func (InstanceStorageResourceType) Values() []InstanceStorageResourceType { "ATTACHMENTS", "CONTACT_EVALUATIONS", "SCREEN_RECORDINGS", + "REAL_TIME_CONTACT_ANALYSIS_CHAT_SEGMENTS", + "REAL_TIME_CONTACT_ANALYSIS_VOICE_SEGMENTS", } } diff --git a/service/dynamodb/api_op_BatchGetItem.go b/service/dynamodb/api_op_BatchGetItem.go index cbc116bd7b7..bd39f8d3447 100644 --- a/service/dynamodb/api_op_BatchGetItem.go +++ b/service/dynamodb/api_op_BatchGetItem.go @@ -68,10 +68,10 @@ func (c *Client) BatchGetItem(ctx context.Context, params *BatchGetItemInput, op // Represents the input of a BatchGetItem operation. type BatchGetItemInput struct { - // A map of one or more table names and, for each table, a map that describes one - // or more items to retrieve from that table. Each table name can be used only once - // per BatchGetItem request. Each element in the map of items to retrieve consists - // of the following: + // A map of one or more table names or table ARNs and, for each table, a map that + // describes one or more items to retrieve from that table. Each table name or ARN + // can be used only once per BatchGetItem request. Each element in the map of + // items to retrieve consists of the following: // - ConsistentRead - If true , a strongly consistent read is used; if false (the // default), an eventually consistent read is used. // - ExpressionAttributeNames - One or more substitution tokens for attribute @@ -138,9 +138,9 @@ type BatchGetItemOutput struct { // - CapacityUnits - The total number of capacity units consumed. ConsumedCapacity []types.ConsumedCapacity - // A map of table name to a list of items. Each object in Responses consists of a - // table name, along with a map of attribute data consisting of the data type and - // attribute value. + // A map of table name or table ARN to a list of items. Each object in Responses + // consists of a table name or ARN, along with a map of attribute data consisting + // of the data type and attribute value. Responses map[string][]map[string]types.AttributeValue // A map of tables and their respective keys that were not processed with the diff --git a/service/dynamodb/api_op_BatchWriteItem.go b/service/dynamodb/api_op_BatchWriteItem.go index cbb7611fe53..cae206a0a91 100644 --- a/service/dynamodb/api_op_BatchWriteItem.go +++ b/service/dynamodb/api_op_BatchWriteItem.go @@ -86,9 +86,9 @@ func (c *Client) BatchWriteItem(ctx context.Context, params *BatchWriteItemInput // Represents the input of a BatchWriteItem operation. type BatchWriteItemInput struct { - // A map of one or more table names and, for each table, a list of operations to - // be performed ( DeleteRequest or PutRequest ). Each element in the map consists - // of the following: + // A map of one or more table names or table ARNs and, for each table, a list of + // operations to be performed ( DeleteRequest or PutRequest ). Each element in the + // map consists of the following: // - DeleteRequest - Perform a DeleteItem operation on the specified item. The // item to be deleted is identified by a Key subelement: // - Key - A map of primary key attribute values that uniquely identify the item. @@ -159,8 +159,8 @@ type BatchWriteItemOutput struct { // UnprocessedItems value is in the same form as RequestItems , so you can provide // this value directly to a subsequent BatchWriteItem operation. For more // information, see RequestItems in the Request Parameters section. Each - // UnprocessedItems entry consists of a table name and, for that table, a list of - // operations to perform ( DeleteRequest or PutRequest ). + // UnprocessedItems entry consists of a table name or table ARN and, for that + // table, a list of operations to perform ( DeleteRequest or PutRequest ). // - DeleteRequest - Perform a DeleteItem operation on the specified item. The // item to be deleted is identified by a Key subelement: // - Key - A map of primary key attribute values that uniquely identify the item. diff --git a/service/dynamodb/api_op_CreateBackup.go b/service/dynamodb/api_op_CreateBackup.go index 2700dd68211..19161558e0d 100644 --- a/service/dynamodb/api_op_CreateBackup.go +++ b/service/dynamodb/api_op_CreateBackup.go @@ -52,7 +52,8 @@ type CreateBackupInput struct { // This member is required. BackupName *string - // The name of the table. + // The name of the table. You can also provide the Amazon Resource Name (ARN) of + // the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_CreateTable.go b/service/dynamodb/api_op_CreateTable.go index ea32e472470..92975ec6d3a 100644 --- a/service/dynamodb/api_op_CreateTable.go +++ b/service/dynamodb/api_op_CreateTable.go @@ -72,7 +72,8 @@ type CreateTableInput struct { // This member is required. KeySchema []types.KeySchemaElement - // The name of the table to create. + // The name of the table to create. You can also provide the Amazon Resource Name + // (ARN) of the table in this parameter. // // This member is required. TableName *string @@ -148,6 +149,17 @@ type CreateTableInput struct { // in the Amazon DynamoDB Developer Guide. ProvisionedThroughput *types.ProvisionedThroughput + // An Amazon Web Services resource-based policy document in JSON format that will + // be attached to the table. When you attach a resource-based policy while creating + // a table, the policy creation is strongly consistent. The maximum size supported + // for a resource-based policy document is 20 KB. DynamoDB counts whitespaces when + // calculating the size of a policy against this limit. You can’t request an + // increase for this limit. For a full list of all considerations that you should + // keep in mind while attaching a resource-based policy, see Resource-based policy + // considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html) + // . + ResourcePolicy *string + // Represents the settings used to enable server-side encryption. SSESpecification *types.SSESpecification diff --git a/service/dynamodb/api_op_DeleteItem.go b/service/dynamodb/api_op_DeleteItem.go index b78ba23027d..eab33851345 100644 --- a/service/dynamodb/api_op_DeleteItem.go +++ b/service/dynamodb/api_op_DeleteItem.go @@ -48,7 +48,8 @@ type DeleteItemInput struct { // This member is required. Key map[string]types.AttributeValue - // The name of the table from which to delete the item. + // The name of the table from which to delete the item. You can also provide the + // Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DeleteResourcePolicy.go b/service/dynamodb/api_op_DeleteResourcePolicy.go new file mode 100644 index 00000000000..cd6720b0861 --- /dev/null +++ b/service/dynamodb/api_op_DeleteResourcePolicy.go @@ -0,0 +1,212 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package dynamodb + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalEndpointDiscovery "github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Deletes the resource-based policy attached to the resource, which can be a +// table or stream. DeleteResourcePolicy is an idempotent operation; running it +// multiple times on the same resource doesn't result in an error response, unless +// you specify an ExpectedRevisionId , which will then return a +// PolicyNotFoundException . To make sure that you don't inadvertently lock +// yourself out of your own resources, the root principal in your Amazon Web +// Services account can perform DeleteResourcePolicy requests, even if your +// resource-based policy explicitly denies the root principal's access. +// DeleteResourcePolicy is an asynchronous operation. If you issue a +// GetResourcePolicy request immediately after running the DeleteResourcePolicy +// request, DynamoDB might still return the deleted policy. This is because the +// policy for your resource might not have been deleted yet. Wait for a few +// seconds, and then try the GetResourcePolicy request again. +func (c *Client) DeleteResourcePolicy(ctx context.Context, params *DeleteResourcePolicyInput, optFns ...func(*Options)) (*DeleteResourcePolicyOutput, error) { + if params == nil { + params = &DeleteResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DeleteResourcePolicy", params, optFns, c.addOperationDeleteResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DeleteResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DeleteResourcePolicyInput struct { + + // The Amazon Resource Name (ARN) of the DynamoDB resource from which the policy + // will be removed. The resources you can specify include tables and streams. If + // you remove the policy of a table, it will also remove the permissions for the + // table's indexes defined in that policy document. This is because index + // permissions are defined in the table's policy. + // + // This member is required. + ResourceArn *string + + // A string value that you can use to conditionally delete your policy. When you + // provide an expected revision ID, if the revision ID of the existing policy on + // the resource doesn't match or if there's no policy attached to the resource, the + // request will fail and return a PolicyNotFoundException . + ExpectedRevisionId *string + + noSmithyDocumentSerde +} + +type DeleteResourcePolicyOutput struct { + + // A unique string that represents the revision ID of the policy. If you are + // comparing revision IDs, make sure to always use string comparison logic. This + // value will be empty if you make a request against a resource without a policy. + RevisionId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDeleteResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson10_serializeOpDeleteResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpDeleteResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteResourcePolicy"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteResourcePolicyDiscoverEndpointMiddleware(stack, options, c); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpDeleteResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteResourcePolicy(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addValidateResponseChecksum(stack, options); err != nil { + return err + } + if err = addAcceptEncodingGzip(stack, options); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func addOpDeleteResourcePolicyDiscoverEndpointMiddleware(stack *middleware.Stack, o Options, c *Client) error { + return stack.Finalize.Insert(&internalEndpointDiscovery.DiscoverEndpoint{ + Options: []func(*internalEndpointDiscovery.DiscoverEndpointOptions){ + func(opt *internalEndpointDiscovery.DiscoverEndpointOptions) { + opt.DisableHTTPS = o.EndpointOptions.DisableHTTPS + opt.Logger = o.Logger + }, + }, + DiscoverOperation: c.fetchOpDeleteResourcePolicyDiscoverEndpoint, + EndpointDiscoveryEnableState: o.EndpointDiscovery.EnableEndpointDiscovery, + EndpointDiscoveryRequired: false, + Region: o.Region, + }, "ResolveEndpointV2", middleware.After) +} + +func (c *Client) fetchOpDeleteResourcePolicyDiscoverEndpoint(ctx context.Context, region string, optFns ...func(*internalEndpointDiscovery.DiscoverEndpointOptions)) (internalEndpointDiscovery.WeightedAddress, error) { + input := getOperationInput(ctx) + in, ok := input.(*DeleteResourcePolicyInput) + if !ok { + return internalEndpointDiscovery.WeightedAddress{}, fmt.Errorf("unknown input type %T", input) + } + _ = in + + identifierMap := make(map[string]string, 0) + identifierMap["sdk#Region"] = region + + key := fmt.Sprintf("DynamoDB.%v", identifierMap) + + if v, ok := c.endpointCache.Get(key); ok { + return v, nil + } + + discoveryOperationInput := &DescribeEndpointsInput{} + + opt := internalEndpointDiscovery.DiscoverEndpointOptions{} + for _, fn := range optFns { + fn(&opt) + } + + go c.handleEndpointDiscoveryFromService(ctx, discoveryOperationInput, region, key, opt) + return internalEndpointDiscovery.WeightedAddress{}, nil +} + +func newServiceMetadataMiddleware_opDeleteResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "DeleteResourcePolicy", + } +} diff --git a/service/dynamodb/api_op_DeleteTable.go b/service/dynamodb/api_op_DeleteTable.go index f3219f40ec5..00d36f83d3c 100644 --- a/service/dynamodb/api_op_DeleteTable.go +++ b/service/dynamodb/api_op_DeleteTable.go @@ -45,7 +45,8 @@ func (c *Client) DeleteTable(ctx context.Context, params *DeleteTableInput, optF // Represents the input of a DeleteTable operation. type DeleteTableInput struct { - // The name of the table to delete. + // The name of the table to delete. You can also provide the Amazon Resource Name + // (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeContinuousBackups.go b/service/dynamodb/api_op_DescribeContinuousBackups.go index 5813d3c9b49..2f60a65d3d9 100644 --- a/service/dynamodb/api_op_DescribeContinuousBackups.go +++ b/service/dynamodb/api_op_DescribeContinuousBackups.go @@ -39,7 +39,8 @@ func (c *Client) DescribeContinuousBackups(ctx context.Context, params *Describe type DescribeContinuousBackupsInput struct { // Name of the table for which the customer wants to check the continuous backups - // and point in time recovery settings. + // and point in time recovery settings. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeContributorInsights.go b/service/dynamodb/api_op_DescribeContributorInsights.go index 6e0f421b7fb..c983b639659 100644 --- a/service/dynamodb/api_op_DescribeContributorInsights.go +++ b/service/dynamodb/api_op_DescribeContributorInsights.go @@ -31,7 +31,8 @@ func (c *Client) DescribeContributorInsights(ctx context.Context, params *Descri type DescribeContributorInsightsInput struct { - // The name of the table to describe. + // The name of the table to describe. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go b/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go index 0e21756c50f..1c29302abdd 100644 --- a/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go +++ b/service/dynamodb/api_op_DescribeKinesisStreamingDestination.go @@ -30,7 +30,8 @@ func (c *Client) DescribeKinesisStreamingDestination(ctx context.Context, params type DescribeKinesisStreamingDestinationInput struct { - // The name of the table being described. + // The name of the table being described. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeTable.go b/service/dynamodb/api_op_DescribeTable.go index 36d723ab5a4..29861d9b443 100644 --- a/service/dynamodb/api_op_DescribeTable.go +++ b/service/dynamodb/api_op_DescribeTable.go @@ -43,7 +43,8 @@ func (c *Client) DescribeTable(ctx context.Context, params *DescribeTableInput, // Represents the input of a DescribeTable operation. type DescribeTableInput struct { - // The name of the table to describe. + // The name of the table to describe. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go b/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go index baca6aadae7..0008f9d1e83 100644 --- a/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go +++ b/service/dynamodb/api_op_DescribeTableReplicaAutoScaling.go @@ -31,7 +31,8 @@ func (c *Client) DescribeTableReplicaAutoScaling(ctx context.Context, params *De type DescribeTableReplicaAutoScalingInput struct { - // The name of the table. + // The name of the table. You can also provide the Amazon Resource Name (ARN) of + // the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DescribeTimeToLive.go b/service/dynamodb/api_op_DescribeTimeToLive.go index 3baa36ccccb..3845703de28 100644 --- a/service/dynamodb/api_op_DescribeTimeToLive.go +++ b/service/dynamodb/api_op_DescribeTimeToLive.go @@ -30,7 +30,8 @@ func (c *Client) DescribeTimeToLive(ctx context.Context, params *DescribeTimeToL type DescribeTimeToLiveInput struct { - // The name of the table to be described. + // The name of the table to be described. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_DisableKinesisStreamingDestination.go b/service/dynamodb/api_op_DisableKinesisStreamingDestination.go index 70d221bd0a8..1d72751c58f 100644 --- a/service/dynamodb/api_op_DisableKinesisStreamingDestination.go +++ b/service/dynamodb/api_op_DisableKinesisStreamingDestination.go @@ -36,7 +36,8 @@ type DisableKinesisStreamingDestinationInput struct { // This member is required. StreamArn *string - // The name of the DynamoDB table. + // The name of the DynamoDB table. You can also provide the Amazon Resource Name + // (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_EnableKinesisStreamingDestination.go b/service/dynamodb/api_op_EnableKinesisStreamingDestination.go index ac0469cdf21..7d0ff0d25de 100644 --- a/service/dynamodb/api_op_EnableKinesisStreamingDestination.go +++ b/service/dynamodb/api_op_EnableKinesisStreamingDestination.go @@ -38,7 +38,8 @@ type EnableKinesisStreamingDestinationInput struct { // This member is required. StreamArn *string - // The name of the DynamoDB table. + // The name of the DynamoDB table. You can also provide the Amazon Resource Name + // (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_GetItem.go b/service/dynamodb/api_op_GetItem.go index d6b520a2283..6d5ef8eca93 100644 --- a/service/dynamodb/api_op_GetItem.go +++ b/service/dynamodb/api_op_GetItem.go @@ -46,7 +46,8 @@ type GetItemInput struct { // This member is required. Key map[string]types.AttributeValue - // The name of the table containing the requested item. + // The name of the table containing the requested item. You can also provide the + // Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_GetResourcePolicy.go b/service/dynamodb/api_op_GetResourcePolicy.go new file mode 100644 index 00000000000..baadeb90f2e --- /dev/null +++ b/service/dynamodb/api_op_GetResourcePolicy.go @@ -0,0 +1,216 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package dynamodb + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalEndpointDiscovery "github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns the resource-based policy document attached to the resource, which can +// be a table or stream, in JSON format. GetResourcePolicy follows an eventually +// consistent (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html) +// model. The following list describes the outcomes when you issue the +// GetResourcePolicy request immediately after issuing another request: +// - If you issue a GetResourcePolicy request immediately after a +// PutResourcePolicy request, DynamoDB might return a PolicyNotFoundException . +// - If you issue a GetResourcePolicy request immediately after a +// DeleteResourcePolicy request, DynamoDB might return the policy that was +// present before the deletion request. +// - If you issue a GetResourcePolicy request immediately after a CreateTable +// request, which includes a resource-based policy, DynamoDB might return a +// ResourceNotFoundException or a PolicyNotFoundException . +// +// Because GetResourcePolicy uses an eventually consistent query, the metadata for +// your policy or table might not be available at that moment. Wait for a few +// seconds, and then retry the GetResourcePolicy request. After a GetResourcePolicy +// request returns a policy created using the PutResourcePolicy request, you can +// assume the policy will start getting applied in the authorization of requests to +// the resource. Because this process is eventually consistent, it will take some +// time to apply the policy to all requests to a resource. Policies that you attach +// while creating a table using the CreateTable request will always be applied to +// all requests for that table. +func (c *Client) GetResourcePolicy(ctx context.Context, params *GetResourcePolicyInput, optFns ...func(*Options)) (*GetResourcePolicyOutput, error) { + if params == nil { + params = &GetResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetResourcePolicy", params, optFns, c.addOperationGetResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetResourcePolicyInput struct { + + // The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy is + // attached. The resources you can specify include tables and streams. + // + // This member is required. + ResourceArn *string + + noSmithyDocumentSerde +} + +type GetResourcePolicyOutput struct { + + // The resource-based policy document attached to the resource, which can be a + // table or stream, in JSON format. + Policy *string + + // A unique string that represents the revision ID of the policy. If you are + // comparing revision IDs, make sure to always use string comparison logic. + RevisionId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson10_serializeOpGetResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpGetResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "GetResourcePolicy"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpGetResourcePolicyDiscoverEndpointMiddleware(stack, options, c); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpGetResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetResourcePolicy(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addValidateResponseChecksum(stack, options); err != nil { + return err + } + if err = addAcceptEncodingGzip(stack, options); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func addOpGetResourcePolicyDiscoverEndpointMiddleware(stack *middleware.Stack, o Options, c *Client) error { + return stack.Finalize.Insert(&internalEndpointDiscovery.DiscoverEndpoint{ + Options: []func(*internalEndpointDiscovery.DiscoverEndpointOptions){ + func(opt *internalEndpointDiscovery.DiscoverEndpointOptions) { + opt.DisableHTTPS = o.EndpointOptions.DisableHTTPS + opt.Logger = o.Logger + }, + }, + DiscoverOperation: c.fetchOpGetResourcePolicyDiscoverEndpoint, + EndpointDiscoveryEnableState: o.EndpointDiscovery.EnableEndpointDiscovery, + EndpointDiscoveryRequired: false, + Region: o.Region, + }, "ResolveEndpointV2", middleware.After) +} + +func (c *Client) fetchOpGetResourcePolicyDiscoverEndpoint(ctx context.Context, region string, optFns ...func(*internalEndpointDiscovery.DiscoverEndpointOptions)) (internalEndpointDiscovery.WeightedAddress, error) { + input := getOperationInput(ctx) + in, ok := input.(*GetResourcePolicyInput) + if !ok { + return internalEndpointDiscovery.WeightedAddress{}, fmt.Errorf("unknown input type %T", input) + } + _ = in + + identifierMap := make(map[string]string, 0) + identifierMap["sdk#Region"] = region + + key := fmt.Sprintf("DynamoDB.%v", identifierMap) + + if v, ok := c.endpointCache.Get(key); ok { + return v, nil + } + + discoveryOperationInput := &DescribeEndpointsInput{} + + opt := internalEndpointDiscovery.DiscoverEndpointOptions{} + for _, fn := range optFns { + fn(&opt) + } + + go c.handleEndpointDiscoveryFromService(ctx, discoveryOperationInput, region, key, opt) + return internalEndpointDiscovery.WeightedAddress{}, nil +} + +func newServiceMetadataMiddleware_opGetResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "GetResourcePolicy", + } +} diff --git a/service/dynamodb/api_op_ListBackups.go b/service/dynamodb/api_op_ListBackups.go index c910c5886a9..50a5ca3f9d9 100644 --- a/service/dynamodb/api_op_ListBackups.go +++ b/service/dynamodb/api_op_ListBackups.go @@ -58,7 +58,8 @@ type ListBackupsInput struct { // Maximum number of backups to return at once. Limit *int32 - // The backups from the table specified by TableName are listed. + // Lists the backups from the table specified in TableName . You can also provide + // the Amazon Resource Name (ARN) of the table in this parameter. TableName *string // Only backups created after this time are listed. TimeRangeLowerBound is diff --git a/service/dynamodb/api_op_ListContributorInsights.go b/service/dynamodb/api_op_ListContributorInsights.go index 9e3e61770a7..da9825d50bc 100644 --- a/service/dynamodb/api_op_ListContributorInsights.go +++ b/service/dynamodb/api_op_ListContributorInsights.go @@ -36,7 +36,8 @@ type ListContributorInsightsInput struct { // A token to for the desired page, if there is one. NextToken *string - // The name of the table. + // The name of the table. You can also provide the Amazon Resource Name (ARN) of + // the table in this parameter. TableName *string noSmithyDocumentSerde diff --git a/service/dynamodb/api_op_PutItem.go b/service/dynamodb/api_op_PutItem.go index 598db5e9860..39336006bd7 100644 --- a/service/dynamodb/api_op_PutItem.go +++ b/service/dynamodb/api_op_PutItem.go @@ -66,7 +66,8 @@ type PutItemInput struct { // This member is required. Item map[string]types.AttributeValue - // The name of the table to contain the item. + // The name of the table to contain the item. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_PutResourcePolicy.go b/service/dynamodb/api_op_PutResourcePolicy.go new file mode 100644 index 00000000000..064a2682052 --- /dev/null +++ b/service/dynamodb/api_op_PutResourcePolicy.go @@ -0,0 +1,231 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package dynamodb + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + internalEndpointDiscovery "github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Attaches a resource-based policy document to the resource, which can be a table +// or stream. When you attach a resource-based policy using this API, the policy +// application is eventually consistent (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html) +// . PutResourcePolicy is an idempotent operation; running it multiple times on +// the same resource using the same policy document will return the same revision +// ID. If you specify an ExpectedRevisionId which doesn't match the current +// policy's RevisionId , the PolicyNotFoundException will be returned. +// PutResourcePolicy is an asynchronous operation. If you issue a GetResourcePolicy +// request immediately after a PutResourcePolicy request, DynamoDB might return +// your previous policy, if there was one, or return the PolicyNotFoundException . +// This is because GetResourcePolicy uses an eventually consistent query, and the +// metadata for your policy or table might not be available at that moment. Wait +// for a few seconds, and then try the GetResourcePolicy request again. +func (c *Client) PutResourcePolicy(ctx context.Context, params *PutResourcePolicyInput, optFns ...func(*Options)) (*PutResourcePolicyOutput, error) { + if params == nil { + params = &PutResourcePolicyInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "PutResourcePolicy", params, optFns, c.addOperationPutResourcePolicyMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*PutResourcePolicyOutput) + out.ResultMetadata = metadata + return out, nil +} + +type PutResourcePolicyInput struct { + + // An Amazon Web Services resource-based policy document in JSON format. The + // maximum size supported for a resource-based policy document is 20 KB. DynamoDB + // counts whitespaces when calculating the size of a policy against this limit. For + // a full list of all considerations that you should keep in mind while attaching a + // resource-based policy, see Resource-based policy considerations (https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/rbac-considerations.html) + // . + // + // This member is required. + Policy *string + + // The Amazon Resource Name (ARN) of the DynamoDB resource to which the policy + // will be attached. The resources you can specify include tables and streams. You + // can control index permissions using the base table's policy. To specify the same + // permission level for your table and its indexes, you can provide both the table + // and index Amazon Resource Name (ARN)s in the Resource field of a given Statement + // in your policy document. Alternatively, to specify different permissions for + // your table, indexes, or both, you can define multiple Statement fields in your + // policy document. + // + // This member is required. + ResourceArn *string + + // Set this parameter to true to confirm that you want to remove your permissions + // to change the policy of this resource in the future. + ConfirmRemoveSelfResourceAccess bool + + // A string value that you can use to conditionally update your policy. You can + // provide the revision ID of your existing policy to make mutating requests + // against that policy. When you provide an expected revision ID, if the revision + // ID of the existing policy on the resource doesn't match or if there's no policy + // attached to the resource, your request will be rejected with a + // PolicyNotFoundException . To conditionally put a policy when no policy exists + // for the resource, specify NO_POLICY for the revision ID. + ExpectedRevisionId *string + + noSmithyDocumentSerde +} + +type PutResourcePolicyOutput struct { + + // A unique string that represents the revision ID of the policy. If you are + // comparing revision IDs, make sure to always use string comparison logic. + RevisionId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationPutResourcePolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsAwsjson10_serializeOpPutResourcePolicy{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpPutResourcePolicy{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "PutResourcePolicy"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpPutResourcePolicyDiscoverEndpointMiddleware(stack, options, c); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addOpPutResourcePolicyValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutResourcePolicy(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addValidateResponseChecksum(stack, options); err != nil { + return err + } + if err = addAcceptEncodingGzip(stack, options); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +func addOpPutResourcePolicyDiscoverEndpointMiddleware(stack *middleware.Stack, o Options, c *Client) error { + return stack.Finalize.Insert(&internalEndpointDiscovery.DiscoverEndpoint{ + Options: []func(*internalEndpointDiscovery.DiscoverEndpointOptions){ + func(opt *internalEndpointDiscovery.DiscoverEndpointOptions) { + opt.DisableHTTPS = o.EndpointOptions.DisableHTTPS + opt.Logger = o.Logger + }, + }, + DiscoverOperation: c.fetchOpPutResourcePolicyDiscoverEndpoint, + EndpointDiscoveryEnableState: o.EndpointDiscovery.EnableEndpointDiscovery, + EndpointDiscoveryRequired: false, + Region: o.Region, + }, "ResolveEndpointV2", middleware.After) +} + +func (c *Client) fetchOpPutResourcePolicyDiscoverEndpoint(ctx context.Context, region string, optFns ...func(*internalEndpointDiscovery.DiscoverEndpointOptions)) (internalEndpointDiscovery.WeightedAddress, error) { + input := getOperationInput(ctx) + in, ok := input.(*PutResourcePolicyInput) + if !ok { + return internalEndpointDiscovery.WeightedAddress{}, fmt.Errorf("unknown input type %T", input) + } + _ = in + + identifierMap := make(map[string]string, 0) + identifierMap["sdk#Region"] = region + + key := fmt.Sprintf("DynamoDB.%v", identifierMap) + + if v, ok := c.endpointCache.Get(key); ok { + return v, nil + } + + discoveryOperationInput := &DescribeEndpointsInput{} + + opt := internalEndpointDiscovery.DiscoverEndpointOptions{} + for _, fn := range optFns { + fn(&opt) + } + + go c.handleEndpointDiscoveryFromService(ctx, discoveryOperationInput, region, key, opt) + return internalEndpointDiscovery.WeightedAddress{}, nil +} + +func newServiceMetadataMiddleware_opPutResourcePolicy(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "PutResourcePolicy", + } +} diff --git a/service/dynamodb/api_op_Query.go b/service/dynamodb/api_op_Query.go index 84be7e41468..83805f8d8f1 100644 --- a/service/dynamodb/api_op_Query.go +++ b/service/dynamodb/api_op_Query.go @@ -67,7 +67,8 @@ func (c *Client) Query(ctx context.Context, params *QueryInput, optFns ...func(* // Represents the input of a Query operation. type QueryInput struct { - // The name of the table containing the requested items. + // The name of the table containing the requested items. You can also provide the + // Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_Scan.go b/service/dynamodb/api_op_Scan.go index f675cf50f69..4a5387288e1 100644 --- a/service/dynamodb/api_op_Scan.go +++ b/service/dynamodb/api_op_Scan.go @@ -63,8 +63,9 @@ func (c *Client) Scan(ctx context.Context, params *ScanInput, optFns ...func(*Op // Represents the input of a Scan operation. type ScanInput struct { - // The name of the table containing the requested items; or, if you provide - // IndexName , the name of the table to which that index belongs. + // The name of the table containing the requested items or if you provide IndexName + // , the name of the table to which that index belongs. You can also provide the + // Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateContinuousBackups.go b/service/dynamodb/api_op_UpdateContinuousBackups.go index ff25f810bed..8ced17d6b31 100644 --- a/service/dynamodb/api_op_UpdateContinuousBackups.go +++ b/service/dynamodb/api_op_UpdateContinuousBackups.go @@ -43,7 +43,8 @@ type UpdateContinuousBackupsInput struct { // This member is required. PointInTimeRecoverySpecification *types.PointInTimeRecoverySpecification - // The name of the table. + // The name of the table. You can also provide the Amazon Resource Name (ARN) of + // the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateContributorInsights.go b/service/dynamodb/api_op_UpdateContributorInsights.go index dd85434816c..403303e7a94 100644 --- a/service/dynamodb/api_op_UpdateContributorInsights.go +++ b/service/dynamodb/api_op_UpdateContributorInsights.go @@ -40,7 +40,8 @@ type UpdateContributorInsightsInput struct { // This member is required. ContributorInsightsAction types.ContributorInsightsAction - // The name of the table. + // The name of the table. You can also provide the Amazon Resource Name (ARN) of + // the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateItem.go b/service/dynamodb/api_op_UpdateItem.go index 3a3552314e7..12b11218b34 100644 --- a/service/dynamodb/api_op_UpdateItem.go +++ b/service/dynamodb/api_op_UpdateItem.go @@ -46,7 +46,8 @@ type UpdateItemInput struct { // This member is required. Key map[string]types.AttributeValue - // The name of the table containing the item to update. + // The name of the table containing the item to update. You can also provide the + // Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go b/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go index 080df59c225..3d2272ad7f5 100644 --- a/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go +++ b/service/dynamodb/api_op_UpdateKinesisStreamingDestination.go @@ -30,12 +30,13 @@ func (c *Client) UpdateKinesisStreamingDestination(ctx context.Context, params * type UpdateKinesisStreamingDestinationInput struct { - // The ARN for the Kinesis stream input. + // The Amazon Resource Name (ARN) for the Kinesis stream input. // // This member is required. StreamArn *string - // The table name for the Kinesis streaming destination input. + // The table name for the Kinesis streaming destination input. You can also + // provide the ARN of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateTable.go b/service/dynamodb/api_op_UpdateTable.go index b0cc285bfb8..a51de71d5a2 100644 --- a/service/dynamodb/api_op_UpdateTable.go +++ b/service/dynamodb/api_op_UpdateTable.go @@ -23,8 +23,8 @@ import ( // // UpdateTable is an asynchronous operation; while it's executing, the table // status changes from ACTIVE to UPDATING . While it's UPDATING , you can't issue -// another UpdateTable request on the base table nor any replicas. When the table -// returns to the ACTIVE state, the UpdateTable operation is complete. +// another UpdateTable request. When the table returns to the ACTIVE state, the +// UpdateTable operation is complete. func (c *Client) UpdateTable(ctx context.Context, params *UpdateTableInput, optFns ...func(*Options)) (*UpdateTableOutput, error) { if params == nil { params = &UpdateTableInput{} @@ -43,7 +43,8 @@ func (c *Client) UpdateTable(ctx context.Context, params *UpdateTableInput, optF // Represents the input of an UpdateTable operation. type UpdateTableInput struct { - // The name of the table to be updated. + // The name of the table to be updated. You can also provide the Amazon Resource + // Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go b/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go index e66c0543d36..ff84b122e75 100644 --- a/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go +++ b/service/dynamodb/api_op_UpdateTableReplicaAutoScaling.go @@ -31,7 +31,8 @@ func (c *Client) UpdateTableReplicaAutoScaling(ctx context.Context, params *Upda type UpdateTableReplicaAutoScalingInput struct { - // The name of the global table to be updated. + // The name of the global table to be updated. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/api_op_UpdateTimeToLive.go b/service/dynamodb/api_op_UpdateTimeToLive.go index 865d0c898f8..e6f79845416 100644 --- a/service/dynamodb/api_op_UpdateTimeToLive.go +++ b/service/dynamodb/api_op_UpdateTimeToLive.go @@ -48,7 +48,8 @@ func (c *Client) UpdateTimeToLive(ctx context.Context, params *UpdateTimeToLiveI // Represents the input of an UpdateTimeToLive operation. type UpdateTimeToLiveInput struct { - // The name of the table to be configured. + // The name of the table to be configured. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/deserializers.go b/service/dynamodb/deserializers.go index 6a995f00e82..be3f239b434 100644 --- a/service/dynamodb/deserializers.go +++ b/service/dynamodb/deserializers.go @@ -980,6 +980,128 @@ func awsAwsjson10_deserializeOpErrorDeleteItem(response *smithyhttp.Response, me } } +type awsAwsjson10_deserializeOpDeleteResourcePolicy struct { +} + +func (*awsAwsjson10_deserializeOpDeleteResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson10_deserializeOpDeleteResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson10_deserializeOpErrorDeleteResourcePolicy(response, &metadata) + } + output := &DeleteResourcePolicyOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson10_deserializeOpDocumentDeleteResourcePolicyOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson10_deserializeOpErrorDeleteResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("InternalServerError", errorCode): + return awsAwsjson10_deserializeErrorInternalServerError(response, errorBody) + + case strings.EqualFold("InvalidEndpointException", errorCode): + return awsAwsjson10_deserializeErrorInvalidEndpointException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson10_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("PolicyNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorPolicyNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsAwsjson10_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson10_deserializeOpDeleteTable struct { } @@ -3276,6 +3398,122 @@ func awsAwsjson10_deserializeOpErrorGetItem(response *smithyhttp.Response, metad } } +type awsAwsjson10_deserializeOpGetResourcePolicy struct { +} + +func (*awsAwsjson10_deserializeOpGetResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson10_deserializeOpGetResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson10_deserializeOpErrorGetResourcePolicy(response, &metadata) + } + output := &GetResourcePolicyOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson10_deserializeOpDocumentGetResourcePolicyOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson10_deserializeOpErrorGetResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("InternalServerError", errorCode): + return awsAwsjson10_deserializeErrorInternalServerError(response, errorBody) + + case strings.EqualFold("InvalidEndpointException", errorCode): + return awsAwsjson10_deserializeErrorInvalidEndpointException(response, errorBody) + + case strings.EqualFold("PolicyNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorPolicyNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson10_deserializeOpImportTable struct { } @@ -4287,6 +4525,128 @@ func awsAwsjson10_deserializeOpErrorPutItem(response *smithyhttp.Response, metad } } +type awsAwsjson10_deserializeOpPutResourcePolicy struct { +} + +func (*awsAwsjson10_deserializeOpPutResourcePolicy) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson10_deserializeOpPutResourcePolicy) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsAwsjson10_deserializeOpErrorPutResourcePolicy(response, &metadata) + } + output := &PutResourcePolicyOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsAwsjson10_deserializeOpDocumentPutResourcePolicyOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + return out, metadata, err +} + +func awsAwsjson10_deserializeOpErrorPutResourcePolicy(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + bodyInfo, err := getProtocolErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { + errorCode = restjson.SanitizeErrorCode(typ) + } + if len(bodyInfo.Message) != 0 { + errorMessage = bodyInfo.Message + } + switch { + case strings.EqualFold("InternalServerError", errorCode): + return awsAwsjson10_deserializeErrorInternalServerError(response, errorBody) + + case strings.EqualFold("InvalidEndpointException", errorCode): + return awsAwsjson10_deserializeErrorInvalidEndpointException(response, errorBody) + + case strings.EqualFold("LimitExceededException", errorCode): + return awsAwsjson10_deserializeErrorLimitExceededException(response, errorBody) + + case strings.EqualFold("PolicyNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorPolicyNotFoundException(response, errorBody) + + case strings.EqualFold("ResourceInUseException", errorCode): + return awsAwsjson10_deserializeErrorResourceInUseException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsAwsjson10_deserializeErrorResourceNotFoundException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson10_deserializeOpQuery struct { } @@ -6996,6 +7356,41 @@ func awsAwsjson10_deserializeErrorPointInTimeRecoveryUnavailableException(respon return output } +func awsAwsjson10_deserializeErrorPolicyNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + output := &types.PolicyNotFoundException{} + err := awsAwsjson10_deserializeDocumentPolicyNotFoundException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + return output +} + func awsAwsjson10_deserializeErrorProvisionedThroughputExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { var buff [1024]byte ringBuffer := smithyio.NewRingBuffer(buff[:]) @@ -9116,7 +9511,7 @@ func awsAwsjson10_deserializeDocumentConsumedCapacity(v **types.ConsumedCapacity if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected TableName to be of type string, got %T instead", value) + return fmt.Errorf("expected TableArn to be of type string, got %T instead", value) } sv.TableName = ptr.String(jtv) } @@ -12737,6 +13132,46 @@ func awsAwsjson10_deserializeDocumentPointInTimeRecoveryUnavailableException(v * return nil } +func awsAwsjson10_deserializeDocumentPolicyNotFoundException(v **types.PolicyNotFoundException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.PolicyNotFoundException + if *v == nil { + sv = &types.PolicyNotFoundException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeDocumentProjection(v **types.Projection, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -15881,6 +16316,46 @@ func awsAwsjson10_deserializeOpDocumentDeleteItemOutput(v **DeleteItemOutput, va return nil } +func awsAwsjson10_deserializeOpDocumentDeleteResourcePolicyOutput(v **DeleteResourcePolicyOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *DeleteResourcePolicyOutput + if *v == nil { + sv = &DeleteResourcePolicyOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RevisionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PolicyRevisionId to be of type string, got %T instead", value) + } + sv.RevisionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeOpDocumentDeleteTableOutput(v **DeleteTableOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -16797,6 +17272,55 @@ func awsAwsjson10_deserializeOpDocumentGetItemOutput(v **GetItemOutput, value in return nil } +func awsAwsjson10_deserializeOpDocumentGetResourcePolicyOutput(v **GetResourcePolicyOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *GetResourcePolicyOutput + if *v == nil { + sv = &GetResourcePolicyOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Policy": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ResourcePolicy to be of type string, got %T instead", value) + } + sv.Policy = ptr.String(jtv) + } + + case "RevisionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PolicyRevisionId to be of type string, got %T instead", value) + } + sv.RevisionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeOpDocumentImportTableOutput(v **ImportTableOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -17194,6 +17718,46 @@ func awsAwsjson10_deserializeOpDocumentPutItemOutput(v **PutItemOutput, value in return nil } +func awsAwsjson10_deserializeOpDocumentPutResourcePolicyOutput(v **PutResourcePolicyOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *PutResourcePolicyOutput + if *v == nil { + sv = &PutResourcePolicyOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RevisionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected PolicyRevisionId to be of type string, got %T instead", value) + } + sv.RevisionId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson10_deserializeOpDocumentQueryOutput(v **QueryOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/dynamodb/generated.json b/service/dynamodb/generated.json index bed9c33b80e..529544017eb 100644 --- a/service/dynamodb/generated.json +++ b/service/dynamodb/generated.json @@ -19,6 +19,7 @@ "api_op_CreateTable.go", "api_op_DeleteBackup.go", "api_op_DeleteItem.go", + "api_op_DeleteResourcePolicy.go", "api_op_DeleteTable.go", "api_op_DescribeBackup.go", "api_op_DescribeContinuousBackups.go", @@ -39,6 +40,7 @@ "api_op_ExecuteTransaction.go", "api_op_ExportTableToPointInTime.go", "api_op_GetItem.go", + "api_op_GetResourcePolicy.go", "api_op_ImportTable.go", "api_op_ListBackups.go", "api_op_ListContributorInsights.go", @@ -48,6 +50,7 @@ "api_op_ListTables.go", "api_op_ListTagsOfResource.go", "api_op_PutItem.go", + "api_op_PutResourcePolicy.go", "api_op_Query.go", "api_op_RestoreTableFromBackup.go", "api_op_RestoreTableToPointInTime.go", diff --git a/service/dynamodb/serializers.go b/service/dynamodb/serializers.go index 833253c9199..0a5c1e813c9 100644 --- a/service/dynamodb/serializers.go +++ b/service/dynamodb/serializers.go @@ -457,6 +457,61 @@ func (m *awsAwsjson10_serializeOpDeleteItem) HandleSerialize(ctx context.Context return next.HandleSerialize(ctx, in) } +type awsAwsjson10_serializeOpDeleteResourcePolicy struct { +} + +func (*awsAwsjson10_serializeOpDeleteResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson10_serializeOpDeleteResourcePolicy) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*DeleteResourcePolicyInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0") + httpBindingEncoder.SetHeader("X-Amz-Target").String("DynamoDB_20120810.DeleteResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson10_serializeOpDocumentDeleteResourcePolicyInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson10_serializeOpDeleteTable struct { } @@ -1557,6 +1612,61 @@ func (m *awsAwsjson10_serializeOpGetItem) HandleSerialize(ctx context.Context, i return next.HandleSerialize(ctx, in) } +type awsAwsjson10_serializeOpGetResourcePolicy struct { +} + +func (*awsAwsjson10_serializeOpGetResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson10_serializeOpGetResourcePolicy) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*GetResourcePolicyInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0") + httpBindingEncoder.SetHeader("X-Amz-Target").String("DynamoDB_20120810.GetResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson10_serializeOpDocumentGetResourcePolicyInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson10_serializeOpImportTable struct { } @@ -2052,6 +2162,61 @@ func (m *awsAwsjson10_serializeOpPutItem) HandleSerialize(ctx context.Context, i return next.HandleSerialize(ctx, in) } +type awsAwsjson10_serializeOpPutResourcePolicy struct { +} + +func (*awsAwsjson10_serializeOpPutResourcePolicy) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson10_serializeOpPutResourcePolicy) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*PutResourcePolicyInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + operationPath := "/" + if len(request.Request.URL.Path) == 0 { + request.Request.URL.Path = operationPath + } else { + request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) + if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { + request.Request.URL.Path += "/" + } + } + request.Request.Method = "POST" + httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.0") + httpBindingEncoder.SetHeader("X-Amz-Target").String("DynamoDB_20120810.PutResourcePolicy") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson10_serializeOpDocumentPutResourcePolicyInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} + type awsAwsjson10_serializeOpQuery struct { } @@ -5139,6 +5304,11 @@ func awsAwsjson10_serializeOpDocumentCreateTableInput(v *CreateTableInput, value } } + if v.ResourcePolicy != nil { + ok := object.Key("ResourcePolicy") + ok.String(*v.ResourcePolicy) + } + if v.SSESpecification != nil { ok := object.Key("SSESpecification") if err := awsAwsjson10_serializeDocumentSSESpecification(v.SSESpecification, ok); err != nil { @@ -5255,6 +5425,23 @@ func awsAwsjson10_serializeOpDocumentDeleteItemInput(v *DeleteItemInput, value s return nil } +func awsAwsjson10_serializeOpDocumentDeleteResourcePolicyInput(v *DeleteResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ExpectedRevisionId != nil { + ok := object.Key("ExpectedRevisionId") + ok.String(*v.ExpectedRevisionId) + } + + if v.ResourceArn != nil { + ok := object.Key("ResourceArn") + ok.String(*v.ResourceArn) + } + + return nil +} + func awsAwsjson10_serializeOpDocumentDeleteTableInput(v *DeleteTableInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -5646,6 +5833,18 @@ func awsAwsjson10_serializeOpDocumentGetItemInput(v *GetItemInput, value smithyj return nil } +func awsAwsjson10_serializeOpDocumentGetResourcePolicyInput(v *GetResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ResourceArn != nil { + ok := object.Key("ResourceArn") + ok.String(*v.ResourceArn) + } + + return nil +} + func awsAwsjson10_serializeOpDocumentImportTableInput(v *ImportTableInput, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -5918,6 +6117,33 @@ func awsAwsjson10_serializeOpDocumentPutItemInput(v *PutItemInput, value smithyj return nil } +func awsAwsjson10_serializeOpDocumentPutResourcePolicyInput(v *PutResourcePolicyInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ConfirmRemoveSelfResourceAccess { + ok := object.Key("ConfirmRemoveSelfResourceAccess") + ok.Boolean(v.ConfirmRemoveSelfResourceAccess) + } + + if v.ExpectedRevisionId != nil { + ok := object.Key("ExpectedRevisionId") + ok.String(*v.ExpectedRevisionId) + } + + if v.Policy != nil { + ok := object.Key("Policy") + ok.String(*v.Policy) + } + + if v.ResourceArn != nil { + ok := object.Key("ResourceArn") + ok.String(*v.ResourceArn) + } + + return nil +} + func awsAwsjson10_serializeOpDocumentQueryInput(v *QueryInput, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/dynamodb/snapshot_test.go b/service/dynamodb/snapshot_test.go index 0e04b01480f..8bdadbafab9 100644 --- a/service/dynamodb/snapshot_test.go +++ b/service/dynamodb/snapshot_test.go @@ -158,6 +158,18 @@ func TestCheckSnapshot_DeleteItem(t *testing.T) { } } +func TestCheckSnapshot_DeleteResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.DeleteResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "DeleteResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_DeleteTable(t *testing.T) { svc := New(Options{}) _, err := svc.DeleteTable(context.Background(), nil, func(o *Options) { @@ -398,6 +410,18 @@ func TestCheckSnapshot_GetItem(t *testing.T) { } } +func TestCheckSnapshot_GetResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "GetResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_ImportTable(t *testing.T) { svc := New(Options{}) _, err := svc.ImportTable(context.Background(), nil, func(o *Options) { @@ -506,6 +530,18 @@ func TestCheckSnapshot_PutItem(t *testing.T) { } } +func TestCheckSnapshot_PutResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.PutResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "PutResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_Query(t *testing.T) { svc := New(Options{}) _, err := svc.Query(context.Background(), nil, func(o *Options) { @@ -805,6 +841,18 @@ func TestUpdateSnapshot_DeleteItem(t *testing.T) { } } +func TestUpdateSnapshot_DeleteResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.DeleteResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "DeleteResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_DeleteTable(t *testing.T) { svc := New(Options{}) _, err := svc.DeleteTable(context.Background(), nil, func(o *Options) { @@ -1045,6 +1093,18 @@ func TestUpdateSnapshot_GetItem(t *testing.T) { } } +func TestUpdateSnapshot_GetResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.GetResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "GetResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_ImportTable(t *testing.T) { svc := New(Options{}) _, err := svc.ImportTable(context.Background(), nil, func(o *Options) { @@ -1153,6 +1213,18 @@ func TestUpdateSnapshot_PutItem(t *testing.T) { } } +func TestUpdateSnapshot_PutResourcePolicy(t *testing.T) { + svc := New(Options{}) + _, err := svc.PutResourcePolicy(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "PutResourcePolicy") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_Query(t *testing.T) { svc := New(Options{}) _, err := svc.Query(context.Background(), nil, func(o *Options) { diff --git a/service/dynamodb/types/errors.go b/service/dynamodb/types/errors.go index 4bbb047bfc2..d11b3b8b687 100644 --- a/service/dynamodb/types/errors.go +++ b/service/dynamodb/types/errors.go @@ -554,6 +554,34 @@ func (e *PointInTimeRecoveryUnavailableException) ErrorFault() smithy.ErrorFault return smithy.FaultClient } +// The operation tried to access a nonexistent resource-based policy. If you +// specified an ExpectedRevisionId , it's possible that a policy is present for the +// resource but its revision ID didn't match the expected value. +type PolicyNotFoundException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *PolicyNotFoundException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *PolicyNotFoundException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *PolicyNotFoundException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "PolicyNotFoundException" + } + return *e.ErrorCodeOverride +} +func (e *PolicyNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + // Your request rate is too high. The Amazon Web Services SDKs for DynamoDB // automatically retry requests that receive this exception. Your request is // eventually successful, unless your retry queue is too large to finish. Reduce diff --git a/service/dynamodb/types/types.go b/service/dynamodb/types/types.go index 196842a1dde..437acc5dae9 100644 --- a/service/dynamodb/types/types.go +++ b/service/dynamodb/types/types.go @@ -729,7 +729,8 @@ type ConditionCheck struct { // This member is required. Key map[string]AttributeValue - // Name of the table for the check item request. + // Name of the table for the check item request. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string @@ -775,7 +776,9 @@ type ConsumedCapacity struct { // The amount of throughput consumed on the table affected by the operation. Table *Capacity - // The name of the table that was affected by the operation. + // The name of the table that was affected by the operation. If you had specified + // the Amazon Resource Name (ARN) of a table in the input, you'll see the table ARN + // in the response. TableName *string // The total number of write capacity units consumed by the operation. @@ -907,7 +910,8 @@ type Delete struct { // This member is required. Key map[string]AttributeValue - // Name of the table in which the item to be deleted resides. + // Name of the table in which the item to be deleted resides. You can also provide + // the Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string @@ -1270,7 +1274,8 @@ type Get struct { // This member is required. Key map[string]AttributeValue - // The name of the table from which to retrieve the specified item. + // The name of the table from which to retrieve the specified item. You can also + // provide the Amazon Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string @@ -2054,7 +2059,8 @@ type Put struct { // This member is required. Item map[string]AttributeValue - // Name of the table in which to write the item. + // Name of the table in which to write the item. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string @@ -2983,7 +2989,8 @@ type Update struct { // This member is required. Key map[string]AttributeValue - // Name of the table for the UpdateItem request. + // Name of the table for the UpdateItem request. You can also provide the Amazon + // Resource Name (ARN) of the table in this parameter. // // This member is required. TableName *string diff --git a/service/dynamodb/validators.go b/service/dynamodb/validators.go index 4762e130283..d1925ed8b4b 100644 --- a/service/dynamodb/validators.go +++ b/service/dynamodb/validators.go @@ -170,6 +170,26 @@ func (m *validateOpDeleteItem) HandleInitialize(ctx context.Context, in middlewa return next.HandleInitialize(ctx, in) } +type validateOpDeleteResourcePolicy struct { +} + +func (*validateOpDeleteResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDeleteResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DeleteResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDeleteResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpDeleteTable struct { } @@ -530,6 +550,26 @@ func (m *validateOpGetItem) HandleInitialize(ctx context.Context, in middleware. return next.HandleInitialize(ctx, in) } +type validateOpGetResourcePolicy struct { +} + +func (*validateOpGetResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpImportTable struct { } @@ -590,6 +630,26 @@ func (m *validateOpPutItem) HandleInitialize(ctx context.Context, in middleware. return next.HandleInitialize(ctx, in) } +type validateOpPutResourcePolicy struct { +} + +func (*validateOpPutResourcePolicy) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpPutResourcePolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*PutResourcePolicyInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpPutResourcePolicyInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpQuery struct { } @@ -962,6 +1022,10 @@ func addOpDeleteItemValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteItem{}, middleware.After) } +func addOpDeleteResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDeleteResourcePolicy{}, middleware.After) +} + func addOpDeleteTableValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteTable{}, middleware.After) } @@ -1034,6 +1098,10 @@ func addOpGetItemValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetItem{}, middleware.After) } +func addOpGetResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetResourcePolicy{}, middleware.After) +} + func addOpImportTableValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpImportTable{}, middleware.After) } @@ -1046,6 +1114,10 @@ func addOpPutItemValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutItem{}, middleware.After) } +func addOpPutResourcePolicyValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpPutResourcePolicy{}, middleware.After) +} + func addOpQueryValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpQuery{}, middleware.After) } @@ -2611,6 +2683,21 @@ func validateOpDeleteItemInput(v *DeleteItemInput) error { } } +func validateOpDeleteResourcePolicyInput(v *DeleteResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DeleteResourcePolicyInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpDeleteTableInput(v *DeleteTableInput) error { if v == nil { return nil @@ -2897,6 +2984,21 @@ func validateOpGetItemInput(v *GetItemInput) error { } } +func validateOpGetResourcePolicyInput(v *GetResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetResourcePolicyInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpImportTableInput(v *ImportTableInput) error { if v == nil { return nil @@ -2959,6 +3061,24 @@ func validateOpPutItemInput(v *PutItemInput) error { } } +func validateOpPutResourcePolicyInput(v *PutResourcePolicyInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "PutResourcePolicyInput"} + if v.ResourceArn == nil { + invalidParams.Add(smithy.NewErrParamRequired("ResourceArn")) + } + if v.Policy == nil { + invalidParams.Add(smithy.NewErrParamRequired("Policy")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpQueryInput(v *QueryInput) error { if v == nil { return nil diff --git a/service/managedblockchainquery/api_op_GetTransaction.go b/service/managedblockchainquery/api_op_GetTransaction.go index 08695252bea..c4eb62460fc 100644 --- a/service/managedblockchainquery/api_op_GetTransaction.go +++ b/service/managedblockchainquery/api_op_GetTransaction.go @@ -38,10 +38,12 @@ type GetTransactionInput struct { Network types.QueryNetwork // The hash of a transaction. It is generated when a transaction is created. - // - // This member is required. TransactionHash *string + // The identifier of a Bitcoin transaction. It is generated when a transaction is + // created. transactionId is only supported on the Bitcoin networks. + TransactionId *string + noSmithyDocumentSerde } diff --git a/service/managedblockchainquery/deserializers.go b/service/managedblockchainquery/deserializers.go index bc8f82f7657..3e903ee5a9d 100644 --- a/service/managedblockchainquery/deserializers.go +++ b/service/managedblockchainquery/deserializers.go @@ -3245,6 +3245,15 @@ func awsRestjson1_deserializeDocumentTransactionOutputItem(v **types.Transaction sv.TransactionHash = ptr.String(jtv) } + case "transactionId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected QueryTransactionId to be of type string, got %T instead", value) + } + sv.TransactionId = ptr.String(jtv) + } + case "transactionTimestamp": if value != nil { switch jtv := value.(type) { diff --git a/service/managedblockchainquery/serializers.go b/service/managedblockchainquery/serializers.go index 607655c050e..dc3bbf590c4 100644 --- a/service/managedblockchainquery/serializers.go +++ b/service/managedblockchainquery/serializers.go @@ -337,6 +337,11 @@ func awsRestjson1_serializeOpDocumentGetTransactionInput(v *GetTransactionInput, ok.String(*v.TransactionHash) } + if v.TransactionId != nil { + ok := object.Key("transactionId") + ok.String(*v.TransactionId) + } + return nil } diff --git a/service/managedblockchainquery/types/types.go b/service/managedblockchainquery/types/types.go index ffcebcf91e0..1bc770af021 100644 --- a/service/managedblockchainquery/types/types.go +++ b/service/managedblockchainquery/types/types.go @@ -507,6 +507,10 @@ type TransactionOutputItem struct { // Specifies whether to list transactions that have not reached Finality. ConfirmationStatus ConfirmationStatus + // The identifier of a Bitcoin transaction. It is generated when a transaction is + // created. + TransactionId *string + noSmithyDocumentSerde } diff --git a/service/managedblockchainquery/validators.go b/service/managedblockchainquery/validators.go index adc1dd6d17a..3ad1c554b55 100644 --- a/service/managedblockchainquery/validators.go +++ b/service/managedblockchainquery/validators.go @@ -480,9 +480,6 @@ func validateOpGetTransactionInput(v *GetTransactionInput) error { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetTransactionInput"} - if v.TransactionHash == nil { - invalidParams.Add(smithy.NewErrParamRequired("TransactionHash")) - } if len(v.Network) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Network")) } diff --git a/service/savingsplans/api_op_CreateSavingsPlan.go b/service/savingsplans/api_op_CreateSavingsPlan.go index 6572a403216..3e4c756b21c 100644 --- a/service/savingsplans/api_op_CreateSavingsPlan.go +++ b/service/savingsplans/api_op_CreateSavingsPlan.go @@ -29,8 +29,9 @@ func (c *Client) CreateSavingsPlan(ctx context.Context, params *CreateSavingsPla type CreateSavingsPlanInput struct { - // The hourly commitment, in USD. This is a value between 0.001 and 1 million. You - // cannot specify more than five digits after the decimal point. + // The hourly commitment, in the same currency of the savingsPlanOfferingId . This + // is a value between 0.001 and 1 million. You cannot specify more than five digits + // after the decimal point. // // This member is required. Commitment *string @@ -40,19 +41,18 @@ type CreateSavingsPlanInput struct { // This member is required. SavingsPlanOfferingId *string - // Unique, case-sensitive identifier that you provide to ensure the idempotency of - // the request. + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. ClientToken *string - // The time at which to purchase the Savings Plan, in UTC format - // (YYYY-MM-DDTHH:MM:SSZ). + // The purchase time of the Savings Plan in UTC format (YYYY-MM-DDTHH:MM:SSZ). PurchaseTime *time.Time // One or more tags. Tags map[string]string // The up-front payment amount. This is a whole number between 50 and 99 percent - // of the total value of the Savings Plan. This parameter is supported only if the + // of the total value of the Savings Plan. This parameter is only supported if the // payment option is Partial Upfront . UpfrontPaymentAmount *string diff --git a/service/savingsplans/api_op_DescribeSavingsPlanRates.go b/service/savingsplans/api_op_DescribeSavingsPlanRates.go index 4362259c62f..9e58a5a4279 100644 --- a/service/savingsplans/api_op_DescribeSavingsPlanRates.go +++ b/service/savingsplans/api_op_DescribeSavingsPlanRates.go @@ -11,7 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Describes the specified Savings Plans rates. +// Describes the rates for the specified Savings Plan. func (c *Client) DescribeSavingsPlanRates(ctx context.Context, params *DescribeSavingsPlanRatesInput, optFns ...func(*Options)) (*DescribeSavingsPlanRatesOutput, error) { if params == nil { params = &DescribeSavingsPlanRatesInput{} @@ -56,7 +56,7 @@ type DescribeSavingsPlanRatesOutput struct { // The ID of the Savings Plan. SavingsPlanId *string - // Information about the Savings Plans rates. + // Information about the Savings Plan rates. SearchResults []types.SavingsPlanRate // Metadata pertaining to the operation's result. diff --git a/service/savingsplans/api_op_DescribeSavingsPlans.go b/service/savingsplans/api_op_DescribeSavingsPlans.go index 786c8b05727..034041b8387 100644 --- a/service/savingsplans/api_op_DescribeSavingsPlans.go +++ b/service/savingsplans/api_op_DescribeSavingsPlans.go @@ -45,7 +45,7 @@ type DescribeSavingsPlansInput struct { // The IDs of the Savings Plans. SavingsPlanIds []string - // The states. + // The current states of the Savings Plans. States []types.SavingsPlanState noSmithyDocumentSerde diff --git a/service/savingsplans/api_op_DescribeSavingsPlansOfferingRates.go b/service/savingsplans/api_op_DescribeSavingsPlansOfferingRates.go index 3086aba4915..08750649268 100644 --- a/service/savingsplans/api_op_DescribeSavingsPlansOfferingRates.go +++ b/service/savingsplans/api_op_DescribeSavingsPlansOfferingRates.go @@ -11,7 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Describes the specified Savings Plans offering rates. +// Describes the offering rates for the specified Savings Plans. func (c *Client) DescribeSavingsPlansOfferingRates(ctx context.Context, params *DescribeSavingsPlansOfferingRatesInput, optFns ...func(*Options)) (*DescribeSavingsPlansOfferingRatesOutput, error) { if params == nil { params = &DescribeSavingsPlansOfferingRatesInput{} @@ -39,10 +39,11 @@ type DescribeSavingsPlansOfferingRatesInput struct { // The token for the next page of results. NextToken *string - // The specific AWS operation for the line item in the billing report. + // The specific Amazon Web Services operation for the line item in the billing + // report. Operations []string - // The AWS products. + // The Amazon Web Services products. Products []types.SavingsPlanProductType // The IDs of the offerings. diff --git a/service/savingsplans/api_op_DescribeSavingsPlansOfferings.go b/service/savingsplans/api_op_DescribeSavingsPlansOfferings.go index 2578b5e5837..16d5d69699c 100644 --- a/service/savingsplans/api_op_DescribeSavingsPlansOfferings.go +++ b/service/savingsplans/api_op_DescribeSavingsPlansOfferings.go @@ -11,7 +11,7 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Describes the specified Savings Plans offerings. +// Describes the offerings for the specified Savings Plans. func (c *Client) DescribeSavingsPlansOfferings(ctx context.Context, params *DescribeSavingsPlansOfferingsInput, optFns ...func(*Options)) (*DescribeSavingsPlansOfferingsOutput, error) { if params == nil { params = &DescribeSavingsPlansOfferingsInput{} @@ -35,7 +35,7 @@ type DescribeSavingsPlansOfferingsInput struct { // The descriptions. Descriptions []string - // The durations, in seconds. + // The duration, in seconds. Durations []int64 // The filters. @@ -51,13 +51,14 @@ type DescribeSavingsPlansOfferingsInput struct { // The IDs of the offerings. OfferingIds []string - // The specific AWS operation for the line item in the billing report. + // The specific Amazon Web Services operation for the line item in the billing + // report. Operations []string // The payment options. PaymentOptions []types.SavingsPlanPaymentOption - // The plan type. + // The plan types. PlanTypes []types.SavingsPlanType // The product type. diff --git a/service/savingsplans/api_op_ReturnSavingsPlan.go b/service/savingsplans/api_op_ReturnSavingsPlan.go new file mode 100644 index 00000000000..b98fb881d8a --- /dev/null +++ b/service/savingsplans/api_op_ReturnSavingsPlan.go @@ -0,0 +1,175 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package savingsplans + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Returns the specified Savings Plan. +func (c *Client) ReturnSavingsPlan(ctx context.Context, params *ReturnSavingsPlanInput, optFns ...func(*Options)) (*ReturnSavingsPlanOutput, error) { + if params == nil { + params = &ReturnSavingsPlanInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ReturnSavingsPlan", params, optFns, c.addOperationReturnSavingsPlanMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ReturnSavingsPlanOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ReturnSavingsPlanInput struct { + + // The ID of the Savings Plan. + // + // This member is required. + SavingsPlanId *string + + // A unique, case-sensitive identifier that you provide to ensure the idempotency + // of the request. + ClientToken *string + + noSmithyDocumentSerde +} + +type ReturnSavingsPlanOutput struct { + + // The ID of the Savings Plan. + SavingsPlanId *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationReturnSavingsPlanMiddlewares(stack *middleware.Stack, options Options) (err error) { + if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { + return err + } + err = stack.Serialize.Add(&awsRestjson1_serializeOpReturnSavingsPlan{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpReturnSavingsPlan{}, middleware.After) + if err != nil { + return err + } + if err := addProtocolFinalizerMiddlewares(stack, options, "ReturnSavingsPlan"); err != nil { + return fmt.Errorf("add protocol finalizers: %v", err) + } + + if err = addlegacyEndpointContextSetter(stack, options); err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = addClientRequestID(stack); err != nil { + return err + } + if err = addComputeContentLength(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = addComputePayloadSHA256(stack); err != nil { + return err + } + if err = addRetry(stack, options); err != nil { + return err + } + if err = addRawResponseToMetadata(stack); err != nil { + return err + } + if err = addRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack, options); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { + return err + } + if err = addIdempotencyToken_opReturnSavingsPlanMiddleware(stack, options); err != nil { + return err + } + if err = addOpReturnSavingsPlanValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opReturnSavingsPlan(options.Region), middleware.Before); err != nil { + return err + } + if err = addRecursionDetection(stack); err != nil { + return err + } + if err = addRequestIDRetrieverMiddleware(stack); err != nil { + return err + } + if err = addResponseErrorMiddleware(stack); err != nil { + return err + } + if err = addRequestResponseLogging(stack, options); err != nil { + return err + } + if err = addDisableHTTPSMiddleware(stack, options); err != nil { + return err + } + return nil +} + +type idempotencyToken_initializeOpReturnSavingsPlan struct { + tokenProvider IdempotencyTokenProvider +} + +func (*idempotencyToken_initializeOpReturnSavingsPlan) ID() string { + return "OperationIdempotencyTokenAutoFill" +} + +func (m *idempotencyToken_initializeOpReturnSavingsPlan) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + if m.tokenProvider == nil { + return next.HandleInitialize(ctx, in) + } + + input, ok := in.Parameters.(*ReturnSavingsPlanInput) + if !ok { + return out, metadata, fmt.Errorf("expected middleware input to be of type *ReturnSavingsPlanInput ") + } + + if input.ClientToken == nil { + t, err := m.tokenProvider.GetIdempotencyToken() + if err != nil { + return out, metadata, err + } + input.ClientToken = &t + } + return next.HandleInitialize(ctx, in) +} +func addIdempotencyToken_opReturnSavingsPlanMiddleware(stack *middleware.Stack, cfg Options) error { + return stack.Initialize.Add(&idempotencyToken_initializeOpReturnSavingsPlan{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) +} + +func newServiceMetadataMiddleware_opReturnSavingsPlan(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + OperationName: "ReturnSavingsPlan", + } +} diff --git a/service/savingsplans/deserializers.go b/service/savingsplans/deserializers.go index 49c03e3cf13..8e82b72faf5 100644 --- a/service/savingsplans/deserializers.go +++ b/service/savingsplans/deserializers.go @@ -1068,6 +1068,166 @@ func awsRestjson1_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsFor return nil } +type awsRestjson1_deserializeOpReturnSavingsPlan struct { +} + +func (*awsRestjson1_deserializeOpReturnSavingsPlan) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpReturnSavingsPlan) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( + out middleware.DeserializeOutput, metadata middleware.Metadata, err error, +) { + out, metadata, err = next.HandleDeserialize(ctx, in) + if err != nil { + return out, metadata, err + } + + response, ok := out.RawResponse.(*smithyhttp.Response) + if !ok { + return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} + } + + if response.StatusCode < 200 || response.StatusCode >= 300 { + return out, metadata, awsRestjson1_deserializeOpErrorReturnSavingsPlan(response, &metadata) + } + output := &ReturnSavingsPlanOutput{} + out.Result = output + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(response.Body, ringBuffer) + + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return out, metadata, err + } + + err = awsRestjson1_deserializeOpDocumentReturnSavingsPlanOutput(&output, shape) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body with invalid JSON, %w", err), + Snapshot: snapshot.Bytes(), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorReturnSavingsPlan(response *smithyhttp.Response, metadata *middleware.Metadata) error { + var errorBuffer bytes.Buffer + if _, err := io.Copy(&errorBuffer, response.Body); err != nil { + return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} + } + errorBody := bytes.NewReader(errorBuffer.Bytes()) + + errorCode := "UnknownError" + errorMessage := errorCode + + headerCode := response.Header.Get("X-Amzn-ErrorType") + if len(headerCode) != 0 { + errorCode = restjson.SanitizeErrorCode(headerCode) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + jsonCode, message, err := restjson.GetErrorInfo(decoder) + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + if len(headerCode) == 0 && len(jsonCode) != 0 { + errorCode = restjson.SanitizeErrorCode(jsonCode) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("ServiceQuotaExceededException", errorCode): + return awsRestjson1_deserializeErrorServiceQuotaExceededException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentReturnSavingsPlanOutput(v **ReturnSavingsPlanOutput, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *ReturnSavingsPlanOutput + if *v == nil { + sv = &ReturnSavingsPlanOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "savingsPlanId": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected SavingsPlanId to be of type string, got %T instead", value) + } + sv.SavingsPlanId = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + type awsRestjson1_deserializeOpTagResource struct { } @@ -1670,6 +1830,15 @@ func awsRestjson1_deserializeDocumentSavingsPlan(v **types.SavingsPlan, value in sv.Region = ptr.String(jtv) } + case "returnableUntil": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.ReturnableUntil = ptr.String(jtv) + } + case "savingsPlanArn": if value != nil { jtv, ok := value.(string) diff --git a/service/savingsplans/doc.go b/service/savingsplans/doc.go index 4ab327eb6e5..4194616649a 100644 --- a/service/savingsplans/doc.go +++ b/service/savingsplans/doc.go @@ -3,9 +3,10 @@ // Package savingsplans provides the API client, operations, and parameter types // for AWS Savings Plans. // -// Savings Plans are a pricing model that offer significant savings on AWS usage -// (for example, on Amazon EC2 instances). You commit to a consistent amount of -// usage, in USD per hour, for a term of 1 or 3 years, and receive a lower price -// for that usage. For more information, see the AWS Savings Plans User Guide (https://docs.aws.amazon.com/savingsplans/latest/userguide/) +// Savings Plans are a pricing model that offer significant savings on Amazon Web +// Services usage (for example, on Amazon EC2 instances). You commit to a +// consistent amount of usage per hour, in the specified currency, for a term of +// one or three years, and receive a lower price for that usage. For more +// information, see the Amazon Web Services Savings Plans User Guide (https://docs.aws.amazon.com/savingsplans/latest/userguide/) // . package savingsplans diff --git a/service/savingsplans/endpoints.go b/service/savingsplans/endpoints.go index 6781210d6b6..225b83e7901 100644 --- a/service/savingsplans/endpoints.go +++ b/service/savingsplans/endpoints.go @@ -408,7 +408,7 @@ func (r *resolver) ResolveEndpoint( } } if _UseFIPS == true { - if true == _PartitionResult.SupportsFIPS { + if _PartitionResult.SupportsFIPS == true { uriString := func() string { var out strings.Builder out.WriteString("https://savingsplans-fips.") diff --git a/service/savingsplans/generated.json b/service/savingsplans/generated.json index bbe04be534a..91d729dbfd2 100644 --- a/service/savingsplans/generated.json +++ b/service/savingsplans/generated.json @@ -15,6 +15,7 @@ "api_op_DescribeSavingsPlansOfferingRates.go", "api_op_DescribeSavingsPlansOfferings.go", "api_op_ListTagsForResource.go", + "api_op_ReturnSavingsPlan.go", "api_op_TagResource.go", "api_op_UntagResource.go", "auth.go", diff --git a/service/savingsplans/serializers.go b/service/savingsplans/serializers.go index d01ad50251b..23e1fce3ee7 100644 --- a/service/savingsplans/serializers.go +++ b/service/savingsplans/serializers.go @@ -758,6 +758,86 @@ func awsRestjson1_serializeOpDocumentListTagsForResourceInput(v *ListTagsForReso return nil } +type awsRestjson1_serializeOpReturnSavingsPlan struct { +} + +func (*awsRestjson1_serializeOpReturnSavingsPlan) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpReturnSavingsPlan) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( + out middleware.SerializeOutput, metadata middleware.Metadata, err error, +) { + request, ok := in.Request.(*smithyhttp.Request) + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} + } + + input, ok := in.Parameters.(*ReturnSavingsPlanInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/ReturnSavingsPlan") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + var restEncoder *httpbinding.Encoder + if request.URL.RawPath == "" { + restEncoder, err = httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) + } else { + request.URL.RawPath = smithyhttp.JoinPath(request.URL.RawPath, opPath) + restEncoder, err = httpbinding.NewEncoderWithRawPath(request.URL.Path, request.URL.RawPath, request.URL.RawQuery, request.Header) + } + + if err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + restEncoder.SetHeader("Content-Type").String("application/json") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsRestjson1_serializeOpDocumentReturnSavingsPlanInput(input, jsonEncoder.Value); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + + if request.Request, err = restEncoder.Encode(request.Request); err != nil { + return out, metadata, &smithy.SerializationError{Err: err} + } + in.Request = request + + return next.HandleSerialize(ctx, in) +} +func awsRestjson1_serializeOpHttpBindingsReturnSavingsPlanInput(v *ReturnSavingsPlanInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentReturnSavingsPlanInput(v *ReturnSavingsPlanInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.ClientToken != nil { + ok := object.Key("clientToken") + ok.String(*v.ClientToken) + } + + if v.SavingsPlanId != nil { + ok := object.Key("savingsPlanId") + ok.String(*v.SavingsPlanId) + } + + return nil +} + type awsRestjson1_serializeOpTagResource struct { } diff --git a/service/savingsplans/snapshot_test.go b/service/savingsplans/snapshot_test.go index d0e0455f94c..33c58ff4ce0 100644 --- a/service/savingsplans/snapshot_test.go +++ b/service/savingsplans/snapshot_test.go @@ -146,6 +146,18 @@ func TestCheckSnapshot_ListTagsForResource(t *testing.T) { } } +func TestCheckSnapshot_ReturnSavingsPlan(t *testing.T) { + svc := New(Options{}) + _, err := svc.ReturnSavingsPlan(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return testSnapshot(stack, "ReturnSavingsPlan") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestCheckSnapshot_TagResource(t *testing.T) { svc := New(Options{}) _, err := svc.TagResource(context.Background(), nil, func(o *Options) { @@ -253,6 +265,18 @@ func TestUpdateSnapshot_ListTagsForResource(t *testing.T) { } } +func TestUpdateSnapshot_ReturnSavingsPlan(t *testing.T) { + svc := New(Options{}) + _, err := svc.ReturnSavingsPlan(context.Background(), nil, func(o *Options) { + o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { + return updateSnapshot(stack, "ReturnSavingsPlan") + }) + }) + if _, ok := err.(snapshotOK); !ok && err != nil { + t.Fatal(err) + } +} + func TestUpdateSnapshot_TagResource(t *testing.T) { svc := New(Options{}) _, err := svc.TagResource(context.Background(), nil, func(o *Options) { diff --git a/service/savingsplans/types/enums.go b/service/savingsplans/types/enums.go index a9d7658a9f9..512d855c30c 100644 --- a/service/savingsplans/types/enums.go +++ b/service/savingsplans/types/enums.go @@ -267,6 +267,8 @@ const ( SavingsPlanStateRetired SavingsPlanState = "retired" SavingsPlanStateQueued SavingsPlanState = "queued" SavingsPlanStateQueuedDeleted SavingsPlanState = "queued-deleted" + SavingsPlanStatePendingReturn SavingsPlanState = "pending-return" + SavingsPlanStateReturned SavingsPlanState = "returned" ) // Values returns all known values for SavingsPlanState. Note that this can be @@ -280,6 +282,8 @@ func (SavingsPlanState) Values() []SavingsPlanState { "retired", "queued", "queued-deleted", + "pending-return", + "returned", } } diff --git a/service/savingsplans/types/types.go b/service/savingsplans/types/types.go index 5e270e6ce62..f9f3ba23bd3 100644 --- a/service/savingsplans/types/types.go +++ b/service/savingsplans/types/types.go @@ -33,7 +33,7 @@ type ParentSavingsPlanOffering struct { // Information about a Savings Plan. type SavingsPlan struct { - // The hourly commitment, in USD. + // The hourly commitment amount in the specified currency. Commitment *string // The currency. @@ -60,9 +60,13 @@ type SavingsPlan struct { // The recurring payment amount. RecurringPaymentAmount *string - // The AWS Region. + // The Amazon Web Services Region. Region *string + // The time until when a return for the Savings Plan can be requested. If the + // Savings Plan is not returnable, the field reflects the Savings Plan start time. + ReturnableUntil *string + // The Amazon Resource Name (ARN) of the Savings Plan. SavingsPlanArn *string @@ -75,7 +79,7 @@ type SavingsPlan struct { // The start time. Start *string - // The state. + // The current state. State SavingsPlanState // One or more tags. @@ -90,7 +94,7 @@ type SavingsPlan struct { noSmithyDocumentSerde } -// Information about a filter. +// Information about a Savings Plan filter. type SavingsPlanFilter struct { // The filter name. @@ -117,7 +121,8 @@ type SavingsPlanOffering struct { // The ID of the offering. OfferingId *string - // The specific AWS operation for the line item in the billing report. + // The specific Amazon Web Services operation for the line item in the billing + // report. Operation *string // The payment option. @@ -141,7 +146,7 @@ type SavingsPlanOffering struct { noSmithyDocumentSerde } -// Information about a filter. +// Information about a Savings Plan offering filter. type SavingsPlanOfferingFilterElement struct { // The filter name. @@ -153,7 +158,7 @@ type SavingsPlanOfferingFilterElement struct { noSmithyDocumentSerde } -// Information about a property. +// Information about a Savings Plan offering property. type SavingsPlanOfferingProperty struct { // The property name. @@ -168,7 +173,8 @@ type SavingsPlanOfferingProperty struct { // Information about a Savings Plan offering rate. type SavingsPlanOfferingRate struct { - // The specific AWS operation for the line item in the billing report. + // The specific Amazon Web Services operation for the line item in the billing + // report. Operation *string // The product type. @@ -195,7 +201,7 @@ type SavingsPlanOfferingRate struct { noSmithyDocumentSerde } -// Information about a filter. +// Information about a Savings Plan offering rate filter. type SavingsPlanOfferingRateFilterElement struct { // The filter name. @@ -207,7 +213,7 @@ type SavingsPlanOfferingRateFilterElement struct { noSmithyDocumentSerde } -// Information about a property. +// Information about a Savings Plan offering rate property. type SavingsPlanOfferingRateProperty struct { // The property name. @@ -225,7 +231,8 @@ type SavingsPlanRate struct { // The currency. Currency CurrencyCode - // The specific AWS operation for the line item in the billing report. + // The specific Amazon Web Services operation for the line item in the billing + // report. Operation *string // The product type. @@ -249,7 +256,7 @@ type SavingsPlanRate struct { noSmithyDocumentSerde } -// Information about a filter. +// Information about a Savings Plan rate filter. type SavingsPlanRateFilter struct { // The filter name. @@ -261,7 +268,7 @@ type SavingsPlanRateFilter struct { noSmithyDocumentSerde } -// Information about a property. +// Information about a Savings Plan rate property. type SavingsPlanRateProperty struct { // The property name. diff --git a/service/savingsplans/validators.go b/service/savingsplans/validators.go index d1ee733e2eb..5bd175abb6b 100644 --- a/service/savingsplans/validators.go +++ b/service/savingsplans/validators.go @@ -89,6 +89,26 @@ func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpReturnSavingsPlan struct { +} + +func (*validateOpReturnSavingsPlan) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpReturnSavingsPlan) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ReturnSavingsPlanInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpReturnSavingsPlanInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpTagResource struct { } @@ -145,6 +165,10 @@ func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) } +func addOpReturnSavingsPlanValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpReturnSavingsPlan{}, middleware.After) +} + func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpTagResource{}, middleware.After) } @@ -216,6 +240,21 @@ func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { } } +func validateOpReturnSavingsPlanInput(v *ReturnSavingsPlanInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ReturnSavingsPlanInput"} + if v.SavingsPlanId == nil { + invalidParams.Add(smithy.NewErrParamRequired("SavingsPlanId")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpTagResourceInput(v *TagResourceInput) error { if v == nil { return nil