diff --git a/.changelog/615db84fb83045499756c8eb20681203.json b/.changelog/615db84fb83045499756c8eb20681203.json new file mode 100644 index 00000000000..8fea6417e11 --- /dev/null +++ b/.changelog/615db84fb83045499756c8eb20681203.json @@ -0,0 +1,8 @@ +{ + "id": "615db84f-b830-4549-9756-c8eb20681203", + "type": "feature", + "description": "This release of the Account Management API enables customers to view and manage whether AWS Opt-In Regions are enabled or disabled for their Account. For more information, see https://docs.aws.amazon.com/accounts/latest/reference/manage-acct-regions.html", + "modules": [ + "service/account" + ] +} \ No newline at end of file diff --git a/.changelog/bf5ce2506bd24464bdc865dc3085a2d5.json b/.changelog/bf5ce2506bd24464bdc865dc3085a2d5.json new file mode 100644 index 00000000000..7f8159ea902 --- /dev/null +++ b/.changelog/bf5ce2506bd24464bdc865dc3085a2d5.json @@ -0,0 +1,8 @@ +{ + "id": "bf5ce250-6bd2-4464-bdc8-65dc3085a2d5", + "type": "feature", + "description": "Adds support for EKS Anywhere on Snowball. AWS Snow Family customers can now install EKS Anywhere service on Snowball Edge Compute Optimized devices.", + "modules": [ + "service/snowball" + ] +} \ No newline at end of file diff --git a/.changelog/f0a32c95321a4c88bc0714aef6a45283.json b/.changelog/f0a32c95321a4c88bc0714aef6a45283.json new file mode 100644 index 00000000000..09d03da9d70 --- /dev/null +++ b/.changelog/f0a32c95321a4c88bc0714aef6a45283.json @@ -0,0 +1,8 @@ +{ + "id": "f0a32c95-321a-4c88-bc07-14aef6a45283", + "type": "feature", + "description": "AWS AppConfig now offers the option to set a version label on hosted configuration versions. If a labeled hosted configuration version is deployed, its version label is available in the GetLatestConfiguration response.", + "modules": [ + "service/appconfigdata" + ] +} \ No newline at end of file diff --git a/service/account/api_op_DisableRegion.go b/service/account/api_op_DisableRegion.go new file mode 100644 index 00000000000..299205c52c7 --- /dev/null +++ b/service/account/api_op_DisableRegion.go @@ -0,0 +1,141 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package account + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Disables (opts-out) a particular Region for an account. +func (c *Client) DisableRegion(ctx context.Context, params *DisableRegionInput, optFns ...func(*Options)) (*DisableRegionOutput, error) { + if params == nil { + params = &DisableRegionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "DisableRegion", params, optFns, c.addOperationDisableRegionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*DisableRegionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type DisableRegionInput struct { + + // Specifies the Region-code for a given Region name (for example, af-south-1). + // When you disable a Region, AWS performs actions to deactivate that Region in + // your account, such as destroying IAM resources in the Region. This process takes + // a few minutes for most accounts, but this can take several hours. You cannot + // enable the Region until the disabling process is fully completed. + // + // This member is required. + RegionName *string + + // Specifies the 12-digit account ID number of the Amazon Web Services account that + // you want to access or modify with this operation. If you don't specify this + // parameter, it defaults to the Amazon Web Services account of the identity used + // to call the operation. To use this parameter, the caller must be an identity in + // the organization's management account + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account) + // or a delegated administrator account. The specified account ID must also be a + // member account in the same organization. The organization must have all features + // enabled + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html), + // and the organization must have trusted access + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html) + // enabled for the Account Management service, and optionally a delegated admin + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html) + // account assigned. The management account can't specify its own AccountId. It + // must call the operation in standalone context by not including the AccountId + // parameter. To call this operation on an account that is not a member of an + // organization, don't specify this parameter. Instead, call the operation using an + // identity belonging to the account whose contacts you wish to retrieve or modify. + AccountId *string + + noSmithyDocumentSerde +} + +type DisableRegionOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationDisableRegionMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpDisableRegion{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpDisableRegion{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpDisableRegionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDisableRegion(options.Region), middleware.Before); 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 + } + return nil +} + +func newServiceMetadataMiddleware_opDisableRegion(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "account", + OperationName: "DisableRegion", + } +} diff --git a/service/account/api_op_EnableRegion.go b/service/account/api_op_EnableRegion.go new file mode 100644 index 00000000000..8ad6deeb160 --- /dev/null +++ b/service/account/api_op_EnableRegion.go @@ -0,0 +1,142 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package account + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Enables (opts-in) a particular Region for an account. +func (c *Client) EnableRegion(ctx context.Context, params *EnableRegionInput, optFns ...func(*Options)) (*EnableRegionOutput, error) { + if params == nil { + params = &EnableRegionInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "EnableRegion", params, optFns, c.addOperationEnableRegionMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*EnableRegionOutput) + out.ResultMetadata = metadata + return out, nil +} + +type EnableRegionInput struct { + + // Specifies the Region-code for a given Region name (for example, af-south-1). + // When you enable a Region, AWS performs actions to prepare your account in that + // Region, such as distributing your IAM resources to the Region. This process + // takes a few minutes for most accounts, but it can take several hours. You cannot + // use the Region until this process is complete. Furthermore, you cannot disable + // the Region until the enabling process is fully completed. + // + // This member is required. + RegionName *string + + // Specifies the 12-digit account ID number of the Amazon Web Services account that + // you want to access or modify with this operation. If you don't specify this + // parameter, it defaults to the Amazon Web Services account of the identity used + // to call the operation. To use this parameter, the caller must be an identity in + // the organization's management account + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account) + // or a delegated administrator account. The specified account ID must also be a + // member account in the same organization. The organization must have all features + // enabled + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html), + // and the organization must have trusted access + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html) + // enabled for the Account Management service, and optionally a delegated admin + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html) + // account assigned. The management account can't specify its own AccountId. It + // must call the operation in standalone context by not including the AccountId + // parameter. To call this operation on an account that is not a member of an + // organization, don't specify this parameter. Instead, call the operation using an + // identity belonging to the account whose contacts you wish to retrieve or modify. + AccountId *string + + noSmithyDocumentSerde +} + +type EnableRegionOutput struct { + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationEnableRegionMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpEnableRegion{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpEnableRegion{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpEnableRegionValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opEnableRegion(options.Region), middleware.Before); 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 + } + return nil +} + +func newServiceMetadataMiddleware_opEnableRegion(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "account", + OperationName: "EnableRegion", + } +} diff --git a/service/account/api_op_GetRegionOptStatus.go b/service/account/api_op_GetRegionOptStatus.go new file mode 100644 index 00000000000..ce941180a46 --- /dev/null +++ b/service/account/api_op_GetRegionOptStatus.go @@ -0,0 +1,148 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package account + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/account/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Retrieves the opt-in status of a particular Region. +func (c *Client) GetRegionOptStatus(ctx context.Context, params *GetRegionOptStatusInput, optFns ...func(*Options)) (*GetRegionOptStatusOutput, error) { + if params == nil { + params = &GetRegionOptStatusInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "GetRegionOptStatus", params, optFns, c.addOperationGetRegionOptStatusMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*GetRegionOptStatusOutput) + out.ResultMetadata = metadata + return out, nil +} + +type GetRegionOptStatusInput struct { + + // Specifies the Region-code for a given Region name (for example, af-south-1). + // This function will return the status of whatever Region you pass into this + // parameter. + // + // This member is required. + RegionName *string + + // Specifies the 12-digit account ID number of the Amazon Web Services account that + // you want to access or modify with this operation. If you don't specify this + // parameter, it defaults to the Amazon Web Services account of the identity used + // to call the operation. To use this parameter, the caller must be an identity in + // the organization's management account + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account) + // or a delegated administrator account. The specified account ID must also be a + // member account in the same organization. The organization must have all features + // enabled + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html), + // and the organization must have trusted access + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html) + // enabled for the Account Management service, and optionally a delegated admin + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html) + // account assigned. The management account can't specify its own AccountId. It + // must call the operation in standalone context by not including the AccountId + // parameter. To call this operation on an account that is not a member of an + // organization, don't specify this parameter. Instead, call the operation using an + // identity belonging to the account whose contacts you wish to retrieve or modify. + AccountId *string + + noSmithyDocumentSerde +} + +type GetRegionOptStatusOutput struct { + + // The Region code that was passed in. + RegionName *string + + // One of the potential statuses a Region can undergo (Enabled, Enabling, Disabled, + // Disabling, Enabled_By_Default). + RegionOptStatus types.RegionOptStatus + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationGetRegionOptStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpGetRegionOptStatus{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpGetRegionOptStatus{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpGetRegionOptStatusValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetRegionOptStatus(options.Region), middleware.Before); 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 + } + return nil +} + +func newServiceMetadataMiddleware_opGetRegionOptStatus(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "account", + OperationName: "GetRegionOptStatus", + } +} diff --git a/service/account/api_op_ListRegions.go b/service/account/api_op_ListRegions.go new file mode 100644 index 00000000000..c3b3027928a --- /dev/null +++ b/service/account/api_op_ListRegions.go @@ -0,0 +1,261 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package account + +import ( + "context" + "fmt" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/account/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all the Regions for a given account and their respective opt-in statuses. +// Optionally, this list can be filtered by the region-opt-status-contains +// parameter. +func (c *Client) ListRegions(ctx context.Context, params *ListRegionsInput, optFns ...func(*Options)) (*ListRegionsOutput, error) { + if params == nil { + params = &ListRegionsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListRegions", params, optFns, c.addOperationListRegionsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListRegionsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListRegionsInput struct { + + // Specifies the 12-digit account ID number of the Amazon Web Services account that + // you want to access or modify with this operation. If you don't specify this + // parameter, it defaults to the Amazon Web Services account of the identity used + // to call the operation. To use this parameter, the caller must be an identity in + // the organization's management account + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html#account) + // or a delegated administrator account. The specified account ID must also be a + // member account in the same organization. The organization must have all features + // enabled + // (https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_org_support-all-features.html), + // and the organization must have trusted access + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-trusted-access.html) + // enabled for the Account Management service, and optionally a delegated admin + // (https://docs.aws.amazon.com/organizations/latest/userguide/using-orgs-delegated-admin.html) + // account assigned. The management account can't specify its own AccountId. It + // must call the operation in standalone context by not including the AccountId + // parameter. To call this operation on an account that is not a member of an + // organization, don't specify this parameter. Instead, call the operation using an + // identity belonging to the account whose contacts you wish to retrieve or modify. + AccountId *string + + // The total number of items to return in the command’s output. If the total number + // of items available is more than the value specified, a NextToken is provided in + // the command’s output. To resume pagination, provide the NextToken value in the + // starting-token argument of a subsequent command. Do not use the NextToken + // response element directly outside of the Amazon Web Services CLI. For usage + // examples, see Pagination + // (http://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the Amazon + // Web Services Command Line Interface User Guide. + MaxResults *int32 + + // A token used to specify where to start paginating. This is the NextToken from a + // previously truncated response. For usage examples, see Pagination + // (http://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the Amazon + // Web Services Command Line Interface User Guide. + NextToken *string + + // A list of Region statuses (Enabling, Enabled, Disabling, Disabled, + // Enabled_by_default) to use to filter the list of Regions for a given account. + // For example, passing in a value of ENABLING will only return a list of Regions + // with a Region status of ENABLING. + RegionOptStatusContains []types.RegionOptStatus + + noSmithyDocumentSerde +} + +type ListRegionsOutput struct { + + // If there is more data to be returned, this will be populated. It should be + // passed into the next-token request parameter of list-regions. + NextToken *string + + // This is a list of Regions for a given account, or if the filtered parameter was + // used, a list of Regions that match the filter criteria set in the filter + // parameter. + Regions []types.Region + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListRegionsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsRestjson1_serializeOpListRegions{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsRestjson1_deserializeOpListRegions{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListRegions(options.Region), middleware.Before); 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 + } + return nil +} + +// ListRegionsAPIClient is a client that implements the ListRegions operation. +type ListRegionsAPIClient interface { + ListRegions(context.Context, *ListRegionsInput, ...func(*Options)) (*ListRegionsOutput, error) +} + +var _ ListRegionsAPIClient = (*Client)(nil) + +// ListRegionsPaginatorOptions is the paginator options for ListRegions +type ListRegionsPaginatorOptions struct { + // The total number of items to return in the command’s output. If the total number + // of items available is more than the value specified, a NextToken is provided in + // the command’s output. To resume pagination, provide the NextToken value in the + // starting-token argument of a subsequent command. Do not use the NextToken + // response element directly outside of the Amazon Web Services CLI. For usage + // examples, see Pagination + // (http://docs.aws.amazon.com/cli/latest/userguide/pagination.html) in the Amazon + // Web Services Command Line Interface User Guide. + Limit int32 + + // Set to true if pagination should stop if the service returns a pagination token + // that matches the most recent token provided to the service. + StopOnDuplicateToken bool +} + +// ListRegionsPaginator is a paginator for ListRegions +type ListRegionsPaginator struct { + options ListRegionsPaginatorOptions + client ListRegionsAPIClient + params *ListRegionsInput + nextToken *string + firstPage bool +} + +// NewListRegionsPaginator returns a new ListRegionsPaginator +func NewListRegionsPaginator(client ListRegionsAPIClient, params *ListRegionsInput, optFns ...func(*ListRegionsPaginatorOptions)) *ListRegionsPaginator { + if params == nil { + params = &ListRegionsInput{} + } + + options := ListRegionsPaginatorOptions{} + if params.MaxResults != nil { + options.Limit = *params.MaxResults + } + + for _, fn := range optFns { + fn(&options) + } + + return &ListRegionsPaginator{ + options: options, + client: client, + params: params, + firstPage: true, + nextToken: params.NextToken, + } +} + +// HasMorePages returns a boolean indicating whether more pages are available +func (p *ListRegionsPaginator) HasMorePages() bool { + return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) +} + +// NextPage retrieves the next ListRegions page. +func (p *ListRegionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListRegionsOutput, error) { + if !p.HasMorePages() { + return nil, fmt.Errorf("no more pages available") + } + + params := *p.params + params.NextToken = p.nextToken + + var limit *int32 + if p.options.Limit > 0 { + limit = &p.options.Limit + } + params.MaxResults = limit + + result, err := p.client.ListRegions(ctx, ¶ms, optFns...) + if err != nil { + return nil, err + } + p.firstPage = false + + prevToken := p.nextToken + p.nextToken = result.NextToken + + if p.options.StopOnDuplicateToken && + prevToken != nil && + p.nextToken != nil && + *prevToken == *p.nextToken { + p.nextToken = nil + } + + return result, nil +} + +func newServiceMetadataMiddleware_opListRegions(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "account", + OperationName: "ListRegions", + } +} diff --git a/service/account/deserializers.go b/service/account/deserializers.go index 184b0f3d72b..efa5ccdff79 100644 --- a/service/account/deserializers.go +++ b/service/account/deserializers.go @@ -120,14 +120,534 @@ func awsRestjson1_deserializeOpErrorDeleteAlternateContact(response *smithyhttp. } } +type awsRestjson1_deserializeOpDisableRegion struct { +} + +func (*awsRestjson1_deserializeOpDisableRegion) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpDisableRegion) 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_deserializeOpErrorDisableRegion(response, &metadata) + } + output := &DisableRegionOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorDisableRegion(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +type awsRestjson1_deserializeOpEnableRegion struct { +} + +func (*awsRestjson1_deserializeOpEnableRegion) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpEnableRegion) 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_deserializeOpErrorEnableRegion(response, &metadata) + } + output := &EnableRegionOutput{} + out.Result = output + + if _, err = io.Copy(ioutil.Discard, response.Body); err != nil { + return out, metadata, &smithy.DeserializationError{ + Err: fmt.Errorf("failed to discard response body, %w", err), + } + } + + return out, metadata, err +} + +func awsRestjson1_deserializeOpErrorEnableRegion(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("ConflictException", errorCode): + return awsRestjson1_deserializeErrorConflictException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsRestjson1_deserializeOpGetAlternateContact struct { } -func (*awsRestjson1_deserializeOpGetAlternateContact) ID() string { +func (*awsRestjson1_deserializeOpGetAlternateContact) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetAlternateContact) 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_deserializeOpErrorGetAlternateContact(response, &metadata) + } + output := &GetAlternateContactOutput{} + 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_deserializeOpDocumentGetAlternateContactOutput(&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_deserializeOpErrorGetAlternateContact(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetAlternateContactOutput(v **GetAlternateContactOutput, 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 *GetAlternateContactOutput + if *v == nil { + sv = &GetAlternateContactOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "AlternateContact": + if err := awsRestjson1_deserializeDocumentAlternateContact(&sv.AlternateContact, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetContactInformation struct { +} + +func (*awsRestjson1_deserializeOpGetContactInformation) ID() string { + return "OperationDeserializer" +} + +func (m *awsRestjson1_deserializeOpGetContactInformation) 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_deserializeOpErrorGetContactInformation(response, &metadata) + } + output := &GetContactInformationOutput{} + 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_deserializeOpDocumentGetContactInformationOutput(&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_deserializeOpErrorGetContactInformation(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("AccessDeniedException", errorCode): + return awsRestjson1_deserializeErrorAccessDeniedException(response, errorBody) + + case strings.EqualFold("InternalServerException", errorCode): + return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) + + case strings.EqualFold("ResourceNotFoundException", errorCode): + return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) + + case strings.EqualFold("TooManyRequestsException", errorCode): + return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) + + case strings.EqualFold("ValidationException", errorCode): + return awsRestjson1_deserializeErrorValidationException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + +func awsRestjson1_deserializeOpDocumentGetContactInformationOutput(v **GetContactInformationOutput, 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 *GetContactInformationOutput + if *v == nil { + sv = &GetContactInformationOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ContactInformation": + if err := awsRestjson1_deserializeDocumentContactInformation(&sv.ContactInformation, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +type awsRestjson1_deserializeOpGetRegionOptStatus struct { +} + +func (*awsRestjson1_deserializeOpGetRegionOptStatus) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetAlternateContact) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpGetRegionOptStatus) 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) @@ -141,9 +661,9 @@ func (m *awsRestjson1_deserializeOpGetAlternateContact) HandleDeserialize(ctx co } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetAlternateContact(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorGetRegionOptStatus(response, &metadata) } - output := &GetAlternateContactOutput{} + output := &GetRegionOptStatusOutput{} out.Result = output var buff [1024]byte @@ -164,7 +684,7 @@ func (m *awsRestjson1_deserializeOpGetAlternateContact) HandleDeserialize(ctx co return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetAlternateContactOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentGetRegionOptStatusOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -177,7 +697,7 @@ func (m *awsRestjson1_deserializeOpGetAlternateContact) HandleDeserialize(ctx co return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetAlternateContact(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorGetRegionOptStatus(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)} @@ -224,9 +744,6 @@ func awsRestjson1_deserializeOpErrorGetAlternateContact(response *smithyhttp.Res case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TooManyRequestsException", errorCode): return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) @@ -243,7 +760,7 @@ func awsRestjson1_deserializeOpErrorGetAlternateContact(response *smithyhttp.Res } } -func awsRestjson1_deserializeOpDocumentGetAlternateContactOutput(v **GetAlternateContactOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentGetRegionOptStatusOutput(v **GetRegionOptStatusOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -256,18 +773,31 @@ func awsRestjson1_deserializeOpDocumentGetAlternateContactOutput(v **GetAlternat return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetAlternateContactOutput + var sv *GetRegionOptStatusOutput if *v == nil { - sv = &GetAlternateContactOutput{} + sv = &GetRegionOptStatusOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "AlternateContact": - if err := awsRestjson1_deserializeDocumentAlternateContact(&sv.AlternateContact, value); err != nil { - return err + case "RegionName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.RegionName = ptr.String(jtv) + } + + case "RegionOptStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionOptStatus to be of type string, got %T instead", value) + } + sv.RegionOptStatus = types.RegionOptStatus(jtv) } default: @@ -279,14 +809,14 @@ func awsRestjson1_deserializeOpDocumentGetAlternateContactOutput(v **GetAlternat return nil } -type awsRestjson1_deserializeOpGetContactInformation struct { +type awsRestjson1_deserializeOpListRegions struct { } -func (*awsRestjson1_deserializeOpGetContactInformation) ID() string { +func (*awsRestjson1_deserializeOpListRegions) ID() string { return "OperationDeserializer" } -func (m *awsRestjson1_deserializeOpGetContactInformation) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( +func (m *awsRestjson1_deserializeOpListRegions) 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) @@ -300,9 +830,9 @@ func (m *awsRestjson1_deserializeOpGetContactInformation) HandleDeserialize(ctx } if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsRestjson1_deserializeOpErrorGetContactInformation(response, &metadata) + return out, metadata, awsRestjson1_deserializeOpErrorListRegions(response, &metadata) } - output := &GetContactInformationOutput{} + output := &ListRegionsOutput{} out.Result = output var buff [1024]byte @@ -323,7 +853,7 @@ func (m *awsRestjson1_deserializeOpGetContactInformation) HandleDeserialize(ctx return out, metadata, err } - err = awsRestjson1_deserializeOpDocumentGetContactInformationOutput(&output, shape) + err = awsRestjson1_deserializeOpDocumentListRegionsOutput(&output, shape) if err != nil { var snapshot bytes.Buffer io.Copy(&snapshot, ringBuffer) @@ -336,7 +866,7 @@ func (m *awsRestjson1_deserializeOpGetContactInformation) HandleDeserialize(ctx return out, metadata, err } -func awsRestjson1_deserializeOpErrorGetContactInformation(response *smithyhttp.Response, metadata *middleware.Metadata) error { +func awsRestjson1_deserializeOpErrorListRegions(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)} @@ -383,9 +913,6 @@ func awsRestjson1_deserializeOpErrorGetContactInformation(response *smithyhttp.R case strings.EqualFold("InternalServerException", errorCode): return awsRestjson1_deserializeErrorInternalServerException(response, errorBody) - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsRestjson1_deserializeErrorResourceNotFoundException(response, errorBody) - case strings.EqualFold("TooManyRequestsException", errorCode): return awsRestjson1_deserializeErrorTooManyRequestsException(response, errorBody) @@ -402,7 +929,7 @@ func awsRestjson1_deserializeOpErrorGetContactInformation(response *smithyhttp.R } } -func awsRestjson1_deserializeOpDocumentGetContactInformationOutput(v **GetContactInformationOutput, value interface{}) error { +func awsRestjson1_deserializeOpDocumentListRegionsOutput(v **ListRegionsOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) } @@ -415,17 +942,26 @@ func awsRestjson1_deserializeOpDocumentGetContactInformationOutput(v **GetContac return fmt.Errorf("unexpected JSON type %v", value) } - var sv *GetContactInformationOutput + var sv *ListRegionsOutput if *v == nil { - sv = &GetContactInformationOutput{} + sv = &ListRegionsOutput{} } else { sv = *v } for key, value := range shape { switch key { - case "ContactInformation": - if err := awsRestjson1_deserializeDocumentContactInformation(&sv.ContactInformation, value); err != nil { + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "Regions": + if err := awsRestjson1_deserializeDocumentRegionOptList(&sv.Regions, value); err != nil { return err } @@ -670,6 +1206,42 @@ func awsRestjson1_deserializeErrorAccessDeniedException(response *smithyhttp.Res return output } +func awsRestjson1_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + output := &types.ConflictException{} + 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 + } + + err := awsRestjson1_deserializeDocumentConflictException(&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 awsRestjson1_deserializeErrorInternalServerException(response *smithyhttp.Response, errorBody *bytes.Reader) error { output := &types.InternalServerException{} var buff [1024]byte @@ -930,6 +1502,46 @@ func awsRestjson1_deserializeDocumentAlternateContact(v **types.AlternateContact return nil } +func awsRestjson1_deserializeDocumentConflictException(v **types.ConflictException, 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.ConflictException + if *v == nil { + sv = &types.ConflictException{} + } 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 String to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsRestjson1_deserializeDocumentContactInformation(v **types.ContactInformation, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -1109,6 +1721,89 @@ func awsRestjson1_deserializeDocumentInternalServerException(v **types.InternalS return nil } +func awsRestjson1_deserializeDocumentRegion(v **types.Region, 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.Region + if *v == nil { + sv = &types.Region{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "RegionName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionName to be of type string, got %T instead", value) + } + sv.RegionName = ptr.String(jtv) + } + + case "RegionOptStatus": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected RegionOptStatus to be of type string, got %T instead", value) + } + sv.RegionOptStatus = types.RegionOptStatus(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentRegionOptList(v *[]types.Region, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.Region + if *v == nil { + cv = []types.Region{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.Region + destAddr := &col + if err := awsRestjson1_deserializeDocumentRegion(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsRestjson1_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -1211,15 +1906,78 @@ func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationExc for key, value := range shape { switch key { + case "fieldList": + if err := awsRestjson1_deserializeDocumentValidationExceptionFieldList(&sv.FieldList, value); err != nil { + return err + } + case "message": if value != nil { jtv, ok := value.(string) if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) + return fmt.Errorf("expected SensitiveString to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + case "reason": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ValidationExceptionReason to be of type string, got %T instead", value) + } + sv.Reason = types.ValidationExceptionReason(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsRestjson1_deserializeDocumentValidationExceptionField(v **types.ValidationExceptionField, 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.ValidationExceptionField + if *v == nil { + sv = &types.ValidationExceptionField{} + } 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 SensitiveString to be of type string, got %T instead", value) } sv.Message = ptr.String(jtv) } + case "name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + default: _, _ = key, value @@ -1228,3 +1986,37 @@ func awsRestjson1_deserializeDocumentValidationException(v **types.ValidationExc *v = sv return nil } + +func awsRestjson1_deserializeDocumentValidationExceptionFieldList(v *[]types.ValidationExceptionField, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.ValidationExceptionField + if *v == nil { + cv = []types.ValidationExceptionField{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ValidationExceptionField + destAddr := &col + if err := awsRestjson1_deserializeDocumentValidationExceptionField(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} diff --git a/service/account/generated.json b/service/account/generated.json index e8e8ed21e73..6ed2a77f127 100644 --- a/service/account/generated.json +++ b/service/account/generated.json @@ -9,8 +9,12 @@ "api_client.go", "api_client_test.go", "api_op_DeleteAlternateContact.go", + "api_op_DisableRegion.go", + "api_op_EnableRegion.go", "api_op_GetAlternateContact.go", "api_op_GetContactInformation.go", + "api_op_GetRegionOptStatus.go", + "api_op_ListRegions.go", "api_op_PutAlternateContact.go", "api_op_PutContactInformation.go", "deserializers.go", diff --git a/service/account/serializers.go b/service/account/serializers.go index 502e960207f..16acf56adad 100644 --- a/service/account/serializers.go +++ b/service/account/serializers.go @@ -87,6 +87,152 @@ func awsRestjson1_serializeOpDocumentDeleteAlternateContactInput(v *DeleteAltern return nil } +type awsRestjson1_serializeOpDisableRegion struct { +} + +func (*awsRestjson1_serializeOpDisableRegion) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpDisableRegion) 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.(*DisableRegionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/disableRegion") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, 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_serializeOpDocumentDisableRegionInput(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_serializeOpHttpBindingsDisableRegionInput(v *DisableRegionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentDisableRegionInput(v *DisableRegionInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountId != nil { + ok := object.Key("AccountId") + ok.String(*v.AccountId) + } + + if v.RegionName != nil { + ok := object.Key("RegionName") + ok.String(*v.RegionName) + } + + return nil +} + +type awsRestjson1_serializeOpEnableRegion struct { +} + +func (*awsRestjson1_serializeOpEnableRegion) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpEnableRegion) 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.(*EnableRegionInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/enableRegion") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, 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_serializeOpDocumentEnableRegionInput(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_serializeOpHttpBindingsEnableRegionInput(v *EnableRegionInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentEnableRegionInput(v *EnableRegionInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountId != nil { + ok := object.Key("AccountId") + ok.String(*v.AccountId) + } + + if v.RegionName != nil { + ok := object.Key("RegionName") + ok.String(*v.RegionName) + } + + return nil +} + type awsRestjson1_serializeOpGetAlternateContact struct { } @@ -228,6 +374,164 @@ func awsRestjson1_serializeOpDocumentGetContactInformationInput(v *GetContactInf return nil } +type awsRestjson1_serializeOpGetRegionOptStatus struct { +} + +func (*awsRestjson1_serializeOpGetRegionOptStatus) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpGetRegionOptStatus) 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.(*GetRegionOptStatusInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/getRegionOptStatus") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, 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_serializeOpDocumentGetRegionOptStatusInput(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_serializeOpHttpBindingsGetRegionOptStatusInput(v *GetRegionOptStatusInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentGetRegionOptStatusInput(v *GetRegionOptStatusInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountId != nil { + ok := object.Key("AccountId") + ok.String(*v.AccountId) + } + + if v.RegionName != nil { + ok := object.Key("RegionName") + ok.String(*v.RegionName) + } + + return nil +} + +type awsRestjson1_serializeOpListRegions struct { +} + +func (*awsRestjson1_serializeOpListRegions) ID() string { + return "OperationSerializer" +} + +func (m *awsRestjson1_serializeOpListRegions) 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.(*ListRegionsInput) + _ = input + if !ok { + return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} + } + + opPath, opQuery := httpbinding.SplitURI("/listRegions") + request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) + request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) + request.Method = "POST" + restEncoder, err := httpbinding.NewEncoder(request.URL.Path, 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_serializeOpDocumentListRegionsInput(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_serializeOpHttpBindingsListRegionsInput(v *ListRegionsInput, encoder *httpbinding.Encoder) error { + if v == nil { + return fmt.Errorf("unsupported serialization of nil %T", v) + } + + return nil +} + +func awsRestjson1_serializeOpDocumentListRegionsInput(v *ListRegionsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.AccountId != nil { + ok := object.Key("AccountId") + ok.String(*v.AccountId) + } + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if v.RegionOptStatusContains != nil { + ok := object.Key("RegionOptStatusContains") + if err := awsRestjson1_serializeDocumentRegionOptStatusList(v.RegionOptStatusContains, ok); err != nil { + return err + } + } + + return nil +} + type awsRestjson1_serializeOpPutAlternateContact struct { } @@ -462,3 +766,14 @@ func awsRestjson1_serializeDocumentContactInformation(v *types.ContactInformatio return nil } + +func awsRestjson1_serializeDocumentRegionOptStatusList(v []types.RegionOptStatus, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + av.String(string(v[i])) + } + return nil +} diff --git a/service/account/types/enums.go b/service/account/types/enums.go index 30fb8f24ae0..713d75aa5b0 100644 --- a/service/account/types/enums.go +++ b/service/account/types/enums.go @@ -21,3 +21,45 @@ func (AlternateContactType) Values() []AlternateContactType { "SECURITY", } } + +type RegionOptStatus string + +// Enum values for RegionOptStatus +const ( + RegionOptStatusEnabled RegionOptStatus = "ENABLED" + RegionOptStatusEnabling RegionOptStatus = "ENABLING" + RegionOptStatusDisabling RegionOptStatus = "DISABLING" + RegionOptStatusDisabled RegionOptStatus = "DISABLED" + RegionOptStatusEnabledByDefault RegionOptStatus = "ENABLED_BY_DEFAULT" +) + +// Values returns all known values for RegionOptStatus. Note that this can be +// expanded in the future, and so it is only as up to date as the client. The +// ordering of this slice is not guaranteed to be stable across updates. +func (RegionOptStatus) Values() []RegionOptStatus { + return []RegionOptStatus{ + "ENABLED", + "ENABLING", + "DISABLING", + "DISABLED", + "ENABLED_BY_DEFAULT", + } +} + +type ValidationExceptionReason string + +// Enum values for ValidationExceptionReason +const ( + ValidationExceptionReasonInvalidRegionOptTarget ValidationExceptionReason = "invalidRegionOptTarget" + ValidationExceptionReasonFieldValidationFailed ValidationExceptionReason = "fieldValidationFailed" +) + +// Values returns all known values for ValidationExceptionReason. Note that this +// can be expanded in the future, and so it is only as up to date as the client. +// The ordering of this slice is not guaranteed to be stable across updates. +func (ValidationExceptionReason) Values() []ValidationExceptionReason { + return []ValidationExceptionReason{ + "invalidRegionOptTarget", + "fieldValidationFailed", + } +} diff --git a/service/account/types/errors.go b/service/account/types/errors.go index c7fb7c98cfe..1126f74125f 100644 --- a/service/account/types/errors.go +++ b/service/account/types/errors.go @@ -34,6 +34,34 @@ func (e *AccessDeniedException) ErrorCode() string { } func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } +// The request could not be processed because of a conflict in the current status +// of the resource. For example, this happens if you try to enable a Region that is +// currently being disabled (in a status of DISABLING). +type ConflictException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *ConflictException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *ConflictException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *ConflictException) ErrorCode() string { + if e.ErrorCodeOverride == nil { + return "ConflictException" + } + return *e.ErrorCodeOverride +} +func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + // The operation failed because of an error internal to Amazon Web Services. Try // your operation again later. type InternalServerException struct { @@ -120,6 +148,9 @@ type ValidationException struct { ErrorCodeOverride *string + Reason ValidationExceptionReason + FieldList []ValidationExceptionField + noSmithyDocumentSerde } diff --git a/service/account/types/types.go b/service/account/types/types.go index 80250f64552..6017f1723d3 100644 --- a/service/account/types/types.go +++ b/service/account/types/types.go @@ -85,4 +85,35 @@ type ContactInformation struct { noSmithyDocumentSerde } +// This is a structure that expresses the Region for a given account, consisting of +// a name and opt-in status. +type Region struct { + + // The Region code of a given Region (for example, us-east-1). + RegionName *string + + // One of potential statuses a Region can undergo (Enabled, Enabling, Disabled, + // Disabling, Enabled_By_Default). + RegionOptStatus RegionOptStatus + + noSmithyDocumentSerde +} + +// The input failed to meet the constraints specified by the AWS service in a +// specified field. +type ValidationExceptionField struct { + + // A message about the validation exception. + // + // This member is required. + Message *string + + // The field name where the invalid entry was detected. + // + // This member is required. + Name *string + + noSmithyDocumentSerde +} + type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/service/account/validators.go b/service/account/validators.go index 1e24e685bcf..9b92205739b 100644 --- a/service/account/validators.go +++ b/service/account/validators.go @@ -30,6 +30,46 @@ func (m *validateOpDeleteAlternateContact) HandleInitialize(ctx context.Context, return next.HandleInitialize(ctx, in) } +type validateOpDisableRegion struct { +} + +func (*validateOpDisableRegion) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpDisableRegion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*DisableRegionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpDisableRegionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + +type validateOpEnableRegion struct { +} + +func (*validateOpEnableRegion) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpEnableRegion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*EnableRegionInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpEnableRegionInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpGetAlternateContact struct { } @@ -50,6 +90,26 @@ func (m *validateOpGetAlternateContact) HandleInitialize(ctx context.Context, in return next.HandleInitialize(ctx, in) } +type validateOpGetRegionOptStatus struct { +} + +func (*validateOpGetRegionOptStatus) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpGetRegionOptStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*GetRegionOptStatusInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpGetRegionOptStatusInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpPutAlternateContact struct { } @@ -94,10 +154,22 @@ func addOpDeleteAlternateContactValidationMiddleware(stack *middleware.Stack) er return stack.Initialize.Add(&validateOpDeleteAlternateContact{}, middleware.After) } +func addOpDisableRegionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpDisableRegion{}, middleware.After) +} + +func addOpEnableRegionValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpEnableRegion{}, middleware.After) +} + func addOpGetAlternateContactValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetAlternateContact{}, middleware.After) } +func addOpGetRegionOptStatusValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpGetRegionOptStatus{}, middleware.After) +} + func addOpPutAlternateContactValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutAlternateContact{}, middleware.After) } @@ -151,6 +223,36 @@ func validateOpDeleteAlternateContactInput(v *DeleteAlternateContactInput) error } } +func validateOpDisableRegionInput(v *DisableRegionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "DisableRegionInput"} + if v.RegionName == nil { + invalidParams.Add(smithy.NewErrParamRequired("RegionName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateOpEnableRegionInput(v *EnableRegionInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "EnableRegionInput"} + if v.RegionName == nil { + invalidParams.Add(smithy.NewErrParamRequired("RegionName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpGetAlternateContactInput(v *GetAlternateContactInput) error { if v == nil { return nil @@ -166,6 +268,21 @@ func validateOpGetAlternateContactInput(v *GetAlternateContactInput) error { } } +func validateOpGetRegionOptStatusInput(v *GetRegionOptStatusInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "GetRegionOptStatusInput"} + if v.RegionName == nil { + invalidParams.Add(smithy.NewErrParamRequired("RegionName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpPutAlternateContactInput(v *PutAlternateContactInput) error { if v == nil { return nil diff --git a/service/appconfigdata/api_op_GetLatestConfiguration.go b/service/appconfigdata/api_op_GetLatestConfiguration.go index f2119971505..db54f6bf062 100644 --- a/service/appconfigdata/api_op_GetLatestConfiguration.go +++ b/service/appconfigdata/api_op_GetLatestConfiguration.go @@ -13,7 +13,7 @@ import ( // Retrieves the latest deployed configuration. This API may return empty // configuration data if the client already has the latest version. For more // information about this API action and to view example CLI commands that show how -// to use it with the StartConfigurationSession API action, see Receiving the +// to use it with the StartConfigurationSession API action, see Retrieving the // configuration // (http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration) // in the AppConfig User Guide. Note the following important information. @@ -46,8 +46,11 @@ type GetLatestConfigurationInput struct { // Token describing the current state of the configuration session. To obtain a // token, first call the StartConfigurationSession API. Note that every call to // GetLatestConfiguration will return a new ConfigurationToken - // (NextPollConfigurationToken in the response) and MUST be provided to subsequent - // GetLatestConfiguration API calls. + // (NextPollConfigurationToken in the response) and must be provided to subsequent + // GetLatestConfiguration API calls. This token should only be used once. To + // support long poll use cases, the token is valid for up to 24 hours. If a + // GetLatestConfiguration call uses an expired token, the system returns + // BadRequestException. // // This member is required. ConfigurationToken *string @@ -65,7 +68,10 @@ type GetLatestConfigurationOutput struct { ContentType *string // The latest token describing the current state of the configuration session. This - // MUST be provided to the next call to GetLatestConfiguration. + // must be provided to the next call to GetLatestConfiguration. This token should + // only be used once. To support long poll use cases, the token is valid for up to + // 24 hours. If a GetLatestConfiguration call uses an expired token, the system + // returns BadRequestException. NextPollConfigurationToken *string // The amount of time the client should wait before polling for configuration @@ -73,6 +79,12 @@ type GetLatestConfigurationOutput struct { // interval. NextPollIntervalInSeconds int32 + // The user-defined label for the AppConfig hosted configuration version. This + // attribute doesn't apply if the configuration is not from an AppConfig hosted + // configuration version. If the client already has the latest version of the + // configuration data, this value is empty. + VersionLabel *string + // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata diff --git a/service/appconfigdata/api_op_StartConfigurationSession.go b/service/appconfigdata/api_op_StartConfigurationSession.go index 9c9d5a5972d..30efb4469b0 100644 --- a/service/appconfigdata/api_op_StartConfigurationSession.go +++ b/service/appconfigdata/api_op_StartConfigurationSession.go @@ -12,8 +12,8 @@ import ( // Starts a configuration session used to retrieve a deployed configuration. For // more information about this API action and to view example CLI commands that -// show how to use it with the GetLatestConfiguration API action, see Receiving the -// configuration +// show how to use it with the GetLatestConfiguration API action, see Retrieving +// the configuration // (http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration) // in the AppConfig User Guide. func (c *Client) StartConfigurationSession(ctx context.Context, params *StartConfigurationSessionInput, optFns ...func(*Options)) (*StartConfigurationSessionOutput, error) { @@ -50,7 +50,7 @@ type StartConfigurationSessionInput struct { // Sets a constraint on a session. If you specify a value of, for example, 60 // seconds, then the client that established the session can't call - // GetLatestConfiguration more frequently then every 60 seconds. + // GetLatestConfiguration more frequently than every 60 seconds. RequiredMinimumPollIntervalInSeconds *int32 noSmithyDocumentSerde @@ -60,9 +60,12 @@ type StartConfigurationSessionOutput struct { // Token encapsulating state about the configuration session. Provide this token to // the GetLatestConfiguration API to retrieve configuration data. This token should - // only be used once in your first call to GetLatestConfiguration. You MUST use the + // only be used once in your first call to GetLatestConfiguration. You must use the // new token in the GetLatestConfiguration response (NextPollConfigurationToken) in - // each subsequent call to GetLatestConfiguration. + // each subsequent call to GetLatestConfiguration. The InitialConfigurationToken + // and NextPollConfigurationToken should only be used once. To support long poll + // use cases, the tokens are valid for up to 24 hours. If a GetLatestConfiguration + // call uses an expired token, the system returns BadRequestException. InitialConfigurationToken *string // Metadata pertaining to the operation's result. diff --git a/service/appconfigdata/deserializers.go b/service/appconfigdata/deserializers.go index af7aaa61d36..a0b6d0b2bb6 100644 --- a/service/appconfigdata/deserializers.go +++ b/service/appconfigdata/deserializers.go @@ -145,6 +145,11 @@ func awsRestjson1_deserializeOpHttpBindingsGetLatestConfigurationOutput(v *GetLa v.NextPollIntervalInSeconds = int32(vv) } + if headerValues := response.Header.Values("Version-Label"); len(headerValues) != 0 { + headerValues[0] = strings.TrimSpace(headerValues[0]) + v.VersionLabel = ptr.String(headerValues[0]) + } + return nil } func awsRestjson1_deserializeOpDocumentGetLatestConfigurationOutput(v *GetLatestConfigurationOutput, body io.ReadCloser, contentLength int64) error { diff --git a/service/appconfigdata/doc.go b/service/appconfigdata/doc.go index 7e4df98d432..1fd832cea7f 100644 --- a/service/appconfigdata/doc.go +++ b/service/appconfigdata/doc.go @@ -20,7 +20,10 @@ // // In response, AppConfig provides an // InitialConfigurationToken to be given to the session's client and used the first -// time it calls GetLatestConfiguration for that session. When calling +// time it calls GetLatestConfiguration for that session. This token should only be +// used once in your first call to GetLatestConfiguration. You must use the new +// token in the GetLatestConfiguration response (NextPollConfigurationToken) in +// each subsequent call to GetLatestConfiguration. When calling // GetLatestConfiguration, your client code sends the most recent // ConfigurationToken value it has and receives in response: // @@ -37,10 +40,13 @@ // latest data intended for the session. This may be empty if the client already // has the latest version of the configuration. // -// For more information and to view -// example CLI commands that show how to retrieve a configuration using the -// AppConfig Data StartConfigurationSession and GetLatestConfiguration API actions, -// see Receiving the configuration +// The InitialConfigurationToken and +// NextPollConfigurationToken should only be used once. To support long poll use +// cases, the tokens are valid for up to 24 hours. If a GetLatestConfiguration call +// uses an expired token, the system returns BadRequestException. For more +// information and to view example CLI commands that show how to retrieve a +// configuration using the AppConfig Data StartConfigurationSession and +// GetLatestConfiguration API actions, see Retrieving the configuration // (http://docs.aws.amazon.com/appconfig/latest/userguide/appconfig-retrieving-the-configuration) // in the AppConfig User Guide. package appconfigdata diff --git a/service/connectcampaigns/internal/endpoints/endpoints.go b/service/connectcampaigns/internal/endpoints/endpoints.go index 7fb82f771e8..ba539ee4383 100644 --- a/service/connectcampaigns/internal/endpoints/endpoints.go +++ b/service/connectcampaigns/internal/endpoints/endpoints.go @@ -138,6 +138,9 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ap-southeast-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-west-2", }: endpoints.Endpoint{}, diff --git a/service/sagemakerruntime/internal/endpoints/endpoints.go b/service/sagemakerruntime/internal/endpoints/endpoints.go index 9eb28369b60..59b52fb3790 100644 --- a/service/sagemakerruntime/internal/endpoints/endpoints.go +++ b/service/sagemakerruntime/internal/endpoints/endpoints.go @@ -391,6 +391,9 @@ var defaultPartitions = endpoints.Partitions{ RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "us-gov-east-1", + }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "us-gov-west-1", }: endpoints.Endpoint{}, diff --git a/service/snowball/api_op_CreateJob.go b/service/snowball/api_op_CreateJob.go index 0efc954eae8..cdfd6df1d4c 100644 --- a/service/snowball/api_op_CreateJob.go +++ b/service/snowball/api_op_CreateJob.go @@ -67,29 +67,21 @@ import ( // * Description: Snowball Edge Storage Optimized with EC2 // Compute // -// * Device type: V3_5C -// -// * Capacity: T32 -// -// * Description: Snowball Edge -// Compute Optimized without GPU -// // * Device type: STANDARD // // * Capacity: T50 // -// * -// Description: Original Snowball device This device is only available in the -// Ningxia, Beijing, and Singapore Amazon Web Services Region +// * Description: Original +// Snowball device This device is only available in the Ningxia, Beijing, and +// Singapore Amazon Web Services Region // -// * Device type: -// STANDARD +// * Device type: STANDARD // -// * Capacity: T80 +// * Capacity: +// T80 // -// * Description: Original Snowball device This device -// is only available in the Ningxia, Beijing, and Singapore Amazon Web Services -// Region. +// * Description: Original Snowball device This device is only available in +// the Ningxia, Beijing, and Singapore Amazon Web Services Region. func (c *Client) CreateJob(ctx context.Context, params *CreateJobInput, optFns ...func(*Options)) (*CreateJobOutput, error) { if params == nil { params = &CreateJobInput{} diff --git a/service/snowball/api_op_CreateLongTermPricing.go b/service/snowball/api_op_CreateLongTermPricing.go index 1a30acd8c05..ea7d12653e8 100644 --- a/service/snowball/api_op_CreateLongTermPricing.go +++ b/service/snowball/api_op_CreateLongTermPricing.go @@ -37,8 +37,8 @@ type CreateLongTermPricingInput struct { // This member is required. LongTermPricingType types.LongTermPricingType - // snowballty Specifies whether the current long-term pricing type for the device - // should be renewed. + // Specifies whether the current long-term pricing type for the device should be + // renewed. IsLongTermPricingAutoRenew *bool // The type of Snow Family devices to use for the long-term pricing job. diff --git a/service/snowball/api_op_ListServiceVersions.go b/service/snowball/api_op_ListServiceVersions.go new file mode 100644 index 00000000000..1a6dd5d1ac2 --- /dev/null +++ b/service/snowball/api_op_ListServiceVersions.go @@ -0,0 +1,148 @@ +// Code generated by smithy-go-codegen DO NOT EDIT. + +package snowball + +import ( + "context" + awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" + "github.com/aws/aws-sdk-go-v2/aws/signer/v4" + "github.com/aws/aws-sdk-go-v2/service/snowball/types" + "github.com/aws/smithy-go/middleware" + smithyhttp "github.com/aws/smithy-go/transport/http" +) + +// Lists all supported versions for Snow on-device services. Returns an array of +// ServiceVersion object containing the supported versions for a particular +// service. +func (c *Client) ListServiceVersions(ctx context.Context, params *ListServiceVersionsInput, optFns ...func(*Options)) (*ListServiceVersionsOutput, error) { + if params == nil { + params = &ListServiceVersionsInput{} + } + + result, metadata, err := c.invokeOperation(ctx, "ListServiceVersions", params, optFns, c.addOperationListServiceVersionsMiddlewares) + if err != nil { + return nil, err + } + + out := result.(*ListServiceVersionsOutput) + out.ResultMetadata = metadata + return out, nil +} + +type ListServiceVersionsInput struct { + + // The name of the service for which you're requesting supported versions. + // + // This member is required. + ServiceName types.ServiceName + + // A list of names and versions of dependant services of the requested service. + DependentServices []types.DependentService + + // The maximum number of ListServiceVersions objects to return. + MaxResults *int32 + + // Because HTTP requests are stateless, this is the starting point for the next + // list of returned ListServiceVersionsRequest versions. + NextToken *string + + noSmithyDocumentSerde +} + +type ListServiceVersionsOutput struct { + + // The name of the service for which the system provided supported versions. + // + // This member is required. + ServiceName types.ServiceName + + // A list of supported versions. + // + // This member is required. + ServiceVersions []types.ServiceVersion + + // A list of names and versions of dependant services of the service for which the + // system provided supported versions. + DependentServices []types.DependentService + + // Because HTTP requests are stateless, this is the starting point of the next list + // of returned ListServiceVersionsResult results. + NextToken *string + + // Metadata pertaining to the operation's result. + ResultMetadata middleware.Metadata + + noSmithyDocumentSerde +} + +func (c *Client) addOperationListServiceVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) { + err = stack.Serialize.Add(&awsAwsjson11_serializeOpListServiceVersions{}, middleware.After) + if err != nil { + return err + } + err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListServiceVersions{}, middleware.After) + if err != nil { + return err + } + if err = addSetLoggerMiddleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { + return err + } + if err = addResolveEndpointMiddleware(stack, options); err != nil { + return err + } + if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { + return err + } + if err = addRetryMiddlewares(stack, options); err != nil { + return err + } + if err = addHTTPSignerV4Middleware(stack, options); err != nil { + return err + } + if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { + return err + } + if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { + return err + } + if err = addClientUserAgent(stack); err != nil { + return err + } + if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { + return err + } + if err = addOpListServiceVersionsValidationMiddleware(stack); err != nil { + return err + } + if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListServiceVersions(options.Region), middleware.Before); 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 + } + return nil +} + +func newServiceMetadataMiddleware_opListServiceVersions(region string) *awsmiddleware.RegisterServiceMetadata { + return &awsmiddleware.RegisterServiceMetadata{ + Region: region, + ServiceID: ServiceID, + SigningName: "snowball", + OperationName: "ListServiceVersions", + } +} diff --git a/service/snowball/deserializers.go b/service/snowball/deserializers.go index 3b27a44ec11..0d34c41a0dc 100644 --- a/service/snowball/deserializers.go +++ b/service/snowball/deserializers.go @@ -2422,6 +2422,120 @@ func awsAwsjson11_deserializeOpErrorListLongTermPricing(response *smithyhttp.Res } } +type awsAwsjson11_deserializeOpListServiceVersions struct { +} + +func (*awsAwsjson11_deserializeOpListServiceVersions) ID() string { + return "OperationDeserializer" +} + +func (m *awsAwsjson11_deserializeOpListServiceVersions) 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, awsAwsjson11_deserializeOpErrorListServiceVersions(response, &metadata) + } + output := &ListServiceVersionsOutput{} + 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 = awsAwsjson11_deserializeOpDocumentListServiceVersionsOutput(&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 awsAwsjson11_deserializeOpErrorListServiceVersions(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 + + code := response.Header.Get("X-Amzn-ErrorType") + if len(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + code, 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(code) != 0 { + errorCode = restjson.SanitizeErrorCode(code) + } + if len(message) != 0 { + errorMessage = message + } + + switch { + case strings.EqualFold("InvalidNextTokenException", errorCode): + return awsAwsjson11_deserializeErrorInvalidNextTokenException(response, errorBody) + + case strings.EqualFold("InvalidResourceException", errorCode): + return awsAwsjson11_deserializeErrorInvalidResourceException(response, errorBody) + + default: + genericError := &smithy.GenericAPIError{ + Code: errorCode, + Message: errorMessage, + } + return genericError + + } +} + type awsAwsjson11_deserializeOpUpdateCluster struct { } @@ -3992,6 +4106,85 @@ func awsAwsjson11_deserializeDocumentDataTransfer(v **types.DataTransfer, value return nil } +func awsAwsjson11_deserializeDocumentDependentService(v **types.DependentService, 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.DependentService + if *v == nil { + sv = &types.DependentService{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "ServiceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) + } + sv.ServiceName = types.ServiceName(jtv) + } + + case "ServiceVersion": + if err := awsAwsjson11_deserializeDocumentServiceVersion(&sv.ServiceVersion, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentDependentServiceList(v *[]types.DependentService, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.DependentService + if *v == nil { + cv = []types.DependentService{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.DependentService + destAddr := &col + if err := awsAwsjson11_deserializeDocumentDependentService(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentDeviceConfiguration(v **types.DeviceConfiguration, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -4151,6 +4344,55 @@ func awsAwsjson11_deserializeDocumentEc2RequestFailedException(v **types.Ec2Requ return nil } +func awsAwsjson11_deserializeDocumentEKSOnDeviceServiceConfiguration(v **types.EKSOnDeviceServiceConfiguration, 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.EKSOnDeviceServiceConfiguration + if *v == nil { + sv = &types.EKSOnDeviceServiceConfiguration{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "EKSAnywhereVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.EKSAnywhereVersion = ptr.String(jtv) + } + + case "KubernetesVersion": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.KubernetesVersion = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentEventTriggerDefinition(v **types.EventTriggerDefinition, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -5485,6 +5727,11 @@ func awsAwsjson11_deserializeDocumentOnDeviceServiceConfiguration(v **types.OnDe for key, value := range shape { switch key { + case "EKSOnDeviceService": + if err := awsAwsjson11_deserializeDocumentEKSOnDeviceServiceConfiguration(&sv.EKSOnDeviceService, value); err != nil { + return err + } + case "NFSOnDeviceService": if err := awsAwsjson11_deserializeDocumentNFSOnDeviceServiceConfiguration(&sv.NFSOnDeviceService, value); err != nil { return err @@ -5628,6 +5875,80 @@ func awsAwsjson11_deserializeDocumentS3ResourceList(v *[]types.S3Resource, value return nil } +func awsAwsjson11_deserializeDocumentServiceVersion(v **types.ServiceVersion, 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.ServiceVersion + if *v == nil { + sv = &types.ServiceVersion{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Version": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.Version = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentServiceVersionList(v *[]types.ServiceVersion, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.ServiceVersion + if *v == nil { + cv = []types.ServiceVersion{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.ServiceVersion + destAddr := &col + if err := awsAwsjson11_deserializeDocumentServiceVersion(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentShipment(v **types.Shipment, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -6902,6 +7223,65 @@ func awsAwsjson11_deserializeOpDocumentListLongTermPricingOutput(v **ListLongTer return nil } +func awsAwsjson11_deserializeOpDocumentListServiceVersionsOutput(v **ListServiceVersionsOutput, 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 *ListServiceVersionsOutput + if *v == nil { + sv = &ListServiceVersionsOutput{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "DependentServices": + if err := awsAwsjson11_deserializeDocumentDependentServiceList(&sv.DependentServices, value); err != nil { + return err + } + + case "NextToken": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected String to be of type string, got %T instead", value) + } + sv.NextToken = ptr.String(jtv) + } + + case "ServiceName": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ServiceName to be of type string, got %T instead", value) + } + sv.ServiceName = types.ServiceName(jtv) + } + + case "ServiceVersions": + if err := awsAwsjson11_deserializeDocumentServiceVersionList(&sv.ServiceVersions, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeOpDocumentUpdateClusterOutput(v **UpdateClusterOutput, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/snowball/generated.json b/service/snowball/generated.json index 0b58c0901e8..63f80307bf0 100644 --- a/service/snowball/generated.json +++ b/service/snowball/generated.json @@ -29,6 +29,7 @@ "api_op_ListCompatibleImages.go", "api_op_ListJobs.go", "api_op_ListLongTermPricing.go", + "api_op_ListServiceVersions.go", "api_op_UpdateCluster.go", "api_op_UpdateJob.go", "api_op_UpdateJobShipmentState.go", diff --git a/service/snowball/serializers.go b/service/snowball/serializers.go index d61f4222963..46c30e1e1d9 100644 --- a/service/snowball/serializers.go +++ b/service/snowball/serializers.go @@ -1170,6 +1170,61 @@ func (m *awsAwsjson11_serializeOpListLongTermPricing) HandleSerialize(ctx contex return next.HandleSerialize(ctx, in) } +type awsAwsjson11_serializeOpListServiceVersions struct { +} + +func (*awsAwsjson11_serializeOpListServiceVersions) ID() string { + return "OperationSerializer" +} + +func (m *awsAwsjson11_serializeOpListServiceVersions) 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.(*ListServiceVersionsInput) + _ = 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.1") + httpBindingEncoder.SetHeader("X-Amz-Target").String("AWSIESnowballJobManagementService.ListServiceVersions") + + jsonEncoder := smithyjson.NewEncoder() + if err := awsAwsjson11_serializeOpDocumentListServiceVersionsInput(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 awsAwsjson11_serializeOpUpdateCluster struct { } @@ -1466,6 +1521,38 @@ func awsAwsjson11_serializeDocumentAddress(v *types.Address, value smithyjson.Va return nil } +func awsAwsjson11_serializeDocumentDependentService(v *types.DependentService, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if len(v.ServiceName) > 0 { + ok := object.Key("ServiceName") + ok.String(string(v.ServiceName)) + } + + if v.ServiceVersion != nil { + ok := object.Key("ServiceVersion") + if err := awsAwsjson11_serializeDocumentServiceVersion(v.ServiceVersion, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentDependentServiceList(v []types.DependentService, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsAwsjson11_serializeDocumentDependentService(&v[i], av); err != nil { + return err + } + } + return nil +} + func awsAwsjson11_serializeDocumentDeviceConfiguration(v *types.DeviceConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1510,6 +1597,23 @@ func awsAwsjson11_serializeDocumentEc2AmiResourceList(v []types.Ec2AmiResource, return nil } +func awsAwsjson11_serializeDocumentEKSOnDeviceServiceConfiguration(v *types.EKSOnDeviceServiceConfiguration, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.EKSAnywhereVersion != nil { + ok := object.Key("EKSAnywhereVersion") + ok.String(*v.EKSAnywhereVersion) + } + + if v.KubernetesVersion != nil { + ok := object.Key("KubernetesVersion") + ok.String(*v.KubernetesVersion) + } + + return nil +} + func awsAwsjson11_serializeDocumentEventTriggerDefinition(v *types.EventTriggerDefinition, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -1680,6 +1784,13 @@ func awsAwsjson11_serializeDocumentOnDeviceServiceConfiguration(v *types.OnDevic object := value.Object() defer object.Close() + if v.EKSOnDeviceService != nil { + ok := object.Key("EKSOnDeviceService") + if err := awsAwsjson11_serializeDocumentEKSOnDeviceServiceConfiguration(v.EKSOnDeviceService, ok); err != nil { + return err + } + } + if v.NFSOnDeviceService != nil { ok := object.Key("NFSOnDeviceService") if err := awsAwsjson11_serializeDocumentNFSOnDeviceServiceConfiguration(v.NFSOnDeviceService, ok); err != nil { @@ -1736,6 +1847,18 @@ func awsAwsjson11_serializeDocumentS3ResourceList(v []types.S3Resource, value sm return nil } +func awsAwsjson11_serializeDocumentServiceVersion(v *types.ServiceVersion, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Version != nil { + ok := object.Key("Version") + ok.String(*v.Version) + } + + return nil +} + func awsAwsjson11_serializeDocumentSnowconeDeviceConfiguration(v *types.SnowconeDeviceConfiguration, value smithyjson.Value) error { object := value.Object() defer object.Close() @@ -2280,6 +2403,35 @@ func awsAwsjson11_serializeOpDocumentListLongTermPricingInput(v *ListLongTermPri return nil } +func awsAwsjson11_serializeOpDocumentListServiceVersionsInput(v *ListServiceVersionsInput, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.DependentServices != nil { + ok := object.Key("DependentServices") + if err := awsAwsjson11_serializeDocumentDependentServiceList(v.DependentServices, ok); err != nil { + return err + } + } + + if v.MaxResults != nil { + ok := object.Key("MaxResults") + ok.Integer(*v.MaxResults) + } + + if v.NextToken != nil { + ok := object.Key("NextToken") + ok.String(*v.NextToken) + } + + if len(v.ServiceName) > 0 { + ok := object.Key("ServiceName") + ok.String(string(v.ServiceName)) + } + + return nil +} + func awsAwsjson11_serializeOpDocumentUpdateClusterInput(v *UpdateClusterInput, value smithyjson.Value) error { object := value.Object() defer object.Close() diff --git a/service/snowball/types/enums.go b/service/snowball/types/enums.go index 0625218643f..1200c41ef61 100644 --- a/service/snowball/types/enums.go +++ b/service/snowball/types/enums.go @@ -140,6 +140,24 @@ func (RemoteManagement) Values() []RemoteManagement { } } +type ServiceName string + +// Enum values for ServiceName +const ( + ServiceNameKubernetes ServiceName = "KUBERNETES" + ServiceNameEksAnywhere ServiceName = "EKS_ANYWHERE" +) + +// Values returns all known values for ServiceName. Note that this can be expanded +// in the future, and so it is only as up to date as the client. The ordering of +// this slice is not guaranteed to be stable across updates. +func (ServiceName) Values() []ServiceName { + return []ServiceName{ + "KUBERNETES", + "EKS_ANYWHERE", + } +} + type ShipmentState string // Enum values for ShipmentState @@ -213,8 +231,8 @@ const ( SnowballCapacityT98 SnowballCapacity = "T98" SnowballCapacityT8 SnowballCapacity = "T8" SnowballCapacityT14 SnowballCapacity = "T14" - SnowballCapacityNoPreference SnowballCapacity = "NoPreference" SnowballCapacityT32 SnowballCapacity = "T32" + SnowballCapacityNoPreference SnowballCapacity = "NoPreference" ) // Values returns all known values for SnowballCapacity. Note that this can be @@ -229,8 +247,8 @@ func (SnowballCapacity) Values() []SnowballCapacity { "T98", "T8", "T14", - "NoPreference", "T32", + "NoPreference", } } diff --git a/service/snowball/types/types.go b/service/snowball/types/types.go index 93034ff8cc8..2970b07ef74 100644 --- a/service/snowball/types/types.go +++ b/service/snowball/types/types.go @@ -201,6 +201,18 @@ type DataTransfer struct { noSmithyDocumentSerde } +// The name and version of the service dependant on the requested service. +type DependentService struct { + + // The name of the dependent service. + ServiceName ServiceName + + // The version of the dependent service. + ServiceVersion *ServiceVersion + + noSmithyDocumentSerde +} + // The container for SnowconeDeviceConfiguration. type DeviceConfiguration struct { @@ -227,6 +239,19 @@ type Ec2AmiResource struct { noSmithyDocumentSerde } +// An object representing the metadata and configuration settings of EKS Anywhere +// on the Snow Family device. +type EKSOnDeviceServiceConfiguration struct { + + // The version of EKS Anywhere on the Snow Family device. + EKSAnywhereVersion *string + + // The Kubernetes version for EKS Anywhere on the Snow Family device. + KubernetesVersion *string + + noSmithyDocumentSerde +} + // The container for the EventTriggerDefinition$EventResourceARN. type EventTriggerDefinition struct { @@ -543,6 +568,9 @@ type Notification struct { // on an Amazon Web Services Snow Family device. type OnDeviceServiceConfiguration struct { + // The configuration of EKS Anywhere on the Snow Family device. + EKSOnDeviceService *EKSOnDeviceServiceConfiguration + // Represents the NFS (Network File System) service on a Snow Family device. NFSOnDeviceService *NFSOnDeviceServiceConfiguration @@ -577,6 +605,15 @@ type S3Resource struct { noSmithyDocumentSerde } +// The version of the requested service. +type ServiceVersion struct { + + // The version number of the requested service. + Version *string + + noSmithyDocumentSerde +} + // The Status and TrackingNumber information for an inbound or outbound shipment. type Shipment struct { diff --git a/service/snowball/validators.go b/service/snowball/validators.go index db11acc2447..8b7505fd8f3 100644 --- a/service/snowball/validators.go +++ b/service/snowball/validators.go @@ -310,6 +310,26 @@ func (m *validateOpListClusterJobs) HandleInitialize(ctx context.Context, in mid return next.HandleInitialize(ctx, in) } +type validateOpListServiceVersions struct { +} + +func (*validateOpListServiceVersions) ID() string { + return "OperationInputValidation" +} + +func (m *validateOpListServiceVersions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( + out middleware.InitializeOutput, metadata middleware.Metadata, err error, +) { + input, ok := in.Parameters.(*ListServiceVersionsInput) + if !ok { + return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) + } + if err := validateOpListServiceVersionsInput(input); err != nil { + return out, metadata, err + } + return next.HandleInitialize(ctx, in) +} + type validateOpUpdateCluster struct { } @@ -450,6 +470,10 @@ func addOpListClusterJobsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListClusterJobs{}, middleware.After) } +func addOpListServiceVersionsValidationMiddleware(stack *middleware.Stack) error { + return stack.Initialize.Add(&validateOpListServiceVersions{}, middleware.After) +} + func addOpUpdateClusterValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpUpdateCluster{}, middleware.After) } @@ -761,6 +785,21 @@ func validateOpListClusterJobsInput(v *ListClusterJobsInput) error { } } +func validateOpListServiceVersionsInput(v *ListServiceVersionsInput) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "ListServiceVersionsInput"} + if len(v.ServiceName) == 0 { + invalidParams.Add(smithy.NewErrParamRequired("ServiceName")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + func validateOpUpdateClusterInput(v *UpdateClusterInput) error { if v == nil { return nil