repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // This action uses the encryption subresource to configure default encryption and // Amazon S3 Bucket Keys for an existing bucket. By default, all buckets have a // default encryption configuration that uses server-side encryption with Amazon S3 // managed keys (SSE-S3). You can optionally configure default encryption for a // bucket by using server-side encryption with Key Management Service (KMS) keys // (SSE-KMS), dual-layer server-side encryption with Amazon Web Services KMS keys // (DSSE-KMS), or server-side encryption with customer-provided keys (SSE-C). If // you specify default encryption by using SSE-KMS, you can also configure Amazon // S3 Bucket Keys. For information about bucket default encryption, see Amazon S3 // bucket default encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) // in the Amazon S3 User Guide. For more information about S3 Bucket Keys, see // Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) // in the Amazon S3 User Guide. This action requires Amazon Web Services Signature // Version 4. For more information, see Authenticating Requests (Amazon Web // Services Signature Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html) // . To use this operation, you must have permission to perform the // s3:PutEncryptionConfiguration action. The bucket owner has this permission by // default. The bucket owner can grant this permission to others. For more // information about permissions, see Permissions Related to Bucket Subresource // Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // in the Amazon S3 User Guide. The following operations are related to // PutBucketEncryption : // - GetBucketEncryption (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketEncryption.html) // - DeleteBucketEncryption (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketEncryption.html) func (c *Client) PutBucketEncryption(ctx context.Context, params *PutBucketEncryptionInput, optFns ...func(*Options)) (*PutBucketEncryptionOutput, error) { if params == nil { params = &PutBucketEncryptionInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketEncryption", params, optFns, c.addOperationPutBucketEncryptionMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketEncryptionOutput) out.ResultMetadata = metadata return out, nil } type PutBucketEncryptionInput struct { // Specifies default encryption for a bucket using server-side encryption with // different key options. By default, all buckets have a default encryption // configuration that uses server-side encryption with Amazon S3 managed keys // (SSE-S3). You can optionally configure default encryption for a bucket by using // server-side encryption with an Amazon Web Services KMS key (SSE-KMS) or a // customer-provided key (SSE-C). For information about the bucket default // encryption feature, see Amazon S3 Bucket Default Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Specifies the default server-side-encryption configuration. // // This member is required. ServerSideEncryptionConfiguration *types.ServerSideEncryptionConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the server-side encryption // configuration. For requests made using the Amazon Web Services Command Line // Interface (CLI) or Amazon Web Services SDKs, this field is calculated // automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketEncryptionOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketEncryptionMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketEncryption{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketEncryption{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketEncryptionValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketEncryption(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketEncryptionInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketEncryptionUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketEncryption(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketEncryption", } } // getPutBucketEncryptionRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutBucketEncryptionRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketEncryptionInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketEncryptionInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketEncryptionRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketEncryptionBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutBucketEncryptionBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketEncryptionInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketEncryptionUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketEncryptionBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
241
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Puts a S3 Intelligent-Tiering configuration to the specified bucket. You can // have up to 1,000 S3 Intelligent-Tiering configurations per bucket. The S3 // Intelligent-Tiering storage class is designed to optimize storage costs by // automatically moving data to the most cost-effective storage access tier, // without performance impact or operational overhead. S3 Intelligent-Tiering // delivers automatic cost savings in three low latency and high throughput access // tiers. To get the lowest storage cost on data that can be accessed in minutes to // hours, you can choose to activate additional archiving capabilities. The S3 // Intelligent-Tiering storage class is the ideal storage class for data with // unknown, changing, or unpredictable access patterns, independent of object size // or retention period. If the size of an object is less than 128 KB, it is not // monitored and not eligible for auto-tiering. Smaller objects can be stored, but // they are always charged at the Frequent Access tier rates in the S3 // Intelligent-Tiering storage class. For more information, see Storage class for // automatically optimizing frequently and infrequently accessed objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html#sc-dynamic-data-access) // . Operations related to PutBucketIntelligentTieringConfiguration include: // - DeleteBucketIntelligentTieringConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketIntelligentTieringConfiguration.html) // - GetBucketIntelligentTieringConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketIntelligentTieringConfiguration.html) // - ListBucketIntelligentTieringConfigurations (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketIntelligentTieringConfigurations.html) // // You only need S3 Intelligent-Tiering enabled on a bucket if you want to // automatically move objects stored in the S3 Intelligent-Tiering storage class to // the Archive Access or Deep Archive Access tier. // PutBucketIntelligentTieringConfiguration has the following special errors: HTTP // 400 Bad Request Error Code: InvalidArgument Cause: Invalid Argument HTTP 400 Bad // Request Error Code: TooManyConfigurations Cause: You are attempting to create a // new configuration but have already reached the 1,000-configuration limit. HTTP // 403 Forbidden Error Cause: You are not the owner of the specified bucket, or you // do not have the s3:PutIntelligentTieringConfiguration bucket permission to set // the configuration on the bucket. func (c *Client) PutBucketIntelligentTieringConfiguration(ctx context.Context, params *PutBucketIntelligentTieringConfigurationInput, optFns ...func(*Options)) (*PutBucketIntelligentTieringConfigurationOutput, error) { if params == nil { params = &PutBucketIntelligentTieringConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketIntelligentTieringConfiguration", params, optFns, c.addOperationPutBucketIntelligentTieringConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketIntelligentTieringConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketIntelligentTieringConfigurationInput struct { // The name of the Amazon S3 bucket whose configuration you want to modify or // retrieve. // // This member is required. Bucket *string // The ID used to identify the S3 Intelligent-Tiering configuration. // // This member is required. Id *string // Container for S3 Intelligent-Tiering configuration. // // This member is required. IntelligentTieringConfiguration *types.IntelligentTieringConfiguration noSmithyDocumentSerde } type PutBucketIntelligentTieringConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketIntelligentTieringConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketIntelligentTieringConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketIntelligentTieringConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketIntelligentTieringConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketIntelligentTieringConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketIntelligentTieringConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketIntelligentTieringConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketIntelligentTieringConfiguration", } } // getPutBucketIntelligentTieringConfigurationBucketMember returns a pointer to // string denoting a provided bucket member valueand a boolean indicating if the // input has a modeled bucket name, func getPutBucketIntelligentTieringConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketIntelligentTieringConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketIntelligentTieringConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketIntelligentTieringConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
200
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // This implementation of the PUT action adds an inventory configuration // (identified by the inventory ID) to the bucket. You can have up to 1,000 // inventory configurations per bucket. Amazon S3 inventory generates inventories // of the objects in the bucket on a daily or weekly basis, and the results are // published to a flat file. The bucket that is inventoried is called the source // bucket, and the bucket where the inventory flat file is stored is called the // destination bucket. The destination bucket must be in the same Amazon Web // Services Region as the source bucket. When you configure an inventory for a // source bucket, you specify the destination bucket where you want the inventory // to be stored, and whether to generate the inventory daily or weekly. You can // also configure what object metadata to include and whether to inventory all // object versions or only current versions. For more information, see Amazon S3 // Inventory (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) // in the Amazon S3 User Guide. You must create a bucket policy on the destination // bucket to grant permissions to Amazon S3 to write objects to the bucket in the // defined location. For an example policy, see Granting Permissions for Amazon S3 // Inventory and Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-9) // . Permissions To use this operation, you must have permission to perform the // s3:PutInventoryConfiguration action. The bucket owner has this permission by // default and can grant this permission to others. The // s3:PutInventoryConfiguration permission allows a user to create an S3 Inventory (https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html) // report that includes all object metadata fields available and to specify the // destination bucket to store the inventory. A user with read access to objects in // the destination bucket can also access all object metadata fields that are // available in the inventory report. To restrict access to an inventory report, // see Restricting access to an Amazon S3 Inventory report (https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html#example-bucket-policies-use-case-10) // in the Amazon S3 User Guide. For more information about the metadata fields // available in S3 Inventory, see Amazon S3 Inventory lists (https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-inventory.html#storage-inventory-contents) // in the Amazon S3 User Guide. For more information about permissions, see // Permissions related to bucket subresource operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Identity and access management in Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // in the Amazon S3 User Guide. PutBucketInventoryConfiguration has the following // special errors: HTTP 400 Bad Request Error Code: InvalidArgument Cause: Invalid // Argument HTTP 400 Bad Request Error Code: TooManyConfigurations Cause: You are // attempting to create a new configuration but have already reached the // 1,000-configuration limit. HTTP 403 Forbidden Error Cause: You are not the owner // of the specified bucket, or you do not have the s3:PutInventoryConfiguration // bucket permission to set the configuration on the bucket. The following // operations are related to PutBucketInventoryConfiguration : // - GetBucketInventoryConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketInventoryConfiguration.html) // - DeleteBucketInventoryConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketInventoryConfiguration.html) // - ListBucketInventoryConfigurations (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketInventoryConfigurations.html) func (c *Client) PutBucketInventoryConfiguration(ctx context.Context, params *PutBucketInventoryConfigurationInput, optFns ...func(*Options)) (*PutBucketInventoryConfigurationOutput, error) { if params == nil { params = &PutBucketInventoryConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketInventoryConfiguration", params, optFns, c.addOperationPutBucketInventoryConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketInventoryConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketInventoryConfigurationInput struct { // The name of the bucket where the inventory configuration will be stored. // // This member is required. Bucket *string // The ID used to identify the inventory configuration. // // This member is required. Id *string // Specifies the inventory configuration. // // This member is required. InventoryConfiguration *types.InventoryConfiguration // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketInventoryConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketInventoryConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketInventoryConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketInventoryConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketInventoryConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketInventoryConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketInventoryConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketInventoryConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketInventoryConfiguration", } } // getPutBucketInventoryConfigurationBucketMember returns a pointer to string // denoting a provided bucket member valueand a boolean indicating if the input has // a modeled bucket name, func getPutBucketInventoryConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketInventoryConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketInventoryConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketInventoryConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
216
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Creates a new lifecycle configuration for the bucket or replaces an existing // lifecycle configuration. Keep in mind that this will overwrite an existing // lifecycle configuration, so if you want to retain any configuration details, // they must be included in the new lifecycle configuration. For information about // lifecycle configuration, see Managing your storage lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) // . Bucket lifecycle configuration now supports specifying a lifecycle rule using // an object key name prefix, one or more object tags, or a combination of both. // Accordingly, this section describes the latest API. The previous version of the // API supported filtering based only on an object key name prefix, which is // supported for backward compatibility. For the related API description, see // PutBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html) // . Rules You specify the lifecycle configuration in your request body. The // lifecycle configuration is specified as XML consisting of one or more rules. An // Amazon S3 Lifecycle configuration can have up to 1,000 rules. This limit is not // adjustable. Each rule consists of the following: // // - A filter identifying a subset of objects to which the rule applies. The // filter can be based on a key name prefix, object tags, or a combination of both. // // - A status indicating whether the rule is in effect. // // - One or more lifecycle transition and expiration actions that you want // Amazon S3 to perform on the objects identified by the filter. If the state of // your bucket is versioning-enabled or versioning-suspended, you can have many // versions of the same object (one current version and zero or more noncurrent // versions). Amazon S3 provides predefined actions that you can specify for // current and noncurrent object versions. // // For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) // and Lifecycle Configuration Elements (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html) // . Permissions By default, all Amazon S3 resources are private, including // buckets, objects, and related subresources (for example, lifecycle configuration // and website configuration). Only the resource owner (that is, the Amazon Web // Services account that created it) can access the resource. The resource owner // can optionally grant access permissions to others by writing an access policy. // For this operation, a user must get the s3:PutLifecycleConfiguration // permission. You can also explicitly deny permissions. An explicit deny also // supersedes any other permissions. If you want to block users or accounts from // removing or deleting objects from your bucket, you must deny them permissions // for the following actions: // - s3:DeleteObject // - s3:DeleteObjectVersion // - s3:PutLifecycleConfiguration // // For more information about permissions, see Managing Access Permissions to Your // Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // . The following operations are related to PutBucketLifecycleConfiguration : // - Examples of Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-configuration-examples.html) // - GetBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycleConfiguration.html) // - DeleteBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketLifecycle.html) func (c *Client) PutBucketLifecycleConfiguration(ctx context.Context, params *PutBucketLifecycleConfigurationInput, optFns ...func(*Options)) (*PutBucketLifecycleConfigurationOutput, error) { if params == nil { params = &PutBucketLifecycleConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketLifecycleConfiguration", params, optFns, c.addOperationPutBucketLifecycleConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketLifecycleConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketLifecycleConfigurationInput struct { // The name of the bucket for which to set the configuration. // // This member is required. Bucket *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Container for lifecycle rules. You can add as many as 1,000 rules. LifecycleConfiguration *types.BucketLifecycleConfiguration noSmithyDocumentSerde } type PutBucketLifecycleConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketLifecycleConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketLifecycleConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketLifecycleConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketLifecycleConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketLifecycleConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketLifecycleConfigurationInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketLifecycleConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketLifecycleConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketLifecycleConfiguration", } } // getPutBucketLifecycleConfigurationRequestAlgorithmMember gets the request // checksum algorithm value provided as input. func getPutBucketLifecycleConfigurationRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketLifecycleConfigurationInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketLifecycleConfigurationInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketLifecycleConfigurationRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketLifecycleConfigurationBucketMember returns a pointer to string // denoting a provided bucket member valueand a boolean indicating if the input has // a modeled bucket name, func getPutBucketLifecycleConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketLifecycleConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketLifecycleConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketLifecycleConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
251
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Set the logging parameters for a bucket and to specify permissions for who can // view and modify the logging parameters. All logs are saved to buckets in the // same Amazon Web Services Region as the source bucket. To set the logging status // of a bucket, you must be the bucket owner. The bucket owner is automatically // granted FULL_CONTROL to all logs. You use the Grantee request element to grant // access to other people. The Permissions request element specifies the kind of // access the grantee has to the logs. If the target bucket for log delivery uses // the bucket owner enforced setting for S3 Object Ownership, you can't use the // Grantee request element to grant access to others. Permissions can only be // granted using policies. For more information, see Permissions for server access // log delivery (https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general) // in the Amazon S3 User Guide. Grantee Values You can specify the person (grantee) // to whom you're assigning access rights (by using request elements) in the // following ways: // - By the person's ID: <>ID<><>GranteesEmail<> DisplayName is optional and // ignored in the request. // - By Email address: <>[email protected]<> The grantee is resolved to the // CanonicalUser and, in a response to a GETObjectAcl request, appears as the // CanonicalUser. // - By URI: <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<> // // To enable logging, you use LoggingEnabled and its children request elements. To // disable logging, you use an empty BucketLoggingStatus request element: For // more information about server access logging, see Server Access Logging (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerLogs.html) // in the Amazon S3 User Guide. For more information about creating a bucket, see // CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // . For more information about returning the logging status of a bucket, see // GetBucketLogging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLogging.html) // . The following operations are related to PutBucketLogging : // - PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) // - DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html) // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // - GetBucketLogging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLogging.html) func (c *Client) PutBucketLogging(ctx context.Context, params *PutBucketLoggingInput, optFns ...func(*Options)) (*PutBucketLoggingOutput, error) { if params == nil { params = &PutBucketLoggingInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketLogging", params, optFns, c.addOperationPutBucketLoggingMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketLoggingOutput) out.ResultMetadata = metadata return out, nil } type PutBucketLoggingInput struct { // The name of the bucket for which to set the logging parameters. // // This member is required. Bucket *string // Container for logging status information. // // This member is required. BucketLoggingStatus *types.BucketLoggingStatus // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash of the PutBucketLogging request body. For requests made using the // Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, // this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketLoggingOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketLoggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketLogging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketLogging{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketLoggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketLogging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketLoggingInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketLoggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketLogging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketLogging", } } // getPutBucketLoggingRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutBucketLoggingRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketLoggingInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketLoggingInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketLoggingRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketLoggingBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutBucketLoggingBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketLoggingInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketLoggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketLoggingBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
241
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets a metrics configuration (specified by the metrics configuration ID) for // the bucket. You can have up to 1,000 metrics configurations per bucket. If // you're updating an existing metrics configuration, note that this is a full // replacement of the existing metrics configuration. If you don't include the // elements you want to keep, they are erased. To use this operation, you must have // permissions to perform the s3:PutMetricsConfiguration action. The bucket owner // has this permission by default. The bucket owner can grant this permission to // others. For more information about permissions, see Permissions Related to // Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // . For information about CloudWatch request metrics for Amazon S3, see // Monitoring Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html) // . The following operations are related to PutBucketMetricsConfiguration : // - DeleteBucketMetricsConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetricsConfiguration.html) // - GetBucketMetricsConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketMetricsConfiguration.html) // - ListBucketMetricsConfigurations (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketMetricsConfigurations.html) // // PutBucketMetricsConfiguration has the following special error: // - Error code: TooManyConfigurations // - Description: You are attempting to create a new configuration but have // already reached the 1,000-configuration limit. // - HTTP Status Code: HTTP 400 Bad Request func (c *Client) PutBucketMetricsConfiguration(ctx context.Context, params *PutBucketMetricsConfigurationInput, optFns ...func(*Options)) (*PutBucketMetricsConfigurationOutput, error) { if params == nil { params = &PutBucketMetricsConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketMetricsConfiguration", params, optFns, c.addOperationPutBucketMetricsConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketMetricsConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketMetricsConfigurationInput struct { // The name of the bucket for which the metrics configuration is set. // // This member is required. Bucket *string // The ID used to identify the metrics configuration. The ID has a 64 character // limit and can only contain letters, numbers, periods, dashes, and underscores. // // This member is required. Id *string // Specifies the metrics configuration. // // This member is required. MetricsConfiguration *types.MetricsConfiguration // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketMetricsConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketMetricsConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketMetricsConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketMetricsConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketMetricsConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketMetricsConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketMetricsConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketMetricsConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketMetricsConfiguration", } } // getPutBucketMetricsConfigurationBucketMember returns a pointer to string // denoting a provided bucket member valueand a boolean indicating if the input has // a modeled bucket name, func getPutBucketMetricsConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketMetricsConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketMetricsConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketMetricsConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
197
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Enables notifications of specified events for a bucket. For more information // about event notifications, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // . Using this API, you can replace an existing notification configuration. The // configuration is an XML file that defines the event types that you want Amazon // S3 to publish and the destination where you want Amazon S3 to publish an event // notification when it detects an event of the specified type. By default, your // bucket has no event notifications configured. That is, the notification // configuration will be an empty NotificationConfiguration . This action // replaces the existing notification configuration with the configuration you // include in the request body. After Amazon S3 receives this request, it first // verifies that any Amazon Simple Notification Service (Amazon SNS) or Amazon // Simple Queue Service (Amazon SQS) destination exists, and that the bucket owner // has permission to publish to it by sending a test notification. In the case of // Lambda destinations, Amazon S3 verifies that the Lambda function permissions // grant Amazon S3 permission to invoke the function from the Amazon S3 bucket. For // more information, see Configuring Notifications for Amazon S3 Events (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // . You can disable notifications by adding the empty NotificationConfiguration // element. For more information about the number of event notification // configurations that you can create per bucket, see Amazon S3 service quotas (https://docs.aws.amazon.com/general/latest/gr/s3.html#limits_s3) // in Amazon Web Services General Reference. By default, only the bucket owner can // configure notifications on a bucket. However, bucket owners can use a bucket // policy to grant permission to other users to set this configuration with the // required s3:PutBucketNotification permission. The PUT notification is an atomic // operation. For example, suppose your notification configuration includes SNS // topic, SQS queue, and Lambda function configurations. When you send a PUT // request with this configuration, Amazon S3 sends test messages to your SNS // topic. If the message fails, the entire PUT action will fail, and Amazon S3 will // not add the configuration to your bucket. If the configuration in the request // body includes only one TopicConfiguration specifying only the // s3:ReducedRedundancyLostObject event type, the response will also include the // x-amz-sns-test-message-id header containing the message ID of the test // notification sent to the topic. The following action is related to // PutBucketNotificationConfiguration : // - GetBucketNotificationConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html) func (c *Client) PutBucketNotificationConfiguration(ctx context.Context, params *PutBucketNotificationConfigurationInput, optFns ...func(*Options)) (*PutBucketNotificationConfigurationOutput, error) { if params == nil { params = &PutBucketNotificationConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketNotificationConfiguration", params, optFns, c.addOperationPutBucketNotificationConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketNotificationConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketNotificationConfigurationInput struct { // The name of the bucket. // // This member is required. Bucket *string // A container for specifying the notification configuration of the bucket. If // this element is empty, notifications are turned off for the bucket. // // This member is required. NotificationConfiguration *types.NotificationConfiguration // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Skips validation of Amazon SQS, Amazon SNS, and Lambda destinations. True or // false value. SkipDestinationValidation bool noSmithyDocumentSerde } type PutBucketNotificationConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketNotificationConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketNotificationConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketNotificationConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketNotificationConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketNotificationConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketNotificationConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketNotificationConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketNotificationConfiguration", } } // getPutBucketNotificationConfigurationBucketMember returns a pointer to string // denoting a provided bucket member valueand a boolean indicating if the input has // a modeled bucket name, func getPutBucketNotificationConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketNotificationConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketNotificationConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketNotificationConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
208
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Creates or modifies OwnershipControls for an Amazon S3 bucket. To use this // operation, you must have the s3:PutBucketOwnershipControls permission. For more // information about Amazon S3 permissions, see Specifying permissions in a policy (https://docs.aws.amazon.com/AmazonS3/latest/user-guide/using-with-s3-actions.html) // . For information about Amazon S3 Object Ownership, see Using object ownership (https://docs.aws.amazon.com/AmazonS3/latest/user-guide/about-object-ownership.html) // . The following operations are related to PutBucketOwnershipControls : // - GetBucketOwnershipControls // - DeleteBucketOwnershipControls func (c *Client) PutBucketOwnershipControls(ctx context.Context, params *PutBucketOwnershipControlsInput, optFns ...func(*Options)) (*PutBucketOwnershipControlsOutput, error) { if params == nil { params = &PutBucketOwnershipControlsInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketOwnershipControls", params, optFns, c.addOperationPutBucketOwnershipControlsMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketOwnershipControlsOutput) out.ResultMetadata = metadata return out, nil } type PutBucketOwnershipControlsInput struct { // The name of the Amazon S3 bucket whose OwnershipControls you want to set. // // This member is required. Bucket *string // The OwnershipControls (BucketOwnerEnforced, BucketOwnerPreferred, or // ObjectWriter) that you want to apply to this Amazon S3 bucket. // // This member is required. OwnershipControls *types.OwnershipControls // The MD5 hash of the OwnershipControls request body. For requests made using the // Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, // this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketOwnershipControlsOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketOwnershipControlsMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketOwnershipControls{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketOwnershipControls{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketOwnershipControlsValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketOwnershipControls(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketOwnershipControlsInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketOwnershipControlsUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketOwnershipControls(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketOwnershipControls", } } func addPutBucketOwnershipControlsInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: nil, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketOwnershipControlsBucketMember returns a pointer to string denoting // a provided bucket member valueand a boolean indicating if the input has a // modeled bucket name, func getPutBucketOwnershipControlsBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketOwnershipControlsInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketOwnershipControlsUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketOwnershipControlsBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
196
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Applies an Amazon S3 bucket policy to an Amazon S3 bucket. If you are using an // identity other than the root user of the Amazon Web Services account that owns // the bucket, the calling identity must have the PutBucketPolicy permissions on // the specified bucket and belong to the bucket owner's account in order to use // this operation. If you don't have PutBucketPolicy permissions, Amazon S3 // returns a 403 Access Denied error. If you have the correct permissions, but // you're not using an identity that belongs to the bucket owner's account, Amazon // S3 returns a 405 Method Not Allowed error. To ensure that bucket owners don't // inadvertently lock themselves out of their own buckets, the root principal in a // bucket owner's Amazon Web Services account can perform the GetBucketPolicy , // PutBucketPolicy , and DeleteBucketPolicy API actions, even if their bucket // policy explicitly denies the root principal's access. Bucket owner root // principals can only be blocked from performing these API actions by VPC endpoint // policies and Amazon Web Services Organizations policies. For more information, // see Bucket policy examples (https://docs.aws.amazon.com/AmazonS3/latest/userguide/example-bucket-policies.html) // . The following operations are related to PutBucketPolicy : // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // - DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html) func (c *Client) PutBucketPolicy(ctx context.Context, params *PutBucketPolicyInput, optFns ...func(*Options)) (*PutBucketPolicyOutput, error) { if params == nil { params = &PutBucketPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketPolicy", params, optFns, c.addOperationPutBucketPolicyMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketPolicyOutput) out.ResultMetadata = metadata return out, nil } type PutBucketPolicyInput struct { // The name of the bucket. // // This member is required. Bucket *string // The bucket policy as a JSON document. // // This member is required. Policy *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // Set this parameter to true to confirm that you want to remove your permissions // to change this bucket policy in the future. ConfirmRemoveSelfBucketAccess bool // The MD5 hash of the request body. For requests made using the Amazon Web // Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is // calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketPolicy{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketPolicyInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketPolicy", } } // getPutBucketPolicyRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutBucketPolicyRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketPolicyInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketPolicyInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketPolicyRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketPolicyBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutBucketPolicyBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketPolicyInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketPolicyBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
230
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Creates a replication configuration or replaces an existing one. For more // information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) // in the Amazon S3 User Guide. Specify the replication configuration in the // request body. In the replication configuration, you provide the name of the // destination bucket or buckets where you want Amazon S3 to replicate objects, the // IAM role that Amazon S3 can assume to replicate objects on your behalf, and // other relevant information. A replication configuration must include at least // one rule, and can contain a maximum of 1,000. Each rule identifies a subset of // objects to replicate by filtering the objects in the source bucket. To choose // additional subsets of objects to replicate, add a rule for each subset. To // specify a subset of the objects in the source bucket to apply a replication rule // to, add the Filter element as a child of the Rule element. You can filter // objects based on an object key prefix, one or more object tags, or both. When // you add the Filter element in the configuration, you must also add the following // elements: DeleteMarkerReplication , Status , and Priority . If you are using an // earlier version of the replication configuration, Amazon S3 handles replication // of delete markers differently. For more information, see Backward Compatibility (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations) // . For information about enabling versioning on a bucket, see Using Versioning (https://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html) // . Handling Replication of Encrypted Objects By default, Amazon S3 doesn't // replicate objects that are stored at rest using server-side encryption with KMS // keys. To replicate Amazon Web Services KMS-encrypted objects, add the following: // SourceSelectionCriteria , SseKmsEncryptedObjects , Status , // EncryptionConfiguration , and ReplicaKmsKeyID . For information about // replication configuration, see Replicating Objects Created with SSE Using KMS // keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-config-for-kms-objects.html) // . For information on PutBucketReplication errors, see List of // replication-related error codes (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#ReplicationErrorCodeList) // Permissions To create a PutBucketReplication request, you must have // s3:PutReplicationConfiguration permissions for the bucket. By default, a // resource owner, in this case the Amazon Web Services account that created the // bucket, can perform this operation. The resource owner can also grant others // permissions to perform the operation. For more information about permissions, // see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // . To perform this operation, the user or role performing the action must have // the iam:PassRole (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html) // permission. The following operations are related to PutBucketReplication : // - GetBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketReplication.html) // - DeleteBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketReplication.html) func (c *Client) PutBucketReplication(ctx context.Context, params *PutBucketReplicationInput, optFns ...func(*Options)) (*PutBucketReplicationOutput, error) { if params == nil { params = &PutBucketReplicationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketReplication", params, optFns, c.addOperationPutBucketReplicationMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketReplicationOutput) out.ResultMetadata = metadata return out, nil } type PutBucketReplicationInput struct { // The name of the bucket // // This member is required. Bucket *string // A container for replication rules. You can add up to 1,000 rules. The maximum // size of a replication configuration is 2 MB. // // This member is required. ReplicationConfiguration *types.ReplicationConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the data. You must use this header as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, see RFC 1864 (http://www.ietf.org/rfc/rfc1864.txt) // . For requests made using the Amazon Web Services Command Line Interface (CLI) // or Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // A token to allow Object Lock to be enabled for an existing bucket. Token *string noSmithyDocumentSerde } type PutBucketReplicationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketReplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketReplication{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketReplication{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketReplicationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketReplication(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketReplicationInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketReplicationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketReplication(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketReplication", } } // getPutBucketReplicationRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutBucketReplicationRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketReplicationInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketReplicationInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketReplicationRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketReplicationBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutBucketReplicationBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketReplicationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketReplicationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketReplicationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
253
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the request payment configuration for a bucket. By default, the bucket // owner pays for downloads from the bucket. This configuration parameter enables // the bucket owner (only) to specify that the person requesting the download will // be charged for the download. For more information, see Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html) // . The following operations are related to PutBucketRequestPayment : // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // - GetBucketRequestPayment (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketRequestPayment.html) func (c *Client) PutBucketRequestPayment(ctx context.Context, params *PutBucketRequestPaymentInput, optFns ...func(*Options)) (*PutBucketRequestPaymentOutput, error) { if params == nil { params = &PutBucketRequestPaymentInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketRequestPayment", params, optFns, c.addOperationPutBucketRequestPaymentMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketRequestPaymentOutput) out.ResultMetadata = metadata return out, nil } type PutBucketRequestPaymentInput struct { // The bucket name. // // This member is required. Bucket *string // Container for Payer. // // This member is required. RequestPaymentConfiguration *types.RequestPaymentConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the data. You must use this header as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, see RFC 1864 (http://www.ietf.org/rfc/rfc1864.txt) // . For requests made using the Amazon Web Services Command Line Interface (CLI) // or Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketRequestPaymentOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketRequestPaymentMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketRequestPayment{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketRequestPayment{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketRequestPaymentValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketRequestPayment(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketRequestPaymentInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketRequestPaymentUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketRequestPayment(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketRequestPayment", } } // getPutBucketRequestPaymentRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutBucketRequestPaymentRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketRequestPaymentInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketRequestPaymentInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketRequestPaymentRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketRequestPaymentBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutBucketRequestPaymentBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketRequestPaymentInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketRequestPaymentUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketRequestPaymentBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
217
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the tags for a bucket. Use tags to organize your Amazon Web Services bill // to reflect your own cost structure. To do this, sign up to get your Amazon Web // Services account bill with tag key values included. Then, to see the cost of // combined resources, organize your billing information according to resources // with the same tag key values. For example, you can tag several resources with a // specific application name, and then organize your billing information to see the // total cost of that application across several services. For more information, // see Cost Allocation and Tagging (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) // and Using Cost Allocation in Amazon S3 Bucket Tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/CostAllocTagging.html) // . When this operation sets the tags for a bucket, it will overwrite any current // tags the bucket already has. You cannot use this operation to add tags to an // existing list of tags. To use this operation, you must have permissions to // perform the s3:PutBucketTagging action. The bucket owner has this permission by // default and can grant this permission to others. For more information about // permissions, see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // . PutBucketTagging has the following special errors: // - Error code: InvalidTagError // - Description: The tag provided was not a valid tag. This error can occur if // the tag did not pass input validation. For information about tag restrictions, // see User-Defined Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html) // and Amazon Web Services-Generated Cost Allocation Tag Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/aws-tag-restrictions.html) // . // - Error code: MalformedXMLError // - Description: The XML provided does not match the schema. // - Error code: OperationAbortedError // - Description: A conflicting conditional action is currently in progress // against this resource. Please try again. // - Error code: InternalError // - Description: The service was unable to apply the provided tag to the // bucket. // // The following operations are related to PutBucketTagging : // - GetBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html) // - DeleteBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketTagging.html) func (c *Client) PutBucketTagging(ctx context.Context, params *PutBucketTaggingInput, optFns ...func(*Options)) (*PutBucketTaggingOutput, error) { if params == nil { params = &PutBucketTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketTagging", params, optFns, c.addOperationPutBucketTaggingMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketTaggingOutput) out.ResultMetadata = metadata return out, nil } type PutBucketTaggingInput struct { // The bucket name. // // This member is required. Bucket *string // Container for the TagSet and Tag elements. // // This member is required. Tagging *types.Tagging // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the data. You must use this header as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, see RFC 1864 (http://www.ietf.org/rfc/rfc1864.txt) // . For requests made using the Amazon Web Services Command Line Interface (CLI) // or Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketTaggingOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketTagging{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketTaggingInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketTagging", } } // getPutBucketTaggingRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutBucketTaggingRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketTaggingInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketTaggingInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketTaggingRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketTaggingBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutBucketTaggingBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketTaggingInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketTaggingBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
245
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the versioning state of an existing bucket. You can set the versioning // state with one of the following values: Enabled—Enables versioning for the // objects in the bucket. All objects added to the bucket receive a unique version // ID. Suspended—Disables versioning for the objects in the bucket. All objects // added to the bucket receive the version ID null. If the versioning state has // never been set on a bucket, it has no versioning state; a GetBucketVersioning (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) // request does not return a versioning state value. In order to enable MFA Delete, // you must be the bucket owner. If you are the bucket owner and want to enable MFA // Delete in the bucket versioning configuration, you must include the x-amz-mfa // request header and the Status and the MfaDelete request elements in a request // to set the versioning state of the bucket. If you have an object expiration // lifecycle configuration in your non-versioned bucket and you want to maintain // the same permanent delete behavior when you enable versioning, you must add a // noncurrent expiration policy. The noncurrent expiration lifecycle configuration // will manage the deletes of the noncurrent object versions in the version-enabled // bucket. (A version-enabled bucket maintains one current and zero or more // noncurrent object versions.) For more information, see Lifecycle and Versioning (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html#lifecycle-and-other-bucket-config) // . The following operations are related to PutBucketVersioning : // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // - DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html) // - GetBucketVersioning (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) func (c *Client) PutBucketVersioning(ctx context.Context, params *PutBucketVersioningInput, optFns ...func(*Options)) (*PutBucketVersioningOutput, error) { if params == nil { params = &PutBucketVersioningInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketVersioning", params, optFns, c.addOperationPutBucketVersioningMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketVersioningOutput) out.ResultMetadata = metadata return out, nil } type PutBucketVersioningInput struct { // The bucket name. // // This member is required. Bucket *string // Container for setting the versioning state. // // This member is required. VersioningConfiguration *types.VersioningConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // >The base64-encoded 128-bit MD5 digest of the data. You must use this header as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, see RFC 1864 (http://www.ietf.org/rfc/rfc1864.txt) // . For requests made using the Amazon Web Services Command Line Interface (CLI) // or Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // The concatenation of the authentication device's serial number, a space, and // the value that is displayed on your authentication device. MFA *string noSmithyDocumentSerde } type PutBucketVersioningOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketVersioningMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketVersioning{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketVersioning{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketVersioningValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketVersioning(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketVersioningInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketVersioningUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketVersioning(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketVersioning", } } // getPutBucketVersioningRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutBucketVersioningRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketVersioningInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketVersioningInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketVersioningRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketVersioningBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutBucketVersioningBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketVersioningInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketVersioningUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketVersioningBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
235
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the configuration of the website that is specified in the website // subresource. To configure a bucket as a website, you can add this subresource on // the bucket with website configuration information such as the file name of the // index document and any redirect rules. For more information, see Hosting // Websites on Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) // . This PUT action requires the S3:PutBucketWebsite permission. By default, only // the bucket owner can configure the website attached to a bucket; however, bucket // owners can allow other users to set the website configuration by writing a // bucket policy that grants them the S3:PutBucketWebsite permission. To redirect // all website requests sent to the bucket's website endpoint, you add a website // configuration with the following elements. Because all requests are sent to // another website, you don't need to provide index document name for the bucket. // - WebsiteConfiguration // - RedirectAllRequestsTo // - HostName // - Protocol // // If you want granular control over redirects, you can use the following elements // to add routing rules that describe conditions for redirecting requests and // information about the redirect destination. In this case, the website // configuration must provide an index document for the bucket, because some // requests might not be redirected. // - WebsiteConfiguration // - IndexDocument // - Suffix // - ErrorDocument // - Key // - RoutingRules // - RoutingRule // - Condition // - HttpErrorCodeReturnedEquals // - KeyPrefixEquals // - Redirect // - Protocol // - HostName // - ReplaceKeyPrefixWith // - ReplaceKeyWith // - HttpRedirectCode // // Amazon S3 has a limitation of 50 routing rules per website configuration. If // you require more than 50 routing rules, you can use object redirect. For more // information, see Configuring an Object Redirect (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html) // in the Amazon S3 User Guide. func (c *Client) PutBucketWebsite(ctx context.Context, params *PutBucketWebsiteInput, optFns ...func(*Options)) (*PutBucketWebsiteOutput, error) { if params == nil { params = &PutBucketWebsiteInput{} } result, metadata, err := c.invokeOperation(ctx, "PutBucketWebsite", params, optFns, c.addOperationPutBucketWebsiteMiddlewares) if err != nil { return nil, err } out := result.(*PutBucketWebsiteOutput) out.ResultMetadata = metadata return out, nil } type PutBucketWebsiteInput struct { // The bucket name. // // This member is required. Bucket *string // Container for the request. // // This member is required. WebsiteConfiguration *types.WebsiteConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the data. You must use this header as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, see RFC 1864 (http://www.ietf.org/rfc/rfc1864.txt) // . For requests made using the Amazon Web Services Command Line Interface (CLI) // or Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutBucketWebsiteOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutBucketWebsiteMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketWebsite{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketWebsite{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutBucketWebsiteValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketWebsite(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutBucketWebsiteInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutBucketWebsiteUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutBucketWebsite(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutBucketWebsite", } } // getPutBucketWebsiteRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutBucketWebsiteRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutBucketWebsiteInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutBucketWebsiteInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutBucketWebsiteRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutBucketWebsiteBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutBucketWebsiteBucketMember(input interface{}) (*string, bool) { in := input.(*PutBucketWebsiteInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutBucketWebsiteUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutBucketWebsiteBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
253
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "io" "time" ) // Adds an object to a bucket. You must have WRITE permissions on a bucket to add // an object to it. Amazon S3 never adds partial objects; if you receive a success // response, Amazon S3 added the entire object to the bucket. You cannot use // PutObject to only update a single piece of metadata for an existing object. You // must put the entire object with updated metadata if you want to update some // values. Amazon S3 is a distributed system. If it receives multiple write // requests for the same object simultaneously, it overwrites all but the last // object written. To prevent objects from being deleted or overwritten, you can // use Amazon S3 Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) // . To ensure that data is not corrupted traversing the network, use the // Content-MD5 header. When you use this header, Amazon S3 checks the object // against the provided MD5 value and, if they do not match, returns an error. // Additionally, you can calculate the MD5 while putting an object to Amazon S3 and // compare the returned ETag to the calculated MD5 value. // - To successfully complete the PutObject request, you must have the // s3:PutObject in your IAM permissions. // - To successfully change the objects acl of your PutObject request, you must // have the s3:PutObjectAcl in your IAM permissions. // - To successfully set the tag-set with your PutObject request, you must have // the s3:PutObjectTagging in your IAM permissions. // - The Content-MD5 header is required for any request to upload an object with // a retention period configured using Amazon S3 Object Lock. For more information // about Amazon S3 Object Lock, see Amazon S3 Object Lock Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html) // in the Amazon S3 User Guide. // // You have four mutually exclusive options to protect data using server-side // encryption in Amazon S3, depending on how you choose to manage the encryption // keys. Specifically, the encryption key options are Amazon S3 managed keys // (SSE-S3), Amazon Web Services KMS keys (SSE-KMS or DSSE-KMS), and // customer-provided keys (SSE-C). Amazon S3 encrypts data with server-side // encryption by using Amazon S3 managed keys (SSE-S3) by default. You can // optionally tell Amazon S3 to encrypt data at rest by using server-side // encryption with other key options. For more information, see Using Server-Side // Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) // . When adding a new object, you can use headers to grant ACL-based permissions // to individual Amazon Web Services accounts or to predefined groups defined by // Amazon S3. These permissions are then added to the ACL on the object. By // default, all objects are private. Only the owner has full access control. For // more information, see Access Control List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) // and Managing ACLs Using the REST API (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-using-rest-api.html) // . If the bucket that you're uploading objects to uses the bucket owner enforced // setting for S3 Object Ownership, ACLs are disabled and no longer affect // permissions. Buckets that use this setting only accept PUT requests that don't // specify an ACL or PUT requests that specify bucket owner full control ACLs, such // as the bucket-owner-full-control canned ACL or an equivalent form of this ACL // expressed in the XML format. PUT requests that contain other ACLs (for example, // custom grants to certain Amazon Web Services accounts) fail and return a 400 // error with the error code AccessControlListNotSupported . For more information, // see Controlling ownership of objects and disabling ACLs (https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html) // in the Amazon S3 User Guide. If your bucket uses the bucket owner enforced // setting for Object Ownership, all objects written to the bucket by any account // will be owned by the bucket owner. By default, Amazon S3 uses the STANDARD // Storage Class to store newly created objects. The STANDARD storage class // provides high durability and high availability. Depending on performance needs, // you can specify a different Storage Class. Amazon S3 on Outposts only uses the // OUTPOSTS Storage Class. For more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) // in the Amazon S3 User Guide. If you enable versioning for a bucket, Amazon S3 // automatically generates a unique version ID for the object being stored. Amazon // S3 returns this ID in the response. When you enable versioning for a bucket, if // Amazon S3 receives multiple write requests for the same object simultaneously, // it stores all of the objects. For more information about versioning, see Adding // Objects to Versioning-Enabled Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/AddingObjectstoVersioningEnabledBuckets.html) // . For information about returning the versioning state of a bucket, see // GetBucketVersioning (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) // . For more information about related Amazon S3 APIs, see the following: // - CopyObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html) // - DeleteObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html) func (c *Client) PutObject(ctx context.Context, params *PutObjectInput, optFns ...func(*Options)) (*PutObjectOutput, error) { if params == nil { params = &PutObjectInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObject", params, optFns, c.addOperationPutObjectMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectOutput) out.ResultMetadata = metadata return out, nil } type PutObjectInput struct { // The bucket name to which the PUT action was initiated. When using this action // with an access point, you must direct requests to the access point hostname. The // access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Object key for which the PUT action was initiated. // // This member is required. Key *string // The canned ACL to apply to the object. For more information, see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL) // . This action is not supported by Amazon S3 on Outposts. ACL types.ObjectCannedACL // Object data. Body io.Reader // Specifies whether Amazon S3 should use an S3 Bucket Key for object encryption // with server-side encryption using Key Management Service (KMS) keys (SSE-KMS). // Setting this header to true causes Amazon S3 to use an S3 Bucket Key for object // encryption with SSE-KMS. Specifying this header with a PUT action doesn’t affect // bucket-level settings for S3 Bucket Key. BucketKeyEnabled bool // Can be used to specify caching behavior along the request/reply chain. For more // information, see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) // . CacheControl *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32 checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32C checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32C *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 160-bit SHA-1 digest of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumSHA1 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 256-bit SHA-256 digest of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Specifies presentational information for the object. For more information, see // https://www.rfc-editor.org/rfc/rfc6266#section-4 (https://www.rfc-editor.org/rfc/rfc6266#section-4) // . ContentDisposition *string // Specifies what content encodings have been applied to the object and thus what // decoding mechanisms must be applied to obtain the media-type referenced by the // Content-Type header field. For more information, see // https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding (https://www.rfc-editor.org/rfc/rfc9110.html#field.content-encoding) // . ContentEncoding *string // The language the content is in. ContentLanguage *string // Size of the body in bytes. This parameter is useful when the size of the body // cannot be determined automatically. For more information, see // https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length (https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length) // . ContentLength int64 // The base64-encoded 128-bit MD5 digest of the message (without the headers) // according to RFC 1864. This header can be used as a message integrity check to // verify that the data is the same data that was originally sent. Although it is // optional, we recommend using the Content-MD5 mechanism as an end-to-end // integrity check. For more information about REST request authentication, see // REST Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // . ContentMD5 *string // A standard MIME type describing the format of the contents. For more // information, see https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type (https://www.rfc-editor.org/rfc/rfc9110.html#name-content-type) // . ContentType *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // The date and time at which the object is no longer cacheable. For more // information, see https://www.rfc-editor.org/rfc/rfc7234#section-5.3 (https://www.rfc-editor.org/rfc/rfc7234#section-5.3) // . Expires *time.Time // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. This // action is not supported by Amazon S3 on Outposts. GrantFullControl *string // Allows grantee to read the object data and its metadata. This action is not // supported by Amazon S3 on Outposts. GrantRead *string // Allows grantee to read the object ACL. This action is not supported by Amazon // S3 on Outposts. GrantReadACP *string // Allows grantee to write the ACL for the applicable object. This action is not // supported by Amazon S3 on Outposts. GrantWriteACP *string // A map of metadata to store with the object in S3. Metadata map[string]string // Specifies whether a legal hold will be applied to this object. For more // information about S3 Object Lock, see Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) // . ObjectLockLegalHoldStatus types.ObjectLockLegalHoldStatus // The Object Lock mode that you want to apply to this object. ObjectLockMode types.ObjectLockMode // The date and time when you want this object's Object Lock to expire. Must be // formatted as a timestamp parameter. ObjectLockRetainUntilDate *time.Time // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // Specifies the algorithm to use to when encrypting the object (for example, // AES256). SSECustomerAlgorithm *string // Specifies the customer-provided encryption key for Amazon S3 to use in // encrypting data. This value is used to store the object and then it is // discarded; Amazon S3 does not store the encryption key. The key must be // appropriate for use with the algorithm specified in the // x-amz-server-side-encryption-customer-algorithm header. SSECustomerKey *string // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure that the // encryption key was transmitted without error. SSECustomerKeyMD5 *string // Specifies the Amazon Web Services KMS Encryption Context to use for object // encryption. The value of this header is a base64-encoded UTF-8 string holding // JSON with the encryption context key-value pairs. This value is stored as object // metadata and automatically gets passed on to Amazon Web Services KMS for future // GetObject or CopyObject operations on this object. SSEKMSEncryptionContext *string // If x-amz-server-side-encryption has a valid value of aws:kms or aws:kms:dsse , // this header specifies the ID of the Key Management Service (KMS) symmetric // encryption customer managed key that was used for the object. If you specify // x-amz-server-side-encryption:aws:kms or // x-amz-server-side-encryption:aws:kms:dsse , but do not provide // x-amz-server-side-encryption-aws-kms-key-id , Amazon S3 uses the Amazon Web // Services managed key ( aws/s3 ) to protect the data. If the KMS key does not // exist in the same account that's issuing the command, you must use the full ARN // and not just the ID. SSEKMSKeyId *string // The server-side encryption algorithm used when storing this object in Amazon S3 // (for example, AES256 , aws:kms , aws:kms:dsse ). ServerSideEncryption types.ServerSideEncryption // By default, Amazon S3 uses the STANDARD Storage Class to store newly created // objects. The STANDARD storage class provides high durability and high // availability. Depending on performance needs, you can specify a different // Storage Class. Amazon S3 on Outposts only uses the OUTPOSTS Storage Class. For // more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) // in the Amazon S3 User Guide. StorageClass types.StorageClass // The tag-set for the object. The tag-set must be encoded as URL Query // parameters. (For example, "Key1=Value1") Tagging *string // If the bucket is configured as a website, redirects requests for this object to // another object in the same bucket or to an external URL. Amazon S3 stores the // value of this header in the object metadata. For information about object // metadata, see Object Key and Metadata (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html) // . In the following example, the request header sets the redirect to an object // (anotherPage.html) in the same bucket: x-amz-website-redirect-location: // /anotherPage.html In the following example, the request header sets the object // redirect to another website: x-amz-website-redirect-location: // http://www.example.com/ For more information about website hosting in Amazon S3, // see Hosting Websites on Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html) // and How to Configure Website Page Redirects (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html) // . WebsiteRedirectLocation *string noSmithyDocumentSerde } type PutObjectOutput struct { // Indicates whether the uploaded object uses an S3 Bucket Key for server-side // encryption with Key Management Service (KMS) keys (SSE-KMS). BucketKeyEnabled bool // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Entity tag for the uploaded object. ETag *string // If the expiration is configured for the object (see // PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html) // ), the response includes this header. It includes the expiry-date and rule-id // key-value pairs that provide information about object expiration. The value of // the rule-id is URL-encoded. Expiration *string // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header confirming the encryption // algorithm used. SSECustomerAlgorithm *string // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header to provide round-trip message // integrity verification of the customer-provided encryption key. SSECustomerKeyMD5 *string // If present, specifies the Amazon Web Services KMS Encryption Context to use for // object encryption. The value of this header is a base64-encoded UTF-8 string // holding JSON with the encryption context key-value pairs. This value is stored // as object metadata and automatically gets passed on to Amazon Web Services KMS // for future GetObject or CopyObject operations on this object. SSEKMSEncryptionContext *string // If x-amz-server-side-encryption has a valid value of aws:kms or aws:kms:dsse , // this header specifies the ID of the Key Management Service (KMS) symmetric // encryption customer managed key that was used for the object. SSEKMSKeyId *string // The server-side encryption algorithm used when storing this object in Amazon S3 // (for example, AES256 , aws:kms , aws:kms:dsse ). ServerSideEncryption types.ServerSideEncryption // Version of the object. VersionId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObject{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObject{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObject(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = add100Continue(stack, options); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = v4.UseDynamicPayloadSigningMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObject(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObject", } } // getPutObjectRequestAlgorithmMember gets the request checksum algorithm value // provided as input. func getPutObjectRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectRequestAlgorithmMember, RequireChecksum: false, EnableTrailingChecksum: true, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectBucketMember returns a pointer to string denoting a provided bucket // member valueand a boolean indicating if the input has a modeled bucket name, func getPutObjectBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) } // PresignPutObject is used to generate a presigned HTTP Request which contains // presigned URL, signed headers and HTTP method used. func (c *PresignClient) PresignPutObject(ctx context.Context, params *PutObjectInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) { if params == nil { params = &PutObjectInput{} } options := c.options.copy() for _, fn := range optFns { fn(&options) } clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption) result, _, err := c.client.invokeOperation(ctx, "PutObject", params, clientOptFns, c.client.addOperationPutObjectMiddlewares, presignConverter(options).convertToPresignMiddleware, func(stack *middleware.Stack, options Options) error { return awshttp.RemoveContentTypeHeader(stack) }, addPutObjectPayloadAsUnsigned, ) if err != nil { return nil, err } out := result.(*v4.PresignedHTTPRequest) return out, nil } func addPutObjectPayloadAsUnsigned(stack *middleware.Stack, options Options) error { v4.RemoveContentSHA256HeaderMiddleware(stack) v4.RemoveComputePayloadSHA256Middleware(stack) return v4.AddUnsignedPayloadMiddleware(stack) }
591
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Uses the acl subresource to set the access control list (ACL) permissions for a // new or existing object in an S3 bucket. You must have WRITE_ACP permission to // set the ACL of an object. For more information, see What permissions can I // grant? (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#permissions) // in the Amazon S3 User Guide. This action is not supported by Amazon S3 on // Outposts. Depending on your application needs, you can choose to set the ACL on // an object using either the request body or the headers. For example, if you have // an existing application that updates a bucket ACL using the request body, you // can continue to use that approach. For more information, see Access Control // List (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) // in the Amazon S3 User Guide. If your bucket uses the bucket owner enforced // setting for S3 Object Ownership, ACLs are disabled and no longer affect // permissions. You must use policies to grant access to your bucket and the // objects in it. Requests to set ACLs or update ACLs fail and return the // AccessControlListNotSupported error code. Requests to read ACLs are still // supported. For more information, see Controlling object ownership (https://docs.aws.amazon.com/AmazonS3/latest/userguide/about-object-ownership.html) // in the Amazon S3 User Guide. Permissions You can set access permissions using // one of the following methods: // - Specify a canned ACL with the x-amz-acl request header. Amazon S3 supports a // set of predefined ACLs, known as canned ACLs. Each canned ACL has a predefined // set of grantees and permissions. Specify the canned ACL name as the value of // x-amz-ac l. If you use this header, you cannot use other access // control-specific headers in your request. For more information, see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL) // . // - Specify access permissions explicitly with the x-amz-grant-read , // x-amz-grant-read-acp , x-amz-grant-write-acp , and x-amz-grant-full-control // headers. When using these headers, you specify explicit access permissions and // grantees (Amazon Web Services accounts or Amazon S3 groups) who will receive the // permission. If you use these ACL-specific headers, you cannot use x-amz-acl // header to set a canned ACL. These parameters map to the set of permissions that // Amazon S3 supports in an ACL. For more information, see Access Control List // (ACL) Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html) // . You specify each grantee as a type=value pair, where the type is one of the // following: // - id – if the value specified is the canonical user ID of an Amazon Web // Services account // - uri – if you are granting permissions to a predefined group // - emailAddress – if the value specified is the email address of an Amazon Web // Services account Using email addresses to specify a grantee is only supported in // the following Amazon Web Services Regions: // - US East (N. Virginia) // - US West (N. California) // - US West (Oregon) // - Asia Pacific (Singapore) // - Asia Pacific (Sydney) // - Asia Pacific (Tokyo) // - Europe (Ireland) // - South America (São Paulo) For a list of all the Amazon S3 supported Regions // and endpoints, see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) // in the Amazon Web Services General Reference. For example, the following // x-amz-grant-read header grants list objects permission to the two Amazon Web // Services accounts identified by their email addresses. x-amz-grant-read: // emailAddress="[email protected]", emailAddress="[email protected]" // // You can use either a canned ACL or specify access permissions explicitly. You // cannot do both. Grantee Values You can specify the person (grantee) to whom // you're assigning access rights (using request elements) in the following ways: // - By the person's ID: <>ID<><>GranteesEmail<> DisplayName is optional and // ignored in the request. // - By URI: <>http://acs.amazonaws.com/groups/global/AuthenticatedUsers<> // - By Email address: <>[email protected]<>lt;/Grantee> The grantee is resolved // to the CanonicalUser and, in a response to a GET Object acl request, appears as // the CanonicalUser. Using email addresses to specify a grantee is only supported // in the following Amazon Web Services Regions: // - US East (N. Virginia) // - US West (N. California) // - US West (Oregon) // - Asia Pacific (Singapore) // - Asia Pacific (Sydney) // - Asia Pacific (Tokyo) // - Europe (Ireland) // - South America (São Paulo) For a list of all the Amazon S3 supported Regions // and endpoints, see Regions and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) // in the Amazon Web Services General Reference. // // Versioning The ACL of an object is set at the object version level. By default, // PUT sets the ACL of the current version of an object. To set the ACL of a // different version, use the versionId subresource. The following operations are // related to PutObjectAcl : // - CopyObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html) // - GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) func (c *Client) PutObjectAcl(ctx context.Context, params *PutObjectAclInput, optFns ...func(*Options)) (*PutObjectAclOutput, error) { if params == nil { params = &PutObjectAclInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObjectAcl", params, optFns, c.addOperationPutObjectAclMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectAclOutput) out.ResultMetadata = metadata return out, nil } type PutObjectAclInput struct { // The bucket name that contains the object to which you want to attach the ACL. // When using this action with an access point, you must direct requests to the // access point hostname. The access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Key for which the PUT action was initiated. When using this action with an // access point, you must direct requests to the access point hostname. The access // point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Key *string // The canned ACL to apply to the object. For more information, see Canned ACL (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#CannedACL) // . ACL types.ObjectCannedACL // Contains the elements that set the ACL permissions for an object per grantee. AccessControlPolicy *types.AccessControlPolicy // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The base64-encoded 128-bit MD5 digest of the data. This header must be used as // a message integrity check to verify that the request body was not corrupted in // transit. For more information, go to RFC 1864.> (http://www.ietf.org/rfc/rfc1864.txt) // For requests made using the Amazon Web Services Command Line Interface (CLI) or // Amazon Web Services SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Allows grantee the read, write, read ACP, and write ACP permissions on the // bucket. This action is not supported by Amazon S3 on Outposts. GrantFullControl *string // Allows grantee to list the objects in the bucket. This action is not supported // by Amazon S3 on Outposts. GrantRead *string // Allows grantee to read the bucket ACL. This action is not supported by Amazon // S3 on Outposts. GrantReadACP *string // Allows grantee to create new objects in the bucket. For the bucket and object // owners of existing objects, also allows deletions and overwrites of those // objects. GrantWrite *string // Allows grantee to write the ACL for the applicable bucket. This action is not // supported by Amazon S3 on Outposts. GrantWriteACP *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // VersionId used to reference a specific version of the object. VersionId *string noSmithyDocumentSerde } type PutObjectAclOutput struct { // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectAclMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObjectAcl{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObjectAcl{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectAclValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObjectAcl(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectAclInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectAclUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObjectAcl(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObjectAcl", } } // getPutObjectAclRequestAlgorithmMember gets the request checksum algorithm value // provided as input. func getPutObjectAclRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectAclInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectAclInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectAclRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectAclBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutObjectAclBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectAclInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectAclUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectAclBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
355
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Applies a legal hold configuration to the specified object. For more // information, see Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) // . This action is not supported by Amazon S3 on Outposts. func (c *Client) PutObjectLegalHold(ctx context.Context, params *PutObjectLegalHoldInput, optFns ...func(*Options)) (*PutObjectLegalHoldOutput, error) { if params == nil { params = &PutObjectLegalHoldInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObjectLegalHold", params, optFns, c.addOperationPutObjectLegalHoldMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectLegalHoldOutput) out.ResultMetadata = metadata return out, nil } type PutObjectLegalHoldInput struct { // The bucket name containing the object that you want to place a legal hold on. // When using this action with an access point, you must direct requests to the // access point hostname. The access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // The key name for the object that you want to place a legal hold on. // // This member is required. Key *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash for the request body. For requests made using the Amazon Web // Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is // calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Container element for the legal hold configuration you want to apply to the // specified object. LegalHold *types.ObjectLockLegalHold // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // The version ID of the object that you want to place a legal hold on. VersionId *string noSmithyDocumentSerde } type PutObjectLegalHoldOutput struct { // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectLegalHoldMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObjectLegalHold{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObjectLegalHold{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectLegalHoldValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObjectLegalHold(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectLegalHoldInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectLegalHoldUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObjectLegalHold(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObjectLegalHold", } } // getPutObjectLegalHoldRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutObjectLegalHoldRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectLegalHoldInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectLegalHoldInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectLegalHoldRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectLegalHoldBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutObjectLegalHoldBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectLegalHoldInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectLegalHoldUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectLegalHoldBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
237
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Places an Object Lock configuration on the specified bucket. The rule specified // in the Object Lock configuration will be applied by default to every new object // placed in the specified bucket. For more information, see Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) // . // - The DefaultRetention settings require both a mode and a period. // - The DefaultRetention period can be either Days or Years but you must select // one. You cannot specify Days and Years at the same time. // - You can only enable Object Lock for new buckets. If you want to turn on // Object Lock for an existing bucket, contact Amazon Web Services Support. func (c *Client) PutObjectLockConfiguration(ctx context.Context, params *PutObjectLockConfigurationInput, optFns ...func(*Options)) (*PutObjectLockConfigurationOutput, error) { if params == nil { params = &PutObjectLockConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObjectLockConfiguration", params, optFns, c.addOperationPutObjectLockConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectLockConfigurationOutput) out.ResultMetadata = metadata return out, nil } type PutObjectLockConfigurationInput struct { // The bucket whose Object Lock configuration you want to create or replace. // // This member is required. Bucket *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash for the request body. For requests made using the Amazon Web // Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is // calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // The Object Lock configuration that you want to apply to the specified bucket. ObjectLockConfiguration *types.ObjectLockConfiguration // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // A token to allow Object Lock to be enabled for an existing bucket. Token *string noSmithyDocumentSerde } type PutObjectLockConfigurationOutput struct { // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectLockConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObjectLockConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObjectLockConfiguration{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectLockConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObjectLockConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectLockConfigurationInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectLockConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObjectLockConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObjectLockConfiguration", } } // getPutObjectLockConfigurationRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutObjectLockConfigurationRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectLockConfigurationInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectLockConfigurationInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectLockConfigurationRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectLockConfigurationBucketMember returns a pointer to string denoting // a provided bucket member valueand a boolean indicating if the input has a // modeled bucket name, func getPutObjectLockConfigurationBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectLockConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectLockConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectLockConfigurationBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
230
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Places an Object Retention configuration on an object. For more information, // see Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) // . Users or accounts require the s3:PutObjectRetention permission in order to // place an Object Retention configuration on objects. Bypassing a Governance // Retention configuration requires the s3:BypassGovernanceRetention permission. // This action is not supported by Amazon S3 on Outposts. func (c *Client) PutObjectRetention(ctx context.Context, params *PutObjectRetentionInput, optFns ...func(*Options)) (*PutObjectRetentionOutput, error) { if params == nil { params = &PutObjectRetentionInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObjectRetention", params, optFns, c.addOperationPutObjectRetentionMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectRetentionOutput) out.ResultMetadata = metadata return out, nil } type PutObjectRetentionInput struct { // The bucket name that contains the object you want to apply this Object // Retention configuration to. When using this action with an access point, you // must direct requests to the access point hostname. The access point hostname // takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. // When using this action with an access point through the Amazon Web Services // SDKs, you provide the access point ARN in place of the bucket name. For more // information about access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // The key name for the object that you want to apply this Object Retention // configuration to. // // This member is required. Key *string // Indicates whether this action should bypass Governance-mode restrictions. BypassGovernanceRetention bool // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash for the request body. For requests made using the Amazon Web // Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is // calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // The container element for the Object Retention configuration. Retention *types.ObjectLockRetention // The version ID for the object that you want to apply this Object Retention // configuration to. VersionId *string noSmithyDocumentSerde } type PutObjectRetentionOutput struct { // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectRetentionMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObjectRetention{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObjectRetention{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectRetentionValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObjectRetention(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectRetentionInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectRetentionUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObjectRetention(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObjectRetention", } } // getPutObjectRetentionRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutObjectRetentionRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectRetentionInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectRetentionInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectRetentionRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectRetentionBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutObjectRetentionBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectRetentionInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectRetentionUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectRetentionBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
244
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Sets the supplied tag-set to an object that already exists in a bucket. A tag // is a key-value pair. You can associate tags with an object by sending a PUT // request against the tagging subresource that is associated with the object. You // can retrieve tags by sending a GET request. For more information, see // GetObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html) // . For tagging-related restrictions related to characters and encodings, see Tag // Restrictions (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/allocation-tag-restrictions.html) // . Note that Amazon S3 limits the maximum number of tags to 10 tags per object. // To use this operation, you must have permission to perform the // s3:PutObjectTagging action. By default, the bucket owner has this permission and // can grant this permission to others. To put tags of any other version, use the // versionId query parameter. You also need permission for the // s3:PutObjectVersionTagging action. For information about the Amazon S3 object // tagging feature, see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html) // . PutObjectTagging has the following special errors: // - Code: InvalidTagError // - Cause: The tag provided was not a valid tag. This error can occur if the // tag did not pass input validation. For more information, see Object Tagging (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html) // . // - Code: MalformedXMLError // - Cause: The XML provided does not match the schema. // - Code: OperationAbortedError // - Cause: A conflicting conditional action is currently in progress against // this resource. Please try again. // - Code: InternalError // - Cause: The service was unable to apply the provided tag to the object. // // The following operations are related to PutObjectTagging : // - GetObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html) // - DeleteObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html) func (c *Client) PutObjectTagging(ctx context.Context, params *PutObjectTaggingInput, optFns ...func(*Options)) (*PutObjectTaggingOutput, error) { if params == nil { params = &PutObjectTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "PutObjectTagging", params, optFns, c.addOperationPutObjectTaggingMiddlewares) if err != nil { return nil, err } out := result.(*PutObjectTaggingOutput) out.ResultMetadata = metadata return out, nil } type PutObjectTaggingInput struct { // The bucket name containing the object. When using this action with an access // point, you must direct requests to the access point hostname. The access point // hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Name of the object key. // // This member is required. Key *string // Container for the TagSet and Tag elements // // This member is required. Tagging *types.Tagging // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash for the request body. For requests made using the Amazon Web // Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is // calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // The versionId of the object that the tag-set will be added to. VersionId *string noSmithyDocumentSerde } type PutObjectTaggingOutput struct { // The versionId of the object the tag-set was added to. VersionId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutObjectTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutObjectTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutObjectTagging{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutObjectTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutObjectTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutObjectTaggingInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutObjectTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutObjectTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutObjectTagging", } } // getPutObjectTaggingRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getPutObjectTaggingRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutObjectTaggingInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutObjectTaggingInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutObjectTaggingRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutObjectTaggingBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getPutObjectTaggingBucketMember(input interface{}) (*string, bool) { in := input.(*PutObjectTaggingInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutObjectTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutObjectTaggingBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
271
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Creates or modifies the PublicAccessBlock configuration for an Amazon S3 // bucket. To use this operation, you must have the s3:PutBucketPublicAccessBlock // permission. For more information about Amazon S3 permissions, see Specifying // Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) // . When Amazon S3 evaluates the PublicAccessBlock configuration for a bucket or // an object, it checks the PublicAccessBlock configuration for both the bucket // (or the bucket that contains the object) and the bucket owner's account. If the // PublicAccessBlock configurations are different between the bucket and the // account, Amazon S3 uses the most restrictive combination of the bucket-level and // account-level settings. For more information about when Amazon S3 considers a // bucket or an object public, see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) // . The following operations are related to PutPublicAccessBlock : // - GetPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetPublicAccessBlock.html) // - DeletePublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeletePublicAccessBlock.html) // - GetBucketPolicyStatus (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketPolicyStatus.html) // - Using Amazon S3 Block Public Access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) func (c *Client) PutPublicAccessBlock(ctx context.Context, params *PutPublicAccessBlockInput, optFns ...func(*Options)) (*PutPublicAccessBlockOutput, error) { if params == nil { params = &PutPublicAccessBlockInput{} } result, metadata, err := c.invokeOperation(ctx, "PutPublicAccessBlock", params, optFns, c.addOperationPutPublicAccessBlockMiddlewares) if err != nil { return nil, err } out := result.(*PutPublicAccessBlockOutput) out.ResultMetadata = metadata return out, nil } type PutPublicAccessBlockInput struct { // The name of the Amazon S3 bucket whose PublicAccessBlock configuration you want // to set. // // This member is required. Bucket *string // The PublicAccessBlock configuration that you want to apply to this Amazon S3 // bucket. You can enable the configuration options in any combination. For more // information about when Amazon S3 considers a bucket or object public, see The // Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) // in the Amazon S3 User Guide. // // This member is required. PublicAccessBlockConfiguration *types.PublicAccessBlockConfiguration // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The MD5 hash of the PutPublicAccessBlock request body. For requests made using // the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services // SDKs, this field is calculated automatically. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string noSmithyDocumentSerde } type PutPublicAccessBlockOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationPutPublicAccessBlockMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpPutPublicAccessBlock{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutPublicAccessBlock{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpPutPublicAccessBlockValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutPublicAccessBlock(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addPutPublicAccessBlockInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addPutPublicAccessBlockUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opPutPublicAccessBlock(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "PutPublicAccessBlock", } } // getPutPublicAccessBlockRequestAlgorithmMember gets the request checksum // algorithm value provided as input. func getPutPublicAccessBlockRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*PutPublicAccessBlockInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addPutPublicAccessBlockInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getPutPublicAccessBlockRequestAlgorithmMember, RequireChecksum: true, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getPutPublicAccessBlockBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getPutPublicAccessBlockBucketMember(input interface{}) (*string, bool) { in := input.(*PutPublicAccessBlockInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addPutPublicAccessBlockUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getPutPublicAccessBlockBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
229
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // Restores an archived copy of an object back into Amazon S3 This action is not // supported by Amazon S3 on Outposts. This action performs the following types of // requests: // - select - Perform a select query on an archived object // - restore an archive - Restore an archived object // // For more information about the S3 structure in the request body, see the // following: // - PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) // - Managing Access with ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html) // in the Amazon S3 User Guide // - Protecting Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) // in the Amazon S3 User Guide // // Define the SQL expression for the SELECT type of restoration for your query in // the request body's SelectParameters structure. You can use expressions like the // following examples. // - The following expression returns all records from the specified object. // SELECT * FROM Object // - Assuming that you are not using any headers for data stored in the object, // you can specify columns with positional headers. SELECT s._1, s._2 FROM // Object s WHERE s._3 > 100 // - If you have headers and you set the fileHeaderInfo in the CSV structure in // the request body to USE , you can specify headers in the query. (If you set // the fileHeaderInfo field to IGNORE , the first row is skipped for the query.) // You cannot mix ordinal positions with header column names. SELECT s.Id, // s.FirstName, s.SSN FROM S3Object s // // When making a select request, you can also do the following: // - To expedite your queries, specify the Expedited tier. For more information // about tiers, see "Restoring Archives," later in this topic. // - Specify details about the data serialization format of both the input // object that is being queried and the serialization of the CSV-encoded query // results. // // The following are additional important facts about the select feature: // - The output results are new Amazon S3 objects. Unlike archive retrievals, // they are stored until explicitly deleted-manually or through a lifecycle // configuration. // - You can issue more than one select request on the same Amazon S3 object. // Amazon S3 doesn't duplicate requests, so avoid issuing duplicate requests. // - Amazon S3 accepts a select request even if the object has already been // restored. A select request doesn’t return error response 409 . // // Permissions To use this operation, you must have permissions to perform the // s3:RestoreObject action. The bucket owner has this permission by default and can // grant this permission to others. For more information about permissions, see // Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // in the Amazon S3 User Guide. Restoring objects Objects that you archive to the // S3 Glacier Flexible Retrieval Flexible Retrieval or S3 Glacier Deep Archive // storage class, and S3 Intelligent-Tiering Archive or S3 Intelligent-Tiering Deep // Archive tiers, are not accessible in real time. For objects in the S3 Glacier // Flexible Retrieval Flexible Retrieval or S3 Glacier Deep Archive storage // classes, you must first initiate a restore request, and then wait until a // temporary copy of the object is available. If you want a permanent copy of the // object, create a copy of it in the Amazon S3 Standard storage class in your S3 // bucket. To access an archived object, you must restore the object for the // duration (number of days) that you specify. For objects in the Archive Access or // Deep Archive Access tiers of S3 Intelligent-Tiering, you must first initiate a // restore request, and then wait until the object is moved into the Frequent // Access tier. To restore a specific object version, you can provide a version ID. // If you don't provide a version ID, Amazon S3 restores the current version. When // restoring an archived object, you can specify one of the following data access // tier options in the Tier element of the request body: // - Expedited - Expedited retrievals allow you to quickly access your data // stored in the S3 Glacier Flexible Retrieval Flexible Retrieval storage class or // S3 Intelligent-Tiering Archive tier when occasional urgent requests for // restoring archives are required. For all but the largest archived objects (250 // MB+), data accessed using Expedited retrievals is typically made available // within 1–5 minutes. Provisioned capacity ensures that retrieval capacity for // Expedited retrievals is available when you need it. Expedited retrievals and // provisioned capacity are not available for objects stored in the S3 Glacier Deep // Archive storage class or S3 Intelligent-Tiering Deep Archive tier. // - Standard - Standard retrievals allow you to access any of your archived // objects within several hours. This is the default option for retrieval requests // that do not specify the retrieval option. Standard retrievals typically finish // within 3–5 hours for objects stored in the S3 Glacier Flexible Retrieval // Flexible Retrieval storage class or S3 Intelligent-Tiering Archive tier. They // typically finish within 12 hours for objects stored in the S3 Glacier Deep // Archive storage class or S3 Intelligent-Tiering Deep Archive tier. Standard // retrievals are free for objects stored in S3 Intelligent-Tiering. // - Bulk - Bulk retrievals free for objects stored in the S3 Glacier Flexible // Retrieval and S3 Intelligent-Tiering storage classes, enabling you to retrieve // large amounts, even petabytes, of data at no cost. Bulk retrievals typically // finish within 5–12 hours for objects stored in the S3 Glacier Flexible Retrieval // Flexible Retrieval storage class or S3 Intelligent-Tiering Archive tier. Bulk // retrievals are also the lowest-cost retrieval option when restoring objects from // S3 Glacier Deep Archive. They typically finish within 48 hours for objects // stored in the S3 Glacier Deep Archive storage class or S3 Intelligent-Tiering // Deep Archive tier. // // For more information about archive retrieval options and provisioned capacity // for Expedited data access, see Restoring Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html) // in the Amazon S3 User Guide. You can use Amazon S3 restore speed upgrade to // change the restore speed to a faster speed while it is in progress. For more // information, see Upgrading the speed of an in-progress restore (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html#restoring-objects-upgrade-tier.title.html) // in the Amazon S3 User Guide. To get the status of object restoration, you can // send a HEAD request. Operations return the x-amz-restore header, which provides // information about the restoration status, in the response. You can use Amazon S3 // event notifications to notify you when a restore is initiated or completed. For // more information, see Configuring Amazon S3 Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon S3 User Guide. After restoring an archived object, you can update // the restoration period by reissuing the request with a new period. Amazon S3 // updates the restoration period relative to the current time and charges only for // the request-there are no data transfer charges. You cannot update the // restoration period when Amazon S3 is actively processing your current restore // request for the object. If your bucket has a lifecycle configuration with a rule // that includes an expiration action, the object expiration overrides the life // span that you specify in a restore request. For example, if you restore an // object copy for 10 days, but the object is scheduled to expire in 3 days, Amazon // S3 deletes the object in 3 days. For more information about lifecycle // configuration, see PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html) // and Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) // in Amazon S3 User Guide. Responses A successful action returns either the 200 OK // or 202 Accepted status code. // // - If the object is not previously restored, then Amazon S3 returns 202 // Accepted in the response. // // - If the object is previously restored, Amazon S3 returns 200 OK in the // response. // // - Special errors: // // - Code: RestoreAlreadyInProgress // // - Cause: Object restore is already in progress. (This error does not apply to // SELECT type requests.) // // - HTTP Status Code: 409 Conflict // // - SOAP Fault Code Prefix: Client // // - Code: GlacierExpeditedRetrievalNotAvailable // // - Cause: expedited retrievals are currently not available. Try again later. // (Returned if there is insufficient capacity to process the Expedited request. // This error applies only to Expedited retrievals and not to S3 Standard or Bulk // retrievals.) // // - HTTP Status Code: 503 // // - SOAP Fault Code Prefix: N/A // // The following operations are related to RestoreObject : // - PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html) // - GetBucketNotificationConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html) func (c *Client) RestoreObject(ctx context.Context, params *RestoreObjectInput, optFns ...func(*Options)) (*RestoreObjectOutput, error) { if params == nil { params = &RestoreObjectInput{} } result, metadata, err := c.invokeOperation(ctx, "RestoreObject", params, optFns, c.addOperationRestoreObjectMiddlewares) if err != nil { return nil, err } out := result.(*RestoreObjectOutput) out.ResultMetadata = metadata return out, nil } type RestoreObjectInput struct { // The bucket name containing the object to restore. When using this action with // an access point, you must direct requests to the access point hostname. The // access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Object key for which the action was initiated. // // This member is required. Key *string // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. ChecksumAlgorithm types.ChecksumAlgorithm // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // Container for restore job parameters. RestoreRequest *types.RestoreRequest // VersionId used to reference a specific version of the object. VersionId *string noSmithyDocumentSerde } type RestoreObjectOutput struct { // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Indicates the path in the provided S3 output location where Select results will // be restored to. RestoreOutputPath *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationRestoreObjectMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpRestoreObject{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpRestoreObject{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpRestoreObjectValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRestoreObject(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addRestoreObjectInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addRestoreObjectUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opRestoreObject(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "RestoreObject", } } // getRestoreObjectRequestAlgorithmMember gets the request checksum algorithm // value provided as input. func getRestoreObjectRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*RestoreObjectInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addRestoreObjectInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getRestoreObjectRequestAlgorithmMember, RequireChecksum: false, EnableTrailingChecksum: false, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getRestoreObjectBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getRestoreObjectBucketMember(input interface{}) (*string, bool) { in := input.(*RestoreObjectInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addRestoreObjectUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getRestoreObjectBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
387
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithysync "github.com/aws/smithy-go/sync" smithyhttp "github.com/aws/smithy-go/transport/http" "sync" ) // This action filters the contents of an Amazon S3 object based on a simple // structured query language (SQL) statement. In the request, along with the SQL // expression, you must also specify a data serialization format (JSON, CSV, or // Apache Parquet) of the object. Amazon S3 uses this format to parse object data // into records, and returns only records that match the specified SQL expression. // You must also specify the data serialization format for the response. This // action is not supported by Amazon S3 on Outposts. For more information about // Amazon S3 Select, see Selecting Content from Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/selecting-content-from-objects.html) // and SELECT Command (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-glacier-select-sql-reference-select.html) // in the Amazon S3 User Guide. Permissions You must have s3:GetObject permission // for this operation. Amazon S3 Select does not support anonymous access. For more // information about permissions, see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) // in the Amazon S3 User Guide. Object Data Formats You can use Amazon S3 Select to // query objects that have the following format properties: // - CSV, JSON, and Parquet - Objects must be in CSV, JSON, or Parquet format. // - UTF-8 - UTF-8 is the only encoding type Amazon S3 Select supports. // - GZIP or BZIP2 - CSV and JSON files can be compressed using GZIP or BZIP2. // GZIP and BZIP2 are the only compression formats that Amazon S3 Select supports // for CSV and JSON files. Amazon S3 Select supports columnar compression for // Parquet using GZIP or Snappy. Amazon S3 Select does not support whole-object // compression for Parquet objects. // - Server-side encryption - Amazon S3 Select supports querying objects that // are protected with server-side encryption. For objects that are encrypted with // customer-provided encryption keys (SSE-C), you must use HTTPS, and you must use // the headers that are documented in the GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // . For more information about SSE-C, see Server-Side Encryption (Using // Customer-Provided Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) // in the Amazon S3 User Guide. For objects that are encrypted with Amazon S3 // managed keys (SSE-S3) and Amazon Web Services KMS keys (SSE-KMS), server-side // encryption is handled transparently, so you don't need to specify anything. For // more information about server-side encryption, including SSE-S3 and SSE-KMS, see // Protecting Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) // in the Amazon S3 User Guide. // // Working with the Response Body Given the response size is unknown, Amazon S3 // Select streams the response as a series of messages and includes a // Transfer-Encoding header with chunked as its value in the response. For more // information, see Appendix: SelectObjectContent Response (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTSelectObjectAppendix.html) // . GetObject Support The SelectObjectContent action does not support the // following GetObject functionality. For more information, see GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // . // - Range : Although you can specify a scan range for an Amazon S3 Select // request (see SelectObjectContentRequest - ScanRange (https://docs.aws.amazon.com/AmazonS3/latest/API/API_SelectObjectContent.html#AmazonS3-SelectObjectContent-request-ScanRange) // in the request parameters), you cannot specify the range of bytes of an object // to return. // - The GLACIER , DEEP_ARCHIVE , and REDUCED_REDUNDANCY storage classes, or the // ARCHIVE_ACCESS and DEEP_ARCHIVE_ACCESS access tiers of the INTELLIGENT_TIERING // storage class: You cannot query objects in the GLACIER , DEEP_ARCHIVE , or // REDUCED_REDUNDANCY storage classes, nor objects in the ARCHIVE_ACCESS or // DEEP_ARCHIVE_ACCESS access tiers of the INTELLIGENT_TIERING storage class. For // more information about storage classes, see Using Amazon S3 storage classes (https://docs.aws.amazon.com/AmazonS3/latest/userguide/storage-class-intro.html) // in the Amazon S3 User Guide. // // Special Errors For a list of special errors for this operation, see List of // SELECT Object Content Error Codes (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#SelectObjectContentErrorCodeList) // The following operations are related to SelectObjectContent : // - GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // - GetBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycleConfiguration.html) // - PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html) func (c *Client) SelectObjectContent(ctx context.Context, params *SelectObjectContentInput, optFns ...func(*Options)) (*SelectObjectContentOutput, error) { if params == nil { params = &SelectObjectContentInput{} } result, metadata, err := c.invokeOperation(ctx, "SelectObjectContent", params, optFns, c.addOperationSelectObjectContentMiddlewares) if err != nil { return nil, err } out := result.(*SelectObjectContentOutput) out.ResultMetadata = metadata return out, nil } // Request to filter the contents of an Amazon S3 object based on a simple // Structured Query Language (SQL) statement. In the request, along with the SQL // expression, you must specify a data serialization format (JSON or CSV) of the // object. Amazon S3 uses this to parse object data into records. It returns only // records that match the specified SQL expression. You must also specify the data // serialization format for the response. For more information, see S3Select API // Documentation (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html) // . type SelectObjectContentInput struct { // The S3 bucket. // // This member is required. Bucket *string // The expression that is used to query the object. // // This member is required. Expression *string // The type of the provided expression (for example, SQL). // // This member is required. ExpressionType types.ExpressionType // Describes the format of the data in the object that is being queried. // // This member is required. InputSerialization *types.InputSerialization // The object key. // // This member is required. Key *string // Describes the format of the data that you want Amazon S3 to return in response. // // This member is required. OutputSerialization *types.OutputSerialization // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Specifies if periodic request progress information should be enabled. RequestProgress *types.RequestProgress // The server-side encryption (SSE) algorithm used to encrypt the object. This // parameter is needed only when the object was created using a checksum algorithm. // For more information, see Protecting data using SSE-C keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) // in the Amazon S3 User Guide. SSECustomerAlgorithm *string // The server-side encryption (SSE) customer managed key. This parameter is needed // only when the object was created using a checksum algorithm. For more // information, see Protecting data using SSE-C keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) // in the Amazon S3 User Guide. SSECustomerKey *string // The MD5 server-side encryption (SSE) customer managed key. This parameter is // needed only when the object was created using a checksum algorithm. For more // information, see Protecting data using SSE-C keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) // in the Amazon S3 User Guide. SSECustomerKeyMD5 *string // Specifies the byte range of the object to get the records from. A record is // processed when its first byte is contained by the range. This parameter is // optional, but when specified, it must not be empty. See RFC 2616, Section // 14.35.1 about how to specify the start and end of the range. ScanRange may be // used in the following ways: // - 50100 - process only the records starting between the bytes 50 and 100 // (inclusive, counting from zero) // - 50 - process only the records starting after the byte 50 // - 50 - process only the records within the last 50 bytes of the file. ScanRange *types.ScanRange noSmithyDocumentSerde } type SelectObjectContentOutput struct { eventStream *SelectObjectContentEventStream // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } // GetStream returns the type to interact with the event stream. func (o *SelectObjectContentOutput) GetStream() *SelectObjectContentEventStream { return o.eventStream } func (c *Client) addOperationSelectObjectContentMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpSelectObjectContent{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpSelectObjectContent{}, middleware.After) if err != nil { return err } if err = addEventStreamSelectObjectContentMiddleware(stack, options); 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpSelectObjectContentValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opSelectObjectContent(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addSelectObjectContentUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opSelectObjectContent(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "SelectObjectContent", } } // getSelectObjectContentBucketMember returns a pointer to string denoting a // provided bucket member valueand a boolean indicating if the input has a modeled // bucket name, func getSelectObjectContentBucketMember(input interface{}) (*string, bool) { in := input.(*SelectObjectContentInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addSelectObjectContentUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getSelectObjectContentBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) } // SelectObjectContentEventStream provides the event stream handling for the SelectObjectContent operation. // // For testing and mocking the event stream this type should be initialized via // the NewSelectObjectContentEventStream constructor function. Using the functional options // to pass in nested mock behavior. type SelectObjectContentEventStream struct { // SelectObjectContentEventStreamReader is the EventStream reader for the // SelectObjectContentEventStream events. This value is automatically set by the // SDK when the API call is made Use this member when unit testing your code with // the SDK to mock out the EventStream Reader. // // Must not be nil. Reader SelectObjectContentEventStreamReader done chan struct{} closeOnce sync.Once err *smithysync.OnceErr } // NewSelectObjectContentEventStream initializes an SelectObjectContentEventStream. // This function should only be used for testing and mocking the SelectObjectContentEventStream // stream within your application. // // The Reader member must be set before reading events from the stream. func NewSelectObjectContentEventStream(optFns ...func(*SelectObjectContentEventStream)) *SelectObjectContentEventStream { es := &SelectObjectContentEventStream{ done: make(chan struct{}), err: smithysync.NewOnceErr(), } for _, fn := range optFns { fn(es) } return es } // Events returns a channel to read events from. func (es *SelectObjectContentEventStream) Events() <-chan types.SelectObjectContentEventStream { return es.Reader.Events() } // Close closes the stream. This will also cause the stream to be closed. // Close must be called when done using the stream API. Not calling Close // may result in resource leaks. // // Will close the underlying EventStream writer and reader, and no more events can be // sent or received. func (es *SelectObjectContentEventStream) Close() error { es.closeOnce.Do(es.safeClose) return es.Err() } func (es *SelectObjectContentEventStream) safeClose() { close(es.done) es.Reader.Close() } // Err returns any error that occurred while reading or writing EventStream Events // from the service API's response. Returns nil if there were no errors. func (es *SelectObjectContentEventStream) Err() error { if err := es.err.Err(); err != nil { return err } if err := es.Reader.Err(); err != nil { return err } return nil } func (es *SelectObjectContentEventStream) waitStreamClose() { type errorSet interface { ErrorSet() <-chan struct{} } var outputErrCh <-chan struct{} if v, ok := es.Reader.(errorSet); ok { outputErrCh = v.ErrorSet() } var outputClosedCh <-chan struct{} if v, ok := es.Reader.(interface{ Closed() <-chan struct{} }); ok { outputClosedCh = v.Closed() } select { case <-es.done: case <-outputErrCh: es.err.SetError(es.Reader.Err()) es.Close() case <-outputClosedCh: if err := es.Reader.Err(); err != nil { es.err.SetError(es.Reader.Err()) } es.Close() } }
394
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" internalChecksum "github.com/aws/aws-sdk-go-v2/service/internal/checksum" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "io" ) // Uploads a part in a multipart upload. In this operation, you provide part data // in your request. However, you have an option to specify your existing Amazon S3 // object as a data source for the part you are uploading. To upload a part from an // existing object, you use the UploadPartCopy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html) // operation. You must initiate a multipart upload (see CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) // ) before you can upload any part. In response to your initiate request, Amazon // S3 returns an upload ID, a unique identifier, that you must include in your // upload part request. Part numbers can be any number from 1 to 10,000, inclusive. // A part number uniquely identifies a part and also defines its position within // the object being created. If you upload a new part using the same part number // that was used with a previous part, the previously uploaded part is overwritten. // For information about maximum and minimum part sizes and other multipart upload // specifications, see Multipart upload limits (https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html) // in the Amazon S3 User Guide. To ensure that data is not corrupted when // traversing the network, specify the Content-MD5 header in the upload part // request. Amazon S3 checks the part data against the provided MD5 value. If they // do not match, Amazon S3 returns an error. If the upload request is signed with // Signature Version 4, then Amazon Web Services S3 uses the x-amz-content-sha256 // header as a checksum instead of Content-MD5 . For more information see // Authenticating Requests: Using the Authorization Header (Amazon Web Services // Signature Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-auth-using-authorization-header.html) // . Note: After you initiate multipart upload and upload one or more parts, you // must either complete or abort multipart upload in order to stop getting charged // for storage of the uploaded parts. Only after you either complete or abort // multipart upload, Amazon S3 frees up the parts storage and stops charging you // for the parts storage. For more information on multipart uploads, go to // Multipart Upload Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html) // in the Amazon S3 User Guide . For information on the permissions required to use // the multipart upload API, go to Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) // in the Amazon S3 User Guide. Server-side encryption is for data encryption at // rest. Amazon S3 encrypts your data as it writes it to disks in its data centers // and decrypts it when you access it. You have three mutually exclusive options to // protect data using server-side encryption in Amazon S3, depending on how you // choose to manage the encryption keys. Specifically, the encryption key options // are Amazon S3 managed keys (SSE-S3), Amazon Web Services KMS keys (SSE-KMS), and // Customer-Provided Keys (SSE-C). Amazon S3 encrypts data with server-side // encryption using Amazon S3 managed keys (SSE-S3) by default. You can optionally // tell Amazon S3 to encrypt data at rest using server-side encryption with other // key options. The option you use depends on whether you want to use KMS keys // (SSE-KMS) or provide your own encryption key (SSE-C). If you choose to provide // your own encryption key, the request headers you provide in the request must // match the headers you used in the request to initiate the upload by using // CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) // . For more information, go to Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) // in the Amazon S3 User Guide. Server-side encryption is supported by the S3 // Multipart Upload actions. Unless you are using a customer-provided encryption // key (SSE-C), you don't need to specify the encryption parameters in each // UploadPart request. Instead, you only need to specify the server-side encryption // parameters in the initial Initiate Multipart request. For more information, see // CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) // . If you requested server-side encryption using a customer-provided encryption // key (SSE-C) in your initiate multipart upload request, you must provide // identical encryption information in each part upload using the following // headers. // - x-amz-server-side-encryption-customer-algorithm // - x-amz-server-side-encryption-customer-key // - x-amz-server-side-encryption-customer-key-MD5 // // UploadPart has the following special errors: // - Code: NoSuchUpload // - Cause: The specified multipart upload does not exist. The upload ID might // be invalid, or the multipart upload might have been aborted or completed. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // // The following operations are related to UploadPart : // - CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) // - CompleteMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html) // - AbortMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html) // - ListParts (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html) // - ListMultipartUploads (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html) func (c *Client) UploadPart(ctx context.Context, params *UploadPartInput, optFns ...func(*Options)) (*UploadPartOutput, error) { if params == nil { params = &UploadPartInput{} } result, metadata, err := c.invokeOperation(ctx, "UploadPart", params, optFns, c.addOperationUploadPartMiddlewares) if err != nil { return nil, err } out := result.(*UploadPartOutput) out.ResultMetadata = metadata return out, nil } type UploadPartInput struct { // The name of the bucket to which the multipart upload was initiated. When using // this action with an access point, you must direct requests to the access point // hostname. The access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Object key for which the multipart upload was initiated. // // This member is required. Key *string // Part number of part being uploaded. This is a positive integer between 1 and // 10,000. // // This member is required. PartNumber int32 // Upload ID identifying the multipart upload whose part is being uploaded. // // This member is required. UploadId *string // Object data. Body io.Reader // Indicates the algorithm used to create the checksum for the object when using // the SDK. This header will not provide any additional functionality if not using // the SDK. When sending this header, there must be a corresponding x-amz-checksum // or x-amz-trailer header sent. Otherwise, Amazon S3 fails the request with the // HTTP status code 400 Bad Request . For more information, see Checking object // integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. If you provide an individual checksum, Amazon S3 // ignores any provided ChecksumAlgorithm parameter. This checksum algorithm must // be the same for all parts and it match the checksum value supplied in the // CreateMultipartUpload request. ChecksumAlgorithm types.ChecksumAlgorithm // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32 checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32C checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32C *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 160-bit SHA-1 digest of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumSHA1 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 256-bit SHA-256 digest of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Size of the body in bytes. This parameter is useful when the size of the body // cannot be determined automatically. ContentLength int64 // The base64-encoded 128-bit MD5 digest of the part data. This parameter is // auto-populated when using the command from the CLI. This parameter is required // if object lock parameters are specified. ContentMD5 *string // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request fails with the HTTP status code 403 Forbidden // (access denied). ExpectedBucketOwner *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // Specifies the algorithm to use to when encrypting the object (for example, // AES256). SSECustomerAlgorithm *string // Specifies the customer-provided encryption key for Amazon S3 to use in // encrypting data. This value is used to store the object and then it is // discarded; Amazon S3 does not store the encryption key. The key must be // appropriate for use with the algorithm specified in the // x-amz-server-side-encryption-customer-algorithm header . This must be the same // encryption key specified in the initiate multipart upload request. SSECustomerKey *string // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure that the // encryption key was transmitted without error. SSECustomerKeyMD5 *string noSmithyDocumentSerde } type UploadPartOutput struct { // Indicates whether the multipart upload uses an S3 Bucket Key for server-side // encryption with Key Management Service (KMS) keys (SSE-KMS). BucketKeyEnabled bool // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Entity tag for the uploaded object. ETag *string // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header confirming the encryption // algorithm used. SSECustomerAlgorithm *string // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header to provide round-trip message // integrity verification of the customer-provided encryption key. SSECustomerKeyMD5 *string // If present, specifies the ID of the Key Management Service (KMS) symmetric // encryption customer managed key was used for the object. SSEKMSKeyId *string // The server-side encryption algorithm used when storing this object in Amazon S3 // (for example, AES256 , aws:kms ). ServerSideEncryption types.ServerSideEncryption // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUploadPartMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpUploadPart{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpUploadPart{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpUploadPartValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUploadPart(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = add100Continue(stack, options); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addUploadPartInputChecksumMiddlewares(stack, options); err != nil { return err } if err = addUploadPartUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = v4.UseDynamicPayloadSigningMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUploadPart(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "UploadPart", } } // getUploadPartRequestAlgorithmMember gets the request checksum algorithm value // provided as input. func getUploadPartRequestAlgorithmMember(input interface{}) (string, bool) { in := input.(*UploadPartInput) if len(in.ChecksumAlgorithm) == 0 { return "", false } return string(in.ChecksumAlgorithm), true } func addUploadPartInputChecksumMiddlewares(stack *middleware.Stack, options Options) error { return internalChecksum.AddInputMiddleware(stack, internalChecksum.InputMiddlewareOptions{ GetAlgorithm: getUploadPartRequestAlgorithmMember, RequireChecksum: false, EnableTrailingChecksum: true, EnableComputeSHA256PayloadHash: true, EnableDecodedContentLengthHeader: true, }) } // getUploadPartBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getUploadPartBucketMember(input interface{}) (*string, bool) { in := input.(*UploadPartInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addUploadPartUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getUploadPartBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) } // PresignUploadPart is used to generate a presigned HTTP Request which contains // presigned URL, signed headers and HTTP method used. func (c *PresignClient) PresignUploadPart(ctx context.Context, params *UploadPartInput, optFns ...func(*PresignOptions)) (*v4.PresignedHTTPRequest, error) { if params == nil { params = &UploadPartInput{} } options := c.options.copy() for _, fn := range optFns { fn(&options) } clientOptFns := append(options.ClientOptions, withNopHTTPClientAPIOption) result, _, err := c.client.invokeOperation(ctx, "UploadPart", params, clientOptFns, c.client.addOperationUploadPartMiddlewares, presignConverter(options).convertToPresignMiddleware, func(stack *middleware.Stack, options Options) error { return awshttp.RemoveContentTypeHeader(stack) }, addUploadPartPayloadAsUnsigned, ) if err != nil { return nil, err } out := result.(*v4.PresignedHTTPRequest) return out, nil } func addUploadPartPayloadAsUnsigned(stack *middleware.Stack, options Options) error { v4.RemoveContentSHA256HeaderMiddleware(stack) v4.RemoveComputePayloadSHA256Middleware(stack) return v4.AddUnsignedPayloadMiddleware(stack) }
465
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "time" ) // Uploads a part by copying data from an existing object as data source. You // specify the data source by adding the request header x-amz-copy-source in your // request and a byte range by adding the request header x-amz-copy-source-range // in your request. For information about maximum and minimum part sizes and other // multipart upload specifications, see Multipart upload limits (https://docs.aws.amazon.com/AmazonS3/latest/userguide/qfacts.html) // in the Amazon S3 User Guide. Instead of using an existing object as part data, // you might use the UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) // action and provide data in your request. You must initiate a multipart upload // before you can upload any part. In response to your initiate request. Amazon S3 // returns a unique identifier, the upload ID, that you must include in your upload // part request. For more information about using the UploadPartCopy operation, // see the following: // - For conceptual information about multipart uploads, see Uploading Objects // Using Multipart Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html) // in the Amazon S3 User Guide. // - For information about permissions required to use the multipart upload API, // see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) // in the Amazon S3 User Guide. // - For information about copying objects using a single atomic action vs. a // multipart upload, see Operations on Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectOperations.html) // in the Amazon S3 User Guide. // - For information about using server-side encryption with customer-provided // encryption keys with the UploadPartCopy operation, see CopyObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html) // and UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) // . // // Note the following additional considerations about the request headers // x-amz-copy-source-if-match , x-amz-copy-source-if-none-match , // x-amz-copy-source-if-unmodified-since , and x-amz-copy-source-if-modified-since // : // - Consideration 1 - If both of the x-amz-copy-source-if-match and // x-amz-copy-source-if-unmodified-since headers are present in the request as // follows: x-amz-copy-source-if-match condition evaluates to true , and; // x-amz-copy-source-if-unmodified-since condition evaluates to false ; Amazon S3 // returns 200 OK and copies the data. // - Consideration 2 - If both of the x-amz-copy-source-if-none-match and // x-amz-copy-source-if-modified-since headers are present in the request as // follows: x-amz-copy-source-if-none-match condition evaluates to false , and; // x-amz-copy-source-if-modified-since condition evaluates to true ; Amazon S3 // returns 412 Precondition Failed response code. // // Versioning If your bucket has versioning enabled, you could have multiple // versions of the same object. By default, x-amz-copy-source identifies the // current version of the object to copy. If the current version is a delete marker // and you don't specify a versionId in the x-amz-copy-source , Amazon S3 returns a // 404 error, because the object does not exist. If you specify versionId in the // x-amz-copy-source and the versionId is a delete marker, Amazon S3 returns an // HTTP 400 error, because you are not allowed to specify a delete marker as a // version for the x-amz-copy-source . You can optionally specify a specific // version of the source object to copy by adding the versionId subresource as // shown in the following example: x-amz-copy-source: // /bucket/object?versionId=version id Special errors // - Code: NoSuchUpload // - Cause: The specified multipart upload does not exist. The upload ID might // be invalid, or the multipart upload might have been aborted or completed. // - HTTP Status Code: 404 Not Found // - Code: InvalidRequest // - Cause: The specified copy source is not supported as a byte-range copy // source. // - HTTP Status Code: 400 Bad Request // // The following operations are related to UploadPartCopy : // - CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html) // - UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) // - CompleteMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CompleteMultipartUpload.html) // - AbortMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_AbortMultipartUpload.html) // - ListParts (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html) // - ListMultipartUploads (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListMultipartUploads.html) func (c *Client) UploadPartCopy(ctx context.Context, params *UploadPartCopyInput, optFns ...func(*Options)) (*UploadPartCopyOutput, error) { if params == nil { params = &UploadPartCopyInput{} } result, metadata, err := c.invokeOperation(ctx, "UploadPartCopy", params, optFns, c.addOperationUploadPartCopyMiddlewares) if err != nil { return nil, err } out := result.(*UploadPartCopyOutput) out.ResultMetadata = metadata return out, nil } type UploadPartCopyInput struct { // The bucket name. When using this action with an access point, you must direct // requests to the access point hostname. The access point hostname takes the form // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this // action with an access point through the Amazon Web Services SDKs, you provide // the access point ARN in place of the bucket name. For more information about // access point ARNs, see Using access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) // in the Amazon S3 User Guide. When you use this action with Amazon S3 on // Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on // Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com . When you // use this action with S3 on Outposts through the Amazon Web Services SDKs, you // provide the Outposts access point ARN in place of the bucket name. For more // information about S3 on Outposts ARNs, see What is S3 on Outposts? (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. // // This member is required. Bucket *string // Specifies the source object for the copy operation. You specify the value in // one of two formats, depending on whether you want to access the source object // through an access point (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) // : // - For objects not accessed through an access point, specify the name of the // source bucket and key of the source object, separated by a slash (/). For // example, to copy the object reports/january.pdf from the bucket // awsexamplebucket , use awsexamplebucket/reports/january.pdf . The value must // be URL-encoded. // - For objects accessed through access points, specify the Amazon Resource // Name (ARN) of the object as accessed through the access point, in the format // arn:aws:s3:::accesspoint//object/ . For example, to copy the object // reports/january.pdf through access point my-access-point owned by account // 123456789012 in Region us-west-2 , use the URL encoding of // arn:aws:s3:us-west-2:123456789012:accesspoint/my-access-point/object/reports/january.pdf // . The value must be URL encoded. Amazon S3 supports copy operations using access // points only when the source and destination buckets are in the same Amazon Web // Services Region. Alternatively, for objects accessed through Amazon S3 on // Outposts, specify the ARN of the object as accessed in the format // arn:aws:s3-outposts:::outpost//object/ . For example, to copy the object // reports/january.pdf through outpost my-outpost owned by account 123456789012 // in Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/object/reports/january.pdf // . The value must be URL-encoded. // To copy a specific version of an object, append ?versionId= to the value (for // example, // awsexamplebucket/reports/january.pdf?versionId=QUpfdndhfd8438MNFDN93jdnJFkdmqnh893 // ). If you don't specify a version ID, Amazon S3 copies the latest version of the // source object. // // This member is required. CopySource *string // Object key for which the multipart upload was initiated. // // This member is required. Key *string // Part number of part being copied. This is a positive integer between 1 and // 10,000. // // This member is required. PartNumber int32 // Upload ID identifying the multipart upload whose part is being copied. // // This member is required. UploadId *string // Copies the object if its entity tag (ETag) matches the specified tag. CopySourceIfMatch *string // Copies the object if it has been modified since the specified time. CopySourceIfModifiedSince *time.Time // Copies the object if its entity tag (ETag) is different than the specified ETag. CopySourceIfNoneMatch *string // Copies the object if it hasn't been modified since the specified time. CopySourceIfUnmodifiedSince *time.Time // The range of bytes to copy from the source object. The range value must use the // form bytes=first-last, where the first and last are the zero-based byte offsets // to copy. For example, bytes=0-9 indicates that you want to copy the first 10 // bytes of the source. You can copy a range only if the source object is greater // than 5 MB. CopySourceRange *string // Specifies the algorithm to use when decrypting the source object (for example, // AES256). CopySourceSSECustomerAlgorithm *string // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt // the source object. The encryption key provided in this header must be one that // was used when the source object was created. CopySourceSSECustomerKey *string // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure that the // encryption key was transmitted without error. CopySourceSSECustomerKeyMD5 *string // The account ID of the expected destination bucket owner. If the destination // bucket is owned by a different account, the request fails with the HTTP status // code 403 Forbidden (access denied). ExpectedBucketOwner *string // The account ID of the expected source bucket owner. If the source bucket is // owned by a different account, the request fails with the HTTP status code 403 // Forbidden (access denied). ExpectedSourceBucketOwner *string // Confirms that the requester knows that they will be charged for the request. // Bucket owners need not specify this parameter in their requests. For information // about downloading objects from Requester Pays buckets, see Downloading Objects // in Requester Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) // in the Amazon S3 User Guide. RequestPayer types.RequestPayer // Specifies the algorithm to use to when encrypting the object (for example, // AES256). SSECustomerAlgorithm *string // Specifies the customer-provided encryption key for Amazon S3 to use in // encrypting data. This value is used to store the object and then it is // discarded; Amazon S3 does not store the encryption key. The key must be // appropriate for use with the algorithm specified in the // x-amz-server-side-encryption-customer-algorithm header. This must be the same // encryption key specified in the initiate multipart upload request. SSECustomerKey *string // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. // Amazon S3 uses this header for a message integrity check to ensure that the // encryption key was transmitted without error. SSECustomerKeyMD5 *string noSmithyDocumentSerde } type UploadPartCopyOutput struct { // Indicates whether the multipart upload uses an S3 Bucket Key for server-side // encryption with Key Management Service (KMS) keys (SSE-KMS). BucketKeyEnabled bool // Container for all response elements. CopyPartResult *types.CopyPartResult // The version of the source object that was copied, if you have enabled // versioning on the source bucket. CopySourceVersionId *string // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header confirming the encryption // algorithm used. SSECustomerAlgorithm *string // If server-side encryption with a customer-provided encryption key was // requested, the response will include this header to provide round-trip message // integrity verification of the customer-provided encryption key. SSECustomerKeyMD5 *string // If present, specifies the ID of the Key Management Service (KMS) symmetric // encryption customer managed key that was used for the object. SSEKMSKeyId *string // The server-side encryption algorithm used when storing this object in Amazon S3 // (for example, AES256 , aws:kms ). ServerSideEncryption types.ServerSideEncryption // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationUploadPartCopyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpUploadPartCopy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpUploadPartCopy{}, 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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addOpUploadPartCopyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUploadPartCopy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addUploadPartCopyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = s3cust.HandleResponseErrorWith200Status(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opUploadPartCopy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "UploadPartCopy", } } // getUploadPartCopyBucketMember returns a pointer to string denoting a provided // bucket member valueand a boolean indicating if the input has a modeled bucket // name, func getUploadPartCopyBucketMember(input interface{}) (*string, bool) { in := input.(*UploadPartCopyInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func addUploadPartCopyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: getUploadPartCopyBucketMember, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: false, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
394
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "io" "strings" "time" ) // Passes transformed objects to a GetObject operation when using Object Lambda // access points. For information about Object Lambda access points, see // Transforming objects with Object Lambda access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/transforming-objects.html) // in the Amazon S3 User Guide. This operation supports metadata that can be // returned by GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // , in addition to RequestRoute , RequestToken , StatusCode , ErrorCode , and // ErrorMessage . The GetObject response metadata is supported so that the // WriteGetObjectResponse caller, typically an Lambda function, can provide the // same metadata when it internally invokes GetObject . When WriteGetObjectResponse // is called by a customer-owned Lambda function, the metadata returned to the end // user GetObject call might differ from what Amazon S3 would normally return. You // can include any number of metadata headers. When including a metadata header, it // should be prefaced with x-amz-meta . For example, x-amz-meta-my-custom-header: // MyCustomValue . The primary use case for this is to forward GetObject metadata. // Amazon Web Services provides some prebuilt Lambda functions that you can use // with S3 Object Lambda to detect and redact personally identifiable information // (PII) and decompress S3 objects. These Lambda functions are available in the // Amazon Web Services Serverless Application Repository, and can be selected // through the Amazon Web Services Management Console when you create your Object // Lambda access point. Example 1: PII Access Control - This Lambda function uses // Amazon Comprehend, a natural language processing (NLP) service using machine // learning to find insights and relationships in text. It automatically detects // personally identifiable information (PII) such as names, addresses, dates, // credit card numbers, and social security numbers from documents in your Amazon // S3 bucket. Example 2: PII Redaction - This Lambda function uses Amazon // Comprehend, a natural language processing (NLP) service using machine learning // to find insights and relationships in text. It automatically redacts personally // identifiable information (PII) such as names, addresses, dates, credit card // numbers, and social security numbers from documents in your Amazon S3 bucket. // Example 3: Decompression - The Lambda function S3ObjectLambdaDecompression, is // equipped to decompress objects stored in S3 in one of six compressed file // formats including bzip2, gzip, snappy, zlib, zstandard and ZIP. For information // on how to view and use these functions, see Using Amazon Web Services built // Lambda functions (https://docs.aws.amazon.com/AmazonS3/latest/userguide/olap-examples.html) // in the Amazon S3 User Guide. func (c *Client) WriteGetObjectResponse(ctx context.Context, params *WriteGetObjectResponseInput, optFns ...func(*Options)) (*WriteGetObjectResponseOutput, error) { if params == nil { params = &WriteGetObjectResponseInput{} } result, metadata, err := c.invokeOperation(ctx, "WriteGetObjectResponse", params, optFns, c.addOperationWriteGetObjectResponseMiddlewares) if err != nil { return nil, err } out := result.(*WriteGetObjectResponseOutput) out.ResultMetadata = metadata return out, nil } type WriteGetObjectResponseInput struct { // Route prefix to the HTTP URL generated. // // This member is required. RequestRoute *string // A single use encrypted token that maps WriteGetObjectResponse to the end user // GetObject request. // // This member is required. RequestToken *string // Indicates that a range of bytes was specified. AcceptRanges *string // The object data. Body io.Reader // Indicates whether the object stored in Amazon S3 uses an S3 bucket key for // server-side encryption with Amazon Web Services KMS (SSE-KMS). BucketKeyEnabled bool // Specifies caching behavior along the request/reply chain. CacheControl *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This specifies the // base64-encoded, 32-bit CRC32 checksum of the object returned by the Object // Lambda function. This may not match the checksum for the object stored in Amazon // S3. Amazon S3 will perform validation of the checksum values only when the // original GetObject request required checksum validation. For more information // about checksums, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. Only one checksum header can be specified at a // time. If you supply multiple checksum headers, this request will fail. ChecksumCRC32 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This specifies the // base64-encoded, 32-bit CRC32C checksum of the object returned by the Object // Lambda function. This may not match the checksum for the object stored in Amazon // S3. Amazon S3 will perform validation of the checksum values only when the // original GetObject request required checksum validation. For more information // about checksums, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. Only one checksum header can be specified at a // time. If you supply multiple checksum headers, this request will fail. ChecksumCRC32C *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This specifies the // base64-encoded, 160-bit SHA-1 digest of the object returned by the Object Lambda // function. This may not match the checksum for the object stored in Amazon S3. // Amazon S3 will perform validation of the checksum values only when the original // GetObject request required checksum validation. For more information about // checksums, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. Only one checksum header can be specified at a // time. If you supply multiple checksum headers, this request will fail. ChecksumSHA1 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This specifies the // base64-encoded, 256-bit SHA-256 digest of the object returned by the Object // Lambda function. This may not match the checksum for the object stored in Amazon // S3. Amazon S3 will perform validation of the checksum values only when the // original GetObject request required checksum validation. For more information // about checksums, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. Only one checksum header can be specified at a // time. If you supply multiple checksum headers, this request will fail. ChecksumSHA256 *string // Specifies presentational information for the object. ContentDisposition *string // Specifies what content encodings have been applied to the object and thus what // decoding mechanisms must be applied to obtain the media-type referenced by the // Content-Type header field. ContentEncoding *string // The language the content is in. ContentLanguage *string // The size of the content body in bytes. ContentLength int64 // The portion of the object returned in the response. ContentRange *string // A standard MIME type describing the format of the object data. ContentType *string // Specifies whether an object stored in Amazon S3 is ( true ) or is not ( false ) // a delete marker. DeleteMarker bool // An opaque identifier assigned by a web server to a specific version of a // resource found at a URL. ETag *string // A string that uniquely identifies an error condition. Returned in the tag of // the error XML response for a corresponding GetObject call. Cannot be used with // a successful StatusCode header or when the transformed object is provided in // the body. All error codes from S3 are sentence-cased. The regular expression // (regex) value is "^[A-Z][a-zA-Z]+$" . ErrorCode *string // Contains a generic description of the error condition. Returned in the tag of // the error XML response for a corresponding GetObject call. Cannot be used with // a successful StatusCode header or when the transformed object is provided in // body. ErrorMessage *string // If the object expiration is configured (see PUT Bucket lifecycle), the response // includes this header. It includes the expiry-date and rule-id key-value pairs // that provide the object expiration information. The value of the rule-id is // URL-encoded. Expiration *string // The date and time at which the object is no longer cacheable. Expires *time.Time // The date and time that the object was last modified. LastModified *time.Time // A map of metadata to store with the object in S3. Metadata map[string]string // Set to the number of metadata entries not returned in x-amz-meta headers. This // can happen if you create metadata using an API like SOAP that supports more // flexible metadata than the REST API. For example, using SOAP, you can create // metadata whose values are not legal HTTP headers. MissingMeta int32 // Indicates whether an object stored in Amazon S3 has an active legal hold. ObjectLockLegalHoldStatus types.ObjectLockLegalHoldStatus // Indicates whether an object stored in Amazon S3 has Object Lock enabled. For // more information about S3 Object Lock, see Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html) // . ObjectLockMode types.ObjectLockMode // The date and time when Object Lock is configured to expire. ObjectLockRetainUntilDate *time.Time // The count of parts this object has. PartsCount int32 // Indicates if request involves bucket that is either a source or destination in // a Replication rule. For more information about S3 Replication, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html) // . ReplicationStatus types.ReplicationStatus // If present, indicates that the requester was successfully charged for the // request. RequestCharged types.RequestCharged // Provides information about object restoration operation and expiration time of // the restored object copy. Restore *string // Encryption algorithm used if server-side encryption with a customer-provided // encryption key was specified for object stored in Amazon S3. SSECustomerAlgorithm *string // 128-bit MD5 digest of customer-provided encryption key used in Amazon S3 to // encrypt data stored in S3. For more information, see Protecting data using // server-side encryption with customer-provided encryption keys (SSE-C) (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html) // . SSECustomerKeyMD5 *string // If present, specifies the ID of the Amazon Web Services Key Management Service // (Amazon Web Services KMS) symmetric encryption customer managed key that was // used for stored in Amazon S3 object. SSEKMSKeyId *string // The server-side encryption algorithm used when storing requested object in // Amazon S3 (for example, AES256, aws:kms ). ServerSideEncryption types.ServerSideEncryption // The integer status code for an HTTP response of a corresponding GetObject // request. The following is a list of status codes. // - 200 - OK // - 206 - Partial Content // - 304 - Not Modified // - 400 - Bad Request // - 401 - Unauthorized // - 403 - Forbidden // - 404 - Not Found // - 405 - Method Not Allowed // - 409 - Conflict // - 411 - Length Required // - 412 - Precondition Failed // - 416 - Range Not Satisfiable // - 500 - Internal Server Error // - 503 - Service Unavailable StatusCode int32 // Provides storage class information of the object. Amazon S3 returns this header // for all objects except for S3 Standard storage class objects. For more // information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) // . StorageClass types.StorageClass // The number of tags, if any, on the object. TagCount int32 // An ID used to reference a specific version of the object. VersionId *string noSmithyDocumentSerde } type WriteGetObjectResponseOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationWriteGetObjectResponseMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpWriteGetObjectResponse{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpWriteGetObjectResponse{}, 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.AddUnsignedPayloadMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(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 = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { return err } if err = addEndpointPrefix_opWriteGetObjectResponseMiddleware(stack); err != nil { return err } if err = addOpWriteGetObjectResponseValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opWriteGetObjectResponse(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addWriteGetObjectResponseUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.UseDynamicPayloadSigningMiddleware(stack); err != nil { return err } if err = disableAcceptEncodingGzip(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opWriteGetObjectResponseMiddleware struct { } func (*endpointPrefix_opWriteGetObjectResponseMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opWriteGetObjectResponseMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*WriteGetObjectResponseInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.RequestRoute == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("RequestRoute forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.RequestRoute) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("RequestRoute forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.RequestRoute)} } else { prefix.WriteString(*input.RequestRoute) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opWriteGetObjectResponseMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opWriteGetObjectResponseMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opWriteGetObjectResponse(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "WriteGetObjectResponse", } } func addWriteGetObjectResponseUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ Accessor: s3cust.UpdateEndpointParameterAccessor{ GetBucketFromInput: nopGetBucketAccessor, }, UsePathStyle: options.UsePathStyle, UseAccelerate: options.UseAccelerate, SupportsAccelerate: true, TargetS3ObjectLambda: true, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }) }
437
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. // Package s3 provides the API client, operations, and parameter types for Amazon // Simple Storage Service. package s3
6
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" "errors" "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "net/url" "strings" ) // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options // EndpointResolver interface for resolving service endpoints. type EndpointResolver interface { ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) } var _ EndpointResolver = &internalendpoints.Resolver{} // NewDefaultEndpointResolver constructs a new service endpoint resolver func NewDefaultEndpointResolver() *internalendpoints.Resolver { return internalendpoints.New() } // EndpointResolverFunc is a helper utility that wraps a function so it satisfies // the EndpointResolver interface. This is useful when you want to add additional // endpoint resolving logic, or stub out specific endpoints with custom values. type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error) func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { return fn(region, options) } func resolveDefaultEndpointConfiguration(o *Options) { if o.EndpointResolver != nil { return } o.EndpointResolver = NewDefaultEndpointResolver() } // EndpointResolverFromURL returns an EndpointResolver configured using the // provided endpoint url. By default, the resolved endpoint resolver uses the // client region as signing region, and the endpoint source is set to // EndpointSourceCustom.You can provide functional options to configure endpoint // values for the resolved endpoint. func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver { e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom} for _, fn := range optFns { fn(&e) } return EndpointResolverFunc( func(region string, options EndpointResolverOptions) (aws.Endpoint, error) { if len(e.SigningRegion) == 0 { e.SigningRegion = region } return e, nil }, ) } type ResolveEndpoint struct { Resolver EndpointResolver Options EndpointResolverOptions } func (*ResolveEndpoint) ID() string { return "ResolveEndpoint" } func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } if m.Resolver == nil { return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") } eo := m.Options eo.Logger = middleware.GetLogger(ctx) var endpoint aws.Endpoint endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo) if err != nil { return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) } req.URL, err = url.Parse(endpoint.URL) if err != nil { return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) } if len(awsmiddleware.GetSigningName(ctx)) == 0 { signingName := endpoint.SigningName if len(signingName) == 0 { signingName = "s3" } ctx = awsmiddleware.SetSigningName(ctx, signingName) } ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source) ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable) ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID) return next.HandleSerialize(ctx, in) } func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { return stack.Serialize.Insert(&ResolveEndpoint{ Resolver: o.EndpointResolver, Options: o.EndpointOptions, }, "OperationSerializer", middleware.Before) } func removeResolveEndpointMiddleware(stack *middleware.Stack) error { _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID()) return err } type wrappedEndpointResolver struct { awsResolver aws.EndpointResolverWithOptions resolver EndpointResolver } func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { if w.awsResolver == nil { goto fallback } endpoint, err = w.awsResolver.ResolveEndpoint(ServiceID, region, options) if err == nil { return endpoint, nil } if nf := (&aws.EndpointNotFoundError{}); !errors.As(err, &nf) { return endpoint, err } fallback: if w.resolver == nil { return endpoint, fmt.Errorf("default endpoint resolver provided was nil") } return w.resolver.ResolveEndpoint(region, options) } type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error) func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) { return a(service, region) } var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil) // withEndpointResolver returns an EndpointResolver that first delegates endpoint resolution to the awsResolver. // If awsResolver returns aws.EndpointNotFoundError error, the resolver will use the the provided // fallbackResolver for resolution. // // fallbackResolver must not be nil func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions, fallbackResolver EndpointResolver) EndpointResolver { var resolver aws.EndpointResolverWithOptions if awsResolverWithOptions != nil { resolver = awsResolverWithOptions } else if awsResolver != nil { resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) } return &wrappedEndpointResolver{ awsResolver: resolver, resolver: fallbackResolver, } } func finalizeClientEndpointResolverOptions(options *Options) { options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage() if len(options.EndpointOptions.ResolvedRegion) == 0 { const fipsInfix = "-fips-" const fipsPrefix = "fips-" const fipsSuffix = "-fips" if strings.Contains(options.Region, fipsInfix) || strings.Contains(options.Region, fipsPrefix) || strings.Contains(options.Region, fipsSuffix) { options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled } } if options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateUnset { if options.UseDualstack { options.EndpointOptions.UseDualStackEndpoint = aws.DualStackEndpointStateEnabled } else { options.EndpointOptions.UseDualStackEndpoint = aws.DualStackEndpointStateDisabled } } }
209
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream" "github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream/eventstreamapi" "github.com/aws/aws-sdk-go-v2/service/s3/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithysync "github.com/aws/smithy-go/sync" smithyhttp "github.com/aws/smithy-go/transport/http" "io" "io/ioutil" "sync" ) // SelectObjectContentEventStreamReader provides the interface for reading events // from a stream. // // The writer's Close method must allow multiple concurrent calls. type SelectObjectContentEventStreamReader interface { Events() <-chan types.SelectObjectContentEventStream Close() error Err() error } type selectObjectContentEventStreamReader struct { stream chan types.SelectObjectContentEventStream decoder *eventstream.Decoder eventStream io.ReadCloser err *smithysync.OnceErr payloadBuf []byte done chan struct{} closeOnce sync.Once } func newSelectObjectContentEventStreamReader(readCloser io.ReadCloser, decoder *eventstream.Decoder) *selectObjectContentEventStreamReader { w := &selectObjectContentEventStreamReader{ stream: make(chan types.SelectObjectContentEventStream), decoder: decoder, eventStream: readCloser, err: smithysync.NewOnceErr(), done: make(chan struct{}), payloadBuf: make([]byte, 10*1024), } go w.readEventStream() return w } func (r *selectObjectContentEventStreamReader) Events() <-chan types.SelectObjectContentEventStream { return r.stream } func (r *selectObjectContentEventStreamReader) readEventStream() { defer r.Close() defer close(r.stream) for { r.payloadBuf = r.payloadBuf[0:0] decodedMessage, err := r.decoder.Decode(r.eventStream, r.payloadBuf) if err != nil { if err == io.EOF { return } select { case <-r.done: return default: r.err.SetError(err) return } } event, err := r.deserializeEventMessage(&decodedMessage) if err != nil { r.err.SetError(err) return } select { case r.stream <- event: case <-r.done: return } } } func (r *selectObjectContentEventStreamReader) deserializeEventMessage(msg *eventstream.Message) (types.SelectObjectContentEventStream, error) { messageType := msg.Headers.Get(eventstreamapi.MessageTypeHeader) if messageType == nil { return nil, fmt.Errorf("%s event header not present", eventstreamapi.MessageTypeHeader) } switch messageType.String() { case eventstreamapi.EventMessageType: var v types.SelectObjectContentEventStream if err := awsRestxml_deserializeEventStreamSelectObjectContentEventStream(&v, msg); err != nil { return nil, err } return v, nil case eventstreamapi.ExceptionMessageType: return nil, awsRestxml_deserializeEventStreamExceptionSelectObjectContentEventStream(msg) case eventstreamapi.ErrorMessageType: errorCode := "UnknownError" errorMessage := errorCode if header := msg.Headers.Get(eventstreamapi.ErrorCodeHeader); header != nil { errorCode = header.String() } if header := msg.Headers.Get(eventstreamapi.ErrorMessageHeader); header != nil { errorMessage = header.String() } return nil, &smithy.GenericAPIError{ Code: errorCode, Message: errorMessage, } default: mc := msg.Clone() return nil, &UnknownEventMessageError{ Type: messageType.String(), Message: &mc, } } } func (r *selectObjectContentEventStreamReader) ErrorSet() <-chan struct{} { return r.err.ErrorSet() } func (r *selectObjectContentEventStreamReader) Close() error { r.closeOnce.Do(r.safeClose) return r.Err() } func (r *selectObjectContentEventStreamReader) safeClose() { close(r.done) r.eventStream.Close() } func (r *selectObjectContentEventStreamReader) Err() error { return r.err.Err() } func (r *selectObjectContentEventStreamReader) Closed() <-chan struct{} { return r.done } type awsRestxml_deserializeOpEventStreamSelectObjectContent struct { LogEventStreamWrites bool LogEventStreamReads bool } func (*awsRestxml_deserializeOpEventStreamSelectObjectContent) ID() string { return "OperationEventStreamDeserializer" } func (m *awsRestxml_deserializeOpEventStreamSelectObjectContent) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( out middleware.DeserializeOutput, metadata middleware.Metadata, err error, ) { defer func() { if err == nil { return } m.closeResponseBody(out) }() logger := middleware.GetLogger(ctx) request, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type: %T", in.Request) } _ = request out, metadata, err = next.HandleDeserialize(ctx, in) if err != nil { return out, metadata, err } deserializeOutput, ok := out.RawResponse.(*smithyhttp.Response) if !ok { return out, metadata, fmt.Errorf("unknown transport type: %T", out.RawResponse) } _ = deserializeOutput output, ok := out.Result.(*SelectObjectContentOutput) if out.Result != nil && !ok { return out, metadata, fmt.Errorf("unexpected output result type: %T", out.Result) } else if out.Result == nil { output = &SelectObjectContentOutput{} out.Result = output } eventReader := newSelectObjectContentEventStreamReader( deserializeOutput.Body, eventstream.NewDecoder(func(options *eventstream.DecoderOptions) { options.Logger = logger options.LogMessages = m.LogEventStreamReads }), ) defer func() { if err == nil { return } _ = eventReader.Close() }() output.eventStream = NewSelectObjectContentEventStream(func(stream *SelectObjectContentEventStream) { stream.Reader = eventReader }) go output.eventStream.waitStreamClose() return out, metadata, nil } func (*awsRestxml_deserializeOpEventStreamSelectObjectContent) closeResponseBody(out middleware.DeserializeOutput) { if resp, ok := out.RawResponse.(*smithyhttp.Response); ok && resp != nil && resp.Body != nil { _, _ = io.Copy(ioutil.Discard, resp.Body) _ = resp.Body.Close() } } func addEventStreamSelectObjectContentMiddleware(stack *middleware.Stack, options Options) error { if err := stack.Deserialize.Insert(&awsRestxml_deserializeOpEventStreamSelectObjectContent{ LogEventStreamWrites: options.ClientLogMode.IsRequestEventMessage(), LogEventStreamReads: options.ClientLogMode.IsResponseEventMessage(), }, "OperationDeserializer", middleware.Before); err != nil { return err } return nil } // UnknownEventMessageError provides an error when a message is received from the stream, // but the reader is unable to determine what kind of message it is. type UnknownEventMessageError struct { Type string Message *eventstream.Message } // Error retruns the error message string. func (e *UnknownEventMessageError) Error() string { return "unknown event stream message type, " + e.Type } func setSafeEventStreamClientLogMode(o *Options, operation string) { switch operation { case "SelectObjectContent": toggleEventStreamClientLogMode(o, false, true) return default: return } } func toggleEventStreamClientLogMode(o *Options, request, response bool) { mode := o.ClientLogMode if request && mode.IsRequestWithBody() { mode.ClearRequestWithBody() mode |= aws.LogRequest } if response && mode.IsResponseWithBody() { mode.ClearResponseWithBody() mode |= aws.LogResponse } o.ClientLogMode = mode }
286
aws-sdk-go-v2
aws
Go
// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. package s3 // goModuleVersion is the tagged release for this module const goModuleVersion = "1.36.0"
7
aws-sdk-go-v2
aws
Go
package s3 import ( "context" "fmt" ) // ListObjectVersionsAPIClient is a client that implements the ListObjectVersions // operation type ListObjectVersionsAPIClient interface { ListObjectVersions(context.Context, *ListObjectVersionsInput, ...func(*Options)) (*ListObjectVersionsOutput, error) } var _ ListObjectVersionsAPIClient = (*Client)(nil) // ListObjectVersionsPaginatorOptions is the paginator options for ListObjectVersions type ListObjectVersionsPaginatorOptions struct { // (Optional) The maximum number of Object Versions that you want Amazon S3 to // return. 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 } // ListObjectVersionsPaginator is a paginator for ListObjectVersions type ListObjectVersionsPaginator struct { options ListObjectVersionsPaginatorOptions client ListObjectVersionsAPIClient params *ListObjectVersionsInput firstPage bool keyMarker *string versionIDMarker *string isTruncated bool } // NewListObjectVersionsPaginator returns a new ListObjectVersionsPaginator func NewListObjectVersionsPaginator(client ListObjectVersionsAPIClient, params *ListObjectVersionsInput, optFns ...func(*ListObjectVersionsPaginatorOptions)) *ListObjectVersionsPaginator { if params == nil { params = &ListObjectVersionsInput{} } options := ListObjectVersionsPaginatorOptions{} options.Limit = params.MaxKeys for _, fn := range optFns { fn(&options) } return &ListObjectVersionsPaginator{ options: options, client: client, params: params, firstPage: true, keyMarker: params.KeyMarker, versionIDMarker: params.VersionIdMarker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListObjectVersionsPaginator) HasMorePages() bool { return p.firstPage || p.isTruncated } // NextPage retrieves the next ListObjectVersions page. func (p *ListObjectVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListObjectVersionsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.KeyMarker = p.keyMarker params.VersionIdMarker = p.versionIDMarker var limit int32 if p.options.Limit > 0 { limit = p.options.Limit } params.MaxKeys = limit result, err := p.client.ListObjectVersions(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.keyMarker p.isTruncated = result.IsTruncated p.keyMarker = nil p.versionIDMarker = nil if result.IsTruncated { p.keyMarker = result.NextKeyMarker p.versionIDMarker = result.NextVersionIdMarker } if p.options.StopOnDuplicateToken && prevToken != nil && p.keyMarker != nil && *prevToken == *p.keyMarker { p.isTruncated = false } return result, nil } // ListMultipartUploadsAPIClient is a client that implements the ListMultipartUploads // operation type ListMultipartUploadsAPIClient interface { ListMultipartUploads(context.Context, *ListMultipartUploadsInput, ...func(*Options)) (*ListMultipartUploadsOutput, error) } var _ ListMultipartUploadsAPIClient = (*Client)(nil) // ListMultipartUploadsPaginatorOptions is the paginator options for ListMultipartUploads type ListMultipartUploadsPaginatorOptions struct { // (Optional) The maximum number of Multipart Uploads that you want Amazon S3 to // return. 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 } // ListMultipartUploadsPaginator is a paginator for ListMultipartUploads type ListMultipartUploadsPaginator struct { options ListMultipartUploadsPaginatorOptions client ListMultipartUploadsAPIClient params *ListMultipartUploadsInput firstPage bool keyMarker *string uploadIDMarker *string isTruncated bool } // NewListMultipartUploadsPaginator returns a new ListMultipartUploadsPaginator func NewListMultipartUploadsPaginator(client ListMultipartUploadsAPIClient, params *ListMultipartUploadsInput, optFns ...func(*ListMultipartUploadsPaginatorOptions)) *ListMultipartUploadsPaginator { if params == nil { params = &ListMultipartUploadsInput{} } options := ListMultipartUploadsPaginatorOptions{} options.Limit = params.MaxUploads for _, fn := range optFns { fn(&options) } return &ListMultipartUploadsPaginator{ options: options, client: client, params: params, firstPage: true, keyMarker: params.KeyMarker, uploadIDMarker: params.UploadIdMarker, } } // HasMorePages returns a boolean indicating whether more pages are available func (p *ListMultipartUploadsPaginator) HasMorePages() bool { return p.firstPage || p.isTruncated } // NextPage retrieves the next ListMultipartUploads page. func (p *ListMultipartUploadsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListMultipartUploadsOutput, error) { if !p.HasMorePages() { return nil, fmt.Errorf("no more pages available") } params := *p.params params.KeyMarker = p.keyMarker params.UploadIdMarker = p.uploadIDMarker var limit int32 if p.options.Limit > 0 { limit = p.options.Limit } params.MaxUploads = limit result, err := p.client.ListMultipartUploads(ctx, &params, optFns...) if err != nil { return nil, err } p.firstPage = false prevToken := p.keyMarker p.isTruncated = result.IsTruncated p.keyMarker = nil p.uploadIDMarker = nil if result.IsTruncated { p.keyMarker = result.NextKeyMarker p.uploadIDMarker = result.NextUploadIdMarker } if p.options.StopOnDuplicateToken && prevToken != nil && p.keyMarker != nil && *prevToken == *p.keyMarker { p.isTruncated = false } return result, nil }
205
aws-sdk-go-v2
aws
Go
package s3 import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "testing" ) type mockListObjectVersionsClient struct { outputs []*ListObjectVersionsOutput inputs []*ListObjectVersionsInput t *testing.T } type mockListMultipartUploadsClient struct { outputs []*ListMultipartUploadsOutput inputs []*ListMultipartUploadsInput t *testing.T } func (c *mockListObjectVersionsClient) ListObjectVersions(ctx context.Context, input *ListObjectVersionsInput, optFns ...func(*Options)) (*ListObjectVersionsOutput, error) { c.inputs = append(c.inputs, input) requestCnt := len(c.inputs) testCurRequest(len(c.outputs), requestCnt, c.outputs[requestCnt-1].MaxKeys, input.MaxKeys, c.t) return c.outputs[requestCnt-1], nil } func (c *mockListMultipartUploadsClient) ListMultipartUploads(ctx context.Context, input *ListMultipartUploadsInput, optFns ...func(*Options)) (*ListMultipartUploadsOutput, error) { c.inputs = append(c.inputs, input) requestCnt := len(c.inputs) testCurRequest(len(c.outputs), requestCnt, c.outputs[requestCnt-1].MaxUploads, input.MaxUploads, c.t) return c.outputs[requestCnt-1], nil } type testCase struct { bucket *string limit int32 requestCnt int stopOnDuplicationToken bool } type listOVTestCase struct { testCase outputs []*ListObjectVersionsOutput } type listMPUTestCase struct { testCase outputs []*ListMultipartUploadsOutput } func TestListObjectVersionsPaginator(t *testing.T) { cases := map[string]listOVTestCase{ "page limit 5": { testCase: testCase{ bucket: aws.String("testBucket1"), limit: 5, requestCnt: 3, }, outputs: []*ListObjectVersionsOutput{ { NextKeyMarker: aws.String("testKey1"), NextVersionIdMarker: aws.String("testID1"), MaxKeys: 5, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextVersionIdMarker: aws.String("testID2"), MaxKeys: 5, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey3"), NextVersionIdMarker: aws.String("testID3"), MaxKeys: 5, IsTruncated: false, }, }, }, "page limit 10 with duplicate marker": { testCase: testCase{ bucket: aws.String("testBucket2"), limit: 10, requestCnt: 3, stopOnDuplicationToken: true, }, outputs: []*ListObjectVersionsOutput{ { NextKeyMarker: aws.String("testKey1"), NextVersionIdMarker: aws.String("testID1"), MaxKeys: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextVersionIdMarker: aws.String("testID2"), MaxKeys: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextVersionIdMarker: aws.String("testID2"), MaxKeys: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey3"), NextVersionIdMarker: aws.String("testID3"), MaxKeys: 10, IsTruncated: false, }, }, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { client := mockListObjectVersionsClient{ t: t, outputs: c.outputs, inputs: []*ListObjectVersionsInput{}, } paginator := NewListObjectVersionsPaginator(&client, &ListObjectVersionsInput{ Bucket: c.bucket, }, func(options *ListObjectVersionsPaginatorOptions) { options.Limit = c.limit options.StopOnDuplicateToken = c.stopOnDuplicationToken }) for paginator.HasMorePages() { _, err := paginator.NextPage(context.TODO()) if err != nil { t.Errorf("error: %v", err) } } inputLen := len(client.inputs) testTotalRequests(c.requestCnt, inputLen, t) for i := 1; i < inputLen; i++ { if *client.inputs[i].KeyMarker != *c.outputs[i-1].NextKeyMarker { t.Errorf("Expect next input's KeyMarker to be eaqul to %s, got %s", *c.outputs[i-1].NextKeyMarker, *client.inputs[i].KeyMarker) } if *client.inputs[i].VersionIdMarker != *c.outputs[i-1].NextVersionIdMarker { t.Errorf("Expect next input's VersionIdMarker to be eaqul to %s, got %s", *c.outputs[i-1].NextVersionIdMarker, *client.inputs[i].VersionIdMarker) } } }) } } func TestListMultipartUploadsPaginator(t *testing.T) { cases := map[string]listMPUTestCase{ "page limit 5": { testCase: testCase{ bucket: aws.String("testBucket1"), limit: 5, requestCnt: 4, }, outputs: []*ListMultipartUploadsOutput{ { NextKeyMarker: aws.String("testKey1"), NextUploadIdMarker: aws.String("testID1"), MaxUploads: 5, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextUploadIdMarker: aws.String("testID2"), MaxUploads: 5, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey3"), NextUploadIdMarker: aws.String("testID3"), MaxUploads: 5, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey4"), NextUploadIdMarker: aws.String("testID4"), MaxUploads: 5, IsTruncated: false, }, }, }, "page limit 10 with duplicate marker": { testCase: testCase{ bucket: aws.String("testBucket2"), limit: 10, requestCnt: 3, stopOnDuplicationToken: true, }, outputs: []*ListMultipartUploadsOutput{ { NextKeyMarker: aws.String("testKey1"), NextUploadIdMarker: aws.String("testID1"), MaxUploads: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextUploadIdMarker: aws.String("testID2"), MaxUploads: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey2"), NextUploadIdMarker: aws.String("testID2"), MaxUploads: 10, IsTruncated: true, }, { NextKeyMarker: aws.String("testKey4"), NextUploadIdMarker: aws.String("testID4"), MaxUploads: 10, IsTruncated: false, }, { NextKeyMarker: aws.String("testKey5"), NextUploadIdMarker: aws.String("testID5"), MaxUploads: 10, IsTruncated: false, }, }, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { client := mockListMultipartUploadsClient{ outputs: c.outputs, inputs: []*ListMultipartUploadsInput{}, t: t, } paginator := NewListMultipartUploadsPaginator(&client, &ListMultipartUploadsInput{ Bucket: c.bucket, }, func(options *ListMultipartUploadsPaginatorOptions) { options.Limit = c.limit options.StopOnDuplicateToken = c.stopOnDuplicationToken }) for paginator.HasMorePages() { _, err := paginator.NextPage(context.TODO()) if err != nil { t.Errorf("error: %v", err) } } inputLen := len(client.inputs) testTotalRequests(c.requestCnt, inputLen, t) for i := 1; i < inputLen; i++ { if *client.inputs[i].KeyMarker != *c.outputs[i-1].NextKeyMarker { t.Errorf("Expect next input's KeyMarker to be eaqul to %s, got %s", *c.outputs[i-1].NextKeyMarker, *client.inputs[i].KeyMarker) } if *client.inputs[i].UploadIdMarker != *c.outputs[i-1].NextUploadIdMarker { t.Errorf("Expect next input's UploadIdMarker to be eaqul to %s, got %s", *c.outputs[i-1].NextUploadIdMarker, *client.inputs[i].UploadIdMarker) } } }) } } func testTotalRequests(expect, actual int, t *testing.T) { if actual != expect { t.Errorf("Expect total request number to be %d, got %d", expect, actual) } } func testCurRequest(maxReqCnt, actualReqCnt int, expectLimit, actualLimit int32, t *testing.T) { if actualReqCnt > maxReqCnt { t.Errorf("Paginator calls client more than expected %d times", maxReqCnt) } if expectLimit != actualLimit { t.Errorf("Expect page limit to be %d, got %d", expectLimit, actualLimit) } }
282
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3
4
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "bytes" "context" "fmt" "github.com/aws/aws-sdk-go-v2/service/s3/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/encoding/httpbinding" smithyxml "github.com/aws/smithy-go/encoding/xml" "github.com/aws/smithy-go/middleware" smithytime "github.com/aws/smithy-go/time" smithyhttp "github.com/aws/smithy-go/transport/http" "net/http" "strconv" "strings" ) type awsRestxml_serializeOpAbortMultipartUpload struct { } func (*awsRestxml_serializeOpAbortMultipartUpload) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpAbortMultipartUpload) 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.(*AbortMultipartUploadInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=AbortMultipartUpload") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsAbortMultipartUploadInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsAbortMultipartUploadInput(v *AbortMultipartUploadInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.UploadId != nil { encoder.SetQuery("uploadId").String(*v.UploadId) } return nil } type awsRestxml_serializeOpCompleteMultipartUpload struct { } func (*awsRestxml_serializeOpCompleteMultipartUpload) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpCompleteMultipartUpload) 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.(*CompleteMultipartUploadInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=CompleteMultipartUpload") 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} } if err := awsRestxml_serializeOpHttpBindingsCompleteMultipartUploadInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.MultipartUpload != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CompleteMultipartUpload", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentCompletedMultipartUpload(input.MultipartUpload, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsCompleteMultipartUploadInput(v *CompleteMultipartUploadInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ChecksumCRC32 != nil && len(*v.ChecksumCRC32) > 0 { locationName := "X-Amz-Checksum-Crc32" encoder.SetHeader(locationName).String(*v.ChecksumCRC32) } if v.ChecksumCRC32C != nil && len(*v.ChecksumCRC32C) > 0 { locationName := "X-Amz-Checksum-Crc32c" encoder.SetHeader(locationName).String(*v.ChecksumCRC32C) } if v.ChecksumSHA1 != nil && len(*v.ChecksumSHA1) > 0 { locationName := "X-Amz-Checksum-Sha1" encoder.SetHeader(locationName).String(*v.ChecksumSHA1) } if v.ChecksumSHA256 != nil && len(*v.ChecksumSHA256) > 0 { locationName := "X-Amz-Checksum-Sha256" encoder.SetHeader(locationName).String(*v.ChecksumSHA256) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.UploadId != nil { encoder.SetQuery("uploadId").String(*v.UploadId) } return nil } type awsRestxml_serializeOpCopyObject struct { } func (*awsRestxml_serializeOpCopyObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpCopyObject) 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.(*CopyObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=CopyObject") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsCopyObjectInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsCopyObjectInput(v *CopyObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BucketKeyEnabled { locationName := "X-Amz-Server-Side-Encryption-Bucket-Key-Enabled" encoder.SetHeader(locationName).Boolean(v.BucketKeyEnabled) } if v.CacheControl != nil && len(*v.CacheControl) > 0 { locationName := "Cache-Control" encoder.SetHeader(locationName).String(*v.CacheControl) } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentDisposition != nil && len(*v.ContentDisposition) > 0 { locationName := "Content-Disposition" encoder.SetHeader(locationName).String(*v.ContentDisposition) } if v.ContentEncoding != nil && len(*v.ContentEncoding) > 0 { locationName := "Content-Encoding" encoder.SetHeader(locationName).String(*v.ContentEncoding) } if v.ContentLanguage != nil && len(*v.ContentLanguage) > 0 { locationName := "Content-Language" encoder.SetHeader(locationName).String(*v.ContentLanguage) } if v.ContentType != nil && len(*v.ContentType) > 0 { locationName := "Content-Type" encoder.SetHeader(locationName).String(*v.ContentType) } if v.CopySource != nil && len(*v.CopySource) > 0 { locationName := "X-Amz-Copy-Source" encoder.SetHeader(locationName).String(*v.CopySource) } if v.CopySourceIfMatch != nil && len(*v.CopySourceIfMatch) > 0 { locationName := "X-Amz-Copy-Source-If-Match" encoder.SetHeader(locationName).String(*v.CopySourceIfMatch) } if v.CopySourceIfModifiedSince != nil { locationName := "X-Amz-Copy-Source-If-Modified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.CopySourceIfModifiedSince)) } if v.CopySourceIfNoneMatch != nil && len(*v.CopySourceIfNoneMatch) > 0 { locationName := "X-Amz-Copy-Source-If-None-Match" encoder.SetHeader(locationName).String(*v.CopySourceIfNoneMatch) } if v.CopySourceIfUnmodifiedSince != nil { locationName := "X-Amz-Copy-Source-If-Unmodified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.CopySourceIfUnmodifiedSince)) } if v.CopySourceSSECustomerAlgorithm != nil && len(*v.CopySourceSSECustomerAlgorithm) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerAlgorithm) } if v.CopySourceSSECustomerKey != nil && len(*v.CopySourceSSECustomerKey) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerKey) } if v.CopySourceSSECustomerKeyMD5 != nil && len(*v.CopySourceSSECustomerKeyMD5) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerKeyMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.ExpectedSourceBucketOwner != nil && len(*v.ExpectedSourceBucketOwner) > 0 { locationName := "X-Amz-Source-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedSourceBucketOwner) } if v.Expires != nil { locationName := "Expires" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.Expires)) } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.Metadata != nil { hv := encoder.Headers("X-Amz-Meta-") for mapKey, mapVal := range v.Metadata { if len(mapVal) > 0 { hv.SetHeader(http.CanonicalHeaderKey(mapKey)).String(mapVal) } } } if len(v.MetadataDirective) > 0 { locationName := "X-Amz-Metadata-Directive" encoder.SetHeader(locationName).String(string(v.MetadataDirective)) } if len(v.ObjectLockLegalHoldStatus) > 0 { locationName := "X-Amz-Object-Lock-Legal-Hold" encoder.SetHeader(locationName).String(string(v.ObjectLockLegalHoldStatus)) } if len(v.ObjectLockMode) > 0 { locationName := "X-Amz-Object-Lock-Mode" encoder.SetHeader(locationName).String(string(v.ObjectLockMode)) } if v.ObjectLockRetainUntilDate != nil { locationName := "X-Amz-Object-Lock-Retain-Until-Date" encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.ObjectLockRetainUntilDate)) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if len(v.ServerSideEncryption) > 0 { locationName := "X-Amz-Server-Side-Encryption" encoder.SetHeader(locationName).String(string(v.ServerSideEncryption)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.SSEKMSEncryptionContext != nil && len(*v.SSEKMSEncryptionContext) > 0 { locationName := "X-Amz-Server-Side-Encryption-Context" encoder.SetHeader(locationName).String(*v.SSEKMSEncryptionContext) } if v.SSEKMSKeyId != nil && len(*v.SSEKMSKeyId) > 0 { locationName := "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id" encoder.SetHeader(locationName).String(*v.SSEKMSKeyId) } if len(v.StorageClass) > 0 { locationName := "X-Amz-Storage-Class" encoder.SetHeader(locationName).String(string(v.StorageClass)) } if v.Tagging != nil && len(*v.Tagging) > 0 { locationName := "X-Amz-Tagging" encoder.SetHeader(locationName).String(*v.Tagging) } if len(v.TaggingDirective) > 0 { locationName := "X-Amz-Tagging-Directive" encoder.SetHeader(locationName).String(string(v.TaggingDirective)) } if v.WebsiteRedirectLocation != nil && len(*v.WebsiteRedirectLocation) > 0 { locationName := "X-Amz-Website-Redirect-Location" encoder.SetHeader(locationName).String(*v.WebsiteRedirectLocation) } return nil } type awsRestxml_serializeOpCreateBucket struct { } func (*awsRestxml_serializeOpCreateBucket) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpCreateBucket) 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.(*CreateBucketInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsCreateBucketInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.CreateBucketConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CreateBucketConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentCreateBucketConfiguration(input.CreateBucketConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsCreateBucketInput(v *CreateBucketInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWrite != nil && len(*v.GrantWrite) > 0 { locationName := "X-Amz-Grant-Write" encoder.SetHeader(locationName).String(*v.GrantWrite) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } if v.ObjectLockEnabledForBucket { locationName := "X-Amz-Bucket-Object-Lock-Enabled" encoder.SetHeader(locationName).Boolean(v.ObjectLockEnabledForBucket) } if len(v.ObjectOwnership) > 0 { locationName := "X-Amz-Object-Ownership" encoder.SetHeader(locationName).String(string(v.ObjectOwnership)) } return nil } type awsRestxml_serializeOpCreateMultipartUpload struct { } func (*awsRestxml_serializeOpCreateMultipartUpload) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpCreateMultipartUpload) 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.(*CreateMultipartUploadInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?uploads&x-id=CreateMultipartUpload") 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} } if err := awsRestxml_serializeOpHttpBindingsCreateMultipartUploadInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsCreateMultipartUploadInput(v *CreateMultipartUploadInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BucketKeyEnabled { locationName := "X-Amz-Server-Side-Encryption-Bucket-Key-Enabled" encoder.SetHeader(locationName).Boolean(v.BucketKeyEnabled) } if v.CacheControl != nil && len(*v.CacheControl) > 0 { locationName := "Cache-Control" encoder.SetHeader(locationName).String(*v.CacheControl) } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentDisposition != nil && len(*v.ContentDisposition) > 0 { locationName := "Content-Disposition" encoder.SetHeader(locationName).String(*v.ContentDisposition) } if v.ContentEncoding != nil && len(*v.ContentEncoding) > 0 { locationName := "Content-Encoding" encoder.SetHeader(locationName).String(*v.ContentEncoding) } if v.ContentLanguage != nil && len(*v.ContentLanguage) > 0 { locationName := "Content-Language" encoder.SetHeader(locationName).String(*v.ContentLanguage) } if v.ContentType != nil && len(*v.ContentType) > 0 { locationName := "Content-Type" encoder.SetHeader(locationName).String(*v.ContentType) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Expires != nil { locationName := "Expires" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.Expires)) } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.Metadata != nil { hv := encoder.Headers("X-Amz-Meta-") for mapKey, mapVal := range v.Metadata { if len(mapVal) > 0 { hv.SetHeader(http.CanonicalHeaderKey(mapKey)).String(mapVal) } } } if len(v.ObjectLockLegalHoldStatus) > 0 { locationName := "X-Amz-Object-Lock-Legal-Hold" encoder.SetHeader(locationName).String(string(v.ObjectLockLegalHoldStatus)) } if len(v.ObjectLockMode) > 0 { locationName := "X-Amz-Object-Lock-Mode" encoder.SetHeader(locationName).String(string(v.ObjectLockMode)) } if v.ObjectLockRetainUntilDate != nil { locationName := "X-Amz-Object-Lock-Retain-Until-Date" encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.ObjectLockRetainUntilDate)) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if len(v.ServerSideEncryption) > 0 { locationName := "X-Amz-Server-Side-Encryption" encoder.SetHeader(locationName).String(string(v.ServerSideEncryption)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.SSEKMSEncryptionContext != nil && len(*v.SSEKMSEncryptionContext) > 0 { locationName := "X-Amz-Server-Side-Encryption-Context" encoder.SetHeader(locationName).String(*v.SSEKMSEncryptionContext) } if v.SSEKMSKeyId != nil && len(*v.SSEKMSKeyId) > 0 { locationName := "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id" encoder.SetHeader(locationName).String(*v.SSEKMSKeyId) } if len(v.StorageClass) > 0 { locationName := "X-Amz-Storage-Class" encoder.SetHeader(locationName).String(string(v.StorageClass)) } if v.Tagging != nil && len(*v.Tagging) > 0 { locationName := "X-Amz-Tagging" encoder.SetHeader(locationName).String(*v.Tagging) } if v.WebsiteRedirectLocation != nil && len(*v.WebsiteRedirectLocation) > 0 { locationName := "X-Amz-Website-Redirect-Location" encoder.SetHeader(locationName).String(*v.WebsiteRedirectLocation) } return nil } type awsRestxml_serializeOpDeleteBucket struct { } func (*awsRestxml_serializeOpDeleteBucket) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucket) 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.(*DeleteBucketInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketInput(v *DeleteBucketInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketAnalyticsConfiguration struct { } func (*awsRestxml_serializeOpDeleteBucketAnalyticsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketAnalyticsConfiguration) 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.(*DeleteBucketAnalyticsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?analytics") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketAnalyticsConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketAnalyticsConfigurationInput(v *DeleteBucketAnalyticsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpDeleteBucketCors struct { } func (*awsRestxml_serializeOpDeleteBucketCors) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketCors) 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.(*DeleteBucketCorsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?cors") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketCorsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketCorsInput(v *DeleteBucketCorsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketEncryption struct { } func (*awsRestxml_serializeOpDeleteBucketEncryption) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketEncryption) 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.(*DeleteBucketEncryptionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?encryption") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketEncryptionInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketEncryptionInput(v *DeleteBucketEncryptionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketIntelligentTieringConfiguration struct { } func (*awsRestxml_serializeOpDeleteBucketIntelligentTieringConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketIntelligentTieringConfiguration) 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.(*DeleteBucketIntelligentTieringConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?intelligent-tiering") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketIntelligentTieringConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketIntelligentTieringConfigurationInput(v *DeleteBucketIntelligentTieringConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpDeleteBucketInventoryConfiguration struct { } func (*awsRestxml_serializeOpDeleteBucketInventoryConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketInventoryConfiguration) 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.(*DeleteBucketInventoryConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?inventory") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketInventoryConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketInventoryConfigurationInput(v *DeleteBucketInventoryConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpDeleteBucketLifecycle struct { } func (*awsRestxml_serializeOpDeleteBucketLifecycle) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketLifecycle) 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.(*DeleteBucketLifecycleInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?lifecycle") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketLifecycleInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketLifecycleInput(v *DeleteBucketLifecycleInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketMetricsConfiguration struct { } func (*awsRestxml_serializeOpDeleteBucketMetricsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketMetricsConfiguration) 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.(*DeleteBucketMetricsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?metrics") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketMetricsConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketMetricsConfigurationInput(v *DeleteBucketMetricsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpDeleteBucketOwnershipControls struct { } func (*awsRestxml_serializeOpDeleteBucketOwnershipControls) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketOwnershipControls) 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.(*DeleteBucketOwnershipControlsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?ownershipControls") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketOwnershipControlsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketOwnershipControlsInput(v *DeleteBucketOwnershipControlsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketPolicy struct { } func (*awsRestxml_serializeOpDeleteBucketPolicy) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketPolicy) 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.(*DeleteBucketPolicyInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?policy") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketPolicyInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketPolicyInput(v *DeleteBucketPolicyInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketReplication struct { } func (*awsRestxml_serializeOpDeleteBucketReplication) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketReplication) 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.(*DeleteBucketReplicationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?replication") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketReplicationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketReplicationInput(v *DeleteBucketReplicationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketTagging struct { } func (*awsRestxml_serializeOpDeleteBucketTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketTagging) 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.(*DeleteBucketTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketTaggingInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketTaggingInput(v *DeleteBucketTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteBucketWebsite struct { } func (*awsRestxml_serializeOpDeleteBucketWebsite) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteBucketWebsite) 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.(*DeleteBucketWebsiteInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?website") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteBucketWebsiteInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteBucketWebsiteInput(v *DeleteBucketWebsiteInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpDeleteObject struct { } func (*awsRestxml_serializeOpDeleteObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteObject) 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.(*DeleteObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=DeleteObject") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteObjectInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteObjectInput(v *DeleteObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BypassGovernanceRetention { locationName := "X-Amz-Bypass-Governance-Retention" encoder.SetHeader(locationName).Boolean(v.BypassGovernanceRetention) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.MFA != nil && len(*v.MFA) > 0 { locationName := "X-Amz-Mfa" encoder.SetHeader(locationName).String(*v.MFA) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpDeleteObjects struct { } func (*awsRestxml_serializeOpDeleteObjects) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteObjects) 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.(*DeleteObjectsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?delete&x-id=DeleteObjects") 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} } if err := awsRestxml_serializeOpHttpBindingsDeleteObjectsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.Delete != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Delete", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentDelete(input.Delete, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsDeleteObjectsInput(v *DeleteObjectsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BypassGovernanceRetention { locationName := "X-Amz-Bypass-Governance-Retention" encoder.SetHeader(locationName).Boolean(v.BypassGovernanceRetention) } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.MFA != nil && len(*v.MFA) > 0 { locationName := "X-Amz-Mfa" encoder.SetHeader(locationName).String(*v.MFA) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } return nil } type awsRestxml_serializeOpDeleteObjectTagging struct { } func (*awsRestxml_serializeOpDeleteObjectTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeleteObjectTagging) 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.(*DeleteObjectTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeleteObjectTaggingInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeleteObjectTaggingInput(v *DeleteObjectTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpDeletePublicAccessBlock struct { } func (*awsRestxml_serializeOpDeletePublicAccessBlock) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpDeletePublicAccessBlock) 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.(*DeletePublicAccessBlockInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?publicAccessBlock") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "DELETE" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsDeletePublicAccessBlockInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsDeletePublicAccessBlockInput(v *DeletePublicAccessBlockInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketAccelerateConfiguration struct { } func (*awsRestxml_serializeOpGetBucketAccelerateConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketAccelerateConfiguration) 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.(*GetBucketAccelerateConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?accelerate") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketAccelerateConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketAccelerateConfigurationInput(v *GetBucketAccelerateConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } return nil } type awsRestxml_serializeOpGetBucketAcl struct { } func (*awsRestxml_serializeOpGetBucketAcl) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketAcl) 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.(*GetBucketAclInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?acl") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketAclInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketAclInput(v *GetBucketAclInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketAnalyticsConfiguration struct { } func (*awsRestxml_serializeOpGetBucketAnalyticsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketAnalyticsConfiguration) 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.(*GetBucketAnalyticsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?analytics&x-id=GetBucketAnalyticsConfiguration") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketAnalyticsConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketAnalyticsConfigurationInput(v *GetBucketAnalyticsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpGetBucketCors struct { } func (*awsRestxml_serializeOpGetBucketCors) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketCors) 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.(*GetBucketCorsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?cors") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketCorsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketCorsInput(v *GetBucketCorsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketEncryption struct { } func (*awsRestxml_serializeOpGetBucketEncryption) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketEncryption) 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.(*GetBucketEncryptionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?encryption") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketEncryptionInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketEncryptionInput(v *GetBucketEncryptionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketIntelligentTieringConfiguration struct { } func (*awsRestxml_serializeOpGetBucketIntelligentTieringConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketIntelligentTieringConfiguration) 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.(*GetBucketIntelligentTieringConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?intelligent-tiering&x-id=GetBucketIntelligentTieringConfiguration") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketIntelligentTieringConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketIntelligentTieringConfigurationInput(v *GetBucketIntelligentTieringConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpGetBucketInventoryConfiguration struct { } func (*awsRestxml_serializeOpGetBucketInventoryConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketInventoryConfiguration) 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.(*GetBucketInventoryConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?inventory&x-id=GetBucketInventoryConfiguration") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketInventoryConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketInventoryConfigurationInput(v *GetBucketInventoryConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpGetBucketLifecycleConfiguration struct { } func (*awsRestxml_serializeOpGetBucketLifecycleConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketLifecycleConfiguration) 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.(*GetBucketLifecycleConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?lifecycle") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketLifecycleConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketLifecycleConfigurationInput(v *GetBucketLifecycleConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketLocation struct { } func (*awsRestxml_serializeOpGetBucketLocation) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketLocation) 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.(*GetBucketLocationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?location") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketLocationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketLocationInput(v *GetBucketLocationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketLogging struct { } func (*awsRestxml_serializeOpGetBucketLogging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketLogging) 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.(*GetBucketLoggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?logging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketLoggingInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketLoggingInput(v *GetBucketLoggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketMetricsConfiguration struct { } func (*awsRestxml_serializeOpGetBucketMetricsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketMetricsConfiguration) 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.(*GetBucketMetricsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?metrics&x-id=GetBucketMetricsConfiguration") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketMetricsConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketMetricsConfigurationInput(v *GetBucketMetricsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpGetBucketNotificationConfiguration struct { } func (*awsRestxml_serializeOpGetBucketNotificationConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketNotificationConfiguration) 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.(*GetBucketNotificationConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?notification") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketNotificationConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketNotificationConfigurationInput(v *GetBucketNotificationConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketOwnershipControls struct { } func (*awsRestxml_serializeOpGetBucketOwnershipControls) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketOwnershipControls) 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.(*GetBucketOwnershipControlsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?ownershipControls") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketOwnershipControlsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketOwnershipControlsInput(v *GetBucketOwnershipControlsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketPolicy struct { } func (*awsRestxml_serializeOpGetBucketPolicy) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketPolicy) 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.(*GetBucketPolicyInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?policy") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketPolicyInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketPolicyInput(v *GetBucketPolicyInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketPolicyStatus struct { } func (*awsRestxml_serializeOpGetBucketPolicyStatus) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketPolicyStatus) 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.(*GetBucketPolicyStatusInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?policyStatus") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketPolicyStatusInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketPolicyStatusInput(v *GetBucketPolicyStatusInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketReplication struct { } func (*awsRestxml_serializeOpGetBucketReplication) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketReplication) 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.(*GetBucketReplicationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?replication") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketReplicationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketReplicationInput(v *GetBucketReplicationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketRequestPayment struct { } func (*awsRestxml_serializeOpGetBucketRequestPayment) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketRequestPayment) 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.(*GetBucketRequestPaymentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?requestPayment") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketRequestPaymentInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketRequestPaymentInput(v *GetBucketRequestPaymentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketTagging struct { } func (*awsRestxml_serializeOpGetBucketTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketTagging) 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.(*GetBucketTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketTaggingInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketTaggingInput(v *GetBucketTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketVersioning struct { } func (*awsRestxml_serializeOpGetBucketVersioning) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketVersioning) 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.(*GetBucketVersioningInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?versioning") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketVersioningInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketVersioningInput(v *GetBucketVersioningInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetBucketWebsite struct { } func (*awsRestxml_serializeOpGetBucketWebsite) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetBucketWebsite) 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.(*GetBucketWebsiteInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?website") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetBucketWebsiteInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetBucketWebsiteInput(v *GetBucketWebsiteInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetObject struct { } func (*awsRestxml_serializeOpGetObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObject) 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.(*GetObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=GetObject") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectInput(v *GetObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumMode) > 0 { locationName := "X-Amz-Checksum-Mode" encoder.SetHeader(locationName).String(string(v.ChecksumMode)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.IfMatch != nil && len(*v.IfMatch) > 0 { locationName := "If-Match" encoder.SetHeader(locationName).String(*v.IfMatch) } if v.IfModifiedSince != nil { locationName := "If-Modified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.IfModifiedSince)) } if v.IfNoneMatch != nil && len(*v.IfNoneMatch) > 0 { locationName := "If-None-Match" encoder.SetHeader(locationName).String(*v.IfNoneMatch) } if v.IfUnmodifiedSince != nil { locationName := "If-Unmodified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.IfUnmodifiedSince)) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.PartNumber != 0 { encoder.SetQuery("partNumber").Integer(v.PartNumber) } if v.Range != nil && len(*v.Range) > 0 { locationName := "Range" encoder.SetHeader(locationName).String(*v.Range) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.ResponseCacheControl != nil { encoder.SetQuery("response-cache-control").String(*v.ResponseCacheControl) } if v.ResponseContentDisposition != nil { encoder.SetQuery("response-content-disposition").String(*v.ResponseContentDisposition) } if v.ResponseContentEncoding != nil { encoder.SetQuery("response-content-encoding").String(*v.ResponseContentEncoding) } if v.ResponseContentLanguage != nil { encoder.SetQuery("response-content-language").String(*v.ResponseContentLanguage) } if v.ResponseContentType != nil { encoder.SetQuery("response-content-type").String(*v.ResponseContentType) } if v.ResponseExpires != nil { encoder.SetQuery("response-expires").String(smithytime.FormatHTTPDate(*v.ResponseExpires)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectAcl struct { } func (*awsRestxml_serializeOpGetObjectAcl) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectAcl) 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.(*GetObjectAclInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?acl") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectAclInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectAclInput(v *GetObjectAclInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectAttributes struct { } func (*awsRestxml_serializeOpGetObjectAttributes) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectAttributes) 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.(*GetObjectAttributesInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?attributes") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectAttributesInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectAttributesInput(v *GetObjectAttributesInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.MaxParts != 0 { locationName := "X-Amz-Max-Parts" encoder.SetHeader(locationName).Integer(v.MaxParts) } if v.ObjectAttributes != nil { locationName := "X-Amz-Object-Attributes" for i := range v.ObjectAttributes { if len(v.ObjectAttributes[i]) > 0 { escaped := string(v.ObjectAttributes[i]) if strings.Index(string(v.ObjectAttributes[i]), `,`) != -1 || strings.Index(string(v.ObjectAttributes[i]), `"`) != -1 { escaped = strconv.Quote(string(v.ObjectAttributes[i])) } encoder.AddHeader(locationName).String(string(escaped)) } } } if v.PartNumberMarker != nil && len(*v.PartNumberMarker) > 0 { locationName := "X-Amz-Part-Number-Marker" encoder.SetHeader(locationName).String(*v.PartNumberMarker) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectLegalHold struct { } func (*awsRestxml_serializeOpGetObjectLegalHold) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectLegalHold) 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.(*GetObjectLegalHoldInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?legal-hold") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectLegalHoldInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectLegalHoldInput(v *GetObjectLegalHoldInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectLockConfiguration struct { } func (*awsRestxml_serializeOpGetObjectLockConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectLockConfiguration) 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.(*GetObjectLockConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?object-lock") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectLockConfigurationInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectLockConfigurationInput(v *GetObjectLockConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpGetObjectRetention struct { } func (*awsRestxml_serializeOpGetObjectRetention) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectRetention) 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.(*GetObjectRetentionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?retention") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectRetentionInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectRetentionInput(v *GetObjectRetentionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectTagging struct { } func (*awsRestxml_serializeOpGetObjectTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectTagging) 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.(*GetObjectTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectTaggingInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectTaggingInput(v *GetObjectTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpGetObjectTorrent struct { } func (*awsRestxml_serializeOpGetObjectTorrent) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetObjectTorrent) 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.(*GetObjectTorrentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?torrent") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetObjectTorrentInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetObjectTorrentInput(v *GetObjectTorrentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } return nil } type awsRestxml_serializeOpGetPublicAccessBlock struct { } func (*awsRestxml_serializeOpGetPublicAccessBlock) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpGetPublicAccessBlock) 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.(*GetPublicAccessBlockInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?publicAccessBlock") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsGetPublicAccessBlockInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsGetPublicAccessBlockInput(v *GetPublicAccessBlockInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpHeadBucket struct { } func (*awsRestxml_serializeOpHeadBucket) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpHeadBucket) 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.(*HeadBucketInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "HEAD" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsHeadBucketInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsHeadBucketInput(v *HeadBucketInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpHeadObject struct { } func (*awsRestxml_serializeOpHeadObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpHeadObject) 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.(*HeadObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "HEAD" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsHeadObjectInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsHeadObjectInput(v *HeadObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumMode) > 0 { locationName := "X-Amz-Checksum-Mode" encoder.SetHeader(locationName).String(string(v.ChecksumMode)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.IfMatch != nil && len(*v.IfMatch) > 0 { locationName := "If-Match" encoder.SetHeader(locationName).String(*v.IfMatch) } if v.IfModifiedSince != nil { locationName := "If-Modified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.IfModifiedSince)) } if v.IfNoneMatch != nil && len(*v.IfNoneMatch) > 0 { locationName := "If-None-Match" encoder.SetHeader(locationName).String(*v.IfNoneMatch) } if v.IfUnmodifiedSince != nil { locationName := "If-Unmodified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.IfUnmodifiedSince)) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.PartNumber != 0 { encoder.SetQuery("partNumber").Integer(v.PartNumber) } if v.Range != nil && len(*v.Range) > 0 { locationName := "Range" encoder.SetHeader(locationName).String(*v.Range) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpListBucketAnalyticsConfigurations struct { } func (*awsRestxml_serializeOpListBucketAnalyticsConfigurations) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListBucketAnalyticsConfigurations) 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.(*ListBucketAnalyticsConfigurationsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?analytics&x-id=ListBucketAnalyticsConfigurations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListBucketAnalyticsConfigurationsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListBucketAnalyticsConfigurationsInput(v *ListBucketAnalyticsConfigurationsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContinuationToken != nil { encoder.SetQuery("continuation-token").String(*v.ContinuationToken) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpListBucketIntelligentTieringConfigurations struct { } func (*awsRestxml_serializeOpListBucketIntelligentTieringConfigurations) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListBucketIntelligentTieringConfigurations) 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.(*ListBucketIntelligentTieringConfigurationsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?intelligent-tiering&x-id=ListBucketIntelligentTieringConfigurations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListBucketIntelligentTieringConfigurationsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListBucketIntelligentTieringConfigurationsInput(v *ListBucketIntelligentTieringConfigurationsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContinuationToken != nil { encoder.SetQuery("continuation-token").String(*v.ContinuationToken) } return nil } type awsRestxml_serializeOpListBucketInventoryConfigurations struct { } func (*awsRestxml_serializeOpListBucketInventoryConfigurations) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListBucketInventoryConfigurations) 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.(*ListBucketInventoryConfigurationsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?inventory&x-id=ListBucketInventoryConfigurations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListBucketInventoryConfigurationsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListBucketInventoryConfigurationsInput(v *ListBucketInventoryConfigurationsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContinuationToken != nil { encoder.SetQuery("continuation-token").String(*v.ContinuationToken) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpListBucketMetricsConfigurations struct { } func (*awsRestxml_serializeOpListBucketMetricsConfigurations) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListBucketMetricsConfigurations) 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.(*ListBucketMetricsConfigurationsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?metrics&x-id=ListBucketMetricsConfigurations") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListBucketMetricsConfigurationsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListBucketMetricsConfigurationsInput(v *ListBucketMetricsConfigurationsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContinuationToken != nil { encoder.SetQuery("continuation-token").String(*v.ContinuationToken) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpListBuckets struct { } func (*awsRestxml_serializeOpListBuckets) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListBuckets) 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.(*ListBucketsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if 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 awsRestxml_serializeOpHttpBindingsListBucketsInput(v *ListBucketsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } return nil } type awsRestxml_serializeOpListMultipartUploads struct { } func (*awsRestxml_serializeOpListMultipartUploads) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListMultipartUploads) 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.(*ListMultipartUploadsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?uploads") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListMultipartUploadsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListMultipartUploadsInput(v *ListMultipartUploadsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Delimiter != nil { encoder.SetQuery("delimiter").String(*v.Delimiter) } if len(v.EncodingType) > 0 { encoder.SetQuery("encoding-type").String(string(v.EncodingType)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.KeyMarker != nil { encoder.SetQuery("key-marker").String(*v.KeyMarker) } if v.MaxUploads != 0 { encoder.SetQuery("max-uploads").Integer(v.MaxUploads) } if v.Prefix != nil { encoder.SetQuery("prefix").String(*v.Prefix) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.UploadIdMarker != nil { encoder.SetQuery("upload-id-marker").String(*v.UploadIdMarker) } return nil } type awsRestxml_serializeOpListObjects struct { } func (*awsRestxml_serializeOpListObjects) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListObjects) 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.(*ListObjectsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListObjectsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListObjectsInput(v *ListObjectsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Delimiter != nil { encoder.SetQuery("delimiter").String(*v.Delimiter) } if len(v.EncodingType) > 0 { encoder.SetQuery("encoding-type").String(string(v.EncodingType)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Marker != nil { encoder.SetQuery("marker").String(*v.Marker) } if v.MaxKeys != 0 { encoder.SetQuery("max-keys").Integer(v.MaxKeys) } if v.OptionalObjectAttributes != nil { locationName := "X-Amz-Optional-Object-Attributes" for i := range v.OptionalObjectAttributes { if len(v.OptionalObjectAttributes[i]) > 0 { escaped := string(v.OptionalObjectAttributes[i]) if strings.Index(string(v.OptionalObjectAttributes[i]), `,`) != -1 || strings.Index(string(v.OptionalObjectAttributes[i]), `"`) != -1 { escaped = strconv.Quote(string(v.OptionalObjectAttributes[i])) } encoder.AddHeader(locationName).String(string(escaped)) } } } if v.Prefix != nil { encoder.SetQuery("prefix").String(*v.Prefix) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } return nil } type awsRestxml_serializeOpListObjectsV2 struct { } func (*awsRestxml_serializeOpListObjectsV2) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListObjectsV2) 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.(*ListObjectsV2Input) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?list-type=2") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListObjectsV2Input(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListObjectsV2Input(v *ListObjectsV2Input, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContinuationToken != nil { encoder.SetQuery("continuation-token").String(*v.ContinuationToken) } if v.Delimiter != nil { encoder.SetQuery("delimiter").String(*v.Delimiter) } if len(v.EncodingType) > 0 { encoder.SetQuery("encoding-type").String(string(v.EncodingType)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.FetchOwner { encoder.SetQuery("fetch-owner").Boolean(v.FetchOwner) } if v.MaxKeys != 0 { encoder.SetQuery("max-keys").Integer(v.MaxKeys) } if v.OptionalObjectAttributes != nil { locationName := "X-Amz-Optional-Object-Attributes" for i := range v.OptionalObjectAttributes { if len(v.OptionalObjectAttributes[i]) > 0 { escaped := string(v.OptionalObjectAttributes[i]) if strings.Index(string(v.OptionalObjectAttributes[i]), `,`) != -1 || strings.Index(string(v.OptionalObjectAttributes[i]), `"`) != -1 { escaped = strconv.Quote(string(v.OptionalObjectAttributes[i])) } encoder.AddHeader(locationName).String(string(escaped)) } } } if v.Prefix != nil { encoder.SetQuery("prefix").String(*v.Prefix) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.StartAfter != nil { encoder.SetQuery("start-after").String(*v.StartAfter) } return nil } type awsRestxml_serializeOpListObjectVersions struct { } func (*awsRestxml_serializeOpListObjectVersions) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListObjectVersions) 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.(*ListObjectVersionsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?versions") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListObjectVersionsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListObjectVersionsInput(v *ListObjectVersionsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Delimiter != nil { encoder.SetQuery("delimiter").String(*v.Delimiter) } if len(v.EncodingType) > 0 { encoder.SetQuery("encoding-type").String(string(v.EncodingType)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.KeyMarker != nil { encoder.SetQuery("key-marker").String(*v.KeyMarker) } if v.MaxKeys != 0 { encoder.SetQuery("max-keys").Integer(v.MaxKeys) } if v.OptionalObjectAttributes != nil { locationName := "X-Amz-Optional-Object-Attributes" for i := range v.OptionalObjectAttributes { if len(v.OptionalObjectAttributes[i]) > 0 { escaped := string(v.OptionalObjectAttributes[i]) if strings.Index(string(v.OptionalObjectAttributes[i]), `,`) != -1 || strings.Index(string(v.OptionalObjectAttributes[i]), `"`) != -1 { escaped = strconv.Quote(string(v.OptionalObjectAttributes[i])) } encoder.AddHeader(locationName).String(string(escaped)) } } } if v.Prefix != nil { encoder.SetQuery("prefix").String(*v.Prefix) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionIdMarker != nil { encoder.SetQuery("version-id-marker").String(*v.VersionIdMarker) } return nil } type awsRestxml_serializeOpListParts struct { } func (*awsRestxml_serializeOpListParts) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpListParts) 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.(*ListPartsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=ListParts") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "GET" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsListPartsInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsListPartsInput(v *ListPartsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.MaxParts != 0 { encoder.SetQuery("max-parts").Integer(v.MaxParts) } if v.PartNumberMarker != nil { encoder.SetQuery("part-number-marker").String(*v.PartNumberMarker) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.UploadId != nil { encoder.SetQuery("uploadId").String(*v.UploadId) } return nil } type awsRestxml_serializeOpPutBucketAccelerateConfiguration struct { } func (*awsRestxml_serializeOpPutBucketAccelerateConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketAccelerateConfiguration) 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.(*PutBucketAccelerateConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?accelerate") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketAccelerateConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.AccelerateConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccelerateConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentAccelerateConfiguration(input.AccelerateConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketAccelerateConfigurationInput(v *PutBucketAccelerateConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketAcl struct { } func (*awsRestxml_serializeOpPutBucketAcl) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketAcl) 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.(*PutBucketAclInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?acl") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketAclInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.AccessControlPolicy != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessControlPolicy", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentAccessControlPolicy(input.AccessControlPolicy, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketAclInput(v *PutBucketAclInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWrite != nil && len(*v.GrantWrite) > 0 { locationName := "X-Amz-Grant-Write" encoder.SetHeader(locationName).String(*v.GrantWrite) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } return nil } type awsRestxml_serializeOpPutBucketAnalyticsConfiguration struct { } func (*awsRestxml_serializeOpPutBucketAnalyticsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketAnalyticsConfiguration) 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.(*PutBucketAnalyticsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?analytics") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketAnalyticsConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.AnalyticsConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AnalyticsConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentAnalyticsConfiguration(input.AnalyticsConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketAnalyticsConfigurationInput(v *PutBucketAnalyticsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpPutBucketCors struct { } func (*awsRestxml_serializeOpPutBucketCors) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketCors) 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.(*PutBucketCorsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?cors") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketCorsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.CORSConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CORSConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentCORSConfiguration(input.CORSConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketCorsInput(v *PutBucketCorsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketEncryption struct { } func (*awsRestxml_serializeOpPutBucketEncryption) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketEncryption) 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.(*PutBucketEncryptionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?encryption") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketEncryptionInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.ServerSideEncryptionConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ServerSideEncryptionConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentServerSideEncryptionConfiguration(input.ServerSideEncryptionConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketEncryptionInput(v *PutBucketEncryptionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketIntelligentTieringConfiguration struct { } func (*awsRestxml_serializeOpPutBucketIntelligentTieringConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketIntelligentTieringConfiguration) 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.(*PutBucketIntelligentTieringConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?intelligent-tiering") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketIntelligentTieringConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.IntelligentTieringConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "IntelligentTieringConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentIntelligentTieringConfiguration(input.IntelligentTieringConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketIntelligentTieringConfigurationInput(v *PutBucketIntelligentTieringConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpPutBucketInventoryConfiguration struct { } func (*awsRestxml_serializeOpPutBucketInventoryConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketInventoryConfiguration) 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.(*PutBucketInventoryConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?inventory") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketInventoryConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.InventoryConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "InventoryConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentInventoryConfiguration(input.InventoryConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketInventoryConfigurationInput(v *PutBucketInventoryConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpPutBucketLifecycleConfiguration struct { } func (*awsRestxml_serializeOpPutBucketLifecycleConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketLifecycleConfiguration) 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.(*PutBucketLifecycleConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?lifecycle") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketLifecycleConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.LifecycleConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "LifecycleConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentBucketLifecycleConfiguration(input.LifecycleConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketLifecycleConfigurationInput(v *PutBucketLifecycleConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketLogging struct { } func (*awsRestxml_serializeOpPutBucketLogging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketLogging) 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.(*PutBucketLoggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?logging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketLoggingInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.BucketLoggingStatus != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BucketLoggingStatus", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentBucketLoggingStatus(input.BucketLoggingStatus, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketLoggingInput(v *PutBucketLoggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketMetricsConfiguration struct { } func (*awsRestxml_serializeOpPutBucketMetricsConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketMetricsConfiguration) 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.(*PutBucketMetricsConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?metrics") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketMetricsConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.MetricsConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "MetricsConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentMetricsConfiguration(input.MetricsConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketMetricsConfigurationInput(v *PutBucketMetricsConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Id != nil { encoder.SetQuery("id").String(*v.Id) } return nil } type awsRestxml_serializeOpPutBucketNotificationConfiguration struct { } func (*awsRestxml_serializeOpPutBucketNotificationConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketNotificationConfiguration) 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.(*PutBucketNotificationConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?notification") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketNotificationConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.NotificationConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NotificationConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentNotificationConfiguration(input.NotificationConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketNotificationConfigurationInput(v *PutBucketNotificationConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.SkipDestinationValidation { locationName := "X-Amz-Skip-Destination-Validation" encoder.SetHeader(locationName).Boolean(v.SkipDestinationValidation) } return nil } type awsRestxml_serializeOpPutBucketOwnershipControls struct { } func (*awsRestxml_serializeOpPutBucketOwnershipControls) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketOwnershipControls) 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.(*PutBucketOwnershipControlsInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?ownershipControls") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketOwnershipControlsInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.OwnershipControls != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OwnershipControls", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentOwnershipControls(input.OwnershipControls, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketOwnershipControlsInput(v *PutBucketOwnershipControlsInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketPolicy struct { } func (*awsRestxml_serializeOpPutBucketPolicy) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketPolicy) 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.(*PutBucketPolicyInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?policy") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketPolicyInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("text/plain") } if input.Policy != nil { payload := strings.NewReader(*input.Policy) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketPolicyInput(v *PutBucketPolicyInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ConfirmRemoveSelfBucketAccess { locationName := "X-Amz-Confirm-Remove-Self-Bucket-Access" encoder.SetHeader(locationName).Boolean(v.ConfirmRemoveSelfBucketAccess) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketReplication struct { } func (*awsRestxml_serializeOpPutBucketReplication) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketReplication) 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.(*PutBucketReplicationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?replication") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketReplicationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.ReplicationConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplicationConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentReplicationConfiguration(input.ReplicationConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketReplicationInput(v *PutBucketReplicationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Token != nil && len(*v.Token) > 0 { locationName := "X-Amz-Bucket-Object-Lock-Token" encoder.SetHeader(locationName).String(*v.Token) } return nil } type awsRestxml_serializeOpPutBucketRequestPayment struct { } func (*awsRestxml_serializeOpPutBucketRequestPayment) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketRequestPayment) 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.(*PutBucketRequestPaymentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?requestPayment") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketRequestPaymentInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.RequestPaymentConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RequestPaymentConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentRequestPaymentConfiguration(input.RequestPaymentConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketRequestPaymentInput(v *PutBucketRequestPaymentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketTagging struct { } func (*awsRestxml_serializeOpPutBucketTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketTagging) 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.(*PutBucketTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketTaggingInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.Tagging != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tagging", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentTagging(input.Tagging, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketTaggingInput(v *PutBucketTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutBucketVersioning struct { } func (*awsRestxml_serializeOpPutBucketVersioning) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketVersioning) 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.(*PutBucketVersioningInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?versioning") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketVersioningInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.VersioningConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "VersioningConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentVersioningConfiguration(input.VersioningConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketVersioningInput(v *PutBucketVersioningInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.MFA != nil && len(*v.MFA) > 0 { locationName := "X-Amz-Mfa" encoder.SetHeader(locationName).String(*v.MFA) } return nil } type awsRestxml_serializeOpPutBucketWebsite struct { } func (*awsRestxml_serializeOpPutBucketWebsite) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutBucketWebsite) 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.(*PutBucketWebsiteInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?website") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutBucketWebsiteInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.WebsiteConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "WebsiteConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentWebsiteConfiguration(input.WebsiteConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutBucketWebsiteInput(v *PutBucketWebsiteInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpPutObject struct { } func (*awsRestxml_serializeOpPutObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObject) 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.(*PutObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=PutObject") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/octet-stream") } if input.Body != nil { payload := input.Body if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectInput(v *PutObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BucketKeyEnabled { locationName := "X-Amz-Server-Side-Encryption-Bucket-Key-Enabled" encoder.SetHeader(locationName).Boolean(v.BucketKeyEnabled) } if v.CacheControl != nil && len(*v.CacheControl) > 0 { locationName := "Cache-Control" encoder.SetHeader(locationName).String(*v.CacheControl) } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ChecksumCRC32 != nil && len(*v.ChecksumCRC32) > 0 { locationName := "X-Amz-Checksum-Crc32" encoder.SetHeader(locationName).String(*v.ChecksumCRC32) } if v.ChecksumCRC32C != nil && len(*v.ChecksumCRC32C) > 0 { locationName := "X-Amz-Checksum-Crc32c" encoder.SetHeader(locationName).String(*v.ChecksumCRC32C) } if v.ChecksumSHA1 != nil && len(*v.ChecksumSHA1) > 0 { locationName := "X-Amz-Checksum-Sha1" encoder.SetHeader(locationName).String(*v.ChecksumSHA1) } if v.ChecksumSHA256 != nil && len(*v.ChecksumSHA256) > 0 { locationName := "X-Amz-Checksum-Sha256" encoder.SetHeader(locationName).String(*v.ChecksumSHA256) } if v.ContentDisposition != nil && len(*v.ContentDisposition) > 0 { locationName := "Content-Disposition" encoder.SetHeader(locationName).String(*v.ContentDisposition) } if v.ContentEncoding != nil && len(*v.ContentEncoding) > 0 { locationName := "Content-Encoding" encoder.SetHeader(locationName).String(*v.ContentEncoding) } if v.ContentLanguage != nil && len(*v.ContentLanguage) > 0 { locationName := "Content-Language" encoder.SetHeader(locationName).String(*v.ContentLanguage) } if v.ContentLength != 0 { locationName := "Content-Length" encoder.SetHeader(locationName).Long(v.ContentLength) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ContentType != nil && len(*v.ContentType) > 0 { locationName := "Content-Type" encoder.SetHeader(locationName).String(*v.ContentType) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Expires != nil { locationName := "Expires" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.Expires)) } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.Metadata != nil { hv := encoder.Headers("X-Amz-Meta-") for mapKey, mapVal := range v.Metadata { if len(mapVal) > 0 { hv.SetHeader(http.CanonicalHeaderKey(mapKey)).String(mapVal) } } } if len(v.ObjectLockLegalHoldStatus) > 0 { locationName := "X-Amz-Object-Lock-Legal-Hold" encoder.SetHeader(locationName).String(string(v.ObjectLockLegalHoldStatus)) } if len(v.ObjectLockMode) > 0 { locationName := "X-Amz-Object-Lock-Mode" encoder.SetHeader(locationName).String(string(v.ObjectLockMode)) } if v.ObjectLockRetainUntilDate != nil { locationName := "X-Amz-Object-Lock-Retain-Until-Date" encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.ObjectLockRetainUntilDate)) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if len(v.ServerSideEncryption) > 0 { locationName := "X-Amz-Server-Side-Encryption" encoder.SetHeader(locationName).String(string(v.ServerSideEncryption)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.SSEKMSEncryptionContext != nil && len(*v.SSEKMSEncryptionContext) > 0 { locationName := "X-Amz-Server-Side-Encryption-Context" encoder.SetHeader(locationName).String(*v.SSEKMSEncryptionContext) } if v.SSEKMSKeyId != nil && len(*v.SSEKMSKeyId) > 0 { locationName := "X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id" encoder.SetHeader(locationName).String(*v.SSEKMSKeyId) } if len(v.StorageClass) > 0 { locationName := "X-Amz-Storage-Class" encoder.SetHeader(locationName).String(string(v.StorageClass)) } if v.Tagging != nil && len(*v.Tagging) > 0 { locationName := "X-Amz-Tagging" encoder.SetHeader(locationName).String(*v.Tagging) } if v.WebsiteRedirectLocation != nil && len(*v.WebsiteRedirectLocation) > 0 { locationName := "X-Amz-Website-Redirect-Location" encoder.SetHeader(locationName).String(*v.WebsiteRedirectLocation) } return nil } type awsRestxml_serializeOpPutObjectAcl struct { } func (*awsRestxml_serializeOpPutObjectAcl) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObjectAcl) 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.(*PutObjectAclInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?acl") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectAclInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.AccessControlPolicy != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessControlPolicy", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentAccessControlPolicy(input.AccessControlPolicy, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectAclInput(v *PutObjectAclInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if len(v.ACL) > 0 { locationName := "X-Amz-Acl" encoder.SetHeader(locationName).String(string(v.ACL)) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.GrantFullControl != nil && len(*v.GrantFullControl) > 0 { locationName := "X-Amz-Grant-Full-Control" encoder.SetHeader(locationName).String(*v.GrantFullControl) } if v.GrantRead != nil && len(*v.GrantRead) > 0 { locationName := "X-Amz-Grant-Read" encoder.SetHeader(locationName).String(*v.GrantRead) } if v.GrantReadACP != nil && len(*v.GrantReadACP) > 0 { locationName := "X-Amz-Grant-Read-Acp" encoder.SetHeader(locationName).String(*v.GrantReadACP) } if v.GrantWrite != nil && len(*v.GrantWrite) > 0 { locationName := "X-Amz-Grant-Write" encoder.SetHeader(locationName).String(*v.GrantWrite) } if v.GrantWriteACP != nil && len(*v.GrantWriteACP) > 0 { locationName := "X-Amz-Grant-Write-Acp" encoder.SetHeader(locationName).String(*v.GrantWriteACP) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpPutObjectLegalHold struct { } func (*awsRestxml_serializeOpPutObjectLegalHold) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObjectLegalHold) 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.(*PutObjectLegalHoldInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?legal-hold") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectLegalHoldInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.LegalHold != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "LegalHold", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentObjectLockLegalHold(input.LegalHold, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectLegalHoldInput(v *PutObjectLegalHoldInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpPutObjectLockConfiguration struct { } func (*awsRestxml_serializeOpPutObjectLockConfiguration) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObjectLockConfiguration) 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.(*PutObjectLockConfigurationInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?object-lock") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectLockConfigurationInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.ObjectLockConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectLockConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentObjectLockConfiguration(input.ObjectLockConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectLockConfigurationInput(v *PutObjectLockConfigurationInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.Token != nil && len(*v.Token) > 0 { locationName := "X-Amz-Bucket-Object-Lock-Token" encoder.SetHeader(locationName).String(*v.Token) } return nil } type awsRestxml_serializeOpPutObjectRetention struct { } func (*awsRestxml_serializeOpPutObjectRetention) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObjectRetention) 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.(*PutObjectRetentionInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?retention") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectRetentionInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.Retention != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Retention", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentObjectLockRetention(input.Retention, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectRetentionInput(v *PutObjectRetentionInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.BypassGovernanceRetention { locationName := "X-Amz-Bypass-Governance-Retention" encoder.SetHeader(locationName).Boolean(v.BypassGovernanceRetention) } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpPutObjectTagging struct { } func (*awsRestxml_serializeOpPutObjectTagging) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutObjectTagging) 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.(*PutObjectTaggingInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?tagging") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutObjectTaggingInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.Tagging != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tagging", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentTagging(input.Tagging, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutObjectTaggingInput(v *PutObjectTaggingInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpPutPublicAccessBlock struct { } func (*awsRestxml_serializeOpPutPublicAccessBlock) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpPutPublicAccessBlock) 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.(*PutPublicAccessBlockInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}?publicAccessBlock") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsPutPublicAccessBlockInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.PublicAccessBlockConfiguration != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "PublicAccessBlockConfiguration", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentPublicAccessBlockConfiguration(input.PublicAccessBlockConfiguration, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsPutPublicAccessBlockInput(v *PutPublicAccessBlockInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } return nil } type awsRestxml_serializeOpRestoreObject struct { } func (*awsRestxml_serializeOpRestoreObject) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpRestoreObject) 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.(*RestoreObjectInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?restore&x-id=RestoreObject") 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} } if err := awsRestxml_serializeOpHttpBindingsRestoreObjectInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if input.RestoreRequest != nil { if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/xml") } xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) payloadRootAttr := []smithyxml.Attr{} payloadRoot := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RestoreRequest", }, Attr: payloadRootAttr, } payloadRoot.Attr = append(payloadRoot.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeDocumentRestoreRequest(input.RestoreRequest, xmlEncoder.RootElement(payloadRoot)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } payload := bytes.NewReader(xmlEncoder.Bytes()) if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsRestoreObjectInput(v *RestoreObjectInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.VersionId != nil { encoder.SetQuery("versionId").String(*v.VersionId) } return nil } type awsRestxml_serializeOpSelectObjectContent struct { } func (*awsRestxml_serializeOpSelectObjectContent) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpSelectObjectContent) 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.(*SelectObjectContentInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?select&select-type=2&x-id=SelectObjectContent") 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} } if err := awsRestxml_serializeOpHttpBindingsSelectObjectContentInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } restEncoder.SetHeader("Content-Type").String("application/xml") xmlEncoder := smithyxml.NewEncoder(bytes.NewBuffer(nil)) rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SelectObjectContentRequest", }, Attr: rootAttr, } root.Attr = append(root.Attr, smithyxml.NewNamespaceAttribute("", "http://s3.amazonaws.com/doc/2006-03-01/")) if err := awsRestxml_serializeOpDocumentSelectObjectContentInput(input, xmlEncoder.RootElement(root)); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if request, err = request.SetStream(bytes.NewReader(xmlEncoder.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 awsRestxml_serializeOpHttpBindingsSelectObjectContentInput(v *SelectObjectContentInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } return nil } func awsRestxml_serializeOpDocumentSelectObjectContentInput(v *SelectObjectContentInput, value smithyxml.Value) error { defer value.Close() if v.Expression != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Expression", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Expression) } if len(v.ExpressionType) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ExpressionType", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.ExpressionType)) } if v.InputSerialization != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "InputSerialization", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInputSerialization(v.InputSerialization, el); err != nil { return err } } if v.OutputSerialization != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OutputSerialization", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentOutputSerialization(v.OutputSerialization, el); err != nil { return err } } if v.RequestProgress != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RequestProgress", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentRequestProgress(v.RequestProgress, el); err != nil { return err } } if v.ScanRange != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ScanRange", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentScanRange(v.ScanRange, el); err != nil { return err } } return nil } type awsRestxml_serializeOpUploadPart struct { } func (*awsRestxml_serializeOpUploadPart) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpUploadPart) 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.(*UploadPartInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=UploadPart") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsUploadPartInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/octet-stream") } if input.Body != nil { payload := input.Body if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsUploadPartInput(v *UploadPartInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if len(v.ChecksumAlgorithm) > 0 { locationName := "X-Amz-Sdk-Checksum-Algorithm" encoder.SetHeader(locationName).String(string(v.ChecksumAlgorithm)) } if v.ChecksumCRC32 != nil && len(*v.ChecksumCRC32) > 0 { locationName := "X-Amz-Checksum-Crc32" encoder.SetHeader(locationName).String(*v.ChecksumCRC32) } if v.ChecksumCRC32C != nil && len(*v.ChecksumCRC32C) > 0 { locationName := "X-Amz-Checksum-Crc32c" encoder.SetHeader(locationName).String(*v.ChecksumCRC32C) } if v.ChecksumSHA1 != nil && len(*v.ChecksumSHA1) > 0 { locationName := "X-Amz-Checksum-Sha1" encoder.SetHeader(locationName).String(*v.ChecksumSHA1) } if v.ChecksumSHA256 != nil && len(*v.ChecksumSHA256) > 0 { locationName := "X-Amz-Checksum-Sha256" encoder.SetHeader(locationName).String(*v.ChecksumSHA256) } if v.ContentLength != 0 { locationName := "Content-Length" encoder.SetHeader(locationName).Long(v.ContentLength) } if v.ContentMD5 != nil && len(*v.ContentMD5) > 0 { locationName := "Content-Md5" encoder.SetHeader(locationName).String(*v.ContentMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } { encoder.SetQuery("partNumber").Integer(v.PartNumber) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.UploadId != nil { encoder.SetQuery("uploadId").String(*v.UploadId) } return nil } type awsRestxml_serializeOpUploadPartCopy struct { } func (*awsRestxml_serializeOpUploadPartCopy) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpUploadPartCopy) 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.(*UploadPartCopyInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/{Bucket}/{Key+}?x-id=UploadPartCopy") request.URL.Path = smithyhttp.JoinPath(request.URL.Path, opPath) request.URL.RawQuery = smithyhttp.JoinRawQuery(request.URL.RawQuery, opQuery) request.Method = "PUT" restEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) if err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if err := awsRestxml_serializeOpHttpBindingsUploadPartCopyInput(input, restEncoder); 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 awsRestxml_serializeOpHttpBindingsUploadPartCopyInput(v *UploadPartCopyInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.Bucket == nil || len(*v.Bucket) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Bucket must not be empty")} } if v.Bucket != nil { if err := encoder.SetURI("Bucket").String(*v.Bucket); err != nil { return err } } if v.CopySource != nil && len(*v.CopySource) > 0 { locationName := "X-Amz-Copy-Source" encoder.SetHeader(locationName).String(*v.CopySource) } if v.CopySourceIfMatch != nil && len(*v.CopySourceIfMatch) > 0 { locationName := "X-Amz-Copy-Source-If-Match" encoder.SetHeader(locationName).String(*v.CopySourceIfMatch) } if v.CopySourceIfModifiedSince != nil { locationName := "X-Amz-Copy-Source-If-Modified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.CopySourceIfModifiedSince)) } if v.CopySourceIfNoneMatch != nil && len(*v.CopySourceIfNoneMatch) > 0 { locationName := "X-Amz-Copy-Source-If-None-Match" encoder.SetHeader(locationName).String(*v.CopySourceIfNoneMatch) } if v.CopySourceIfUnmodifiedSince != nil { locationName := "X-Amz-Copy-Source-If-Unmodified-Since" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.CopySourceIfUnmodifiedSince)) } if v.CopySourceRange != nil && len(*v.CopySourceRange) > 0 { locationName := "X-Amz-Copy-Source-Range" encoder.SetHeader(locationName).String(*v.CopySourceRange) } if v.CopySourceSSECustomerAlgorithm != nil && len(*v.CopySourceSSECustomerAlgorithm) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerAlgorithm) } if v.CopySourceSSECustomerKey != nil && len(*v.CopySourceSSECustomerKey) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerKey) } if v.CopySourceSSECustomerKeyMD5 != nil && len(*v.CopySourceSSECustomerKeyMD5) > 0 { locationName := "X-Amz-Copy-Source-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.CopySourceSSECustomerKeyMD5) } if v.ExpectedBucketOwner != nil && len(*v.ExpectedBucketOwner) > 0 { locationName := "X-Amz-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedBucketOwner) } if v.ExpectedSourceBucketOwner != nil && len(*v.ExpectedSourceBucketOwner) > 0 { locationName := "X-Amz-Source-Expected-Bucket-Owner" encoder.SetHeader(locationName).String(*v.ExpectedSourceBucketOwner) } if v.Key == nil || len(*v.Key) == 0 { return &smithy.SerializationError{Err: fmt.Errorf("input member Key must not be empty")} } if v.Key != nil { if err := encoder.SetURI("Key").String(*v.Key); err != nil { return err } } { encoder.SetQuery("partNumber").Integer(v.PartNumber) } if len(v.RequestPayer) > 0 { locationName := "X-Amz-Request-Payer" encoder.SetHeader(locationName).String(string(v.RequestPayer)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKey != nil && len(*v.SSECustomerKey) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key" encoder.SetHeader(locationName).String(*v.SSECustomerKey) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.UploadId != nil { encoder.SetQuery("uploadId").String(*v.UploadId) } return nil } type awsRestxml_serializeOpWriteGetObjectResponse struct { } func (*awsRestxml_serializeOpWriteGetObjectResponse) ID() string { return "OperationSerializer" } func (m *awsRestxml_serializeOpWriteGetObjectResponse) 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.(*WriteGetObjectResponseInput) _ = input if !ok { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} } opPath, opQuery := httpbinding.SplitURI("/WriteGetObjectResponse?x-id=WriteGetObjectResponse") 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} } if err := awsRestxml_serializeOpHttpBindingsWriteGetObjectResponseInput(input, restEncoder); err != nil { return out, metadata, &smithy.SerializationError{Err: err} } if !restEncoder.HasHeader("Content-Type") { ctx = smithyhttp.SetIsContentTypeDefaultValue(ctx, true) restEncoder.SetHeader("Content-Type").String("application/octet-stream") } if input.Body != nil { payload := input.Body if request, err = request.SetStream(payload); 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 awsRestxml_serializeOpHttpBindingsWriteGetObjectResponseInput(v *WriteGetObjectResponseInput, encoder *httpbinding.Encoder) error { if v == nil { return fmt.Errorf("unsupported serialization of nil %T", v) } if v.AcceptRanges != nil && len(*v.AcceptRanges) > 0 { locationName := "X-Amz-Fwd-Header-Accept-Ranges" encoder.SetHeader(locationName).String(*v.AcceptRanges) } if v.BucketKeyEnabled { locationName := "X-Amz-Fwd-Header-X-Amz-Server-Side-Encryption-Bucket-Key-Enabled" encoder.SetHeader(locationName).Boolean(v.BucketKeyEnabled) } if v.CacheControl != nil && len(*v.CacheControl) > 0 { locationName := "X-Amz-Fwd-Header-Cache-Control" encoder.SetHeader(locationName).String(*v.CacheControl) } if v.ChecksumCRC32 != nil && len(*v.ChecksumCRC32) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Checksum-Crc32" encoder.SetHeader(locationName).String(*v.ChecksumCRC32) } if v.ChecksumCRC32C != nil && len(*v.ChecksumCRC32C) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Checksum-Crc32c" encoder.SetHeader(locationName).String(*v.ChecksumCRC32C) } if v.ChecksumSHA1 != nil && len(*v.ChecksumSHA1) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Checksum-Sha1" encoder.SetHeader(locationName).String(*v.ChecksumSHA1) } if v.ChecksumSHA256 != nil && len(*v.ChecksumSHA256) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Checksum-Sha256" encoder.SetHeader(locationName).String(*v.ChecksumSHA256) } if v.ContentDisposition != nil && len(*v.ContentDisposition) > 0 { locationName := "X-Amz-Fwd-Header-Content-Disposition" encoder.SetHeader(locationName).String(*v.ContentDisposition) } if v.ContentEncoding != nil && len(*v.ContentEncoding) > 0 { locationName := "X-Amz-Fwd-Header-Content-Encoding" encoder.SetHeader(locationName).String(*v.ContentEncoding) } if v.ContentLanguage != nil && len(*v.ContentLanguage) > 0 { locationName := "X-Amz-Fwd-Header-Content-Language" encoder.SetHeader(locationName).String(*v.ContentLanguage) } if v.ContentLength != 0 { locationName := "Content-Length" encoder.SetHeader(locationName).Long(v.ContentLength) } if v.ContentRange != nil && len(*v.ContentRange) > 0 { locationName := "X-Amz-Fwd-Header-Content-Range" encoder.SetHeader(locationName).String(*v.ContentRange) } if v.ContentType != nil && len(*v.ContentType) > 0 { locationName := "X-Amz-Fwd-Header-Content-Type" encoder.SetHeader(locationName).String(*v.ContentType) } if v.DeleteMarker { locationName := "X-Amz-Fwd-Header-X-Amz-Delete-Marker" encoder.SetHeader(locationName).Boolean(v.DeleteMarker) } if v.ErrorCode != nil && len(*v.ErrorCode) > 0 { locationName := "X-Amz-Fwd-Error-Code" encoder.SetHeader(locationName).String(*v.ErrorCode) } if v.ErrorMessage != nil && len(*v.ErrorMessage) > 0 { locationName := "X-Amz-Fwd-Error-Message" encoder.SetHeader(locationName).String(*v.ErrorMessage) } if v.ETag != nil && len(*v.ETag) > 0 { locationName := "X-Amz-Fwd-Header-Etag" encoder.SetHeader(locationName).String(*v.ETag) } if v.Expiration != nil && len(*v.Expiration) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Expiration" encoder.SetHeader(locationName).String(*v.Expiration) } if v.Expires != nil { locationName := "X-Amz-Fwd-Header-Expires" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.Expires)) } if v.LastModified != nil { locationName := "X-Amz-Fwd-Header-Last-Modified" encoder.SetHeader(locationName).String(smithytime.FormatHTTPDate(*v.LastModified)) } if v.Metadata != nil { hv := encoder.Headers("X-Amz-Meta-") for mapKey, mapVal := range v.Metadata { if len(mapVal) > 0 { hv.SetHeader(http.CanonicalHeaderKey(mapKey)).String(mapVal) } } } if v.MissingMeta != 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Missing-Meta" encoder.SetHeader(locationName).Integer(v.MissingMeta) } if len(v.ObjectLockLegalHoldStatus) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Object-Lock-Legal-Hold" encoder.SetHeader(locationName).String(string(v.ObjectLockLegalHoldStatus)) } if len(v.ObjectLockMode) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Object-Lock-Mode" encoder.SetHeader(locationName).String(string(v.ObjectLockMode)) } if v.ObjectLockRetainUntilDate != nil { locationName := "X-Amz-Fwd-Header-X-Amz-Object-Lock-Retain-Until-Date" encoder.SetHeader(locationName).String(smithytime.FormatDateTime(*v.ObjectLockRetainUntilDate)) } if v.PartsCount != 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Mp-Parts-Count" encoder.SetHeader(locationName).Integer(v.PartsCount) } if len(v.ReplicationStatus) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Replication-Status" encoder.SetHeader(locationName).String(string(v.ReplicationStatus)) } if len(v.RequestCharged) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Request-Charged" encoder.SetHeader(locationName).String(string(v.RequestCharged)) } if v.RequestRoute != nil && len(*v.RequestRoute) > 0 { locationName := "X-Amz-Request-Route" encoder.SetHeader(locationName).String(*v.RequestRoute) } if v.RequestToken != nil && len(*v.RequestToken) > 0 { locationName := "X-Amz-Request-Token" encoder.SetHeader(locationName).String(*v.RequestToken) } if v.Restore != nil && len(*v.Restore) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Restore" encoder.SetHeader(locationName).String(*v.Restore) } if len(v.ServerSideEncryption) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Server-Side-Encryption" encoder.SetHeader(locationName).String(string(v.ServerSideEncryption)) } if v.SSECustomerAlgorithm != nil && len(*v.SSECustomerAlgorithm) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Server-Side-Encryption-Customer-Algorithm" encoder.SetHeader(locationName).String(*v.SSECustomerAlgorithm) } if v.SSECustomerKeyMD5 != nil && len(*v.SSECustomerKeyMD5) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Server-Side-Encryption-Customer-Key-Md5" encoder.SetHeader(locationName).String(*v.SSECustomerKeyMD5) } if v.SSEKMSKeyId != nil && len(*v.SSEKMSKeyId) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Server-Side-Encryption-Aws-Kms-Key-Id" encoder.SetHeader(locationName).String(*v.SSEKMSKeyId) } if v.StatusCode != 0 { locationName := "X-Amz-Fwd-Status" encoder.SetHeader(locationName).Integer(v.StatusCode) } if len(v.StorageClass) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Storage-Class" encoder.SetHeader(locationName).String(string(v.StorageClass)) } if v.TagCount != 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Tagging-Count" encoder.SetHeader(locationName).Integer(v.TagCount) } if v.VersionId != nil && len(*v.VersionId) > 0 { locationName := "X-Amz-Fwd-Header-X-Amz-Version-Id" encoder.SetHeader(locationName).String(*v.VersionId) } return nil } func awsRestxml_serializeDocumentAbortIncompleteMultipartUpload(v *types.AbortIncompleteMultipartUpload, value smithyxml.Value) error { defer value.Close() if v.DaysAfterInitiation != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DaysAfterInitiation", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.DaysAfterInitiation) } return nil } func awsRestxml_serializeDocumentAccelerateConfiguration(v *types.AccelerateConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentAccessControlPolicy(v *types.AccessControlPolicy, value smithyxml.Value) error { defer value.Close() if v.Grants != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessControlList", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentGrants(v.Grants, el); err != nil { return err } } if v.Owner != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Owner", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentOwner(v.Owner, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentAccessControlTranslation(v *types.AccessControlTranslation, value smithyxml.Value) error { defer value.Close() if len(v.Owner) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Owner", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Owner)) } return nil } func awsRestxml_serializeDocumentAllowedHeaders(v []string, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() am.String(v[i]) } return nil } func awsRestxml_serializeDocumentAllowedMethods(v []string, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() am.String(v[i]) } return nil } func awsRestxml_serializeDocumentAllowedOrigins(v []string, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() am.String(v[i]) } return nil } func awsRestxml_serializeDocumentAnalyticsAndOperator(v *types.AnalyticsAndOperator, value smithyxml.Value) error { defer value.Close() if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tags != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTagSet(v.Tags, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentAnalyticsConfiguration(v *types.AnalyticsConfiguration, value smithyxml.Value) error { defer value.Close() if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentAnalyticsFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if v.StorageClassAnalysis != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "StorageClassAnalysis", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentStorageClassAnalysis(v.StorageClassAnalysis, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentAnalyticsExportDestination(v *types.AnalyticsExportDestination, value smithyxml.Value) error { defer value.Close() if v.S3BucketDestination != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "S3BucketDestination", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentAnalyticsS3BucketDestination(v.S3BucketDestination, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentAnalyticsFilter(v types.AnalyticsFilter, value smithyxml.Value) error { defer value.Close() switch uv := v.(type) { case *types.AnalyticsFilterMemberAnd: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "And", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentAnalyticsAndOperator(&uv.Value, av); err != nil { return err } case *types.AnalyticsFilterMemberPrefix: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.String(uv.Value) case *types.AnalyticsFilterMemberTag: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentTag(&uv.Value, av); err != nil { return err } default: return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) } return nil } func awsRestxml_serializeDocumentAnalyticsS3BucketDestination(v *types.AnalyticsS3BucketDestination, value smithyxml.Value) error { defer value.Close() if v.Bucket != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Bucket", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Bucket) } if v.BucketAccountId != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BucketAccountId", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.BucketAccountId) } if len(v.Format) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Format", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Format)) } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } return nil } func awsRestxml_serializeDocumentBucketLifecycleConfiguration(v *types.BucketLifecycleConfiguration, value smithyxml.Value) error { defer value.Close() if v.Rules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Rule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentLifecycleRules(v.Rules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentBucketLoggingStatus(v *types.BucketLoggingStatus, value smithyxml.Value) error { defer value.Close() if v.LoggingEnabled != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "LoggingEnabled", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentLoggingEnabled(v.LoggingEnabled, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentCompletedMultipartUpload(v *types.CompletedMultipartUpload, value smithyxml.Value) error { defer value.Close() if v.Parts != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Part", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentCompletedPartList(v.Parts, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentCompletedPart(v *types.CompletedPart, value smithyxml.Value) error { defer value.Close() if v.ChecksumCRC32 != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ChecksumCRC32", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ChecksumCRC32) } if v.ChecksumCRC32C != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ChecksumCRC32C", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ChecksumCRC32C) } if v.ChecksumSHA1 != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ChecksumSHA1", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ChecksumSHA1) } if v.ChecksumSHA256 != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ChecksumSHA256", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ChecksumSHA256) } if v.ETag != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ETag", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ETag) } if v.PartNumber != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "PartNumber", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.PartNumber) } return nil } func awsRestxml_serializeDocumentCompletedPartList(v []types.CompletedPart, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentCompletedPart(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentCondition(v *types.Condition, value smithyxml.Value) error { defer value.Close() if v.HttpErrorCodeReturnedEquals != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "HttpErrorCodeReturnedEquals", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.HttpErrorCodeReturnedEquals) } if v.KeyPrefixEquals != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "KeyPrefixEquals", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.KeyPrefixEquals) } return nil } func awsRestxml_serializeDocumentCORSConfiguration(v *types.CORSConfiguration, value smithyxml.Value) error { defer value.Close() if v.CORSRules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CORSRule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentCORSRules(v.CORSRules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentCORSRule(v *types.CORSRule, value smithyxml.Value) error { defer value.Close() if v.AllowedHeaders != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AllowedHeader", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentAllowedHeaders(v.AllowedHeaders, el); err != nil { return err } } if v.AllowedMethods != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AllowedMethod", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentAllowedMethods(v.AllowedMethods, el); err != nil { return err } } if v.AllowedOrigins != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AllowedOrigin", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentAllowedOrigins(v.AllowedOrigins, el); err != nil { return err } } if v.ExposeHeaders != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ExposeHeader", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentExposeHeaders(v.ExposeHeaders, el); err != nil { return err } } if v.ID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ID) } if v.MaxAgeSeconds != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "MaxAgeSeconds", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.MaxAgeSeconds) } return nil } func awsRestxml_serializeDocumentCORSRules(v []types.CORSRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentCORSRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentCreateBucketConfiguration(v *types.CreateBucketConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.LocationConstraint) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "LocationConstraint", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.LocationConstraint)) } return nil } func awsRestxml_serializeDocumentCSVInput(v *types.CSVInput, value smithyxml.Value) error { defer value.Close() if v.AllowQuotedRecordDelimiter { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AllowQuotedRecordDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.AllowQuotedRecordDelimiter) } if v.Comments != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Comments", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Comments) } if v.FieldDelimiter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "FieldDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.FieldDelimiter) } if len(v.FileHeaderInfo) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "FileHeaderInfo", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.FileHeaderInfo)) } if v.QuoteCharacter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QuoteCharacter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.QuoteCharacter) } if v.QuoteEscapeCharacter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QuoteEscapeCharacter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.QuoteEscapeCharacter) } if v.RecordDelimiter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RecordDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.RecordDelimiter) } return nil } func awsRestxml_serializeDocumentCSVOutput(v *types.CSVOutput, value smithyxml.Value) error { defer value.Close() if v.FieldDelimiter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "FieldDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.FieldDelimiter) } if v.QuoteCharacter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QuoteCharacter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.QuoteCharacter) } if v.QuoteEscapeCharacter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QuoteEscapeCharacter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.QuoteEscapeCharacter) } if len(v.QuoteFields) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QuoteFields", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.QuoteFields)) } if v.RecordDelimiter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RecordDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.RecordDelimiter) } return nil } func awsRestxml_serializeDocumentDefaultRetention(v *types.DefaultRetention, value smithyxml.Value) error { defer value.Close() if v.Days != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Days", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Days) } if len(v.Mode) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Mode", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Mode)) } if v.Years != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Years", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Years) } return nil } func awsRestxml_serializeDocumentDelete(v *types.Delete, value smithyxml.Value) error { defer value.Close() if v.Objects != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Object", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentObjectIdentifierList(v.Objects, el); err != nil { return err } } if v.Quiet { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Quiet", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.Quiet) } return nil } func awsRestxml_serializeDocumentDeleteMarkerReplication(v *types.DeleteMarkerReplication, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentDestination(v *types.Destination, value smithyxml.Value) error { defer value.Close() if v.AccessControlTranslation != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessControlTranslation", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentAccessControlTranslation(v.AccessControlTranslation, el); err != nil { return err } } if v.Account != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Account", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Account) } if v.Bucket != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Bucket", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Bucket) } if v.EncryptionConfiguration != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "EncryptionConfiguration", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentEncryptionConfiguration(v.EncryptionConfiguration, el); err != nil { return err } } if v.Metrics != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Metrics", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentMetrics(v.Metrics, el); err != nil { return err } } if v.ReplicationTime != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplicationTime", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentReplicationTime(v.ReplicationTime, el); err != nil { return err } } if len(v.StorageClass) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "StorageClass", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.StorageClass)) } return nil } func awsRestxml_serializeDocumentEncryption(v *types.Encryption, value smithyxml.Value) error { defer value.Close() if len(v.EncryptionType) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "EncryptionType", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.EncryptionType)) } if v.KMSContext != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "KMSContext", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.KMSContext) } if v.KMSKeyId != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "KMSKeyId", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.KMSKeyId) } return nil } func awsRestxml_serializeDocumentEncryptionConfiguration(v *types.EncryptionConfiguration, value smithyxml.Value) error { defer value.Close() if v.ReplicaKmsKeyID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplicaKmsKeyID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ReplicaKmsKeyID) } return nil } func awsRestxml_serializeDocumentErrorDocument(v *types.ErrorDocument, value smithyxml.Value) error { defer value.Close() if v.Key != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Key", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Key) } return nil } func awsRestxml_serializeDocumentEventBridgeConfiguration(v *types.EventBridgeConfiguration, value smithyxml.Value) error { defer value.Close() return nil } func awsRestxml_serializeDocumentEventList(v []types.Event, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() am.String(string(v[i])) } return nil } func awsRestxml_serializeDocumentExistingObjectReplication(v *types.ExistingObjectReplication, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentExposeHeaders(v []string, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() am.String(v[i]) } return nil } func awsRestxml_serializeDocumentFilterRule(v *types.FilterRule, value smithyxml.Value) error { defer value.Close() if len(v.Name) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Name", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Name)) } if v.Value != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Value", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Value) } return nil } func awsRestxml_serializeDocumentFilterRuleList(v []types.FilterRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentFilterRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentGlacierJobParameters(v *types.GlacierJobParameters, value smithyxml.Value) error { defer value.Close() if len(v.Tier) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tier", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Tier)) } return nil } func awsRestxml_serializeDocumentGrant(v *types.Grant, value smithyxml.Value) error { defer value.Close() if v.Grantee != nil { rootAttr := []smithyxml.Attr{} rootAttr = append(rootAttr, smithyxml.NewNamespaceAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance")) if len(v.Grantee.Type) > 0 { var av string av = string(v.Grantee.Type) rootAttr = append(rootAttr, smithyxml.NewAttribute("xsi:type", av)) } root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Grantee", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentGrantee(v.Grantee, el); err != nil { return err } } if len(v.Permission) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Permission", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Permission)) } return nil } func awsRestxml_serializeDocumentGrantee(v *types.Grantee, value smithyxml.Value) error { defer value.Close() if v.DisplayName != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DisplayName", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.DisplayName) } if v.EmailAddress != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "EmailAddress", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.EmailAddress) } if v.ID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ID) } if v.URI != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "URI", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.URI) } return nil } func awsRestxml_serializeDocumentGrants(v []types.Grant, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Grant", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentGrant(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentIndexDocument(v *types.IndexDocument, value smithyxml.Value) error { defer value.Close() if v.Suffix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Suffix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Suffix) } return nil } func awsRestxml_serializeDocumentInputSerialization(v *types.InputSerialization, value smithyxml.Value) error { defer value.Close() if len(v.CompressionType) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CompressionType", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.CompressionType)) } if v.CSV != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CSV", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentCSVInput(v.CSV, el); err != nil { return err } } if v.JSON != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "JSON", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentJSONInput(v.JSON, el); err != nil { return err } } if v.Parquet != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Parquet", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentParquetInput(v.Parquet, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentIntelligentTieringAndOperator(v *types.IntelligentTieringAndOperator, value smithyxml.Value) error { defer value.Close() if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tags != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTagSet(v.Tags, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentIntelligentTieringConfiguration(v *types.IntelligentTieringConfiguration, value smithyxml.Value) error { defer value.Close() if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentIntelligentTieringFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } if v.Tierings != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tiering", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTieringList(v.Tierings, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentIntelligentTieringFilter(v *types.IntelligentTieringFilter, value smithyxml.Value) error { defer value.Close() if v.And != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "And", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentIntelligentTieringAndOperator(v.And, el); err != nil { return err } } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tag != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentTag(v.Tag, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentInventoryConfiguration(v *types.InventoryConfiguration, value smithyxml.Value) error { defer value.Close() if v.Destination != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Destination", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventoryDestination(v.Destination, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventoryFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if len(v.IncludedObjectVersions) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "IncludedObjectVersions", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.IncludedObjectVersions)) } { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "IsEnabled", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.IsEnabled) } if v.OptionalFields != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OptionalFields", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventoryOptionalFields(v.OptionalFields, el); err != nil { return err } } if v.Schedule != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Schedule", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventorySchedule(v.Schedule, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentInventoryDestination(v *types.InventoryDestination, value smithyxml.Value) error { defer value.Close() if v.S3BucketDestination != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "S3BucketDestination", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventoryS3BucketDestination(v.S3BucketDestination, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentInventoryEncryption(v *types.InventoryEncryption, value smithyxml.Value) error { defer value.Close() if v.SSEKMS != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SSE-KMS", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentSSEKMS(v.SSEKMS, el); err != nil { return err } } if v.SSES3 != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SSE-S3", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentSSES3(v.SSES3, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentInventoryFilter(v *types.InventoryFilter, value smithyxml.Value) error { defer value.Close() if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } return nil } func awsRestxml_serializeDocumentInventoryOptionalFields(v []types.InventoryOptionalField, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Field", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() am.String(string(v[i])) } return nil } func awsRestxml_serializeDocumentInventoryS3BucketDestination(v *types.InventoryS3BucketDestination, value smithyxml.Value) error { defer value.Close() if v.AccountId != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccountId", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.AccountId) } if v.Bucket != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Bucket", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Bucket) } if v.Encryption != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Encryption", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInventoryEncryption(v.Encryption, el); err != nil { return err } } if len(v.Format) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Format", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Format)) } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } return nil } func awsRestxml_serializeDocumentInventorySchedule(v *types.InventorySchedule, value smithyxml.Value) error { defer value.Close() if len(v.Frequency) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Frequency", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Frequency)) } return nil } func awsRestxml_serializeDocumentJSONInput(v *types.JSONInput, value smithyxml.Value) error { defer value.Close() if len(v.Type) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Type", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Type)) } return nil } func awsRestxml_serializeDocumentJSONOutput(v *types.JSONOutput, value smithyxml.Value) error { defer value.Close() if v.RecordDelimiter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RecordDelimiter", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.RecordDelimiter) } return nil } func awsRestxml_serializeDocumentLambdaFunctionConfiguration(v *types.LambdaFunctionConfiguration, value smithyxml.Value) error { defer value.Close() if v.Events != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Event", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentEventList(v.Events, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentNotificationConfigurationFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if v.LambdaFunctionArn != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CloudFunction", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.LambdaFunctionArn) } return nil } func awsRestxml_serializeDocumentLambdaFunctionConfigurationList(v []types.LambdaFunctionConfiguration, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentLambdaFunctionConfiguration(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentLifecycleExpiration(v *types.LifecycleExpiration, value smithyxml.Value) error { defer value.Close() if v.Date != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Date", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(smithytime.FormatDateTime(*v.Date)) } if v.Days != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Days", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Days) } if v.ExpiredObjectDeleteMarker { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ExpiredObjectDeleteMarker", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.ExpiredObjectDeleteMarker) } return nil } func awsRestxml_serializeDocumentLifecycleRule(v *types.LifecycleRule, value smithyxml.Value) error { defer value.Close() if v.AbortIncompleteMultipartUpload != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AbortIncompleteMultipartUpload", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentAbortIncompleteMultipartUpload(v.AbortIncompleteMultipartUpload, el); err != nil { return err } } if v.Expiration != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Expiration", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentLifecycleExpiration(v.Expiration, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentLifecycleRuleFilter(v.Filter, el); err != nil { return err } } if v.ID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ID) } if v.NoncurrentVersionExpiration != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NoncurrentVersionExpiration", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentNoncurrentVersionExpiration(v.NoncurrentVersionExpiration, el); err != nil { return err } } if v.NoncurrentVersionTransitions != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NoncurrentVersionTransition", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentNoncurrentVersionTransitionList(v.NoncurrentVersionTransitions, el); err != nil { return err } } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } if v.Transitions != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Transition", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTransitionList(v.Transitions, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentLifecycleRuleAndOperator(v *types.LifecycleRuleAndOperator, value smithyxml.Value) error { defer value.Close() if v.ObjectSizeGreaterThan != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectSizeGreaterThan", }, Attr: rootAttr, } el := value.MemberElement(root) el.Long(v.ObjectSizeGreaterThan) } if v.ObjectSizeLessThan != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectSizeLessThan", }, Attr: rootAttr, } el := value.MemberElement(root) el.Long(v.ObjectSizeLessThan) } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tags != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTagSet(v.Tags, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentLifecycleRuleFilter(v types.LifecycleRuleFilter, value smithyxml.Value) error { defer value.Close() switch uv := v.(type) { case *types.LifecycleRuleFilterMemberAnd: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "And", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentLifecycleRuleAndOperator(&uv.Value, av); err != nil { return err } case *types.LifecycleRuleFilterMemberObjectSizeGreaterThan: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectSizeGreaterThan", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.Long(uv.Value) case *types.LifecycleRuleFilterMemberObjectSizeLessThan: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectSizeLessThan", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.Long(uv.Value) case *types.LifecycleRuleFilterMemberPrefix: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.String(uv.Value) case *types.LifecycleRuleFilterMemberTag: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentTag(&uv.Value, av); err != nil { return err } default: return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) } return nil } func awsRestxml_serializeDocumentLifecycleRules(v []types.LifecycleRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentLifecycleRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentLoggingEnabled(v *types.LoggingEnabled, value smithyxml.Value) error { defer value.Close() if v.TargetBucket != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "TargetBucket", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.TargetBucket) } if v.TargetGrants != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "TargetGrants", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentTargetGrants(v.TargetGrants, el); err != nil { return err } } if v.TargetPrefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "TargetPrefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.TargetPrefix) } return nil } func awsRestxml_serializeDocumentMetadataEntry(v *types.MetadataEntry, value smithyxml.Value) error { defer value.Close() if v.Name != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Name", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Name) } if v.Value != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Value", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Value) } return nil } func awsRestxml_serializeDocumentMetrics(v *types.Metrics, value smithyxml.Value) error { defer value.Close() if v.EventThreshold != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "EventThreshold", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentReplicationTimeValue(v.EventThreshold, el); err != nil { return err } } if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentMetricsAndOperator(v *types.MetricsAndOperator, value smithyxml.Value) error { defer value.Close() if v.AccessPointArn != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessPointArn", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.AccessPointArn) } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tags != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTagSet(v.Tags, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentMetricsConfiguration(v *types.MetricsConfiguration, value smithyxml.Value) error { defer value.Close() if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentMetricsFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } return nil } func awsRestxml_serializeDocumentMetricsFilter(v types.MetricsFilter, value smithyxml.Value) error { defer value.Close() switch uv := v.(type) { case *types.MetricsFilterMemberAccessPointArn: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessPointArn", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.String(uv.Value) case *types.MetricsFilterMemberAnd: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "And", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentMetricsAndOperator(&uv.Value, av); err != nil { return err } case *types.MetricsFilterMemberPrefix: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.String(uv.Value) case *types.MetricsFilterMemberTag: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentTag(&uv.Value, av); err != nil { return err } default: return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) } return nil } func awsRestxml_serializeDocumentNoncurrentVersionExpiration(v *types.NoncurrentVersionExpiration, value smithyxml.Value) error { defer value.Close() if v.NewerNoncurrentVersions != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NewerNoncurrentVersions", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.NewerNoncurrentVersions) } if v.NoncurrentDays != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NoncurrentDays", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.NoncurrentDays) } return nil } func awsRestxml_serializeDocumentNoncurrentVersionTransition(v *types.NoncurrentVersionTransition, value smithyxml.Value) error { defer value.Close() if v.NewerNoncurrentVersions != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NewerNoncurrentVersions", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.NewerNoncurrentVersions) } if v.NoncurrentDays != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "NoncurrentDays", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.NoncurrentDays) } if len(v.StorageClass) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "StorageClass", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.StorageClass)) } return nil } func awsRestxml_serializeDocumentNoncurrentVersionTransitionList(v []types.NoncurrentVersionTransition, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentNoncurrentVersionTransition(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentNotificationConfiguration(v *types.NotificationConfiguration, value smithyxml.Value) error { defer value.Close() if v.EventBridgeConfiguration != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "EventBridgeConfiguration", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentEventBridgeConfiguration(v.EventBridgeConfiguration, el); err != nil { return err } } if v.LambdaFunctionConfigurations != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CloudFunctionConfiguration", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentLambdaFunctionConfigurationList(v.LambdaFunctionConfigurations, el); err != nil { return err } } if v.QueueConfigurations != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "QueueConfiguration", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentQueueConfigurationList(v.QueueConfigurations, el); err != nil { return err } } if v.TopicConfigurations != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "TopicConfiguration", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTopicConfigurationList(v.TopicConfigurations, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentNotificationConfigurationFilter(v *types.NotificationConfigurationFilter, value smithyxml.Value) error { defer value.Close() if v.Key != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "S3Key", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentS3KeyFilter(v.Key, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentObjectIdentifier(v *types.ObjectIdentifier, value smithyxml.Value) error { defer value.Close() if v.Key != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Key", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Key) } if v.VersionId != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "VersionId", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.VersionId) } return nil } func awsRestxml_serializeDocumentObjectIdentifierList(v []types.ObjectIdentifier, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentObjectIdentifier(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentObjectLockConfiguration(v *types.ObjectLockConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.ObjectLockEnabled) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectLockEnabled", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.ObjectLockEnabled)) } if v.Rule != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Rule", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentObjectLockRule(v.Rule, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentObjectLockLegalHold(v *types.ObjectLockLegalHold, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentObjectLockRetention(v *types.ObjectLockRetention, value smithyxml.Value) error { defer value.Close() if len(v.Mode) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Mode", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Mode)) } if v.RetainUntilDate != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RetainUntilDate", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(smithytime.FormatDateTime(*v.RetainUntilDate)) } return nil } func awsRestxml_serializeDocumentObjectLockRule(v *types.ObjectLockRule, value smithyxml.Value) error { defer value.Close() if v.DefaultRetention != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DefaultRetention", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentDefaultRetention(v.DefaultRetention, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentOutputLocation(v *types.OutputLocation, value smithyxml.Value) error { defer value.Close() if v.S3 != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "S3", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentS3Location(v.S3, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentOutputSerialization(v *types.OutputSerialization, value smithyxml.Value) error { defer value.Close() if v.CSV != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CSV", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentCSVOutput(v.CSV, el); err != nil { return err } } if v.JSON != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "JSON", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentJSONOutput(v.JSON, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentOwner(v *types.Owner, value smithyxml.Value) error { defer value.Close() if v.DisplayName != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DisplayName", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.DisplayName) } if v.ID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ID) } return nil } func awsRestxml_serializeDocumentOwnershipControls(v *types.OwnershipControls, value smithyxml.Value) error { defer value.Close() if v.Rules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Rule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentOwnershipControlsRules(v.Rules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentOwnershipControlsRule(v *types.OwnershipControlsRule, value smithyxml.Value) error { defer value.Close() if len(v.ObjectOwnership) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ObjectOwnership", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.ObjectOwnership)) } return nil } func awsRestxml_serializeDocumentOwnershipControlsRules(v []types.OwnershipControlsRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentOwnershipControlsRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentParquetInput(v *types.ParquetInput, value smithyxml.Value) error { defer value.Close() return nil } func awsRestxml_serializeDocumentPublicAccessBlockConfiguration(v *types.PublicAccessBlockConfiguration, value smithyxml.Value) error { defer value.Close() if v.BlockPublicAcls { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BlockPublicAcls", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.BlockPublicAcls) } if v.BlockPublicPolicy { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BlockPublicPolicy", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.BlockPublicPolicy) } if v.IgnorePublicAcls { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "IgnorePublicAcls", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.IgnorePublicAcls) } if v.RestrictPublicBuckets { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RestrictPublicBuckets", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.RestrictPublicBuckets) } return nil } func awsRestxml_serializeDocumentQueueConfiguration(v *types.QueueConfiguration, value smithyxml.Value) error { defer value.Close() if v.Events != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Event", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentEventList(v.Events, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentNotificationConfigurationFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if v.QueueArn != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Queue", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.QueueArn) } return nil } func awsRestxml_serializeDocumentQueueConfigurationList(v []types.QueueConfiguration, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentQueueConfiguration(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentRedirect(v *types.Redirect, value smithyxml.Value) error { defer value.Close() if v.HostName != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "HostName", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.HostName) } if v.HttpRedirectCode != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "HttpRedirectCode", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.HttpRedirectCode) } if len(v.Protocol) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Protocol", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Protocol)) } if v.ReplaceKeyPrefixWith != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplaceKeyPrefixWith", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ReplaceKeyPrefixWith) } if v.ReplaceKeyWith != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplaceKeyWith", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ReplaceKeyWith) } return nil } func awsRestxml_serializeDocumentRedirectAllRequestsTo(v *types.RedirectAllRequestsTo, value smithyxml.Value) error { defer value.Close() if v.HostName != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "HostName", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.HostName) } if len(v.Protocol) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Protocol", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Protocol)) } return nil } func awsRestxml_serializeDocumentReplicaModifications(v *types.ReplicaModifications, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentReplicationConfiguration(v *types.ReplicationConfiguration, value smithyxml.Value) error { defer value.Close() if v.Role != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Role", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Role) } if v.Rules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Rule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentReplicationRules(v.Rules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentReplicationRule(v *types.ReplicationRule, value smithyxml.Value) error { defer value.Close() if v.DeleteMarkerReplication != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DeleteMarkerReplication", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentDeleteMarkerReplication(v.DeleteMarkerReplication, el); err != nil { return err } } if v.Destination != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Destination", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentDestination(v.Destination, el); err != nil { return err } } if v.ExistingObjectReplication != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ExistingObjectReplication", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentExistingObjectReplication(v.ExistingObjectReplication, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentReplicationRuleFilter(v.Filter, el); err != nil { return err } } if v.ID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.ID) } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Priority != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Priority", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Priority) } if v.SourceSelectionCriteria != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SourceSelectionCriteria", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentSourceSelectionCriteria(v.SourceSelectionCriteria, el); err != nil { return err } } if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentReplicationRuleAndOperator(v *types.ReplicationRuleAndOperator, value smithyxml.Value) error { defer value.Close() if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if v.Tags != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentTagSet(v.Tags, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentReplicationRuleFilter(v types.ReplicationRuleFilter, value smithyxml.Value) error { defer value.Close() switch uv := v.(type) { case *types.ReplicationRuleFilterMemberAnd: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "And", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentReplicationRuleAndOperator(&uv.Value, av); err != nil { return err } case *types.ReplicationRuleFilterMemberPrefix: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) av.String(uv.Value) case *types.ReplicationRuleFilterMemberTag: customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: customMemberNameAttr, } av := value.MemberElement(customMemberName) if err := awsRestxml_serializeDocumentTag(&uv.Value, av); err != nil { return err } default: return fmt.Errorf("attempted to serialize unknown member type %T for union %T", uv, v) } return nil } func awsRestxml_serializeDocumentReplicationRules(v []types.ReplicationRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentReplicationRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentReplicationTime(v *types.ReplicationTime, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } if v.Time != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Time", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentReplicationTimeValue(v.Time, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentReplicationTimeValue(v *types.ReplicationTimeValue, value smithyxml.Value) error { defer value.Close() if v.Minutes != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Minutes", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Minutes) } return nil } func awsRestxml_serializeDocumentRequestPaymentConfiguration(v *types.RequestPaymentConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.Payer) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Payer", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Payer)) } return nil } func awsRestxml_serializeDocumentRequestProgress(v *types.RequestProgress, value smithyxml.Value) error { defer value.Close() if v.Enabled { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Enabled", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.Enabled) } return nil } func awsRestxml_serializeDocumentRestoreRequest(v *types.RestoreRequest, value smithyxml.Value) error { defer value.Close() if v.Days != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Days", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Days) } if v.Description != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Description", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Description) } if v.GlacierJobParameters != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "GlacierJobParameters", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentGlacierJobParameters(v.GlacierJobParameters, el); err != nil { return err } } if v.OutputLocation != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OutputLocation", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentOutputLocation(v.OutputLocation, el); err != nil { return err } } if v.SelectParameters != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SelectParameters", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentSelectParameters(v.SelectParameters, el); err != nil { return err } } if len(v.Tier) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tier", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Tier)) } if len(v.Type) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Type", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Type)) } return nil } func awsRestxml_serializeDocumentRoutingRule(v *types.RoutingRule, value smithyxml.Value) error { defer value.Close() if v.Condition != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Condition", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentCondition(v.Condition, el); err != nil { return err } } if v.Redirect != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Redirect", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentRedirect(v.Redirect, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentRoutingRules(v []types.RoutingRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RoutingRule", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentRoutingRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentS3KeyFilter(v *types.S3KeyFilter, value smithyxml.Value) error { defer value.Close() if v.FilterRules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "FilterRule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentFilterRuleList(v.FilterRules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentS3Location(v *types.S3Location, value smithyxml.Value) error { defer value.Close() if v.AccessControlList != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessControlList", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentGrants(v.AccessControlList, el); err != nil { return err } } if v.BucketName != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BucketName", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.BucketName) } if len(v.CannedACL) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "CannedACL", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.CannedACL)) } if v.Encryption != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Encryption", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentEncryption(v.Encryption, el); err != nil { return err } } if v.Prefix != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Prefix", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Prefix) } if len(v.StorageClass) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "StorageClass", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.StorageClass)) } if v.Tagging != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tagging", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentTagging(v.Tagging, el); err != nil { return err } } if v.UserMetadata != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "UserMetadata", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentUserMetadata(v.UserMetadata, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentScanRange(v *types.ScanRange, value smithyxml.Value) error { defer value.Close() if v.End != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "End", }, Attr: rootAttr, } el := value.MemberElement(root) el.Long(v.End) } if v.Start != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Start", }, Attr: rootAttr, } el := value.MemberElement(root) el.Long(v.Start) } return nil } func awsRestxml_serializeDocumentSelectParameters(v *types.SelectParameters, value smithyxml.Value) error { defer value.Close() if v.Expression != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Expression", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Expression) } if len(v.ExpressionType) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ExpressionType", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.ExpressionType)) } if v.InputSerialization != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "InputSerialization", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentInputSerialization(v.InputSerialization, el); err != nil { return err } } if v.OutputSerialization != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OutputSerialization", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentOutputSerialization(v.OutputSerialization, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentServerSideEncryptionByDefault(v *types.ServerSideEncryptionByDefault, value smithyxml.Value) error { defer value.Close() if v.KMSMasterKeyID != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "KMSMasterKeyID", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.KMSMasterKeyID) } if len(v.SSEAlgorithm) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SSEAlgorithm", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.SSEAlgorithm)) } return nil } func awsRestxml_serializeDocumentServerSideEncryptionConfiguration(v *types.ServerSideEncryptionConfiguration, value smithyxml.Value) error { defer value.Close() if v.Rules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Rule", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentServerSideEncryptionRules(v.Rules, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentServerSideEncryptionRule(v *types.ServerSideEncryptionRule, value smithyxml.Value) error { defer value.Close() if v.ApplyServerSideEncryptionByDefault != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ApplyServerSideEncryptionByDefault", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentServerSideEncryptionByDefault(v.ApplyServerSideEncryptionByDefault, el); err != nil { return err } } if v.BucketKeyEnabled { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "BucketKeyEnabled", }, Attr: rootAttr, } el := value.MemberElement(root) el.Boolean(v.BucketKeyEnabled) } return nil } func awsRestxml_serializeDocumentServerSideEncryptionRules(v []types.ServerSideEncryptionRule, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentServerSideEncryptionRule(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentSourceSelectionCriteria(v *types.SourceSelectionCriteria, value smithyxml.Value) error { defer value.Close() if v.ReplicaModifications != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ReplicaModifications", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentReplicaModifications(v.ReplicaModifications, el); err != nil { return err } } if v.SseKmsEncryptedObjects != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "SseKmsEncryptedObjects", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentSseKmsEncryptedObjects(v.SseKmsEncryptedObjects, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentSSEKMS(v *types.SSEKMS, value smithyxml.Value) error { defer value.Close() if v.KeyId != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "KeyId", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.KeyId) } return nil } func awsRestxml_serializeDocumentSseKmsEncryptedObjects(v *types.SseKmsEncryptedObjects, value smithyxml.Value) error { defer value.Close() if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentSSES3(v *types.SSES3, value smithyxml.Value) error { defer value.Close() return nil } func awsRestxml_serializeDocumentStorageClassAnalysis(v *types.StorageClassAnalysis, value smithyxml.Value) error { defer value.Close() if v.DataExport != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "DataExport", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentStorageClassAnalysisDataExport(v.DataExport, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentStorageClassAnalysisDataExport(v *types.StorageClassAnalysisDataExport, value smithyxml.Value) error { defer value.Close() if v.Destination != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Destination", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentAnalyticsExportDestination(v.Destination, el); err != nil { return err } } if len(v.OutputSchemaVersion) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "OutputSchemaVersion", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.OutputSchemaVersion)) } return nil } func awsRestxml_serializeDocumentTag(v *types.Tag, value smithyxml.Value) error { defer value.Close() if v.Key != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Key", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Key) } if v.Value != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Value", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Value) } return nil } func awsRestxml_serializeDocumentTagging(v *types.Tagging, value smithyxml.Value) error { defer value.Close() if v.TagSet != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "TagSet", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentTagSet(v.TagSet, el); err != nil { return err } } return nil } func awsRestxml_serializeDocumentTagSet(v []types.Tag, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Tag", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentTag(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentTargetGrant(v *types.TargetGrant, value smithyxml.Value) error { defer value.Close() if v.Grantee != nil { rootAttr := []smithyxml.Attr{} rootAttr = append(rootAttr, smithyxml.NewNamespaceAttribute("xsi", "http://www.w3.org/2001/XMLSchema-instance")) if len(v.Grantee.Type) > 0 { var av string av = string(v.Grantee.Type) rootAttr = append(rootAttr, smithyxml.NewAttribute("xsi:type", av)) } root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Grantee", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentGrantee(v.Grantee, el); err != nil { return err } } if len(v.Permission) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Permission", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Permission)) } return nil } func awsRestxml_serializeDocumentTargetGrants(v []types.TargetGrant, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Grant", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentTargetGrant(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentTiering(v *types.Tiering, value smithyxml.Value) error { defer value.Close() if len(v.AccessTier) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "AccessTier", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.AccessTier)) } { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Days", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Days) } return nil } func awsRestxml_serializeDocumentTieringList(v []types.Tiering, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentTiering(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentTopicConfiguration(v *types.TopicConfiguration, value smithyxml.Value) error { defer value.Close() if v.Events != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Event", }, Attr: rootAttr, } el := value.FlattenedElement(root) if err := awsRestxml_serializeDocumentEventList(v.Events, el); err != nil { return err } } if v.Filter != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Filter", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentNotificationConfigurationFilter(v.Filter, el); err != nil { return err } } if v.Id != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Id", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.Id) } if v.TopicArn != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Topic", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(*v.TopicArn) } return nil } func awsRestxml_serializeDocumentTopicConfigurationList(v []types.TopicConfiguration, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentTopicConfiguration(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentTransition(v *types.Transition, value smithyxml.Value) error { defer value.Close() if v.Date != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Date", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(smithytime.FormatDateTime(*v.Date)) } if v.Days != 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Days", }, Attr: rootAttr, } el := value.MemberElement(root) el.Integer(v.Days) } if len(v.StorageClass) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "StorageClass", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.StorageClass)) } return nil } func awsRestxml_serializeDocumentTransitionList(v []types.Transition, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } array = value.Array() for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentTransition(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentUserMetadata(v []types.MetadataEntry, value smithyxml.Value) error { var array *smithyxml.Array if !value.IsFlattened() { defer value.Close() } customMemberNameAttr := []smithyxml.Attr{} customMemberName := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "MetadataEntry", }, Attr: customMemberNameAttr, } array = value.ArrayWithCustomName(customMemberName) for i := range v { am := array.Member() if err := awsRestxml_serializeDocumentMetadataEntry(&v[i], am); err != nil { return err } } return nil } func awsRestxml_serializeDocumentVersioningConfiguration(v *types.VersioningConfiguration, value smithyxml.Value) error { defer value.Close() if len(v.MFADelete) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "MfaDelete", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.MFADelete)) } if len(v.Status) > 0 { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "Status", }, Attr: rootAttr, } el := value.MemberElement(root) el.String(string(v.Status)) } return nil } func awsRestxml_serializeDocumentWebsiteConfiguration(v *types.WebsiteConfiguration, value smithyxml.Value) error { defer value.Close() if v.ErrorDocument != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "ErrorDocument", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentErrorDocument(v.ErrorDocument, el); err != nil { return err } } if v.IndexDocument != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "IndexDocument", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentIndexDocument(v.IndexDocument, el); err != nil { return err } } if v.RedirectAllRequestsTo != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RedirectAllRequestsTo", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentRedirectAllRequestsTo(v.RedirectAllRequestsTo, el); err != nil { return err } } if v.RoutingRules != nil { rootAttr := []smithyxml.Attr{} root := smithyxml.StartElement{ Name: smithyxml.Name{ Local: "RoutingRules", }, Attr: rootAttr, } el := value.MemberElement(root) if err := awsRestxml_serializeDocumentRoutingRules(v.RoutingRules, el); err != nil { return err } } return nil }
12,771
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3 import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/service/s3/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" ) type validateOpAbortMultipartUpload struct { } func (*validateOpAbortMultipartUpload) ID() string { return "OperationInputValidation" } func (m *validateOpAbortMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*AbortMultipartUploadInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpAbortMultipartUploadInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpCompleteMultipartUpload struct { } func (*validateOpCompleteMultipartUpload) ID() string { return "OperationInputValidation" } func (m *validateOpCompleteMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*CompleteMultipartUploadInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpCompleteMultipartUploadInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpCopyObject struct { } func (*validateOpCopyObject) ID() string { return "OperationInputValidation" } func (m *validateOpCopyObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*CopyObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpCopyObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpCreateBucket struct { } func (*validateOpCreateBucket) ID() string { return "OperationInputValidation" } func (m *validateOpCreateBucket) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*CreateBucketInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpCreateBucketInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpCreateMultipartUpload struct { } func (*validateOpCreateMultipartUpload) ID() string { return "OperationInputValidation" } func (m *validateOpCreateMultipartUpload) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*CreateMultipartUploadInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpCreateMultipartUploadInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketAnalyticsConfiguration struct { } func (*validateOpDeleteBucketAnalyticsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketAnalyticsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketAnalyticsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketAnalyticsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketCors struct { } func (*validateOpDeleteBucketCors) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketCors) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketCorsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketCorsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketEncryption struct { } func (*validateOpDeleteBucketEncryption) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketEncryption) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketEncryptionInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketEncryptionInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucket struct { } func (*validateOpDeleteBucket) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucket) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketIntelligentTieringConfiguration struct { } func (*validateOpDeleteBucketIntelligentTieringConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketIntelligentTieringConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketIntelligentTieringConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketIntelligentTieringConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketInventoryConfiguration struct { } func (*validateOpDeleteBucketInventoryConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketInventoryConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketInventoryConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketInventoryConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketLifecycle struct { } func (*validateOpDeleteBucketLifecycle) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketLifecycle) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketLifecycleInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketLifecycleInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketMetricsConfiguration struct { } func (*validateOpDeleteBucketMetricsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketMetricsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketMetricsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketMetricsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketOwnershipControls struct { } func (*validateOpDeleteBucketOwnershipControls) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketOwnershipControls) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketOwnershipControlsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketOwnershipControlsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketPolicy struct { } func (*validateOpDeleteBucketPolicy) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketPolicyInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketReplication struct { } func (*validateOpDeleteBucketReplication) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketReplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketReplicationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketReplicationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketTagging struct { } func (*validateOpDeleteBucketTagging) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteBucketWebsite struct { } func (*validateOpDeleteBucketWebsite) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteBucketWebsite) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteBucketWebsiteInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteBucketWebsiteInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteObject struct { } func (*validateOpDeleteObject) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteObjects struct { } func (*validateOpDeleteObjects) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteObjects) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteObjectsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteObjectsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeleteObjectTagging struct { } func (*validateOpDeleteObjectTagging) ID() string { return "OperationInputValidation" } func (m *validateOpDeleteObjectTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeleteObjectTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeleteObjectTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpDeletePublicAccessBlock struct { } func (*validateOpDeletePublicAccessBlock) ID() string { return "OperationInputValidation" } func (m *validateOpDeletePublicAccessBlock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*DeletePublicAccessBlockInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpDeletePublicAccessBlockInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketAccelerateConfiguration struct { } func (*validateOpGetBucketAccelerateConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketAccelerateConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketAccelerateConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketAccelerateConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketAcl struct { } func (*validateOpGetBucketAcl) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketAcl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketAclInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketAclInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketAnalyticsConfiguration struct { } func (*validateOpGetBucketAnalyticsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketAnalyticsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketAnalyticsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketAnalyticsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketCors struct { } func (*validateOpGetBucketCors) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketCors) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketCorsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketCorsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketEncryption struct { } func (*validateOpGetBucketEncryption) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketEncryption) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketEncryptionInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketEncryptionInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketIntelligentTieringConfiguration struct { } func (*validateOpGetBucketIntelligentTieringConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketIntelligentTieringConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketIntelligentTieringConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketIntelligentTieringConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketInventoryConfiguration struct { } func (*validateOpGetBucketInventoryConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketInventoryConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketInventoryConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketInventoryConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketLifecycleConfiguration struct { } func (*validateOpGetBucketLifecycleConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketLifecycleConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketLifecycleConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketLifecycleConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketLocation struct { } func (*validateOpGetBucketLocation) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketLocation) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketLocationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketLocationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketLogging struct { } func (*validateOpGetBucketLogging) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketLogging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketLoggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketLoggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketMetricsConfiguration struct { } func (*validateOpGetBucketMetricsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketMetricsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketMetricsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketMetricsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketNotificationConfiguration struct { } func (*validateOpGetBucketNotificationConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketNotificationConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketNotificationConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketNotificationConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketOwnershipControls struct { } func (*validateOpGetBucketOwnershipControls) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketOwnershipControls) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketOwnershipControlsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketOwnershipControlsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketPolicy struct { } func (*validateOpGetBucketPolicy) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketPolicyInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketPolicyStatus struct { } func (*validateOpGetBucketPolicyStatus) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketPolicyStatus) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketPolicyStatusInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketPolicyStatusInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketReplication struct { } func (*validateOpGetBucketReplication) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketReplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketReplicationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketReplicationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketRequestPayment struct { } func (*validateOpGetBucketRequestPayment) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketRequestPayment) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketRequestPaymentInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketRequestPaymentInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketTagging struct { } func (*validateOpGetBucketTagging) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketVersioning struct { } func (*validateOpGetBucketVersioning) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketVersioning) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketVersioningInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketVersioningInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetBucketWebsite struct { } func (*validateOpGetBucketWebsite) ID() string { return "OperationInputValidation" } func (m *validateOpGetBucketWebsite) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetBucketWebsiteInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetBucketWebsiteInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectAcl struct { } func (*validateOpGetObjectAcl) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectAcl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectAclInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectAclInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectAttributes struct { } func (*validateOpGetObjectAttributes) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectAttributes) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectAttributesInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectAttributesInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObject struct { } func (*validateOpGetObject) ID() string { return "OperationInputValidation" } func (m *validateOpGetObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectLegalHold struct { } func (*validateOpGetObjectLegalHold) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectLegalHold) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectLegalHoldInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectLegalHoldInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectLockConfiguration struct { } func (*validateOpGetObjectLockConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectLockConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectLockConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectLockConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectRetention struct { } func (*validateOpGetObjectRetention) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectRetention) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectRetentionInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectRetentionInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectTagging struct { } func (*validateOpGetObjectTagging) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetObjectTorrent struct { } func (*validateOpGetObjectTorrent) ID() string { return "OperationInputValidation" } func (m *validateOpGetObjectTorrent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetObjectTorrentInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetObjectTorrentInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpGetPublicAccessBlock struct { } func (*validateOpGetPublicAccessBlock) ID() string { return "OperationInputValidation" } func (m *validateOpGetPublicAccessBlock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*GetPublicAccessBlockInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpGetPublicAccessBlockInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpHeadBucket struct { } func (*validateOpHeadBucket) ID() string { return "OperationInputValidation" } func (m *validateOpHeadBucket) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*HeadBucketInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpHeadBucketInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpHeadObject struct { } func (*validateOpHeadObject) ID() string { return "OperationInputValidation" } func (m *validateOpHeadObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*HeadObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpHeadObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListBucketAnalyticsConfigurations struct { } func (*validateOpListBucketAnalyticsConfigurations) ID() string { return "OperationInputValidation" } func (m *validateOpListBucketAnalyticsConfigurations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListBucketAnalyticsConfigurationsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListBucketAnalyticsConfigurationsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListBucketIntelligentTieringConfigurations struct { } func (*validateOpListBucketIntelligentTieringConfigurations) ID() string { return "OperationInputValidation" } func (m *validateOpListBucketIntelligentTieringConfigurations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListBucketIntelligentTieringConfigurationsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListBucketIntelligentTieringConfigurationsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListBucketInventoryConfigurations struct { } func (*validateOpListBucketInventoryConfigurations) ID() string { return "OperationInputValidation" } func (m *validateOpListBucketInventoryConfigurations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListBucketInventoryConfigurationsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListBucketInventoryConfigurationsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListBucketMetricsConfigurations struct { } func (*validateOpListBucketMetricsConfigurations) ID() string { return "OperationInputValidation" } func (m *validateOpListBucketMetricsConfigurations) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListBucketMetricsConfigurationsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListBucketMetricsConfigurationsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListMultipartUploads struct { } func (*validateOpListMultipartUploads) ID() string { return "OperationInputValidation" } func (m *validateOpListMultipartUploads) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListMultipartUploadsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListMultipartUploadsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListObjects struct { } func (*validateOpListObjects) ID() string { return "OperationInputValidation" } func (m *validateOpListObjects) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListObjectsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListObjectsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListObjectsV2 struct { } func (*validateOpListObjectsV2) ID() string { return "OperationInputValidation" } func (m *validateOpListObjectsV2) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListObjectsV2Input) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListObjectsV2Input(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListObjectVersions struct { } func (*validateOpListObjectVersions) ID() string { return "OperationInputValidation" } func (m *validateOpListObjectVersions) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListObjectVersionsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListObjectVersionsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpListParts struct { } func (*validateOpListParts) ID() string { return "OperationInputValidation" } func (m *validateOpListParts) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*ListPartsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpListPartsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketAccelerateConfiguration struct { } func (*validateOpPutBucketAccelerateConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketAccelerateConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketAccelerateConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketAccelerateConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketAcl struct { } func (*validateOpPutBucketAcl) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketAcl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketAclInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketAclInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketAnalyticsConfiguration struct { } func (*validateOpPutBucketAnalyticsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketAnalyticsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketAnalyticsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketAnalyticsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketCors struct { } func (*validateOpPutBucketCors) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketCors) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketCorsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketCorsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketEncryption struct { } func (*validateOpPutBucketEncryption) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketEncryption) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketEncryptionInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketEncryptionInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketIntelligentTieringConfiguration struct { } func (*validateOpPutBucketIntelligentTieringConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketIntelligentTieringConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketIntelligentTieringConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketIntelligentTieringConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketInventoryConfiguration struct { } func (*validateOpPutBucketInventoryConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketInventoryConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketInventoryConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketInventoryConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketLifecycleConfiguration struct { } func (*validateOpPutBucketLifecycleConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketLifecycleConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketLifecycleConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketLifecycleConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketLogging struct { } func (*validateOpPutBucketLogging) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketLogging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketLoggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketLoggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketMetricsConfiguration struct { } func (*validateOpPutBucketMetricsConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketMetricsConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketMetricsConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketMetricsConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketNotificationConfiguration struct { } func (*validateOpPutBucketNotificationConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketNotificationConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketNotificationConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketNotificationConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketOwnershipControls struct { } func (*validateOpPutBucketOwnershipControls) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketOwnershipControls) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketOwnershipControlsInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketOwnershipControlsInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketPolicy struct { } func (*validateOpPutBucketPolicy) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketPolicy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketPolicyInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketReplication struct { } func (*validateOpPutBucketReplication) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketReplication) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketReplicationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketReplicationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketRequestPayment struct { } func (*validateOpPutBucketRequestPayment) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketRequestPayment) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketRequestPaymentInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketRequestPaymentInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketTagging struct { } func (*validateOpPutBucketTagging) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketVersioning struct { } func (*validateOpPutBucketVersioning) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketVersioning) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketVersioningInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketVersioningInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutBucketWebsite struct { } func (*validateOpPutBucketWebsite) ID() string { return "OperationInputValidation" } func (m *validateOpPutBucketWebsite) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutBucketWebsiteInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutBucketWebsiteInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObjectAcl struct { } func (*validateOpPutObjectAcl) ID() string { return "OperationInputValidation" } func (m *validateOpPutObjectAcl) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectAclInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectAclInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObject struct { } func (*validateOpPutObject) ID() string { return "OperationInputValidation" } func (m *validateOpPutObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObjectLegalHold struct { } func (*validateOpPutObjectLegalHold) ID() string { return "OperationInputValidation" } func (m *validateOpPutObjectLegalHold) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectLegalHoldInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectLegalHoldInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObjectLockConfiguration struct { } func (*validateOpPutObjectLockConfiguration) ID() string { return "OperationInputValidation" } func (m *validateOpPutObjectLockConfiguration) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectLockConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectLockConfigurationInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObjectRetention struct { } func (*validateOpPutObjectRetention) ID() string { return "OperationInputValidation" } func (m *validateOpPutObjectRetention) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectRetentionInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectRetentionInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutObjectTagging struct { } func (*validateOpPutObjectTagging) ID() string { return "OperationInputValidation" } func (m *validateOpPutObjectTagging) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutObjectTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutObjectTaggingInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpPutPublicAccessBlock struct { } func (*validateOpPutPublicAccessBlock) ID() string { return "OperationInputValidation" } func (m *validateOpPutPublicAccessBlock) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*PutPublicAccessBlockInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpPutPublicAccessBlockInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpRestoreObject struct { } func (*validateOpRestoreObject) ID() string { return "OperationInputValidation" } func (m *validateOpRestoreObject) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*RestoreObjectInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpRestoreObjectInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpSelectObjectContent struct { } func (*validateOpSelectObjectContent) ID() string { return "OperationInputValidation" } func (m *validateOpSelectObjectContent) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*SelectObjectContentInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpSelectObjectContentInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpUploadPartCopy struct { } func (*validateOpUploadPartCopy) ID() string { return "OperationInputValidation" } func (m *validateOpUploadPartCopy) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*UploadPartCopyInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpUploadPartCopyInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpUploadPart struct { } func (*validateOpUploadPart) ID() string { return "OperationInputValidation" } func (m *validateOpUploadPart) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*UploadPartInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpUploadPartInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } type validateOpWriteGetObjectResponse struct { } func (*validateOpWriteGetObjectResponse) ID() string { return "OperationInputValidation" } func (m *validateOpWriteGetObjectResponse) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { input, ok := in.Parameters.(*WriteGetObjectResponseInput) if !ok { return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) } if err := validateOpWriteGetObjectResponseInput(input); err != nil { return out, metadata, err } return next.HandleInitialize(ctx, in) } func addOpAbortMultipartUploadValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpAbortMultipartUpload{}, middleware.After) } func addOpCompleteMultipartUploadValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCompleteMultipartUpload{}, middleware.After) } func addOpCopyObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCopyObject{}, middleware.After) } func addOpCreateBucketValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCreateBucket{}, middleware.After) } func addOpCreateMultipartUploadValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpCreateMultipartUpload{}, middleware.After) } func addOpDeleteBucketAnalyticsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketAnalyticsConfiguration{}, middleware.After) } func addOpDeleteBucketCorsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketCors{}, middleware.After) } func addOpDeleteBucketEncryptionValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketEncryption{}, middleware.After) } func addOpDeleteBucketValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucket{}, middleware.After) } func addOpDeleteBucketIntelligentTieringConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketIntelligentTieringConfiguration{}, middleware.After) } func addOpDeleteBucketInventoryConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketInventoryConfiguration{}, middleware.After) } func addOpDeleteBucketLifecycleValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketLifecycle{}, middleware.After) } func addOpDeleteBucketMetricsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketMetricsConfiguration{}, middleware.After) } func addOpDeleteBucketOwnershipControlsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketOwnershipControls{}, middleware.After) } func addOpDeleteBucketPolicyValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketPolicy{}, middleware.After) } func addOpDeleteBucketReplicationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketReplication{}, middleware.After) } func addOpDeleteBucketTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketTagging{}, middleware.After) } func addOpDeleteBucketWebsiteValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteBucketWebsite{}, middleware.After) } func addOpDeleteObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteObject{}, middleware.After) } func addOpDeleteObjectsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteObjects{}, middleware.After) } func addOpDeleteObjectTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeleteObjectTagging{}, middleware.After) } func addOpDeletePublicAccessBlockValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpDeletePublicAccessBlock{}, middleware.After) } func addOpGetBucketAccelerateConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketAccelerateConfiguration{}, middleware.After) } func addOpGetBucketAclValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketAcl{}, middleware.After) } func addOpGetBucketAnalyticsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketAnalyticsConfiguration{}, middleware.After) } func addOpGetBucketCorsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketCors{}, middleware.After) } func addOpGetBucketEncryptionValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketEncryption{}, middleware.After) } func addOpGetBucketIntelligentTieringConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketIntelligentTieringConfiguration{}, middleware.After) } func addOpGetBucketInventoryConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketInventoryConfiguration{}, middleware.After) } func addOpGetBucketLifecycleConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketLifecycleConfiguration{}, middleware.After) } func addOpGetBucketLocationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketLocation{}, middleware.After) } func addOpGetBucketLoggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketLogging{}, middleware.After) } func addOpGetBucketMetricsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketMetricsConfiguration{}, middleware.After) } func addOpGetBucketNotificationConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketNotificationConfiguration{}, middleware.After) } func addOpGetBucketOwnershipControlsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketOwnershipControls{}, middleware.After) } func addOpGetBucketPolicyValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketPolicy{}, middleware.After) } func addOpGetBucketPolicyStatusValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketPolicyStatus{}, middleware.After) } func addOpGetBucketReplicationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketReplication{}, middleware.After) } func addOpGetBucketRequestPaymentValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketRequestPayment{}, middleware.After) } func addOpGetBucketTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketTagging{}, middleware.After) } func addOpGetBucketVersioningValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketVersioning{}, middleware.After) } func addOpGetBucketWebsiteValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetBucketWebsite{}, middleware.After) } func addOpGetObjectAclValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectAcl{}, middleware.After) } func addOpGetObjectAttributesValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectAttributes{}, middleware.After) } func addOpGetObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObject{}, middleware.After) } func addOpGetObjectLegalHoldValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectLegalHold{}, middleware.After) } func addOpGetObjectLockConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectLockConfiguration{}, middleware.After) } func addOpGetObjectRetentionValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectRetention{}, middleware.After) } func addOpGetObjectTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectTagging{}, middleware.After) } func addOpGetObjectTorrentValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetObjectTorrent{}, middleware.After) } func addOpGetPublicAccessBlockValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpGetPublicAccessBlock{}, middleware.After) } func addOpHeadBucketValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpHeadBucket{}, middleware.After) } func addOpHeadObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpHeadObject{}, middleware.After) } func addOpListBucketAnalyticsConfigurationsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListBucketAnalyticsConfigurations{}, middleware.After) } func addOpListBucketIntelligentTieringConfigurationsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListBucketIntelligentTieringConfigurations{}, middleware.After) } func addOpListBucketInventoryConfigurationsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListBucketInventoryConfigurations{}, middleware.After) } func addOpListBucketMetricsConfigurationsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListBucketMetricsConfigurations{}, middleware.After) } func addOpListMultipartUploadsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListMultipartUploads{}, middleware.After) } func addOpListObjectsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListObjects{}, middleware.After) } func addOpListObjectsV2ValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListObjectsV2{}, middleware.After) } func addOpListObjectVersionsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListObjectVersions{}, middleware.After) } func addOpListPartsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpListParts{}, middleware.After) } func addOpPutBucketAccelerateConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketAccelerateConfiguration{}, middleware.After) } func addOpPutBucketAclValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketAcl{}, middleware.After) } func addOpPutBucketAnalyticsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketAnalyticsConfiguration{}, middleware.After) } func addOpPutBucketCorsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketCors{}, middleware.After) } func addOpPutBucketEncryptionValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketEncryption{}, middleware.After) } func addOpPutBucketIntelligentTieringConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketIntelligentTieringConfiguration{}, middleware.After) } func addOpPutBucketInventoryConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketInventoryConfiguration{}, middleware.After) } func addOpPutBucketLifecycleConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketLifecycleConfiguration{}, middleware.After) } func addOpPutBucketLoggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketLogging{}, middleware.After) } func addOpPutBucketMetricsConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketMetricsConfiguration{}, middleware.After) } func addOpPutBucketNotificationConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketNotificationConfiguration{}, middleware.After) } func addOpPutBucketOwnershipControlsValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketOwnershipControls{}, middleware.After) } func addOpPutBucketPolicyValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketPolicy{}, middleware.After) } func addOpPutBucketReplicationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketReplication{}, middleware.After) } func addOpPutBucketRequestPaymentValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketRequestPayment{}, middleware.After) } func addOpPutBucketTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketTagging{}, middleware.After) } func addOpPutBucketVersioningValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketVersioning{}, middleware.After) } func addOpPutBucketWebsiteValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutBucketWebsite{}, middleware.After) } func addOpPutObjectAclValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObjectAcl{}, middleware.After) } func addOpPutObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObject{}, middleware.After) } func addOpPutObjectLegalHoldValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObjectLegalHold{}, middleware.After) } func addOpPutObjectLockConfigurationValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObjectLockConfiguration{}, middleware.After) } func addOpPutObjectRetentionValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObjectRetention{}, middleware.After) } func addOpPutObjectTaggingValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutObjectTagging{}, middleware.After) } func addOpPutPublicAccessBlockValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpPutPublicAccessBlock{}, middleware.After) } func addOpRestoreObjectValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpRestoreObject{}, middleware.After) } func addOpSelectObjectContentValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpSelectObjectContent{}, middleware.After) } func addOpUploadPartCopyValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpUploadPartCopy{}, middleware.After) } func addOpUploadPartValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpUploadPart{}, middleware.After) } func addOpWriteGetObjectResponseValidationMiddleware(stack *middleware.Stack) error { return stack.Initialize.Add(&validateOpWriteGetObjectResponse{}, middleware.After) } func validateAccessControlPolicy(v *types.AccessControlPolicy) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AccessControlPolicy"} if v.Grants != nil { if err := validateGrants(v.Grants); err != nil { invalidParams.AddNested("Grants", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAccessControlTranslation(v *types.AccessControlTranslation) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AccessControlTranslation"} if len(v.Owner) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Owner")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAnalyticsAndOperator(v *types.AnalyticsAndOperator) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AnalyticsAndOperator"} if v.Tags != nil { if err := validateTagSet(v.Tags); err != nil { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAnalyticsConfiguration(v *types.AnalyticsConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AnalyticsConfiguration"} if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.Filter != nil { if err := validateAnalyticsFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if v.StorageClassAnalysis == nil { invalidParams.Add(smithy.NewErrParamRequired("StorageClassAnalysis")) } else if v.StorageClassAnalysis != nil { if err := validateStorageClassAnalysis(v.StorageClassAnalysis); err != nil { invalidParams.AddNested("StorageClassAnalysis", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAnalyticsExportDestination(v *types.AnalyticsExportDestination) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AnalyticsExportDestination"} if v.S3BucketDestination == nil { invalidParams.Add(smithy.NewErrParamRequired("S3BucketDestination")) } else if v.S3BucketDestination != nil { if err := validateAnalyticsS3BucketDestination(v.S3BucketDestination); err != nil { invalidParams.AddNested("S3BucketDestination", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAnalyticsFilter(v types.AnalyticsFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AnalyticsFilter"} switch uv := v.(type) { case *types.AnalyticsFilterMemberAnd: if err := validateAnalyticsAndOperator(&uv.Value); err != nil { invalidParams.AddNested("[And]", err.(smithy.InvalidParamsError)) } case *types.AnalyticsFilterMemberTag: if err := validateTag(&uv.Value); err != nil { invalidParams.AddNested("[Tag]", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateAnalyticsS3BucketDestination(v *types.AnalyticsS3BucketDestination) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AnalyticsS3BucketDestination"} if len(v.Format) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Format")) } if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateBucketLifecycleConfiguration(v *types.BucketLifecycleConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "BucketLifecycleConfiguration"} if v.Rules == nil { invalidParams.Add(smithy.NewErrParamRequired("Rules")) } else if v.Rules != nil { if err := validateLifecycleRules(v.Rules); err != nil { invalidParams.AddNested("Rules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateBucketLoggingStatus(v *types.BucketLoggingStatus) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "BucketLoggingStatus"} if v.LoggingEnabled != nil { if err := validateLoggingEnabled(v.LoggingEnabled); err != nil { invalidParams.AddNested("LoggingEnabled", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateCORSConfiguration(v *types.CORSConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CORSConfiguration"} if v.CORSRules == nil { invalidParams.Add(smithy.NewErrParamRequired("CORSRules")) } else if v.CORSRules != nil { if err := validateCORSRules(v.CORSRules); err != nil { invalidParams.AddNested("CORSRules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateCORSRule(v *types.CORSRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CORSRule"} if v.AllowedMethods == nil { invalidParams.Add(smithy.NewErrParamRequired("AllowedMethods")) } if v.AllowedOrigins == nil { invalidParams.Add(smithy.NewErrParamRequired("AllowedOrigins")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateCORSRules(v []types.CORSRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CORSRules"} for i := range v { if err := validateCORSRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateDelete(v *types.Delete) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Delete"} if v.Objects == nil { invalidParams.Add(smithy.NewErrParamRequired("Objects")) } else if v.Objects != nil { if err := validateObjectIdentifierList(v.Objects); err != nil { invalidParams.AddNested("Objects", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateDestination(v *types.Destination) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Destination"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.AccessControlTranslation != nil { if err := validateAccessControlTranslation(v.AccessControlTranslation); err != nil { invalidParams.AddNested("AccessControlTranslation", err.(smithy.InvalidParamsError)) } } if v.ReplicationTime != nil { if err := validateReplicationTime(v.ReplicationTime); err != nil { invalidParams.AddNested("ReplicationTime", err.(smithy.InvalidParamsError)) } } if v.Metrics != nil { if err := validateMetrics(v.Metrics); err != nil { invalidParams.AddNested("Metrics", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateEncryption(v *types.Encryption) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Encryption"} if len(v.EncryptionType) == 0 { invalidParams.Add(smithy.NewErrParamRequired("EncryptionType")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateErrorDocument(v *types.ErrorDocument) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ErrorDocument"} if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateExistingObjectReplication(v *types.ExistingObjectReplication) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ExistingObjectReplication"} if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateGlacierJobParameters(v *types.GlacierJobParameters) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GlacierJobParameters"} if len(v.Tier) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Tier")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateGrant(v *types.Grant) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Grant"} if v.Grantee != nil { if err := validateGrantee(v.Grantee); err != nil { invalidParams.AddNested("Grantee", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateGrantee(v *types.Grantee) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Grantee"} if len(v.Type) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Type")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateGrants(v []types.Grant) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Grants"} for i := range v { if err := validateGrant(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateIndexDocument(v *types.IndexDocument) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "IndexDocument"} if v.Suffix == nil { invalidParams.Add(smithy.NewErrParamRequired("Suffix")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateIntelligentTieringAndOperator(v *types.IntelligentTieringAndOperator) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "IntelligentTieringAndOperator"} if v.Tags != nil { if err := validateTagSet(v.Tags); err != nil { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateIntelligentTieringConfiguration(v *types.IntelligentTieringConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "IntelligentTieringConfiguration"} if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.Filter != nil { if err := validateIntelligentTieringFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if v.Tierings == nil { invalidParams.Add(smithy.NewErrParamRequired("Tierings")) } else if v.Tierings != nil { if err := validateTieringList(v.Tierings); err != nil { invalidParams.AddNested("Tierings", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateIntelligentTieringFilter(v *types.IntelligentTieringFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "IntelligentTieringFilter"} if v.Tag != nil { if err := validateTag(v.Tag); err != nil { invalidParams.AddNested("Tag", err.(smithy.InvalidParamsError)) } } if v.And != nil { if err := validateIntelligentTieringAndOperator(v.And); err != nil { invalidParams.AddNested("And", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventoryConfiguration(v *types.InventoryConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventoryConfiguration"} if v.Destination == nil { invalidParams.Add(smithy.NewErrParamRequired("Destination")) } else if v.Destination != nil { if err := validateInventoryDestination(v.Destination); err != nil { invalidParams.AddNested("Destination", err.(smithy.InvalidParamsError)) } } if v.Filter != nil { if err := validateInventoryFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if len(v.IncludedObjectVersions) == 0 { invalidParams.Add(smithy.NewErrParamRequired("IncludedObjectVersions")) } if v.Schedule == nil { invalidParams.Add(smithy.NewErrParamRequired("Schedule")) } else if v.Schedule != nil { if err := validateInventorySchedule(v.Schedule); err != nil { invalidParams.AddNested("Schedule", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventoryDestination(v *types.InventoryDestination) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventoryDestination"} if v.S3BucketDestination == nil { invalidParams.Add(smithy.NewErrParamRequired("S3BucketDestination")) } else if v.S3BucketDestination != nil { if err := validateInventoryS3BucketDestination(v.S3BucketDestination); err != nil { invalidParams.AddNested("S3BucketDestination", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventoryEncryption(v *types.InventoryEncryption) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventoryEncryption"} if v.SSEKMS != nil { if err := validateSSEKMS(v.SSEKMS); err != nil { invalidParams.AddNested("SSEKMS", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventoryFilter(v *types.InventoryFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventoryFilter"} if v.Prefix == nil { invalidParams.Add(smithy.NewErrParamRequired("Prefix")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventoryS3BucketDestination(v *types.InventoryS3BucketDestination) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventoryS3BucketDestination"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if len(v.Format) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Format")) } if v.Encryption != nil { if err := validateInventoryEncryption(v.Encryption); err != nil { invalidParams.AddNested("Encryption", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateInventorySchedule(v *types.InventorySchedule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "InventorySchedule"} if len(v.Frequency) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Frequency")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLambdaFunctionConfiguration(v *types.LambdaFunctionConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LambdaFunctionConfiguration"} if v.LambdaFunctionArn == nil { invalidParams.Add(smithy.NewErrParamRequired("LambdaFunctionArn")) } if v.Events == nil { invalidParams.Add(smithy.NewErrParamRequired("Events")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLambdaFunctionConfigurationList(v []types.LambdaFunctionConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LambdaFunctionConfigurationList"} for i := range v { if err := validateLambdaFunctionConfiguration(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLifecycleRule(v *types.LifecycleRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LifecycleRule"} if v.Filter != nil { if err := validateLifecycleRuleFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLifecycleRuleAndOperator(v *types.LifecycleRuleAndOperator) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LifecycleRuleAndOperator"} if v.Tags != nil { if err := validateTagSet(v.Tags); err != nil { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLifecycleRuleFilter(v types.LifecycleRuleFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LifecycleRuleFilter"} switch uv := v.(type) { case *types.LifecycleRuleFilterMemberAnd: if err := validateLifecycleRuleAndOperator(&uv.Value); err != nil { invalidParams.AddNested("[And]", err.(smithy.InvalidParamsError)) } case *types.LifecycleRuleFilterMemberTag: if err := validateTag(&uv.Value); err != nil { invalidParams.AddNested("[Tag]", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLifecycleRules(v []types.LifecycleRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LifecycleRules"} for i := range v { if err := validateLifecycleRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateLoggingEnabled(v *types.LoggingEnabled) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "LoggingEnabled"} if v.TargetBucket == nil { invalidParams.Add(smithy.NewErrParamRequired("TargetBucket")) } if v.TargetGrants != nil { if err := validateTargetGrants(v.TargetGrants); err != nil { invalidParams.AddNested("TargetGrants", err.(smithy.InvalidParamsError)) } } if v.TargetPrefix == nil { invalidParams.Add(smithy.NewErrParamRequired("TargetPrefix")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateMetrics(v *types.Metrics) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Metrics"} if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateMetricsAndOperator(v *types.MetricsAndOperator) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "MetricsAndOperator"} if v.Tags != nil { if err := validateTagSet(v.Tags); err != nil { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateMetricsConfiguration(v *types.MetricsConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "MetricsConfiguration"} if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.Filter != nil { if err := validateMetricsFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateMetricsFilter(v types.MetricsFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "MetricsFilter"} switch uv := v.(type) { case *types.MetricsFilterMemberAnd: if err := validateMetricsAndOperator(&uv.Value); err != nil { invalidParams.AddNested("[And]", err.(smithy.InvalidParamsError)) } case *types.MetricsFilterMemberTag: if err := validateTag(&uv.Value); err != nil { invalidParams.AddNested("[Tag]", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateNotificationConfiguration(v *types.NotificationConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "NotificationConfiguration"} if v.TopicConfigurations != nil { if err := validateTopicConfigurationList(v.TopicConfigurations); err != nil { invalidParams.AddNested("TopicConfigurations", err.(smithy.InvalidParamsError)) } } if v.QueueConfigurations != nil { if err := validateQueueConfigurationList(v.QueueConfigurations); err != nil { invalidParams.AddNested("QueueConfigurations", err.(smithy.InvalidParamsError)) } } if v.LambdaFunctionConfigurations != nil { if err := validateLambdaFunctionConfigurationList(v.LambdaFunctionConfigurations); err != nil { invalidParams.AddNested("LambdaFunctionConfigurations", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateObjectIdentifier(v *types.ObjectIdentifier) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ObjectIdentifier"} if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateObjectIdentifierList(v []types.ObjectIdentifier) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ObjectIdentifierList"} for i := range v { if err := validateObjectIdentifier(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOutputLocation(v *types.OutputLocation) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "OutputLocation"} if v.S3 != nil { if err := validateS3Location(v.S3); err != nil { invalidParams.AddNested("S3", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOwnershipControls(v *types.OwnershipControls) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "OwnershipControls"} if v.Rules == nil { invalidParams.Add(smithy.NewErrParamRequired("Rules")) } else if v.Rules != nil { if err := validateOwnershipControlsRules(v.Rules); err != nil { invalidParams.AddNested("Rules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOwnershipControlsRule(v *types.OwnershipControlsRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "OwnershipControlsRule"} if len(v.ObjectOwnership) == 0 { invalidParams.Add(smithy.NewErrParamRequired("ObjectOwnership")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOwnershipControlsRules(v []types.OwnershipControlsRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "OwnershipControlsRules"} for i := range v { if err := validateOwnershipControlsRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateQueueConfiguration(v *types.QueueConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "QueueConfiguration"} if v.QueueArn == nil { invalidParams.Add(smithy.NewErrParamRequired("QueueArn")) } if v.Events == nil { invalidParams.Add(smithy.NewErrParamRequired("Events")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateQueueConfigurationList(v []types.QueueConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "QueueConfigurationList"} for i := range v { if err := validateQueueConfiguration(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateRedirectAllRequestsTo(v *types.RedirectAllRequestsTo) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RedirectAllRequestsTo"} if v.HostName == nil { invalidParams.Add(smithy.NewErrParamRequired("HostName")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicaModifications(v *types.ReplicaModifications) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicaModifications"} if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationConfiguration(v *types.ReplicationConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationConfiguration"} if v.Role == nil { invalidParams.Add(smithy.NewErrParamRequired("Role")) } if v.Rules == nil { invalidParams.Add(smithy.NewErrParamRequired("Rules")) } else if v.Rules != nil { if err := validateReplicationRules(v.Rules); err != nil { invalidParams.AddNested("Rules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationRule(v *types.ReplicationRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationRule"} if v.Filter != nil { if err := validateReplicationRuleFilter(v.Filter); err != nil { invalidParams.AddNested("Filter", err.(smithy.InvalidParamsError)) } } if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if v.SourceSelectionCriteria != nil { if err := validateSourceSelectionCriteria(v.SourceSelectionCriteria); err != nil { invalidParams.AddNested("SourceSelectionCriteria", err.(smithy.InvalidParamsError)) } } if v.ExistingObjectReplication != nil { if err := validateExistingObjectReplication(v.ExistingObjectReplication); err != nil { invalidParams.AddNested("ExistingObjectReplication", err.(smithy.InvalidParamsError)) } } if v.Destination == nil { invalidParams.Add(smithy.NewErrParamRequired("Destination")) } else if v.Destination != nil { if err := validateDestination(v.Destination); err != nil { invalidParams.AddNested("Destination", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationRuleAndOperator(v *types.ReplicationRuleAndOperator) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationRuleAndOperator"} if v.Tags != nil { if err := validateTagSet(v.Tags); err != nil { invalidParams.AddNested("Tags", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationRuleFilter(v types.ReplicationRuleFilter) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationRuleFilter"} switch uv := v.(type) { case *types.ReplicationRuleFilterMemberAnd: if err := validateReplicationRuleAndOperator(&uv.Value); err != nil { invalidParams.AddNested("[And]", err.(smithy.InvalidParamsError)) } case *types.ReplicationRuleFilterMemberTag: if err := validateTag(&uv.Value); err != nil { invalidParams.AddNested("[Tag]", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationRules(v []types.ReplicationRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationRules"} for i := range v { if err := validateReplicationRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateReplicationTime(v *types.ReplicationTime) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ReplicationTime"} if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if v.Time == nil { invalidParams.Add(smithy.NewErrParamRequired("Time")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateRequestPaymentConfiguration(v *types.RequestPaymentConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RequestPaymentConfiguration"} if len(v.Payer) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Payer")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateRestoreRequest(v *types.RestoreRequest) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RestoreRequest"} if v.GlacierJobParameters != nil { if err := validateGlacierJobParameters(v.GlacierJobParameters); err != nil { invalidParams.AddNested("GlacierJobParameters", err.(smithy.InvalidParamsError)) } } if v.SelectParameters != nil { if err := validateSelectParameters(v.SelectParameters); err != nil { invalidParams.AddNested("SelectParameters", err.(smithy.InvalidParamsError)) } } if v.OutputLocation != nil { if err := validateOutputLocation(v.OutputLocation); err != nil { invalidParams.AddNested("OutputLocation", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateRoutingRule(v *types.RoutingRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RoutingRule"} if v.Redirect == nil { invalidParams.Add(smithy.NewErrParamRequired("Redirect")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateRoutingRules(v []types.RoutingRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RoutingRules"} for i := range v { if err := validateRoutingRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateS3Location(v *types.S3Location) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "S3Location"} if v.BucketName == nil { invalidParams.Add(smithy.NewErrParamRequired("BucketName")) } if v.Prefix == nil { invalidParams.Add(smithy.NewErrParamRequired("Prefix")) } if v.Encryption != nil { if err := validateEncryption(v.Encryption); err != nil { invalidParams.AddNested("Encryption", err.(smithy.InvalidParamsError)) } } if v.AccessControlList != nil { if err := validateGrants(v.AccessControlList); err != nil { invalidParams.AddNested("AccessControlList", err.(smithy.InvalidParamsError)) } } if v.Tagging != nil { if err := validateTagging(v.Tagging); err != nil { invalidParams.AddNested("Tagging", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateSelectParameters(v *types.SelectParameters) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "SelectParameters"} if v.InputSerialization == nil { invalidParams.Add(smithy.NewErrParamRequired("InputSerialization")) } if len(v.ExpressionType) == 0 { invalidParams.Add(smithy.NewErrParamRequired("ExpressionType")) } if v.Expression == nil { invalidParams.Add(smithy.NewErrParamRequired("Expression")) } if v.OutputSerialization == nil { invalidParams.Add(smithy.NewErrParamRequired("OutputSerialization")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateServerSideEncryptionByDefault(v *types.ServerSideEncryptionByDefault) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ServerSideEncryptionByDefault"} if len(v.SSEAlgorithm) == 0 { invalidParams.Add(smithy.NewErrParamRequired("SSEAlgorithm")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateServerSideEncryptionConfiguration(v *types.ServerSideEncryptionConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ServerSideEncryptionConfiguration"} if v.Rules == nil { invalidParams.Add(smithy.NewErrParamRequired("Rules")) } else if v.Rules != nil { if err := validateServerSideEncryptionRules(v.Rules); err != nil { invalidParams.AddNested("Rules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateServerSideEncryptionRule(v *types.ServerSideEncryptionRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ServerSideEncryptionRule"} if v.ApplyServerSideEncryptionByDefault != nil { if err := validateServerSideEncryptionByDefault(v.ApplyServerSideEncryptionByDefault); err != nil { invalidParams.AddNested("ApplyServerSideEncryptionByDefault", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateServerSideEncryptionRules(v []types.ServerSideEncryptionRule) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ServerSideEncryptionRules"} for i := range v { if err := validateServerSideEncryptionRule(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateSourceSelectionCriteria(v *types.SourceSelectionCriteria) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "SourceSelectionCriteria"} if v.SseKmsEncryptedObjects != nil { if err := validateSseKmsEncryptedObjects(v.SseKmsEncryptedObjects); err != nil { invalidParams.AddNested("SseKmsEncryptedObjects", err.(smithy.InvalidParamsError)) } } if v.ReplicaModifications != nil { if err := validateReplicaModifications(v.ReplicaModifications); err != nil { invalidParams.AddNested("ReplicaModifications", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateSSEKMS(v *types.SSEKMS) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "SSEKMS"} if v.KeyId == nil { invalidParams.Add(smithy.NewErrParamRequired("KeyId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateSseKmsEncryptedObjects(v *types.SseKmsEncryptedObjects) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "SseKmsEncryptedObjects"} if len(v.Status) == 0 { invalidParams.Add(smithy.NewErrParamRequired("Status")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateStorageClassAnalysis(v *types.StorageClassAnalysis) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "StorageClassAnalysis"} if v.DataExport != nil { if err := validateStorageClassAnalysisDataExport(v.DataExport); err != nil { invalidParams.AddNested("DataExport", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateStorageClassAnalysisDataExport(v *types.StorageClassAnalysisDataExport) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "StorageClassAnalysisDataExport"} if len(v.OutputSchemaVersion) == 0 { invalidParams.Add(smithy.NewErrParamRequired("OutputSchemaVersion")) } if v.Destination == nil { invalidParams.Add(smithy.NewErrParamRequired("Destination")) } else if v.Destination != nil { if err := validateAnalyticsExportDestination(v.Destination); err != nil { invalidParams.AddNested("Destination", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTag(v *types.Tag) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Tag"} if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.Value == nil { invalidParams.Add(smithy.NewErrParamRequired("Value")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTagging(v *types.Tagging) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Tagging"} if v.TagSet == nil { invalidParams.Add(smithy.NewErrParamRequired("TagSet")) } else if v.TagSet != nil { if err := validateTagSet(v.TagSet); err != nil { invalidParams.AddNested("TagSet", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTagSet(v []types.Tag) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TagSet"} for i := range v { if err := validateTag(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTargetGrant(v *types.TargetGrant) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TargetGrant"} if v.Grantee != nil { if err := validateGrantee(v.Grantee); err != nil { invalidParams.AddNested("Grantee", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTargetGrants(v []types.TargetGrant) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TargetGrants"} for i := range v { if err := validateTargetGrant(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTiering(v *types.Tiering) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "Tiering"} if len(v.AccessTier) == 0 { invalidParams.Add(smithy.NewErrParamRequired("AccessTier")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTieringList(v []types.Tiering) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TieringList"} for i := range v { if err := validateTiering(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTopicConfiguration(v *types.TopicConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TopicConfiguration"} if v.TopicArn == nil { invalidParams.Add(smithy.NewErrParamRequired("TopicArn")) } if v.Events == nil { invalidParams.Add(smithy.NewErrParamRequired("Events")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateTopicConfigurationList(v []types.TopicConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "TopicConfigurationList"} for i := range v { if err := validateTopicConfiguration(&v[i]); err != nil { invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateWebsiteConfiguration(v *types.WebsiteConfiguration) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "WebsiteConfiguration"} if v.ErrorDocument != nil { if err := validateErrorDocument(v.ErrorDocument); err != nil { invalidParams.AddNested("ErrorDocument", err.(smithy.InvalidParamsError)) } } if v.IndexDocument != nil { if err := validateIndexDocument(v.IndexDocument); err != nil { invalidParams.AddNested("IndexDocument", err.(smithy.InvalidParamsError)) } } if v.RedirectAllRequestsTo != nil { if err := validateRedirectAllRequestsTo(v.RedirectAllRequestsTo); err != nil { invalidParams.AddNested("RedirectAllRequestsTo", err.(smithy.InvalidParamsError)) } } if v.RoutingRules != nil { if err := validateRoutingRules(v.RoutingRules); err != nil { invalidParams.AddNested("RoutingRules", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpAbortMultipartUploadInput(v *AbortMultipartUploadInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "AbortMultipartUploadInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.UploadId == nil { invalidParams.Add(smithy.NewErrParamRequired("UploadId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpCompleteMultipartUploadInput(v *CompleteMultipartUploadInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CompleteMultipartUploadInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.UploadId == nil { invalidParams.Add(smithy.NewErrParamRequired("UploadId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpCopyObjectInput(v *CopyObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CopyObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.CopySource == nil { invalidParams.Add(smithy.NewErrParamRequired("CopySource")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpCreateBucketInput(v *CreateBucketInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CreateBucketInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpCreateMultipartUploadInput(v *CreateMultipartUploadInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "CreateMultipartUploadInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketAnalyticsConfigurationInput(v *DeleteBucketAnalyticsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketAnalyticsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketCorsInput(v *DeleteBucketCorsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketCorsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketEncryptionInput(v *DeleteBucketEncryptionInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketEncryptionInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketInput(v *DeleteBucketInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketIntelligentTieringConfigurationInput(v *DeleteBucketIntelligentTieringConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketIntelligentTieringConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketInventoryConfigurationInput(v *DeleteBucketInventoryConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketInventoryConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketLifecycleInput(v *DeleteBucketLifecycleInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketLifecycleInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketMetricsConfigurationInput(v *DeleteBucketMetricsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketMetricsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketOwnershipControlsInput(v *DeleteBucketOwnershipControlsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketOwnershipControlsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketPolicyInput(v *DeleteBucketPolicyInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketPolicyInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketReplicationInput(v *DeleteBucketReplicationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketReplicationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketTaggingInput(v *DeleteBucketTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteBucketWebsiteInput(v *DeleteBucketWebsiteInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteBucketWebsiteInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteObjectInput(v *DeleteObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteObjectsInput(v *DeleteObjectsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteObjectsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Delete == nil { invalidParams.Add(smithy.NewErrParamRequired("Delete")) } else if v.Delete != nil { if err := validateDelete(v.Delete); err != nil { invalidParams.AddNested("Delete", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeleteObjectTaggingInput(v *DeleteObjectTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeleteObjectTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpDeletePublicAccessBlockInput(v *DeletePublicAccessBlockInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "DeletePublicAccessBlockInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketAccelerateConfigurationInput(v *GetBucketAccelerateConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketAccelerateConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketAclInput(v *GetBucketAclInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketAclInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketAnalyticsConfigurationInput(v *GetBucketAnalyticsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketAnalyticsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketCorsInput(v *GetBucketCorsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketCorsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketEncryptionInput(v *GetBucketEncryptionInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketEncryptionInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketIntelligentTieringConfigurationInput(v *GetBucketIntelligentTieringConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketIntelligentTieringConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketInventoryConfigurationInput(v *GetBucketInventoryConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketInventoryConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketLifecycleConfigurationInput(v *GetBucketLifecycleConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketLifecycleConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketLocationInput(v *GetBucketLocationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketLocationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketLoggingInput(v *GetBucketLoggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketLoggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketMetricsConfigurationInput(v *GetBucketMetricsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketMetricsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketNotificationConfigurationInput(v *GetBucketNotificationConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketNotificationConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketOwnershipControlsInput(v *GetBucketOwnershipControlsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketOwnershipControlsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketPolicyInput(v *GetBucketPolicyInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketPolicyInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketPolicyStatusInput(v *GetBucketPolicyStatusInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketPolicyStatusInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketReplicationInput(v *GetBucketReplicationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketReplicationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketRequestPaymentInput(v *GetBucketRequestPaymentInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketRequestPaymentInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketTaggingInput(v *GetBucketTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketVersioningInput(v *GetBucketVersioningInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketVersioningInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetBucketWebsiteInput(v *GetBucketWebsiteInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetBucketWebsiteInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectAclInput(v *GetObjectAclInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectAclInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectAttributesInput(v *GetObjectAttributesInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectAttributesInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.ObjectAttributes == nil { invalidParams.Add(smithy.NewErrParamRequired("ObjectAttributes")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectInput(v *GetObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectLegalHoldInput(v *GetObjectLegalHoldInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectLegalHoldInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectLockConfigurationInput(v *GetObjectLockConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectLockConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectRetentionInput(v *GetObjectRetentionInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectRetentionInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectTaggingInput(v *GetObjectTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetObjectTorrentInput(v *GetObjectTorrentInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetObjectTorrentInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpGetPublicAccessBlockInput(v *GetPublicAccessBlockInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "GetPublicAccessBlockInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpHeadBucketInput(v *HeadBucketInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "HeadBucketInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpHeadObjectInput(v *HeadObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "HeadObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListBucketAnalyticsConfigurationsInput(v *ListBucketAnalyticsConfigurationsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListBucketAnalyticsConfigurationsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListBucketIntelligentTieringConfigurationsInput(v *ListBucketIntelligentTieringConfigurationsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListBucketIntelligentTieringConfigurationsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListBucketInventoryConfigurationsInput(v *ListBucketInventoryConfigurationsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListBucketInventoryConfigurationsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListBucketMetricsConfigurationsInput(v *ListBucketMetricsConfigurationsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListBucketMetricsConfigurationsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListMultipartUploadsInput(v *ListMultipartUploadsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListMultipartUploadsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListObjectsInput(v *ListObjectsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListObjectsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListObjectsV2Input(v *ListObjectsV2Input) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListObjectsV2Input"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListObjectVersionsInput(v *ListObjectVersionsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListObjectVersionsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpListPartsInput(v *ListPartsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "ListPartsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.UploadId == nil { invalidParams.Add(smithy.NewErrParamRequired("UploadId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketAccelerateConfigurationInput(v *PutBucketAccelerateConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketAccelerateConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.AccelerateConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("AccelerateConfiguration")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketAclInput(v *PutBucketAclInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketAclInput"} if v.AccessControlPolicy != nil { if err := validateAccessControlPolicy(v.AccessControlPolicy); err != nil { invalidParams.AddNested("AccessControlPolicy", err.(smithy.InvalidParamsError)) } } if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketAnalyticsConfigurationInput(v *PutBucketAnalyticsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketAnalyticsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.AnalyticsConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("AnalyticsConfiguration")) } else if v.AnalyticsConfiguration != nil { if err := validateAnalyticsConfiguration(v.AnalyticsConfiguration); err != nil { invalidParams.AddNested("AnalyticsConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketCorsInput(v *PutBucketCorsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketCorsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.CORSConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("CORSConfiguration")) } else if v.CORSConfiguration != nil { if err := validateCORSConfiguration(v.CORSConfiguration); err != nil { invalidParams.AddNested("CORSConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketEncryptionInput(v *PutBucketEncryptionInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketEncryptionInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.ServerSideEncryptionConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("ServerSideEncryptionConfiguration")) } else if v.ServerSideEncryptionConfiguration != nil { if err := validateServerSideEncryptionConfiguration(v.ServerSideEncryptionConfiguration); err != nil { invalidParams.AddNested("ServerSideEncryptionConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketIntelligentTieringConfigurationInput(v *PutBucketIntelligentTieringConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketIntelligentTieringConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.IntelligentTieringConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("IntelligentTieringConfiguration")) } else if v.IntelligentTieringConfiguration != nil { if err := validateIntelligentTieringConfiguration(v.IntelligentTieringConfiguration); err != nil { invalidParams.AddNested("IntelligentTieringConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketInventoryConfigurationInput(v *PutBucketInventoryConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketInventoryConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.InventoryConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("InventoryConfiguration")) } else if v.InventoryConfiguration != nil { if err := validateInventoryConfiguration(v.InventoryConfiguration); err != nil { invalidParams.AddNested("InventoryConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketLifecycleConfigurationInput(v *PutBucketLifecycleConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketLifecycleConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.LifecycleConfiguration != nil { if err := validateBucketLifecycleConfiguration(v.LifecycleConfiguration); err != nil { invalidParams.AddNested("LifecycleConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketLoggingInput(v *PutBucketLoggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketLoggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.BucketLoggingStatus == nil { invalidParams.Add(smithy.NewErrParamRequired("BucketLoggingStatus")) } else if v.BucketLoggingStatus != nil { if err := validateBucketLoggingStatus(v.BucketLoggingStatus); err != nil { invalidParams.AddNested("BucketLoggingStatus", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketMetricsConfigurationInput(v *PutBucketMetricsConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketMetricsConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Id == nil { invalidParams.Add(smithy.NewErrParamRequired("Id")) } if v.MetricsConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("MetricsConfiguration")) } else if v.MetricsConfiguration != nil { if err := validateMetricsConfiguration(v.MetricsConfiguration); err != nil { invalidParams.AddNested("MetricsConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketNotificationConfigurationInput(v *PutBucketNotificationConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketNotificationConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.NotificationConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("NotificationConfiguration")) } else if v.NotificationConfiguration != nil { if err := validateNotificationConfiguration(v.NotificationConfiguration); err != nil { invalidParams.AddNested("NotificationConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketOwnershipControlsInput(v *PutBucketOwnershipControlsInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketOwnershipControlsInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.OwnershipControls == nil { invalidParams.Add(smithy.NewErrParamRequired("OwnershipControls")) } else if v.OwnershipControls != nil { if err := validateOwnershipControls(v.OwnershipControls); err != nil { invalidParams.AddNested("OwnershipControls", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketPolicyInput(v *PutBucketPolicyInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketPolicyInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Policy == nil { invalidParams.Add(smithy.NewErrParamRequired("Policy")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketReplicationInput(v *PutBucketReplicationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketReplicationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.ReplicationConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("ReplicationConfiguration")) } else if v.ReplicationConfiguration != nil { if err := validateReplicationConfiguration(v.ReplicationConfiguration); err != nil { invalidParams.AddNested("ReplicationConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketRequestPaymentInput(v *PutBucketRequestPaymentInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketRequestPaymentInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.RequestPaymentConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("RequestPaymentConfiguration")) } else if v.RequestPaymentConfiguration != nil { if err := validateRequestPaymentConfiguration(v.RequestPaymentConfiguration); err != nil { invalidParams.AddNested("RequestPaymentConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketTaggingInput(v *PutBucketTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Tagging == nil { invalidParams.Add(smithy.NewErrParamRequired("Tagging")) } else if v.Tagging != nil { if err := validateTagging(v.Tagging); err != nil { invalidParams.AddNested("Tagging", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketVersioningInput(v *PutBucketVersioningInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketVersioningInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.VersioningConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("VersioningConfiguration")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutBucketWebsiteInput(v *PutBucketWebsiteInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutBucketWebsiteInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.WebsiteConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("WebsiteConfiguration")) } else if v.WebsiteConfiguration != nil { if err := validateWebsiteConfiguration(v.WebsiteConfiguration); err != nil { invalidParams.AddNested("WebsiteConfiguration", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectAclInput(v *PutObjectAclInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectAclInput"} if v.AccessControlPolicy != nil { if err := validateAccessControlPolicy(v.AccessControlPolicy); err != nil { invalidParams.AddNested("AccessControlPolicy", err.(smithy.InvalidParamsError)) } } if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectInput(v *PutObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectLegalHoldInput(v *PutObjectLegalHoldInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectLegalHoldInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectLockConfigurationInput(v *PutObjectLockConfigurationInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectLockConfigurationInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectRetentionInput(v *PutObjectRetentionInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectRetentionInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutObjectTaggingInput(v *PutObjectTaggingInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutObjectTaggingInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.Tagging == nil { invalidParams.Add(smithy.NewErrParamRequired("Tagging")) } else if v.Tagging != nil { if err := validateTagging(v.Tagging); err != nil { invalidParams.AddNested("Tagging", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpPutPublicAccessBlockInput(v *PutPublicAccessBlockInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "PutPublicAccessBlockInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.PublicAccessBlockConfiguration == nil { invalidParams.Add(smithy.NewErrParamRequired("PublicAccessBlockConfiguration")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpRestoreObjectInput(v *RestoreObjectInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "RestoreObjectInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.RestoreRequest != nil { if err := validateRestoreRequest(v.RestoreRequest); err != nil { invalidParams.AddNested("RestoreRequest", err.(smithy.InvalidParamsError)) } } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpSelectObjectContentInput(v *SelectObjectContentInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "SelectObjectContentInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.Expression == nil { invalidParams.Add(smithy.NewErrParamRequired("Expression")) } if len(v.ExpressionType) == 0 { invalidParams.Add(smithy.NewErrParamRequired("ExpressionType")) } if v.InputSerialization == nil { invalidParams.Add(smithy.NewErrParamRequired("InputSerialization")) } if v.OutputSerialization == nil { invalidParams.Add(smithy.NewErrParamRequired("OutputSerialization")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpUploadPartCopyInput(v *UploadPartCopyInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "UploadPartCopyInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.CopySource == nil { invalidParams.Add(smithy.NewErrParamRequired("CopySource")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.UploadId == nil { invalidParams.Add(smithy.NewErrParamRequired("UploadId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpUploadPartInput(v *UploadPartInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "UploadPartInput"} if v.Bucket == nil { invalidParams.Add(smithy.NewErrParamRequired("Bucket")) } if v.Key == nil { invalidParams.Add(smithy.NewErrParamRequired("Key")) } if v.UploadId == nil { invalidParams.Add(smithy.NewErrParamRequired("UploadId")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } } func validateOpWriteGetObjectResponseInput(v *WriteGetObjectResponseInput) error { if v == nil { return nil } invalidParams := smithy.InvalidParamsError{Context: "WriteGetObjectResponseInput"} if v.RequestRoute == nil { invalidParams.Add(smithy.NewErrParamRequired("RequestRoute")) } if v.RequestToken == nil { invalidParams.Add(smithy.NewErrParamRequired("RequestToken")) } if invalidParams.Len() > 0 { return invalidParams } else { return nil } }
5,495
aws-sdk-go-v2
aws
Go
package arn import ( "fmt" "strings" awsarn "github.com/aws/aws-sdk-go-v2/aws/arn" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn" ) const ( s3Namespace = "s3" s3ObjectsLambdaNamespace = "s3-object-lambda" s3OutpostsNamespace = "s3-outposts" ) // ParseEndpointARN parses a given generic aws ARN into a s3 arn resource. func ParseEndpointARN(v awsarn.ARN) (arn.Resource, error) { return arn.ParseResource(v, accessPointResourceParser) } func accessPointResourceParser(a awsarn.ARN) (arn.Resource, error) { resParts := arn.SplitResource(a.Resource) switch resParts[0] { case "accesspoint": switch a.Service { case s3Namespace: return arn.ParseAccessPointResource(a, resParts[1:]) case s3ObjectsLambdaNamespace: return parseS3ObjectLambdaAccessPointResource(a, resParts) default: return arn.AccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("service is not %s or %s", s3Namespace, s3ObjectsLambdaNamespace)} } case "outpost": if a.Service != s3OutpostsNamespace { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "service is not %s"} } return parseOutpostAccessPointResource(a, resParts[1:]) default: return nil, arn.InvalidARNError{ARN: a, Reason: "unknown resource type"} } } func parseOutpostAccessPointResource(a awsarn.ARN, resParts []string) (arn.OutpostAccessPointARN, error) { // outpost accesspoint arn is only valid if service is s3-outposts if a.Service != "s3-outposts" { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "service is not s3-outposts"} } if len(resParts) == 0 { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "outpost resource-id not set"} } if len(resParts) < 3 { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ ARN: a, Reason: "access-point resource not set in Outpost ARN", } } resID := strings.TrimSpace(resParts[0]) if len(resID) == 0 { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "outpost resource-id not set"} } var outpostAccessPointARN = arn.OutpostAccessPointARN{} switch resParts[1] { case "accesspoint": // Do not allow region-less outpost access-point arns. if len(a.Region) == 0 { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "region is not set"} } accessPointARN, err := arn.ParseAccessPointResource(a, resParts[2:]) if err != nil { return arn.OutpostAccessPointARN{}, err } // set access-point arn outpostAccessPointARN.AccessPointARN = accessPointARN default: return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "access-point resource not set in Outpost ARN"} } // set outpost id outpostAccessPointARN.OutpostID = resID return outpostAccessPointARN, nil } func parseS3ObjectLambdaAccessPointResource(a awsarn.ARN, resParts []string) (arn.S3ObjectLambdaAccessPointARN, error) { if a.Service != s3ObjectsLambdaNamespace { return arn.S3ObjectLambdaAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("service is not %s", s3ObjectsLambdaNamespace)} } if len(a.Region) == 0 { return arn.S3ObjectLambdaAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("%s region not set", s3ObjectsLambdaNamespace)} } accessPointARN, err := arn.ParseAccessPointResource(a, resParts[1:]) if err != nil { return arn.S3ObjectLambdaAccessPointARN{}, err } return arn.S3ObjectLambdaAccessPointARN{ AccessPointARN: accessPointARN, }, nil }
107
aws-sdk-go-v2
aws
Go
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. package configtesting import ( "github.com/aws/aws-sdk-go-v2/config" svcExternal "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config" ) // UseARNRegionProvider Assertions var ( _ svcExternal.UseARNRegionProvider = &config.EnvConfig{} _ svcExternal.UseARNRegionProvider = &config.SharedConfig{} )
15
aws-sdk-go-v2
aws
Go
// Package configtesting provides unit testing of s3 module's config loading. package configtesting
3
aws-sdk-go-v2
aws
Go
// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. package configtesting // goModuleVersion is the tagged release for this module const goModuleVersion = "tip"
7
aws-sdk-go-v2
aws
Go
/* Package customizations provides customizations for the Amazon S3 API client. This package provides support for following S3 customizations ProcessARN Middleware: processes an ARN if provided as input and updates the endpoint as per the arn type UpdateEndpoint Middleware: resolves a custom endpoint as per s3 config options RemoveBucket Middleware: removes a serialized bucket name from request url path processResponseWith200Error Middleware: Deserializing response error with 200 status code # Virtual Host style url addressing Since serializers serialize by default as path style url, we use customization to modify the endpoint url when `UsePathStyle` option on S3Client is unset or false. This flag will be ignored if `UseAccelerate` option is set to true. If UseAccelerate is not enabled, and the bucket name is not a valid hostname label, they SDK will fallback to forcing the request to be made as if UsePathStyle was enabled. This behavior is also used if UseDualStackEndpoint is enabled. https://docs.aws.amazon.com/AmazonS3/latest/dev/dual-stack-endpoints.html#dual-stack-endpoints-description # Transfer acceleration By default S3 Transfer acceleration support is disabled. By enabling `UseAccelerate` option on S3Client, one can enable s3 transfer acceleration support. Transfer acceleration only works with Virtual Host style addressing, and thus `UsePathStyle` option if set is ignored. Transfer acceleration is not supported for S3 operations DeleteBucket, ListBuckets, and CreateBucket. # Dualstack support By default dualstack support for s3 client is disabled. By enabling `UseDualstack` option on s3 client, you can enable dualstack endpoint support. # Endpoint customizations Customizations to lookup ARN, process ARN needs to happen before request serialization. UpdateEndpoint middleware which mutates resources based on Options such as UseDualstack, UseAccelerate for modifying resolved endpoint are executed after request serialization. Remove bucket middleware is executed after an request is serialized, and removes the serialized bucket name from request path Middleware layering: Initialize : HTTP Request -> ARN Lookup -> Input-Validation -> Serialize step Serialize : HTTP Request -> Process ARN -> operation serializer -> Update-Endpoint customization -> Remove-Bucket -> next middleware Customization options: UseARNRegion (Disabled by Default) UsePathStyle (Disabled by Default) UseAccelerate (Disabled by Default) UseDualstack (Disabled by Default) # Handle Error response with 200 status code S3 operations: CopyObject, CompleteMultipartUpload, UploadPartCopy can have an error Response with status code 2xx. The processResponseWith200Error middleware customizations enables SDK to check for an error within response body prior to deserialization. As the check for 2xx response containing an error needs to be performed earlier than response deserialization. Since the behavior of Deserialization is in reverse order to the other stack steps its easier to consider that "after" means "before". Middleware layering: HTTP Response -> handle 200 error customization -> deserialize */ package customizations
80
aws-sdk-go-v2
aws
Go
package customizations import ( "bytes" "context" "encoding/xml" "fmt" "io" "io/ioutil" "strings" "github.com/aws/smithy-go" smithyxml "github.com/aws/smithy-go/encoding/xml" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // HandleResponseErrorWith200Status check for S3 200 error response. // If an s3 200 error is found, status code for the response is modified temporarily to // 5xx response status code. func HandleResponseErrorWith200Status(stack *middleware.Stack) error { return stack.Deserialize.Insert(&processResponseFor200ErrorMiddleware{}, "OperationDeserializer", middleware.After) } // middleware to process raw response and look for error response with 200 status code type processResponseFor200ErrorMiddleware struct{} // ID returns the middleware ID. func (*processResponseFor200ErrorMiddleware) ID() string { return "S3:ProcessResponseFor200Error" } func (m *processResponseFor200ErrorMiddleware) 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)} } // check if response status code is 2xx. if response.StatusCode < 200 || response.StatusCode >= 300 { return } var readBuff bytes.Buffer body := io.TeeReader(response.Body, &readBuff) rootDecoder := xml.NewDecoder(body) t, err := smithyxml.FetchRootElement(rootDecoder) if err == io.EOF { return out, metadata, &smithy.DeserializationError{ Err: fmt.Errorf("received empty response payload"), } } // rewind response body response.Body = ioutil.NopCloser(io.MultiReader(&readBuff, response.Body)) // if start tag is "Error", the response is consider error response. if strings.EqualFold(t.Name.Local, "Error") { // according to https://aws.amazon.com/premiumsupport/knowledge-center/s3-resolve-200-internalerror/ // 200 error responses are similar to 5xx errors. response.StatusCode = 500 } return out, metadata, err }
75
aws-sdk-go-v2
aws
Go
package customizations_test import ( "context" "net/http" "net/http/httptest" "strings" "testing" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awstesting/unit" "github.com/aws/aws-sdk-go-v2/service/s3" ) type EndpointResolverFunc func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) func (fn EndpointResolverFunc) ResolveEndpoint(region string, options s3.EndpointResolverOptions) (endpoint aws.Endpoint, err error) { return fn(region, options) } func TestErrorResponseWith200StatusCode(t *testing.T) { cases := map[string]struct { response []byte statusCode int expectedError string expectedBucket string }{ "200ErrorBody": { response: []byte(`<Error><Type>Sender</Type> <Code>InvalidGreeting</Code> <Message>Hi</Message> <AnotherSetting>setting</AnotherSetting> <RequestId>foo-id</RequestId></Error>`), statusCode: 200, expectedError: "InvalidGreeting", }, "200NoResponse": { response: []byte{}, statusCode: 200, expectedError: "received empty response payload", }, "200InvalidResponse": { response: []byte(`<Error><Type>Sender</Type> <Code>InvalidGreeting</Code> <Message>Hi</Message> <AnotherSetting>setting</AnotherSetting> <RequestId>foo-id`), statusCode: 200, expectedError: "unexpected EOF", }, "200SuccessResponse": { response: []byte(`<CompleteMultipartUploadResult> <Bucket>bucket</Bucket> </CompleteMultipartUploadResult>`), statusCode: 200, expectedError: "", expectedBucket: "bucket", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { server := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(c.statusCode) w.Write(c.response) })) defer server.Close() options := s3.Options{ Credentials: unit.StubCredentialsProvider{}, Retryer: aws.NopRetryer{}, Region: "mock-region", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (e aws.Endpoint, err error) { e.URL = server.URL e.SigningRegion = "us-west-2" return e, err }), UsePathStyle: true, } svc := s3.New(options) resp, err := svc.CompleteMultipartUpload(context.Background(), &s3.CompleteMultipartUploadInput{ UploadId: aws.String("mockID"), RequestPayer: "requester", Bucket: aws.String("bucket"), Key: aws.String("mockKey"), }) if len(c.expectedError) != 0 { if err == nil { t.Fatalf("expected error, got none") } if e, a := c.expectedError, err.Error(); !strings.Contains(a, e) { t.Fatalf("expected %v, got %v", e, a) } } if len(c.expectedBucket) != 0 { if e, a := c.expectedBucket, *resp.Bucket; !strings.EqualFold(e, a) { t.Fatalf("expected bucket name to be %v, got %v", e, a) } } }) } }
109
aws-sdk-go-v2
aws
Go
package customizations import ( "github.com/aws/smithy-go/transport/http" "strings" ) func updateS3HostForS3AccessPoint(req *http.Request) { updateHostPrefix(req, "s3", s3AccessPoint) } func updateS3HostForS3ObjectLambda(req *http.Request) { updateHostPrefix(req, "s3", s3ObjectLambda) } func updateHostPrefix(req *http.Request, oldEndpointPrefix, newEndpointPrefix string) { host := req.URL.Host if strings.HasPrefix(host, oldEndpointPrefix) { // For example if oldEndpointPrefix=s3 would replace to newEndpointPrefix req.URL.Host = newEndpointPrefix + host[len(oldEndpointPrefix):] } }
23
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "strconv" "time" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // AddExpiresOnPresignedURL represents a build middleware used to assign // expiration on a presigned URL. type AddExpiresOnPresignedURL struct { // Expires is time.Duration within which presigned url should be expired. // This should be the duration in seconds the presigned URL should be considered valid for. // By default the S3 presigned url expires in 15 minutes ie. 900 seconds. Expires time.Duration } // ID representing the middleware func (*AddExpiresOnPresignedURL) ID() string { return "S3:AddExpiresOnPresignedURL" } // HandleBuild handles the build step middleware behavior func (m *AddExpiresOnPresignedURL) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) ( out middleware.BuildOutput, metadata middleware.Metadata, err error, ) { // if expiration is unset skip this middleware if m.Expires == 0 { // default to 15 * time.Minutes m.Expires = 15 * time.Minute } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", req) } // set S3 X-AMZ-Expires header query := req.URL.Query() query.Set("X-Amz-Expires", strconv.FormatInt(int64(m.Expires/time.Second), 10)) req.URL.RawQuery = query.Encode() return next.HandleBuild(ctx, in) }
50
aws-sdk-go-v2
aws
Go
package customizations_test import ( "bytes" "context" "net/http" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/internal/awstesting/unit" "github.com/aws/aws-sdk-go-v2/service/s3" s3types "github.com/aws/aws-sdk-go-v2/service/s3/types" ) func TestPutObject_PresignURL(t *testing.T) { cases := map[string]struct { input s3.PutObjectInput options []func(*s3.PresignOptions) expectPresignedURLHost string expectRequestURIQuery []string expectSignedHeader http.Header expectMethod string expectError string }{ "standard case": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: strings.NewReader("hello-world"), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "seekable payload": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: bytes.NewReader([]byte("hello-world")), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "unseekable payload": { // unseekable payload succeeds as we disable content sha256 computation for streaming input input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: bytes.NewBuffer([]byte(`hello-world`)), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "empty body": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: bytes.NewReader([]byte(``)), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "nil body": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "nil body with content-length": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), ContentLength: 100, }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, "Content-Length": []string{"100"}, }, }, "mrap presigned": { input: s3.PutObjectInput{ Bucket: aws.String("arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap"), Key: aws.String("mockkey"), Body: strings.NewReader("hello-world"), }, expectPresignedURLHost: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", "X-Amz-Region-Set", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com"}, }, }, "mrap presigned with mrap disabled": { input: s3.PutObjectInput{ Bucket: aws.String("arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap"), Key: aws.String("mockkey"), Body: strings.NewReader("hello-world"), }, options: []func(option *s3.PresignOptions){ func(option *s3.PresignOptions) { option.ClientOptions = []func(o *s3.Options){ func(o *s3.Options) { o.DisableMultiRegionAccessPoints = true }, } }, }, expectError: "Multi-Region access point ARNs are disabled", }, "standard case with checksum preset checksum": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: strings.NewReader("hello world"), ChecksumAlgorithm: s3types.ChecksumAlgorithmCrc32c, ChecksumCRC32: aws.String("DUoRhQ=="), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", "X-Amz-Checksum-Crc32", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "standard case with checksum empty body": { input: s3.PutObjectInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), Body: strings.NewReader(""), ChecksumAlgorithm: s3types.ChecksumAlgorithmCrc32c, ChecksumCRC32: aws.String("AAAAAA=="), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "x-id=PutObject", "X-Amz-Signature", "X-Amz-Checksum-Crc32", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { ctx := context.Background() cfg := aws.Config{ Region: "us-west-2", Credentials: unit.StubCredentialsProvider{}, Retryer: func() aws.Retryer { return aws.NopRetryer{} }, } presignClient := s3.NewPresignClient(s3.NewFromConfig(cfg), c.options...) req, err := presignClient.PresignPutObject(ctx, &c.input) if err != nil { if len(c.expectError) == 0 { t.Fatalf("expected no error, got %v", err) } // if expect error, match error and skip rest if e, a := c.expectError, err.Error(); !strings.Contains(a, e) { t.Fatalf("expected error to be %s, got %s", e, a) } return } else { if len(c.expectError) != 0 { t.Fatalf("expected error to be %v, got none", c.expectError) } } if e, a := c.expectPresignedURLHost, req.URL; !strings.Contains(a, e) { t.Fatalf("expected presigned url to contain host %s, got %s", e, a) } if len(c.expectRequestURIQuery) != 0 { for _, label := range c.expectRequestURIQuery { if e, a := label, req.URL; !strings.Contains(a, e) { t.Fatalf("expected presigned url to contain %v label in url: %v", label, req.URL) } } } if e, a := c.expectSignedHeader, req.SignedHeader; len(cmp.Diff(e, a)) != 0 { t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmp.Diff(e, a)) } if e, a := c.expectMethod, req.Method; !strings.EqualFold(e, a) { t.Fatalf("expected presigning Method to be %s, got %s", e, a) } }) } } func TestUploadPart_PresignURL(t *testing.T) { cases := map[string]struct { input s3.UploadPartInput options s3.PresignOptions expectPresignedURLHost string expectRequestURIQuery []string expectSignedHeader http.Header expectMethod string expectError string }{ "standard case": { input: s3.UploadPartInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), PartNumber: 1, UploadId: aws.String("123456"), Body: strings.NewReader("hello-world"), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "partNumber=1", "uploadId=123456", "x-id=UploadPart", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "seekable payload": { input: s3.UploadPartInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), PartNumber: 1, UploadId: aws.String("123456"), Body: bytes.NewReader([]byte("hello-world")), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "partNumber=1", "uploadId=123456", "x-id=UploadPart", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "unseekable payload": { // unseekable payload succeeds as we disable content sha256 computation for streaming input input: s3.UploadPartInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), PartNumber: 1, UploadId: aws.String("123456"), Body: bytes.NewBuffer([]byte(`hello-world`)), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "partNumber=1", "uploadId=123456", "x-id=UploadPart", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Content-Length": []string{"11"}, "Content-Type": []string{"application/octet-stream"}, "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "empty body": { input: s3.UploadPartInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), PartNumber: 1, UploadId: aws.String("123456"), Body: bytes.NewReader([]byte(``)), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "partNumber=1", "uploadId=123456", "x-id=UploadPart", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, "nil body": { input: s3.UploadPartInput{ Bucket: aws.String("mock-bucket"), Key: aws.String("mockkey"), PartNumber: 1, UploadId: aws.String("123456"), }, expectPresignedURLHost: "https://mock-bucket.s3.us-west-2.amazonaws.com/mockkey?", expectRequestURIQuery: []string{ "X-Amz-Expires=900", "X-Amz-Credential", "X-Amz-Date", "partNumber=1", "uploadId=123456", "x-id=UploadPart", "X-Amz-Signature", }, expectMethod: "PUT", expectSignedHeader: http.Header{ "Host": []string{"mock-bucket.s3.us-west-2.amazonaws.com"}, }, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { ctx := context.Background() cfg := aws.Config{ Region: "us-west-2", Credentials: unit.StubCredentialsProvider{}, Retryer: func() aws.Retryer { return aws.NopRetryer{} }, } presignClient := s3.NewPresignClient(s3.NewFromConfig(cfg), func(options *s3.PresignOptions) { options = &c.options }) req, err := presignClient.PresignUploadPart(ctx, &c.input) if err != nil { if len(c.expectError) == 0 { t.Fatalf("expected no error, got %v", err) } // if expect error, match error and skip rest if e, a := c.expectError, err.Error(); !strings.Contains(a, e) { t.Fatalf("expected error to be %s, got %s", e, a) } } else { if len(c.expectError) != 0 { t.Fatalf("expected error to be %v, got none", c.expectError) } } if e, a := c.expectPresignedURLHost, req.URL; !strings.Contains(a, e) { t.Fatalf("expected presigned url to contain host %s, got %s", e, a) } if len(c.expectRequestURIQuery) != 0 { for _, label := range c.expectRequestURIQuery { if e, a := label, req.URL; !strings.Contains(a, e) { t.Fatalf("expected presigned url to contain %v label in url: %v", label, req.URL) } } } if e, a := c.expectSignedHeader, req.SignedHeader; len(cmp.Diff(e, a)) != 0 { t.Fatalf("expected signed header to be %s, got %s, \n diff : %s", e, a, cmp.Diff(e, a)) } if e, a := c.expectMethod, req.Method; !strings.EqualFold(e, a) { t.Fatalf("expected presigning Method to be %s, got %s", e, a) } }) } }
473
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "net/url" "strings" "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/transport/http" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/internal/v4a" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/arn" s3arn "github.com/aws/aws-sdk-go-v2/service/s3/internal/arn" "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" ) const ( s3AccessPoint = "s3-accesspoint" s3ObjectLambda = "s3-object-lambda" ) // processARNResource is used to process an ARN resource. type processARNResource struct { // UseARNRegion indicates if region parsed from an ARN should be used. UseARNRegion bool // UseAccelerate indicates if s3 transfer acceleration is enabled UseAccelerate bool // EndpointResolver used to resolve endpoints. This may be a custom endpoint resolver EndpointResolver EndpointResolver // EndpointResolverOptions used by endpoint resolver EndpointResolverOptions EndpointResolverOptions // DisableMultiRegionAccessPoints indicates multi-region access point support is disabled DisableMultiRegionAccessPoints bool } // ID returns the middleware ID. func (*processARNResource) ID() string { return "S3:ProcessARNResource" } func (m *processARNResource) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { // check if arn was provided, if not skip this middleware arnValue, ok := s3shared.GetARNResourceFromContext(ctx) if !ok { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*http.Request) if !ok { return out, metadata, fmt.Errorf("unknown request type %T", req) } // parse arn into an endpoint arn wrt to service resource, err := s3arn.ParseEndpointARN(arnValue) if err != nil { return out, metadata, err } // build a resource request struct resourceRequest := s3shared.ResourceRequest{ Resource: resource, UseARNRegion: m.UseARNRegion, UseFIPS: m.EndpointResolverOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled, RequestRegion: awsmiddleware.GetRegion(ctx), SigningRegion: awsmiddleware.GetSigningRegion(ctx), PartitionID: awsmiddleware.GetPartitionID(ctx), } // switch to correct endpoint updater switch tv := resource.(type) { case arn.AccessPointARN: // multi-region arns do not need to validate for cross partition request if len(tv.Region) != 0 { // validate resource request if err := validateRegionForResourceRequest(resourceRequest); err != nil { return out, metadata, err } } // Special handling for region-less ap-arns. if len(tv.Region) == 0 { // check if multi-region arn support is disabled if m.DisableMultiRegionAccessPoints { return out, metadata, fmt.Errorf("Invalid configuration, Multi-Region access point ARNs are disabled") } // Do not allow dual-stack configuration with multi-region arns. if m.EndpointResolverOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled { return out, metadata, s3shared.NewClientConfiguredForDualStackError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } } // check if accelerate if m.UseAccelerate { return out, metadata, s3shared.NewClientConfiguredForAccelerateError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // fetch arn region to resolve request resolveRegion := tv.Region // check if request region is FIPS if resourceRequest.UseFIPS && len(resolveRegion) == 0 { // Do not allow Fips support within multi-region arns. return out, metadata, s3shared.NewClientConfiguredForFIPSError( tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } var requestBuilder func(context.Context, accesspointOptions) (context.Context, error) if len(resolveRegion) == 0 { requestBuilder = buildMultiRegionAccessPointsRequest } else { requestBuilder = buildAccessPointRequest } // build request as per accesspoint builder ctx, err = requestBuilder(ctx, accesspointOptions{ processARNResource: *m, request: req, resource: tv, resolveRegion: resolveRegion, partitionID: resourceRequest.PartitionID, requestRegion: resourceRequest.RequestRegion, }) if err != nil { return out, metadata, err } case arn.S3ObjectLambdaAccessPointARN: // validate region for resource request if err := validateRegionForResourceRequest(resourceRequest); err != nil { return out, metadata, err } // check if accelerate if m.UseAccelerate { return out, metadata, s3shared.NewClientConfiguredForAccelerateError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // check if dualstack if m.EndpointResolverOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled { return out, metadata, s3shared.NewClientConfiguredForDualStackError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // fetch arn region to resolve request resolveRegion := tv.Region // build access point request ctx, err = buildS3ObjectLambdaAccessPointRequest(ctx, accesspointOptions{ processARNResource: *m, request: req, resource: tv.AccessPointARN, resolveRegion: resolveRegion, partitionID: resourceRequest.PartitionID, requestRegion: resourceRequest.RequestRegion, }) if err != nil { return out, metadata, err } // process outpost accesspoint ARN case arn.OutpostAccessPointARN: // validate region for resource request if err := validateRegionForResourceRequest(resourceRequest); err != nil { return out, metadata, err } // check if accelerate if m.UseAccelerate { return out, metadata, s3shared.NewClientConfiguredForAccelerateError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // check if dual stack if m.EndpointResolverOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled { return out, metadata, s3shared.NewClientConfiguredForDualStackError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // check if request region is FIPS if resourceRequest.UseFIPS { return out, metadata, s3shared.NewFIPSConfigurationError(tv, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // build outpost access point request ctx, err = buildOutpostAccessPointRequest(ctx, outpostAccessPointOptions{ processARNResource: *m, resource: tv, request: req, partitionID: resourceRequest.PartitionID, requestRegion: resourceRequest.RequestRegion, }) if err != nil { return out, metadata, err } default: return out, metadata, s3shared.NewInvalidARNError(resource, nil) } return next.HandleSerialize(ctx, in) } // validate if s3 resource and request region config is compatible. func validateRegionForResourceRequest(resourceRequest s3shared.ResourceRequest) error { // check if resourceRequest leads to a cross partition error v, err := resourceRequest.IsCrossPartition() if err != nil { return err } if v { // if cross partition return s3shared.NewClientPartitionMismatchError(resourceRequest.Resource, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } // check if resourceRequest leads to a cross region error if !resourceRequest.AllowCrossRegion() && resourceRequest.IsCrossRegion() { // if cross region, but not use ARN region is not enabled return s3shared.NewClientRegionMismatchError(resourceRequest.Resource, resourceRequest.PartitionID, resourceRequest.RequestRegion, nil) } return nil } // === Accesspoint ========== type accesspointOptions struct { processARNResource request *http.Request resource arn.AccessPointARN resolveRegion string partitionID string requestRegion string } func buildAccessPointRequest(ctx context.Context, options accesspointOptions) (context.Context, error) { tv := options.resource req := options.request resolveRegion := options.resolveRegion resolveService := tv.Service ero := options.EndpointResolverOptions ero.Logger = middleware.GetLogger(ctx) ero.ResolvedRegion = "" // clear endpoint option's resolved region so that we resolve using the passed in region // resolve endpoint endpoint, err := options.EndpointResolver.ResolveEndpoint(resolveRegion, ero) if err != nil { return ctx, s3shared.NewFailedToResolveEndpointError( tv, options.partitionID, options.requestRegion, err, ) } // assign resolved endpoint url to request url req.URL, err = url.Parse(endpoint.URL) if err != nil { return ctx, fmt.Errorf("failed to parse endpoint URL: %w", err) } if len(endpoint.SigningName) != 0 && endpoint.Source == aws.EndpointSourceCustom { ctx = awsmiddleware.SetSigningName(ctx, endpoint.SigningName) } else { // Must sign with s3-object-lambda ctx = awsmiddleware.SetSigningName(ctx, resolveService) } if len(endpoint.SigningRegion) != 0 { ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) } else { ctx = awsmiddleware.SetSigningRegion(ctx, resolveRegion) } // update serviceID to "s3-accesspoint" ctx = awsmiddleware.SetServiceID(ctx, s3AccessPoint) // disable host prefix behavior ctx = http.DisableEndpointHostPrefix(ctx, true) // remove the serialized arn in place of /{Bucket} ctx = setBucketToRemoveOnContext(ctx, tv.String()) // skip arn processing, if arn region resolves to a immutable endpoint if endpoint.HostnameImmutable { return ctx, nil } updateS3HostForS3AccessPoint(req) ctx, err = buildAccessPointHostPrefix(ctx, req, tv) if err != nil { return ctx, err } return ctx, nil } func buildS3ObjectLambdaAccessPointRequest(ctx context.Context, options accesspointOptions) (context.Context, error) { tv := options.resource req := options.request resolveRegion := options.resolveRegion resolveService := tv.Service ero := options.EndpointResolverOptions ero.Logger = middleware.GetLogger(ctx) ero.ResolvedRegion = "" // clear endpoint options resolved region so we resolve the passed in region // resolve endpoint endpoint, err := options.EndpointResolver.ResolveEndpoint(resolveRegion, ero) if err != nil { return ctx, s3shared.NewFailedToResolveEndpointError( tv, options.partitionID, options.requestRegion, err, ) } // assign resolved endpoint url to request url req.URL, err = url.Parse(endpoint.URL) if err != nil { return ctx, fmt.Errorf("failed to parse endpoint URL: %w", err) } if len(endpoint.SigningName) != 0 && endpoint.Source == aws.EndpointSourceCustom { ctx = awsmiddleware.SetSigningName(ctx, endpoint.SigningName) } else { // Must sign with s3-object-lambda ctx = awsmiddleware.SetSigningName(ctx, resolveService) } if len(endpoint.SigningRegion) != 0 { ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) } else { ctx = awsmiddleware.SetSigningRegion(ctx, resolveRegion) } // update serviceID to "s3-object-lambda" ctx = awsmiddleware.SetServiceID(ctx, s3ObjectLambda) // disable host prefix behavior ctx = http.DisableEndpointHostPrefix(ctx, true) // remove the serialized arn in place of /{Bucket} ctx = setBucketToRemoveOnContext(ctx, tv.String()) // skip arn processing, if arn region resolves to a immutable endpoint if endpoint.HostnameImmutable { return ctx, nil } if endpoint.Source == aws.EndpointSourceServiceMetadata { updateS3HostForS3ObjectLambda(req) } ctx, err = buildAccessPointHostPrefix(ctx, req, tv) if err != nil { return ctx, err } return ctx, nil } func buildMultiRegionAccessPointsRequest(ctx context.Context, options accesspointOptions) (context.Context, error) { const s3GlobalLabel = "s3-global." const accesspointLabel = "accesspoint." tv := options.resource req := options.request resolveService := tv.Service resolveRegion := options.requestRegion arnPartition := tv.Partition // resolve endpoint ero := options.EndpointResolverOptions ero.Logger = middleware.GetLogger(ctx) endpoint, err := options.EndpointResolver.ResolveEndpoint(resolveRegion, ero) if err != nil { return ctx, s3shared.NewFailedToResolveEndpointError( tv, options.partitionID, options.requestRegion, err, ) } // set signing region and version for MRAP endpoint.SigningRegion = "*" ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) ctx = SetSignerVersion(ctx, v4a.Version) if len(endpoint.SigningName) != 0 { ctx = awsmiddleware.SetSigningName(ctx, endpoint.SigningName) } else { ctx = awsmiddleware.SetSigningName(ctx, resolveService) } // skip arn processing, if arn region resolves to a immutable endpoint if endpoint.HostnameImmutable { return ctx, nil } // modify endpoint host to use s3-global host prefix scheme := strings.SplitN(endpoint.URL, "://", 2) dnsSuffix, err := endpoints.GetDNSSuffix(arnPartition, ero) if err != nil { return ctx, fmt.Errorf("Error determining dns suffix from arn partition, %w", err) } // set url as per partition endpoint.URL = scheme[0] + "://" + s3GlobalLabel + dnsSuffix // assign resolved endpoint url to request url req.URL, err = url.Parse(endpoint.URL) if err != nil { return ctx, fmt.Errorf("failed to parse endpoint URL: %w", err) } // build access point host prefix accessPointHostPrefix := tv.AccessPointName + "." + accesspointLabel // add host prefix to url req.URL.Host = accessPointHostPrefix + req.URL.Host if len(req.Host) > 0 { req.Host = accessPointHostPrefix + req.Host } // validate the endpoint host if err := http.ValidateEndpointHost(req.URL.Host); err != nil { return ctx, fmt.Errorf("endpoint validation error: %w, when using arn %v", err, tv) } // disable host prefix behavior ctx = http.DisableEndpointHostPrefix(ctx, true) // remove the serialized arn in place of /{Bucket} ctx = setBucketToRemoveOnContext(ctx, tv.String()) return ctx, nil } func buildAccessPointHostPrefix(ctx context.Context, req *http.Request, tv arn.AccessPointARN) (context.Context, error) { // add host prefix for access point accessPointHostPrefix := tv.AccessPointName + "-" + tv.AccountID + "." req.URL.Host = accessPointHostPrefix + req.URL.Host if len(req.Host) > 0 { req.Host = accessPointHostPrefix + req.Host } // validate the endpoint host if err := http.ValidateEndpointHost(req.URL.Host); err != nil { return ctx, s3shared.NewInvalidARNError(tv, err) } return ctx, nil } // ====== Outpost Accesspoint ======== type outpostAccessPointOptions struct { processARNResource request *http.Request resource arn.OutpostAccessPointARN partitionID string requestRegion string } func buildOutpostAccessPointRequest(ctx context.Context, options outpostAccessPointOptions) (context.Context, error) { tv := options.resource req := options.request resolveRegion := tv.Region resolveService := tv.Service endpointsID := resolveService if strings.EqualFold(resolveService, "s3-outposts") { // assign endpoints ID as "S3" endpointsID = "s3" } ero := options.EndpointResolverOptions ero.Logger = middleware.GetLogger(ctx) ero.ResolvedRegion = "" // resolve regional endpoint for resolved region. endpoint, err := options.EndpointResolver.ResolveEndpoint(resolveRegion, ero) if err != nil { return ctx, s3shared.NewFailedToResolveEndpointError( tv, options.partitionID, options.requestRegion, err, ) } // assign resolved endpoint url to request url req.URL, err = url.Parse(endpoint.URL) if err != nil { return ctx, fmt.Errorf("failed to parse endpoint URL: %w", err) } // assign resolved service from arn as signing name if len(endpoint.SigningName) != 0 && endpoint.Source == aws.EndpointSourceCustom { ctx = awsmiddleware.SetSigningName(ctx, endpoint.SigningName) } else { ctx = awsmiddleware.SetSigningName(ctx, resolveService) } if len(endpoint.SigningRegion) != 0 { // redirect signer to use resolved endpoint signing name and region ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) } else { ctx = awsmiddleware.SetSigningRegion(ctx, resolveRegion) } // update serviceID to resolved service id ctx = awsmiddleware.SetServiceID(ctx, resolveService) // disable host prefix behavior ctx = http.DisableEndpointHostPrefix(ctx, true) // remove the serialized arn in place of /{Bucket} ctx = setBucketToRemoveOnContext(ctx, tv.String()) // skip further customizations, if arn region resolves to a immutable endpoint if endpoint.HostnameImmutable { return ctx, nil } updateHostPrefix(req, endpointsID, resolveService) // add host prefix for s3-outposts outpostAPHostPrefix := tv.AccessPointName + "-" + tv.AccountID + "." + tv.OutpostID + "." req.URL.Host = outpostAPHostPrefix + req.URL.Host if len(req.Host) > 0 { req.Host = outpostAPHostPrefix + req.Host } // validate the endpoint host if err := http.ValidateEndpointHost(req.URL.Host); err != nil { return ctx, s3shared.NewInvalidARNError(tv, err) } return ctx, nil }
565
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/transport/http" ) // removeBucketFromPathMiddleware needs to be executed after serialize step is performed type removeBucketFromPathMiddleware struct { } func (m *removeBucketFromPathMiddleware) ID() string { return "S3:RemoveBucketFromPathMiddleware" } func (m *removeBucketFromPathMiddleware) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { // check if a bucket removal from HTTP path is required bucket, ok := getRemoveBucketFromPath(ctx) if !ok { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*http.Request) if !ok { return out, metadata, fmt.Errorf("unknown request type %T", req) } removeBucketFromPath(req.URL, bucket) return next.HandleSerialize(ctx, in) } type removeBucketKey struct { bucket string } // setBucketToRemoveOnContext sets the bucket name to be removed. // // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func setBucketToRemoveOnContext(ctx context.Context, bucket string) context.Context { return middleware.WithStackValue(ctx, removeBucketKey{}, bucket) } // getRemoveBucketFromPath returns the bucket name to remove from the path. // // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func getRemoveBucketFromPath(ctx context.Context) (string, bool) { v, ok := middleware.GetStackValue(ctx, removeBucketKey{}).(string) return v, ok }
59
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/transport/http" "net/url" ) type s3ObjectLambdaEndpoint struct { // whether the operation should use the s3-object-lambda endpoint UseEndpoint bool // use transfer acceleration UseAccelerate bool EndpointResolver EndpointResolver EndpointResolverOptions EndpointResolverOptions } func (t *s3ObjectLambdaEndpoint) ID() string { return "S3:ObjectLambdaEndpoint" } func (t *s3ObjectLambdaEndpoint) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if !t.UseEndpoint { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*http.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type: %T", in.Request) } if t.EndpointResolverOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled { return out, metadata, fmt.Errorf("client configured for dualstack but not supported for operation") } if t.UseAccelerate { return out, metadata, fmt.Errorf("client configured for accelerate but not supported for operation") } region := awsmiddleware.GetRegion(ctx) ero := t.EndpointResolverOptions endpoint, err := t.EndpointResolver.ResolveEndpoint(region, ero) if err != nil { return out, metadata, err } // Set the ServiceID and SigningName ctx = awsmiddleware.SetServiceID(ctx, s3ObjectLambda) if len(endpoint.SigningName) > 0 && endpoint.Source == aws.EndpointSourceCustom { ctx = awsmiddleware.SetSigningName(ctx, endpoint.SigningName) } else { ctx = awsmiddleware.SetSigningName(ctx, s3ObjectLambda) } req.URL, err = url.Parse(endpoint.URL) if err != nil { return out, metadata, err } if len(endpoint.SigningRegion) > 0 { ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) } else { ctx = awsmiddleware.SetSigningRegion(ctx, region) } if endpoint.Source == aws.EndpointSourceServiceMetadata || !endpoint.HostnameImmutable { updateS3HostForS3ObjectLambda(req) } return next.HandleSerialize(ctx, in) }
85
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "github.com/aws/aws-sdk-go-v2/aws" v4 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" "github.com/aws/aws-sdk-go-v2/internal/v4a" "github.com/aws/smithy-go/middleware" ) type signerVersionKey struct{} // GetSignerVersion retrieves the signer version to use for signing // // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func GetSignerVersion(ctx context.Context) (v string) { v, _ = middleware.GetStackValue(ctx, signerVersionKey{}).(string) return v } // SetSignerVersion sets the signer version to be used for signing the request // // Scoped to stack values. Use github.com/aws/smithy-go/middleware#ClearStackValues // to clear all stack values. func SetSignerVersion(ctx context.Context, version string) context.Context { return middleware.WithStackValue(ctx, signerVersionKey{}, version) } // SignHTTPRequestMiddlewareOptions is the configuration options for the SignHTTPRequestMiddleware middleware. type SignHTTPRequestMiddlewareOptions struct { // credential provider CredentialsProvider aws.CredentialsProvider // log signing LogSigning bool // v4 signer V4Signer v4.HTTPSigner //v4a signer V4aSigner v4a.HTTPSigner } // NewSignHTTPRequestMiddleware constructs a SignHTTPRequestMiddleware using the given Signer for signing requests func NewSignHTTPRequestMiddleware(options SignHTTPRequestMiddlewareOptions) *SignHTTPRequestMiddleware { return &SignHTTPRequestMiddleware{ credentialsProvider: options.CredentialsProvider, v4Signer: options.V4Signer, v4aSigner: options.V4aSigner, logSigning: options.LogSigning, } } // SignHTTPRequestMiddleware is a `FinalizeMiddleware` implementation to select HTTP Signing method type SignHTTPRequestMiddleware struct { // credential provider credentialsProvider aws.CredentialsProvider // log signing logSigning bool // v4 signer v4Signer v4.HTTPSigner //v4a signer v4aSigner v4a.HTTPSigner } // ID is the SignHTTPRequestMiddleware identifier func (s *SignHTTPRequestMiddleware) ID() string { return "Signing" } // HandleFinalize will take the provided input and sign the request using the SigV4 authentication scheme func (s *SignHTTPRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( out middleware.FinalizeOutput, metadata middleware.Metadata, err error, ) { // fetch signer type from context signerVersion := GetSignerVersion(ctx) switch signerVersion { case v4a.Version: v4aCredentialProvider, ok := s.credentialsProvider.(v4a.CredentialsProvider) if !ok { return out, metadata, fmt.Errorf("invalid credential-provider provided for sigV4a Signer") } mw := v4a.NewSignHTTPRequestMiddleware(v4a.SignHTTPRequestMiddlewareOptions{ Credentials: v4aCredentialProvider, Signer: s.v4aSigner, LogSigning: s.logSigning, }) return mw.HandleFinalize(ctx, in, next) default: mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{ CredentialsProvider: s.credentialsProvider, Signer: s.v4Signer, LogSigning: s.logSigning, }) return mw.HandleFinalize(ctx, in, next) } } // RegisterSigningMiddleware registers the wrapper signing middleware to the stack. If a signing middleware is already // present, this provided middleware will be swapped. Otherwise the middleware will be added at the tail of the // finalize step. func RegisterSigningMiddleware(stack *middleware.Stack, signingMiddleware *SignHTTPRequestMiddleware) (err error) { const signedID = "Signing" _, present := stack.Finalize.Get(signedID) if present { _, err = stack.Finalize.Swap(signedID, signingMiddleware) } else { err = stack.Finalize.Add(signingMiddleware, middleware.After) } return err } // PresignHTTPRequestMiddlewareOptions is the options for the PresignHTTPRequestMiddleware middleware. type PresignHTTPRequestMiddlewareOptions struct { CredentialsProvider aws.CredentialsProvider V4Presigner v4.HTTPPresigner V4aPresigner v4a.HTTPPresigner LogSigning bool } // PresignHTTPRequestMiddleware provides the Finalize middleware for creating a // presigned URL for an HTTP request. // // Will short circuit the middleware stack and not forward onto the next // Finalize handler. type PresignHTTPRequestMiddleware struct { // cred provider and signer for sigv4 credentialsProvider aws.CredentialsProvider // sigV4 signer v4Signer v4.HTTPPresigner // sigV4a signer v4aSigner v4a.HTTPPresigner // log signing logSigning bool } // NewPresignHTTPRequestMiddleware constructs a PresignHTTPRequestMiddleware using the given Signer for signing requests func NewPresignHTTPRequestMiddleware(options PresignHTTPRequestMiddlewareOptions) *PresignHTTPRequestMiddleware { return &PresignHTTPRequestMiddleware{ credentialsProvider: options.CredentialsProvider, v4Signer: options.V4Presigner, v4aSigner: options.V4aPresigner, logSigning: options.LogSigning, } } // ID provides the middleware ID. func (*PresignHTTPRequestMiddleware) ID() string { return "PresignHTTPRequest" } // HandleFinalize will take the provided input and create a presigned url for // the http request using the SigV4 or SigV4a presign authentication scheme. // // Since the signed request is not a valid HTTP request func (p *PresignHTTPRequestMiddleware) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, metadata middleware.Metadata, err error, ) { // fetch signer type from context signerVersion := GetSignerVersion(ctx) switch signerVersion { case v4a.Version: v4aCredentialProvider, ok := p.credentialsProvider.(v4a.CredentialsProvider) if !ok { return out, metadata, fmt.Errorf("invalid credential-provider provided for sigV4a Signer") } mw := v4a.NewPresignHTTPRequestMiddleware(v4a.PresignHTTPRequestMiddlewareOptions{ CredentialsProvider: v4aCredentialProvider, Presigner: p.v4aSigner, LogSigning: p.logSigning, }) return mw.HandleFinalize(ctx, in, next) default: mw := v4.NewPresignHTTPRequestMiddleware(v4.PresignHTTPRequestMiddlewareOptions{ CredentialsProvider: p.credentialsProvider, Presigner: p.v4Signer, LogSigning: p.logSigning, }) return mw.HandleFinalize(ctx, in, next) } } // RegisterPreSigningMiddleware registers the wrapper pre-signing middleware to the stack. If a pre-signing middleware is already // present, this provided middleware will be swapped. Otherwise the middleware will be added at the tail of the // finalize step. func RegisterPreSigningMiddleware(stack *middleware.Stack, signingMiddleware *PresignHTTPRequestMiddleware) (err error) { const signedID = "PresignHTTPRequest" _, present := stack.Finalize.Get(signedID) if present { _, err = stack.Finalize.Swap(signedID, signingMiddleware) } else { err = stack.Finalize.Add(signingMiddleware, middleware.After) } return err }
214
aws-sdk-go-v2
aws
Go
package customizations_test import ( "context" "errors" "net/http" "net/http/httptest" "strings" "testing" "time" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/smithy-go" ) func Test_EmptyResponse(t *testing.T) { cases := map[string]struct { status int responseBody []byte expectError bool }{ "success case with no response body": { status: 200, responseBody: []byte(``), }, "error case with no response body": { status: 400, responseBody: []byte(``), expectError: true, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { server := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(c.status) w.Write(c.responseBody) })) defer server.Close() ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) defer cancelFn() cfg := aws.Config{ Region: "us-east-1", EndpointResolver: aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) { return aws.Endpoint{ URL: server.URL, SigningName: "s3", }, nil }), Retryer: func() aws.Retryer { return aws.NopRetryer{} }, } client := s3.NewFromConfig(cfg, func(options *s3.Options) { options.UsePathStyle = true }) params := &s3.HeadBucketInput{Bucket: aws.String("aws-sdk-go-data")} _, err := client.HeadBucket(ctx, params) if c.expectError { var apiErr smithy.APIError if !errors.As(err, &apiErr) { t.Fatalf("expect error to be API error, was not, %v", err) } if len(apiErr.ErrorCode()) == 0 { t.Errorf("expect non-empty error code") } if len(apiErr.ErrorMessage()) == 0 { t.Errorf("expect non-empty error message") } } else { if err != nil { t.Errorf("expected no error, got %v", err.Error()) } } }) } } func TestBucketLocationPopulation(t *testing.T) { cases := map[string]struct { responseBody string expectLocation string expectError string }{ "empty location": { responseBody: `<?xml version="1.0" encoding="UTF-8"?><LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/"/>`, expectLocation: "", }, "EU location": { responseBody: `<?xml version="1.0" encoding="UTF-8"?><LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">EU</LocationConstraint>`, expectLocation: "EU", }, "AfSouth1 location": { responseBody: `<?xml version="1.0" encoding="UTF-8"?><LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">af-south-1</LocationConstraint>`, expectLocation: "af-south-1", }, "IncompleteResponse": { responseBody: `<?xml version="1.0" encoding="UTF-8"?><LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">`, expectError: "unexpected EOF", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { server := httptest.NewServer(http.HandlerFunc( func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(200) w.Write([]byte(c.responseBody)) })) defer server.Close() ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second) defer cancelFn() cfg := aws.Config{ Region: "us-east-1", EndpointResolver: aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) { return aws.Endpoint{ URL: server.URL, SigningName: "s3", }, nil }), Retryer: func() aws.Retryer { return aws.NopRetryer{} }, } client := s3.NewFromConfig(cfg, func(options *s3.Options) { options.UsePathStyle = true }) params := &s3.GetBucketLocationInput{ Bucket: aws.String("aws-sdk-go-data"), } resp, err := client.GetBucketLocation(ctx, params) if len(c.expectError) != 0 && err == nil { t.Fatal("expect error, got none") } if err != nil && len(c.expectError) == 0 { t.Fatalf("expect no error, got %v", err) } else { if err != nil { if !strings.Contains(err.Error(), c.expectError) { t.Fatalf("expect error to be %v, got %v", err.Error(), c.expectError) } return } } if e, a := c.expectLocation, resp.LocationConstraint; !strings.EqualFold(e, string(a)) { t.Fatalf("expected location constraint to be deserialized as %v, got %v", e, a) } }) } }
163
aws-sdk-go-v2
aws
Go
package customizations import ( "context" "fmt" "log" "net/url" "strings" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" internalendpoints "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" "github.com/aws/smithy-go/encoding/httpbinding" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // EndpointResolver interface for resolving service endpoints. type EndpointResolver interface { ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) } // EndpointResolverOptions is the service endpoint resolver options type EndpointResolverOptions = internalendpoints.Options // UpdateEndpointParameterAccessor represents accessor functions used by the middleware type UpdateEndpointParameterAccessor struct { // functional pointer to fetch bucket name from provided input. // The function is intended to take an input value, and // return a string pointer to value of string, and bool if // input has no bucket member. GetBucketFromInput func(interface{}) (*string, bool) } // UpdateEndpointOptions provides the options for the UpdateEndpoint middleware setup. type UpdateEndpointOptions struct { // Accessor are parameter accessors used by the middleware Accessor UpdateEndpointParameterAccessor // use path style UsePathStyle bool // use transfer acceleration UseAccelerate bool // indicates if an operation supports s3 transfer acceleration. SupportsAccelerate bool // use ARN region UseARNRegion bool // Indicates that the operation should target the s3-object-lambda endpoint. // Used to direct operations that do not route based on an input ARN. TargetS3ObjectLambda bool // EndpointResolver used to resolve endpoints. This may be a custom endpoint resolver EndpointResolver EndpointResolver // EndpointResolverOptions used by endpoint resolver EndpointResolverOptions EndpointResolverOptions // DisableMultiRegionAccessPoints indicates multi-region access point support is disabled DisableMultiRegionAccessPoints bool } // UpdateEndpoint adds the middleware to the middleware stack based on the UpdateEndpointOptions. func UpdateEndpoint(stack *middleware.Stack, options UpdateEndpointOptions) (err error) { const serializerID = "OperationSerializer" // initial arn look up middleware err = stack.Initialize.Add(&s3shared.ARNLookup{ GetARNValue: options.Accessor.GetBucketFromInput, }, middleware.Before) if err != nil { return err } // process arn err = stack.Serialize.Insert(&processARNResource{ UseARNRegion: options.UseARNRegion, UseAccelerate: options.UseAccelerate, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointResolverOptions, DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, }, serializerID, middleware.Before) if err != nil { return err } // process whether the operation requires the s3-object-lambda endpoint // Occurs before operation serializer so that hostPrefix mutations // can be handled correctly. err = stack.Serialize.Insert(&s3ObjectLambdaEndpoint{ UseEndpoint: options.TargetS3ObjectLambda, UseAccelerate: options.UseAccelerate, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointResolverOptions, }, serializerID, middleware.Before) if err != nil { return err } // remove bucket arn middleware err = stack.Serialize.Insert(&removeBucketFromPathMiddleware{}, serializerID, middleware.After) if err != nil { return err } // update endpoint to use options for path style and accelerate err = stack.Serialize.Insert(&updateEndpoint{ usePathStyle: options.UsePathStyle, getBucketFromInput: options.Accessor.GetBucketFromInput, useAccelerate: options.UseAccelerate, supportsAccelerate: options.SupportsAccelerate, }, serializerID, middleware.After) if err != nil { return err } return err } type updateEndpoint struct { // path style options usePathStyle bool getBucketFromInput func(interface{}) (*string, bool) // accelerate options useAccelerate bool supportsAccelerate bool } // ID returns the middleware ID. func (*updateEndpoint) ID() string { return "S3:UpdateEndpoint" } func (u *updateEndpoint) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { // if arn was processed, skip this middleware if _, ok := s3shared.GetARNResourceFromContext(ctx); ok { return next.HandleSerialize(ctx, in) } // skip this customization if host name is set as immutable if smithyhttp.GetHostnameImmutable(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown request type %T", req) } // check if accelerate is supported if u.useAccelerate && !u.supportsAccelerate { // accelerate is not supported, thus will be ignored log.Println("Transfer acceleration is not supported for the operation, ignoring UseAccelerate.") u.useAccelerate = false } // transfer acceleration is not supported with path style urls if u.useAccelerate && u.usePathStyle { log.Println("UseAccelerate is not compatible with UsePathStyle, ignoring UsePathStyle.") u.usePathStyle = false } if u.getBucketFromInput != nil { // Below customization only apply if bucket name is provided bucket, ok := u.getBucketFromInput(in.Parameters) if ok && bucket != nil { region := awsmiddleware.GetRegion(ctx) if err := u.updateEndpointFromConfig(req, *bucket, region); err != nil { return out, metadata, err } } } return next.HandleSerialize(ctx, in) } func (u updateEndpoint) updateEndpointFromConfig(req *smithyhttp.Request, bucket string, region string) error { // do nothing if path style is enforced if u.usePathStyle { return nil } if !hostCompatibleBucketName(req.URL, bucket) { // bucket name must be valid to put into the host for accelerate operations. // For non-accelerate operations the bucket name can stay in the path if // not valid hostname. var err error if u.useAccelerate { err = fmt.Errorf("bucket name %s is not compatible with S3", bucket) } // No-Op if not using accelerate. return err } // accelerate is only supported if use path style is disabled if u.useAccelerate { parts := strings.Split(req.URL.Host, ".") if len(parts) < 3 { return fmt.Errorf("unable to update endpoint host for S3 accelerate, hostname invalid, %s", req.URL.Host) } if parts[0] == "s3" || strings.HasPrefix(parts[0], "s3-") { parts[0] = "s3-accelerate" } for i := 1; i+1 < len(parts); i++ { if strings.EqualFold(parts[i], region) { parts = append(parts[:i], parts[i+1:]...) break } } // construct the url host req.URL.Host = strings.Join(parts, ".") } // move bucket to follow virtual host style moveBucketNameToHost(req.URL, bucket) return nil } // updates endpoint to use virtual host styling func moveBucketNameToHost(u *url.URL, bucket string) { u.Host = bucket + "." + u.Host removeBucketFromPath(u, bucket) } // remove bucket from url func removeBucketFromPath(u *url.URL, bucket string) { if strings.HasPrefix(u.Path, "/"+bucket) { // modify url path u.Path = strings.Replace(u.Path, "/"+bucket, "", 1) // modify url raw path u.RawPath = strings.Replace(u.RawPath, "/"+httpbinding.EscapePath(bucket, true), "", 1) } if u.Path == "" { u.Path = "/" } if u.RawPath == "" { u.RawPath = "/" } } // hostCompatibleBucketName returns true if the request should // put the bucket in the host. This is false if the bucket is not // DNS compatible or the EndpointResolver resolves an aws.Endpoint with // HostnameImmutable member set to true. // // https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws#Endpoint.HostnameImmutable func hostCompatibleBucketName(u *url.URL, bucket string) bool { // Bucket might be DNS compatible but dots in the hostname will fail // certificate validation, so do not use host-style. if u.Scheme == "https" && strings.Contains(bucket, ".") { return false } // if the bucket is DNS compatible return dnsCompatibleBucketName(bucket) } // dnsCompatibleBucketName returns true if the bucket name is DNS compatible. // Buckets created outside of the classic region MUST be DNS compatible. func dnsCompatibleBucketName(bucket string) bool { if strings.Contains(bucket, "..") { return false } // checks for `^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$` domain mapping if !((bucket[0] > 96 && bucket[0] < 123) || (bucket[0] > 47 && bucket[0] < 58)) { return false } for _, c := range bucket[1:] { if !((c > 96 && c < 123) || (c > 47 && c < 58) || c == 46 || c == 45) { return false } } // checks for `^(\d+\.){3}\d+$` IPaddressing v := strings.SplitN(bucket, ".", -1) if len(v) == 4 { for _, c := range bucket { if !((c > 47 && c < 58) || c == 46) { // we confirm that this is not a IP address return true } } // this is a IP address return false } return true }
307
aws-sdk-go-v2
aws
Go
package customizations import ( "net/url" "strconv" "testing" ) func TestRemoveBucketFromPath(t *testing.T) { cases := []struct { url url.URL bucket string expected string }{ { url: url.URL{ Scheme: "https", Host: "amazonaws.com", Path: "/bucket-name/key/path", RawPath: "/bucket-name/key/path", }, bucket: "bucket-name", expected: "https://amazonaws.com/key/path", }, { url: url.URL{ Scheme: "https", Host: "amazonaws.com", Path: "/bucket-name/key/path/with/bucket-name", RawPath: "/bucket-name/key/path/with/bucket-name", }, bucket: "bucket-name", expected: "https://amazonaws.com/key/path/with/bucket-name", }, { url: url.URL{ Scheme: "https", Host: "amazonaws.com", Path: "/arn:aws:s3:us-east-1:012345678901:accesspoint:myap/key/path?isEscaped=true", RawPath: "/arn%3Aaws%3As3%3Aus-east-1%3A012345678901%3Aaccesspoint%3Amyap/key/path%3FisEscaped%3Dtrue", }, bucket: "arn:aws:s3:us-east-1:012345678901:accesspoint:myap", expected: "https://amazonaws.com/key/path%3FisEscaped%3Dtrue", }, { url: url.URL{ Scheme: "https", Host: "amazonaws.com", Path: "/path/to/key", RawPath: "/path/to/key", }, bucket: "not-a-match", expected: "https://amazonaws.com/path/to/key", }, { url: url.URL{ Scheme: "https", Host: "amazonaws.com", Path: "", RawPath: "", }, bucket: "not-a-match", expected: "https://amazonaws.com/", }, } for i, tt := range cases { t.Run(strconv.Itoa(i), func(t *testing.T) { removeBucketFromPath(&tt.url, tt.bucket) if e, a := tt.expected, tt.url.String(); e != a { t.Errorf("expect %v, got %v", e, a) } }) } }
77
aws-sdk-go-v2
aws
Go
package customizations_test import ( "context" "fmt" "strconv" "strings" "testing" "github.com/aws/aws-sdk-go-v2/aws" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/internal/awstesting/unit" "github.com/aws/aws-sdk-go-v2/internal/v4a" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/aws/aws-sdk-go-v2/service/s3/internal/endpoints" "github.com/aws/smithy-go/middleware" "github.com/aws/smithy-go/ptr" smithyhttp "github.com/aws/smithy-go/transport/http" ) type s3BucketTest struct { bucket string key string url string err string } func TestUpdateEndpointBuild(t *testing.T) { cases := map[string]map[string]struct { tests []s3BucketTest useAccelerate bool useDualstack bool usePathStyle bool disableHTTPS bool customEndpoint *aws.Endpoint }{ "default endpoint": { "PathStyleBucket": { usePathStyle: true, tests: []s3BucketTest{ {"abc", "key", "https://s3.mock-region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://s3.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.mock-region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a..bc", "key", "https://s3.mock-region.amazonaws.com/a..bc/key?x-id=GetObject", ""}, {"abc", "k:e,y", "https://s3.mock-region.amazonaws.com/abc/k%3Ae%2Cy?x-id=GetObject", ""}, }, }, "VirtualHostStyleBucket": { tests: []s3BucketTest{ {"abc", "key", "https://abc.s3.mock-region.amazonaws.com/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://s3.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.mock-region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a..bc", "key", "https://s3.mock-region.amazonaws.com/a..bc/key?x-id=GetObject", ""}, {"abc", "k:e,y", "https://abc.s3.mock-region.amazonaws.com/k%3Ae%2Cy?x-id=GetObject", ""}, }, }, "Accelerate": { useAccelerate: true, tests: []s3BucketTest{ {"abc", "key", "https://abc.s3-accelerate.amazonaws.com/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.mock-region.amazonaws.com/a.b.c/key?x-id=GetObject", "not compatible"}, {"a$b$c", "key", "https://s3.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", "not compatible"}, }, }, "AccelerateNoSSLTests": { useAccelerate: true, disableHTTPS: true, tests: []s3BucketTest{ {"abc", "key", "http://abc.s3-accelerate.amazonaws.com/key?x-id=GetObject", ""}, {"a.b.c", "key", "http://a.b.c.s3-accelerate.amazonaws.com/key?x-id=GetObject", ""}, {"a$b$c", "key", "http://s3.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", "not compatible"}, }, }, "DualStack": { useDualstack: true, tests: []s3BucketTest{ {"abc", "key", "https://abc.s3.dualstack.mock-region.amazonaws.com/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.dualstack.mock-region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://s3.dualstack.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, }, }, "DualStackWithPathStyle": { useDualstack: true, usePathStyle: true, tests: []s3BucketTest{ {"abc", "key", "https://s3.dualstack.mock-region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.dualstack.mock-region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://s3.dualstack.mock-region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, }, }, "AccelerateWithDualStack": { useAccelerate: true, useDualstack: true, tests: []s3BucketTest{ {"abc", "key", "https://abc.s3-accelerate.dualstack.amazonaws.com/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://s3.mock-region.dualstack.amazonaws.com/a.b.c/key?x-id=GetObject", "not compatible"}, {"a$b$c", "key", "https://s3.mock-region.dualstack.amazonaws.com/a%24b%24c/key?x-id=GetObject", "not compatible"}, }, }, }, "immutable endpoint": { "PathStyleBucket": { usePathStyle: true, customEndpoint: &aws.Endpoint{ URL: "https://example.region.amazonaws.com", HostnameImmutable: true, }, tests: []s3BucketTest{ {"abc", "key", "https://example.region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://example.region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://example.region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a..bc", "key", "https://example.region.amazonaws.com/a..bc/key?x-id=GetObject", ""}, {"abc", "k:e,y", "https://example.region.amazonaws.com/abc/k%3Ae%2Cy?x-id=GetObject", ""}, }, }, "VirtualHostStyleBucket": { customEndpoint: &aws.Endpoint{ URL: "https://example.region.amazonaws.com", HostnameImmutable: true, }, tests: []s3BucketTest{ {"abc", "key", "https://example.region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://example.region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://example.region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a..bc", "key", "https://example.region.amazonaws.com/a..bc/key?x-id=GetObject", ""}, {"abc", "k:e,y", "https://example.region.amazonaws.com/abc/k%3Ae%2Cy?x-id=GetObject", ""}, }, }, "Accelerate": { useAccelerate: true, customEndpoint: &aws.Endpoint{ URL: "https://example.region.amazonaws.com", HostnameImmutable: true, }, tests: []s3BucketTest{ {"abc", "key", "https://example.region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://example.region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://example.region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a..bc", "key", "https://example.region.amazonaws.com/a..bc/key?x-id=GetObject", ""}, }, }, "AccelerateNoSSLTests": { useAccelerate: true, disableHTTPS: true, customEndpoint: &aws.Endpoint{ URL: "https://example.region.amazonaws.com", HostnameImmutable: true, }, tests: []s3BucketTest{ {"abc", "key", "https://example.region.amazonaws.com/abc/key?x-id=GetObject", ""}, {"a.b.c", "key", "https://example.region.amazonaws.com/a.b.c/key?x-id=GetObject", ""}, {"a$b$c", "key", "https://example.region.amazonaws.com/a%24b%24c/key?x-id=GetObject", ""}, }, }, }, } for suitName, cs := range cases { t.Run(suitName, func(t *testing.T) { for unitName, c := range cs { t.Run(unitName, func(t *testing.T) { options := s3.Options{ Credentials: unit.StubCredentialsProvider{}, Retryer: aws.NopRetryer{}, Region: "mock-region", HTTPClient: smithyhttp.NopClient{}, EndpointOptions: endpoints.Options{ DisableHTTPS: c.disableHTTPS, }, UsePathStyle: c.usePathStyle, UseAccelerate: c.useAccelerate, UseDualstack: c.useDualstack, } if c.customEndpoint != nil { options.EndpointResolver = s3.EndpointResolverFunc( func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return *c.customEndpoint, nil }) } svc := s3.New(options) for i, test := range c.tests { t.Run(strconv.Itoa(i), func(t *testing.T) { fm := requestRetrieverMiddleware{} _, err := svc.GetObject(context.Background(), &s3.GetObjectInput{Bucket: &test.bucket, Key: &test.key}, func(options *s3.Options) { options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error { stack.Serialize.Insert(&fm, "OperationSerializer", middleware.Before) return nil }) }, ) if test.err != "" { if err == nil { t.Fatalf("test %d: expected error, got none", i) } if a, e := err.Error(), test.err; !strings.Contains(a, e) { t.Fatalf("expect error code to contain %q, got %q", e, a) } return } if err != nil { t.Fatalf("expect no error, got %v", err) } req := fm.request.Build(context.Background()) if e, a := test.url, req.URL.String(); e != a { t.Fatalf("expect url %s, got %s", e, a) } }) } }) } }) } } // test case struct used to test endpoint customizations type testCaseForEndpointCustomization struct { options s3.Options bucket string operation func(ctx context.Context, svc *s3.Client, fm *requestRetriever) (interface{}, error) expectedErr string expectedReqURL string expectedSigningName string expectedSigningRegion string expectedHeader map[string]string } func TestEndpointWithARN(t *testing.T) { // test cases cases := map[string]testCaseForEndpointCustomization{ "Object Lambda with no UseARNRegion flag set": { bucket: "arn:aws:s3-object-lambda:us-west-2:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://myap-123456789012.s3-object-lambda.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3-object-lambda", expectedSigningRegion: "us-west-2", }, "Object Lambda with UseARNRegion flag set": { bucket: "arn:aws:s3-object-lambda:us-east-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedReqURL: "https://myap-123456789012.s3-object-lambda.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3-object-lambda", expectedSigningRegion: "us-east-1", }, "Object Lambda with Cross-Region error": { bucket: "arn:aws:s3-object-lambda:us-east-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", }, expectedErr: "client region does not match provided ARN region", }, "Object Lambda Pseudo-Region with UseARNRegion flag set": { bucket: "arn:aws:s3-object-lambda:us-east-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "aws-global", UseARNRegion: true, }, expectedReqURL: "https://myap-123456789012.s3-object-lambda.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningRegion: "us-east-1", expectedSigningName: "s3-object-lambda", }, "Object Lambda Cross-Region DualStack error": { bucket: "arn:aws:s3-object-lambda:us-east-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", UseDualstack: true, UseARNRegion: true, }, expectedErr: "client configured for S3 Dual-stack but is not supported with resource ARN", }, "Object Lambda Cross-Partition error": { bucket: "arn:aws-cn:s3-object-lambda:cn-north-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "client partition does not match provided ARN partition", }, "Object Lambda FIPS": { bucket: "arn:aws-us-gov:s3-object-lambda:us-gov-west-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-gov-west-1", EndpointOptions: endpoints.Options{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedReqURL: "https://myap-123456789012.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "Object Lambda FIPS (ResolvedRegion)": { bucket: "arn:aws-us-gov:s3-object-lambda:us-gov-west-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "fips-us-gov-west-1", }, expectedReqURL: "https://myap-123456789012.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "Object Lambda FIPS with UseARNRegion flag set": { bucket: "arn:aws-us-gov:s3-object-lambda:us-gov-west-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-gov-west-1", UseARNRegion: true, EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedReqURL: "https://myap-123456789012.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "Object Lambda FIPS (ResolvedRegion) with UseARNRegion flag set": { bucket: "arn:aws-us-gov:s3-object-lambda:us-gov-west-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "fips-us-gov-west-1", UseARNRegion: true, }, expectedReqURL: "https://myap-123456789012.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "Object Lambda with Accelerate": { bucket: "arn:aws:s3-object-lambda:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseAccelerate: true, }, expectedErr: "client configured for S3 Accelerate but is not supported with resource ARN", }, "Object Lambda with Custom Endpoint Source": { bucket: "arn:aws:s3-object-lambda:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://my-domain.com", Source: aws.EndpointSourceCustom, SigningName: "custom-sign-name", SigningRegion: region, }, nil }), }, expectedReqURL: "https://myendpoint-123456789012.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "custom-sign-name", expectedSigningRegion: "us-west-2", }, "Object Lambda with Custom Endpoint Source Immutable": { bucket: "arn:aws:s3-object-lambda:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://myendpoint-123456789012.my-domain.com", Source: aws.EndpointSourceCustom, SigningName: "custom-sign-name", SigningRegion: region, HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://myendpoint-123456789012.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "custom-sign-name", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint with no S3UseARNRegion flag set": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.s3-outposts.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3-outposts", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint Cross-Region Enabled": { bucket: "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.s3-outposts.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3-outposts", expectedSigningRegion: "us-east-1", }, "Outpost AccessPoint Cross-Region Disabled": { bucket: "arn:aws:s3-outposts:us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", }, expectedErr: "client region does not match provided ARN region", }, "Outpost AccessPoint other partition": { bucket: "arn:aws-cn:s3-outposts:cn-north-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "ConfigurationError : client partition does not match provided ARN partition", }, "Outpost AccessPoint cn partition": { bucket: "arn:aws-cn:s3-outposts:cn-north-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "cn-north-1", }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.s3-outposts.cn-north-1.amazonaws.com.cn/testkey?x-id=GetObject", expectedSigningName: "s3-outposts", expectedSigningRegion: "cn-north-1", }, "Outpost AccessPoint Custom Endpoint Source": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://my-domain.com", Source: aws.EndpointSourceCustom, SigningName: "custom-sign-name", SigningRegion: region, }, nil }), }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "custom-sign-name", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint Custom Endpoint Source Immutable": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://myaccesspoint-123456789012.op-01234567890123456.my-domain.com", Source: aws.EndpointSourceCustom, SigningName: "custom-sign-name", SigningRegion: region, HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "custom-sign-name", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint us-gov region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-gov-east-1", UseARNRegion: true, }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.s3-outposts.us-gov-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3-outposts", expectedSigningRegion: "us-gov-east-1", }, "Outpost AccessPoint FIPS cross-region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "fips-us-gov-west-1", }, expectedErr: "ConfigurationError : client region does not match provided ARN region", }, "Outpost AccessPoint with FIPS cross-region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-gov-west-1", UseARNRegion: true, EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedErr: "use of ARN is not supported when client or request is configured for FIPS", }, "Outpost AccessPoint with FIPS (ResolvedRegion) cross-region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "fips-us-gov-west-1", UseARNRegion: true, }, expectedErr: "use of ARN is not supported when client or request is configured for FIPS", }, "Outpost AccessPoint with FIPS matching region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-gov-west-1", EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, UseARNRegion: true, }, expectedErr: "use of ARN is not supported when client or request is configured for FIPS", }, "Outpost AccessPoint with FIPS (ResolvedRegion) matching region": { bucket: "arn:aws-us-gov:s3-outposts:us-gov-west-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "fips-us-gov-west-1", UseARNRegion: true, }, expectedErr: "use of ARN is not supported when client or request is configured for FIPS", }, "Outpost AccessPoint with Immutable Endpoint": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://myaccesspoint-123456789012.op-01234567890123456.my-domain.com", SigningRegion: region, HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "s3-outposts", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint with DualStack": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseDualstack: true, }, expectedErr: "ConfigurationError : client configured for S3 Dual-stack but is not supported with resource ARN", }, "Outpost AccessPoint with Accelerate": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseAccelerate: true, }, expectedErr: "ConfigurationError : client configured for S3 Accelerate but is not supported with resource ARN", }, "AccessPoint": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "AccessPoint slash delimiter": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint/myendpoint", options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "AccessPoint other partition": { bucket: "arn:aws-cn:s3:cn-north-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "cn-north-1", }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.cn-north-1.amazonaws.com.cn/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "cn-north-1", }, "AccessPoint Cross-Region Disabled": { bucket: "arn:aws:s3:ap-south-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", }, expectedErr: "client region does not match provided ARN region", }, "AccessPoint Cross-Region Enabled": { bucket: "arn:aws:s3:ap-south-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.ap-south-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "ap-south-1", }, "AccessPoint us-east-1": { bucket: "arn:aws:s3:us-east-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-east-1", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-east-1", }, "AccessPoint us-east-1 cross region": { bucket: "arn:aws:s3:us-east-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-east-1", }, "AccessPoint Cross-Partition not supported": { bucket: "arn:aws-cn:s3:cn-north-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseDualstack: true, UseARNRegion: true, }, expectedErr: "client partition does not match provided ARN partition", }, "AccessPoint DualStack": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseDualstack: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.dualstack.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "AccessPoint FIPS same region with cross region disabled": { bucket: "arn:aws-us-gov:s3:us-gov-west-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-gov-west-1", EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-west-1", }, "AccessPoint FIPS (ResolvedRegion) same region with cross region disabled": { bucket: "arn:aws-us-gov:s3:us-gov-west-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "fips-us-gov-west-1", }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-west-1", }, "AccessPoint FIPS same region with cross region enabled": { bucket: "arn:aws-us-gov:s3:us-gov-west-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-gov-west-1", EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-west-1", }, "AccessPoint FIPS (ResolvedRegion) same region with cross region enabled": { bucket: "arn:aws-us-gov:s3:us-gov-west-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "fips-us-gov-west-1", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-west-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-west-1", }, "AccessPoint Immutable Endpoint": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://myendpoint-123456789012.s3-accesspoint.us-east-1.amazonaws.com", SigningRegion: region, HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "AccessPoint Custom Endpoint Source": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://myendpoint-123456789012.my-domain.com", Source: aws.EndpointSourceCustom, SigningName: "custom-sign-name", SigningRegion: region, HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://myendpoint-123456789012.my-domain.com/testkey?x-id=GetObject", expectedSigningName: "custom-sign-name", expectedSigningRegion: "us-west-2", }, "AccessPoint FIPS cross region": { bucket: "arn:aws-us-gov:s3:us-gov-east-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-gov-west-1", UseARNRegion: true, EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-east-1", }, "AccessPoint FIPS (ResolvedRegion) cross region": { bucket: "arn:aws-us-gov:s3:us-gov-east-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "fips-us-gov-west-1", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint-fips.us-gov-east-1.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-gov-east-1", }, "AccessPoint Accelerate not supported": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseAccelerate: true, }, expectedErr: "client configured for S3 Accelerate", }, "Custom Resolver Without PartitionID in ClientInfo": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { switch region { case "us-west-2": return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com", SigningRegion: "us-west-2", SigningName: "s3", SigningMethod: "s3v4", }, nil } return aws.Endpoint{}, nil }), }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Custom Resolver Without PartitionID in Cross-Region Target": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-east-1", UseARNRegion: true, EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { switch region { case "us-west-2": return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com", PartitionID: "aws", SigningRegion: "us-west-2", SigningName: "s3", SigningMethod: "s3v4", }, nil case "us-east-1": return aws.Endpoint{ URL: "https://s3.us-east-1.amazonaws.com", SigningRegion: "us-east-1", SigningName: "s3", SigningMethod: "s3v4", }, nil } return aws.Endpoint{}, nil }), }, expectedReqURL: "https://myendpoint-123456789012.s3-accesspoint.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket host-style": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://mock-bucket.s3.us-west-2.amazonaws.com/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket path-style": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", UsePathStyle: true, }, expectedReqURL: "https://s3.us-west-2.amazonaws.com/mock-bucket/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket host-style endpoint with default port": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com:443", SigningRegion: "us-west-2", }, nil }), }, expectedReqURL: "https://mock-bucket.s3.us-west-2.amazonaws.com:443/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket host-style endpoint with non-default port": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com:8443", SigningRegion: "us-west-2", }, nil }), }, expectedReqURL: "https://mock-bucket.s3.us-west-2.amazonaws.com:8443/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket path-style endpoint with default port": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com:443", SigningRegion: "us-west-2", }, nil }), UsePathStyle: true, }, expectedReqURL: "https://s3.us-west-2.amazonaws.com:443/mock-bucket/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "bucket path-style endpoint with non-default port": { bucket: "mock-bucket", options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://s3.us-west-2.amazonaws.com:8443", SigningRegion: "us-west-2", }, nil }), UsePathStyle: true, }, expectedReqURL: "https://s3.us-west-2.amazonaws.com:8443/mock-bucket/testkey?x-id=GetObject", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Invalid AccessPoint ARN with FIPS pseudo-region (prefix)": { bucket: "arn:aws:s3:fips-us-east-1:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, "Invalid AccessPoint ARN with FIPS pseudo-region (suffix)": { bucket: "arn:aws:s3:us-east-1-fips:123456789012:accesspoint:myendpoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, "Invalid Outpost AccessPoint ARN with FIPS pseudo-region (prefix)": { bucket: "arn:aws:s3-outposts:fips-us-east-1:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, "Invalid Outpost AccessPoint ARN with FIPS pseudo-region (suffix)": { bucket: "arn:aws:s3-outposts:us-east-1-fips:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, "Invalid Object Lambda ARN with FIPS pseudo-region (prefix)": { bucket: "arn:aws:s3-object-lambda:fips-us-east-1:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, "Invalid Object Lambda ARN with FIPS pseudo-region (suffix)": { bucket: "arn:aws:s3-object-lambda:us-east-1-fips:123456789012:accesspoint/myap", options: s3.Options{ Region: "us-west-2", UseARNRegion: true, }, expectedErr: "FIPS region not allowed in ARN", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { runValidations(t, c, func(ctx context.Context, svc *s3.Client, fetcher *requestRetriever) (interface{}, error) { if c.operation != nil { return c.operation(ctx, svc, fetcher) } return svc.GetObject(ctx, &s3.GetObjectInput{ Bucket: ptr.String(c.bucket), Key: ptr.String("testkey"), }, addRequestRetriever(fetcher)) }) }) } } func TestVPC_CustomEndpoint(t *testing.T) { cases := map[string]testCaseForEndpointCustomization{ "standard custom endpoint url": { bucket: "bucketname", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", }, expectedReqURL: "https://bucketname.beta.example.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "AccessPoint with custom endpoint url": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", }, expectedReqURL: "https://myendpoint-123456789012.beta.example.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Outpost AccessPoint with custom endpoint url": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", }, expectedReqURL: "https://myaccesspoint-123456789012.op-01234567890123456.beta.example.com/", expectedSigningName: "s3-outposts", expectedSigningRegion: "us-west-2", }, "ListBucket with custom endpoint url": { options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", }, operation: func(ctx context.Context, svc *s3.Client, fm *requestRetriever) (interface{}, error) { return svc.ListBuckets(ctx, &s3.ListBucketsInput{}, addRequestRetriever(fm)) }, expectedReqURL: "https://bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Path-style addressing with custom endpoint url": { bucket: "bucketname", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", UsePathStyle: true, }, expectedReqURL: "https://bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com/bucketname", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Virtual host addressing with custom endpoint url": { bucket: "bucketname", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", }, expectedReqURL: "https://bucketname.bucket.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Access-point with custom endpoint url and use_arn_region set": { bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:myendpoint", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://accesspoint.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "eu-west-1", UseARNRegion: true, }, expectedReqURL: "https://myendpoint-123456789012.accesspoint.vpce-123-abc.s3.us-west-2.vpce.amazonaws.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Custom endpoint url with Dualstack": { bucket: "bucketname", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", UseDualstack: true, }, expectedReqURL: "https://bucketname.beta.example.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, "Outpost with custom endpoint url and Dualstack": { bucket: "arn:aws:s3-outposts:us-west-2:123456789012:outpost:op-01234567890123456:accesspoint:myaccesspoint", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), Region: "us-west-2", UseDualstack: true, }, expectedErr: "client configured for S3 Dual-stack but is not supported with resource ARN", }, "Standard custom endpoint url with Immutable Host": { bucket: "bucketname", options: s3.Options{ EndpointResolver: s3.EndpointResolverFromURL("https://beta.example.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" endpoint.HostnameImmutable = true }), Region: "us-west-2", }, expectedReqURL: "https://beta.example.com/bucketname", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { runValidations(t, c, func(ctx context.Context, svc *s3.Client, fm *requestRetriever) (interface{}, error) { if c.operation != nil { return c.operation(ctx, svc, fm) } return svc.ListObjects(ctx, &s3.ListObjectsInput{ Bucket: ptr.String(c.bucket), }, addRequestRetriever(fm)) }) }) } } func TestWriteGetObjectResponse_UpdateEndpoint(t *testing.T) { cases := map[string]testCaseForEndpointCustomization{ "standard endpoint": { options: s3.Options{ Region: "us-west-2", }, expectedReqURL: "https://test-route.s3-object-lambda.us-west-2.amazonaws.com/WriteGetObjectResponse?x-id=WriteGetObjectResponse", expectedSigningRegion: "us-west-2", expectedSigningName: "s3-object-lambda", }, "fips endpoint": { options: s3.Options{ Region: "us-gov-west-1", EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, expectedReqURL: "https://test-route.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/WriteGetObjectResponse?x-id=WriteGetObjectResponse", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "fips endpoint (ResolvedRegion)": { options: s3.Options{ Region: "fips-us-gov-west-1", }, expectedReqURL: "https://test-route.s3-object-lambda-fips.us-gov-west-1.amazonaws.com/WriteGetObjectResponse?x-id=WriteGetObjectResponse", expectedSigningRegion: "us-gov-west-1", expectedSigningName: "s3-object-lambda", }, "duakstack endpoint": { options: s3.Options{ Region: "us-west-2", UseDualstack: true, }, expectedErr: "client configured for dualstack but not supported for operation", }, "accelerate endpoint": { options: s3.Options{ Region: "us-west-2", UseAccelerate: true, }, expectedErr: "client configured for accelerate but not supported for operation", }, "custom endpoint": { options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://my-domain.com", SigningRegion: region, SigningName: "s3", // incorrect signing name gets overwritten }, nil }), }, expectedReqURL: "https://test-route.my-domain.com/WriteGetObjectResponse?x-id=WriteGetObjectResponse", expectedSigningRegion: "us-west-2", expectedSigningName: "s3-object-lambda", }, "custom endpoint immutable": { options: s3.Options{ Region: "us-west-2", EndpointResolver: EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: "https://test-route.my-domain.com", SigningRegion: region, SigningName: "s3", // incorrect signing name gets overwritten HostnameImmutable: true, }, nil }), }, expectedReqURL: "https://test-route.my-domain.com/WriteGetObjectResponse?x-id=WriteGetObjectResponse", expectedSigningRegion: "us-west-2", expectedSigningName: "s3-object-lambda", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { runValidations(t, c, func(ctx context.Context, client *s3.Client, retrieverMiddleware *requestRetriever) (interface{}, error) { return client.WriteGetObjectResponse(context.Background(), &s3.WriteGetObjectResponseInput{ RequestRoute: aws.String("test-route"), RequestToken: aws.String("test-token"), }, addRequestRetriever(retrieverMiddleware)) }) }) } } func TestUseDualStackClientBehavior(t *testing.T) { cases := map[string]testCaseForEndpointCustomization{ "client options dual-stack false, endpoint resolver dual-stack unset": { options: s3.Options{ Region: "us-west-2", UseDualstack: false, }, expectedReqURL: "https://test-bucket.s3.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, "client options dual-stack true, endpoint resolver dual-stack unset": { options: s3.Options{ Region: "us-west-2", UseDualstack: true, }, expectedReqURL: "https://test-bucket.s3.dualstack.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, "client options dual-stack off, endpoint resolver dual-stack disabled": { options: s3.Options{ Region: "us-west-2", EndpointOptions: s3.EndpointResolverOptions{ UseDualStackEndpoint: aws.DualStackEndpointStateDisabled, }, }, expectedReqURL: "https://test-bucket.s3.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, "client options dual-stack off, endpoint resolver dual-stack enabled": { options: s3.Options{ Region: "us-west-2", EndpointOptions: s3.EndpointResolverOptions{ UseDualStackEndpoint: aws.DualStackEndpointStateEnabled, }, }, expectedReqURL: "https://test-bucket.s3.dualstack.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, "client options dual-stack on, endpoint resolver dual-stack disabled": { options: s3.Options{ Region: "us-west-2", UseDualstack: true, EndpointOptions: s3.EndpointResolverOptions{ UseDualStackEndpoint: aws.DualStackEndpointStateDisabled, }, }, expectedReqURL: "https://test-bucket.s3.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, "client options dual-stack off, endpoint resolver dual-stack on": { options: s3.Options{ Region: "us-west-2", UseDualstack: false, EndpointOptions: s3.EndpointResolverOptions{ UseDualStackEndpoint: aws.DualStackEndpointStateEnabled, }, }, expectedReqURL: "https://test-bucket.s3.dualstack.us-west-2.amazonaws.com/test-key?x-id=GetObject", expectedSigningRegion: "us-west-2", expectedSigningName: "s3", }, } for name, tt := range cases { t.Run(name, func(t *testing.T) { runValidations(t, tt, func(ctx context.Context, client *s3.Client, retrieverMiddleware *requestRetriever) (interface{}, error) { return client.GetObject(context.Background(), &s3.GetObjectInput{ Bucket: aws.String("test-bucket"), Key: aws.String("test-key"), }, addRequestRetriever(retrieverMiddleware)) }) }) } } func TestMultiRegionAccessPoints_UpdateEndpoint(t *testing.T) { cases := map[string]testCaseForEndpointCustomization{ "region as us-east-1": { options: s3.Options{ Region: "us-east-1", }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "region as us-west-2": { options: s3.Options{ Region: "us-west-2", }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "region as aws-global": { options: s3.Options{ Region: "aws-global", }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "cn partition": { options: s3.Options{ Region: "cn-north-1", }, bucket: "arn:aws-cn:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com.cn/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "cn partition arn with cross partition client region": { options: s3.Options{ Region: "ap-north-1", }, bucket: "arn:aws-cn:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com.cn/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "region as us-west-2 with mrap disabled": { options: s3.Options{ Region: "us-west-2", DisableMultiRegionAccessPoints: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "Multi-Region access point ARNs are disabled", }, "region as aws-global with mrap disabled": { options: s3.Options{ Region: "aws-global", DisableMultiRegionAccessPoints: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "Multi-Region access point ARNs are disabled", }, "with dualstack": { options: s3.Options{ Region: "us-west-2", UseDualstack: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "client configured for S3 Dual-stack but is not supported with resource", }, "with accelerate": { options: s3.Options{ Region: "us-west-2", UseAccelerate: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "client configured for S3 Accelerate but is not supported with resource", }, "access point with no region and mrap disabled": { options: s3.Options{ Region: "us-west-2", DisableMultiRegionAccessPoints: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:myendpoint", expectedErr: "Multi-Region access point ARNs are disabled", }, "endpoint with no region and disabled mrap": { options: s3.Options{ Region: "us-west-2", DisableMultiRegionAccessPoints: true, }, bucket: "arn:aws:s3::123456789012:accesspoint:myendpoint", expectedErr: "Multi-Region access point ARNs are disabled", }, "endpoint with no region": { options: s3.Options{ Region: "us-west-2", }, bucket: "arn:aws:s3::123456789012:accesspoint:myendpoint", expectedReqURL: "https://myendpoint.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "endpoint containing dot with no region": { options: s3.Options{ Region: "us-west-2", }, bucket: "arn:aws:s3::123456789012:accesspoint:my.bucket", expectedReqURL: "https://my.bucket.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "custom endpoint": { options: s3.Options{ Region: "us-west-2", EndpointResolver: s3.EndpointResolverFromURL("https://mockendpoint.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" }), }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap.accesspoint.s3-global.amazonaws.com/", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "custom endpoint with hostname immutable": { options: s3.Options{ Region: "us-west-2", EndpointResolver: s3.EndpointResolverFromURL("https://mockendpoint.amazonaws.com", func(endpoint *aws.Endpoint) { endpoint.SigningRegion = "us-west-2" endpoint.HostnameImmutable = true }), }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mockendpoint.amazonaws.com/arn%3Aaws%3As3%3A%3A123456789012%3Aaccesspoint%3Amfzwi23gnjvgw.mrap", expectedHeader: map[string]string{ v4a.AmzRegionSetKey: "*", }, expectedSigningName: "s3", expectedSigningRegion: "*", }, "with fips client": { options: s3.Options{ Region: "us-west-2", EndpointOptions: s3.EndpointResolverOptions{ UseFIPSEndpoint: aws.FIPSEndpointStateEnabled, }, }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "client configured for fips but cross-region resource ARN provided", }, "with fips (ResolvedRegion) client": { options: s3.Options{ Region: "fips-us-west-2", }, bucket: "arn:aws:s3::123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedErr: "client configured for fips but cross-region resource ARN provided", }, "Accesspoint ARN with region and MRAP disabled": { options: s3.Options{ Region: "us-west-2", DisableMultiRegionAccessPoints: false, }, bucket: "arn:aws:s3:us-west-2:123456789012:accesspoint:mfzwi23gnjvgw.mrap", expectedReqURL: "https://mfzwi23gnjvgw.mrap-123456789012.s3-accesspoint.us-west-2.amazonaws.com/", expectedSigningName: "s3", expectedSigningRegion: "us-west-2", }, } for name, c := range cases { t.Run(name, func(t *testing.T) { runValidations(t, c, func(ctx context.Context, svc *s3.Client, reqRetriever *requestRetriever) (interface{}, error) { if c.operation != nil { return c.operation(ctx, svc, reqRetriever) } return svc.ListObjects(ctx, &s3.ListObjectsInput{ Bucket: ptr.String(c.bucket), }, addRequestRetriever(reqRetriever)) }) }) } } // addRequestRetriever provides request retriever function - that can be used to fetch request from // various build steps. Currently we support fetching after serializing and after finalized middlewares. var addRequestRetriever = func(fm *requestRetriever) func(options *s3.Options) { return func(options *s3.Options) { // append request retriever middleware for request inspection options.APIOptions = append(options.APIOptions, func(stack *middleware.Stack) error { // adds AFTER operation serializer middleware return stack.Serialize.Insert(fm.serializedRequest, "OperationSerializer", middleware.After) }, func(stack *middleware.Stack) error { // adds AFTER operation finalize middleware return stack.Finalize.Add(fm.signedRequest, middleware.After) }) } } // requestRetriever can be used to fetch request within various stages of request. // currently we support fetching requests after serialization, and after signing. type requestRetriever struct { // serializedRequest retriver should be used to fetch request after Operation serializers are executed. serializedRequest *requestRetrieverMiddleware // signedRequest retriever should be used to fetch request from Finalize step after signedRequest *requestRetrieverMiddleware } func runValidations(t *testing.T, c testCaseForEndpointCustomization, operation func( context.Context, *s3.Client, *requestRetriever) (interface{}, error)) { // options opts := c.options.Copy() opts.Credentials = unit.StubCredentialsProvider{} opts.HTTPClient = smithyhttp.NopClient{} opts.Retryer = aws.NopRetryer{} // build an s3 client svc := s3.New(opts) // initialize request fetcher to fetch after input is serialized for request serializedRequest := requestRetrieverMiddleware{} // initialize request fetcher to fetch request after it is signed signedRequest := requestRetrieverMiddleware{} ctx := context.Background() // call an operation _, err := operation(ctx, svc, &requestRetriever{ serializedRequest: &serializedRequest, signedRequest: &signedRequest, }) // inspect any errors if len(c.expectedErr) != 0 { if err == nil { t.Fatalf("expected error, got none") } if a, e := err.Error(), c.expectedErr; !strings.Contains(a, e) { t.Fatalf("expect error code to contain %q, got %q", e, a) } return } if err != nil { t.Fatalf("expect no error, got %v", err) } // build the captured request req := serializedRequest.request.Build(ctx) // verify the built request is as expected if e, a := c.expectedReqURL, req.URL.String(); e != a { t.Fatalf("expect url %s, got %s", e, a) } if e, a := c.expectedSigningRegion, serializedRequest.signingRegion; !strings.EqualFold(e, a) { t.Fatalf("expect signing region as %s, got %s", e, a) } if e, a := c.expectedSigningName, serializedRequest.signingName; !strings.EqualFold(e, a) { t.Fatalf("expect signing name as %s, got %s", e, a) } // fetch signed request signedReq := signedRequest.request // validate if expected headers are present in request for key, ev := range c.expectedHeader { av := signedReq.Header.Get(key) if len(av) == 0 { t.Fatalf("expected header %v to be present in %v was not", key, req.Header) } if !strings.EqualFold(ev, av) { t.Fatalf("expected header %v to be %v, got %v instead", key, ev, av) } } } // request retriever middleware is used to fetch request within a stack step. type requestRetrieverMiddleware struct { request *smithyhttp.Request signingRegion string signingName string } func (*requestRetrieverMiddleware) ID() string { return "S3:requestRetrieverMiddleware" } func (rm *requestRetrieverMiddleware) HandleSerialize( ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, ) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown request type %T", req) } rm.request = req rm.signingName = awsmiddleware.GetSigningName(ctx) rm.signingRegion = awsmiddleware.GetSigningRegion(ctx) return next.HandleSerialize(ctx, in) } func (rm *requestRetrieverMiddleware) HandleFinalize( ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, ) ( out middleware.FinalizeOutput, metadata middleware.Metadata, err error, ) { req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown request type %T", req) } rm.request = req rm.signingName = awsmiddleware.GetSigningName(ctx) rm.signingRegion = awsmiddleware.GetSigningRegion(ctx) return next.HandleFinalize(ctx, in) }
1,595
aws-sdk-go-v2
aws
Go
package customizations_test import ( "bytes" "context" "crypto/tls" "fmt" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" "github.com/google/go-cmp/cmp" "io/ioutil" "net/http" "net/http/httptest" "testing" ) type readSeeker struct { br *bytes.Reader } func (r *readSeeker) Read(p []byte) (int, error) { return r.br.Read(p) } func (r *readSeeker) Seek(offset int64, whence int) (int64, error) { return r.br.Seek(offset, whence) } type readOnlyReader struct { br *bytes.Reader } func (r *readOnlyReader) Read(p []byte) (int, error) { return r.br.Read(p) } type lenReader struct { br *bytes.Reader } func (r *lenReader) Read(p []byte) (int, error) { return r.br.Read(p) } func (r *lenReader) Len() int { return r.br.Len() } func TestWriteGetObjectResponse(t *testing.T) { const contentLength = "Content-Length" const contentSha256 = "X-Amz-Content-Sha256" const unsignedPayload = "UNSIGNED-PAYLOAD" cases := map[string]struct { Handler func(*testing.T) http.Handler Input s3.WriteGetObjectResponseInput }{ "Content-Length seekable": { Handler: func(t *testing.T) http.Handler { return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { expectedInput := []byte("test input") if len(request.TransferEncoding) != 0 { t.Errorf("expect no transfer-encoding") } if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } all, err := ioutil.ReadAll(request.Body) if err != nil { t.Errorf("expect no error, got %v", err) } if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) }) }, Input: s3.WriteGetObjectResponseInput{ RequestRoute: aws.String("route"), RequestToken: aws.String("token"), Body: &readSeeker{br: bytes.NewReader([]byte("test input"))}, }, }, "Content-Length Len Interface": { Handler: func(t *testing.T) http.Handler { return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { expectedInput := []byte("test input") if len(request.TransferEncoding) != 0 { t.Errorf("expect no transfer-encoding") } if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } all, err := ioutil.ReadAll(request.Body) if err != nil { t.Errorf("expect no error, got %v", err) } if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) }) }, Input: s3.WriteGetObjectResponseInput{ RequestRoute: aws.String("route"), RequestToken: aws.String("token"), Body: &lenReader{bytes.NewReader([]byte("test input"))}, }, }, "Content-Length Input Parameter": { Handler: func(t *testing.T) http.Handler { return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { expectedInput := []byte("test input") if len(request.TransferEncoding) != 0 { t.Errorf("expect no transfer-encoding") } if diff := cmp.Diff(request.Header.Get(contentLength), fmt.Sprintf("%d", len(expectedInput))); len(diff) > 0 { t.Error(diff) } if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } all, err := ioutil.ReadAll(request.Body) if err != nil { t.Errorf("expect no error, got %v", err) } if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) }) }, Input: s3.WriteGetObjectResponseInput{ RequestRoute: aws.String("route"), RequestToken: aws.String("token"), Body: &readOnlyReader{bytes.NewReader([]byte("test input"))}, ContentLength: 10, }, }, "Content-Length Not Provided": { Handler: func(t *testing.T) http.Handler { return http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) { expectedInput := []byte("test input") if diff := cmp.Diff(request.TransferEncoding, []string{"chunked"}); len(diff) > 0 { t.Error(diff) } if diff := cmp.Diff(request.Header.Get(contentLength), ""); len(diff) > 0 { t.Error(diff) } if diff := cmp.Diff(request.Header.Get(contentSha256), unsignedPayload); len(diff) > 0 { t.Error(diff) } all, err := ioutil.ReadAll(request.Body) if err != nil { t.Errorf("expect no error, got %v", err) } if diff := cmp.Diff(all, expectedInput); len(diff) > 0 { t.Error(diff) } writer.WriteHeader(200) }) }, Input: s3.WriteGetObjectResponseInput{ RequestRoute: aws.String("route"), RequestToken: aws.String("token"), Body: &readOnlyReader{bytes.NewReader([]byte("test input"))}, }, }, } for name, tt := range cases { t.Run(name, func(t *testing.T) { server := httptest.NewTLSServer(tt.Handler(t)) defer server.Close() client := s3.New(s3.Options{ Region: "us-west-2", HTTPClient: &http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, }, EndpointResolver: s3.EndpointResolverFunc(func(region string, options s3.EndpointResolverOptions) (aws.Endpoint, error) { return aws.Endpoint{ URL: server.URL, SigningName: "s3-object-lambda", SigningRegion: region, Source: aws.EndpointSourceCustom, HostnameImmutable: true, }, nil }), }) _, err := client.WriteGetObjectResponse(context.Background(), &tt.Input) if err != nil { t.Fatalf("expect no error, got %v", err) } }) } }
222
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package endpoints import ( "fmt" "github.com/aws/aws-sdk-go-v2/aws" endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2" "github.com/aws/smithy-go/logging" "regexp" "strings" ) // Options is the endpoint resolver configuration options type Options struct { // Logger is a logging implementation that log events should be sent to. Logger logging.Logger // LogDeprecated indicates that deprecated endpoints should be logged to the // provided logger. LogDeprecated bool // ResolvedRegion is used to override the region to be resolved, rather then the // using the value passed to the ResolveEndpoint method. This value is used by the // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative // name. You must not set this value directly in your application. ResolvedRegion string // DisableHTTPS informs the resolver to return an endpoint that does not use the // HTTPS scheme. DisableHTTPS bool // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint. UseDualStackEndpoint aws.DualStackEndpointState // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint. UseFIPSEndpoint aws.FIPSEndpointState } func (o Options) GetResolvedRegion() string { return o.ResolvedRegion } func (o Options) GetDisableHTTPS() bool { return o.DisableHTTPS } func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState { return o.UseDualStackEndpoint } func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState { return o.UseFIPSEndpoint } func transformToSharedOptions(options Options) endpoints.Options { return endpoints.Options{ Logger: options.Logger, LogDeprecated: options.LogDeprecated, ResolvedRegion: options.ResolvedRegion, DisableHTTPS: options.DisableHTTPS, UseDualStackEndpoint: options.UseDualStackEndpoint, UseFIPSEndpoint: options.UseFIPSEndpoint, } } // Resolver S3 endpoint resolver type Resolver struct { partitions endpoints.Partitions } // ResolveEndpoint resolves the service endpoint for the given region and options func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { if len(region) == 0 { return endpoint, &aws.MissingRegionError{} } opt := transformToSharedOptions(options) return r.partitions.ResolveEndpoint(region, opt) } // New returns a new Resolver func New() *Resolver { return &Resolver{ partitions: defaultPartitions, } } var partitionRegexp = struct { Aws *regexp.Regexp AwsCn *regexp.Regexp AwsIso *regexp.Regexp AwsIsoB *regexp.Regexp AwsIsoE *regexp.Regexp AwsIsoF *regexp.Regexp AwsUsGov *regexp.Regexp }{ Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$"), AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"), AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"), AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), } var defaultPartitions = endpoints.Partitions{ { ID: "aws", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.{region}.amazonaws.com", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.amazonaws.com", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.{region}.amazonaws.com", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.amazonaws.com", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, }, RegionRegex: partitionRegexp.Aws, IsRegionalized: true, Endpoints: endpoints.Endpoints{ endpoints.EndpointKey{ Region: "af-south-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "af-south-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.af-south-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-east-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-east-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-east-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-northeast-1", }: endpoints.Endpoint{ Hostname: "s3.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-northeast-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-northeast-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-northeast-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-northeast-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-northeast-3", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-northeast-3", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-northeast-3.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-south-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-south-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-south-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-south-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-south-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-south-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-southeast-1", }: endpoints.Endpoint{ Hostname: "s3.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-southeast-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-southeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-southeast-2", }: endpoints.Endpoint{ Hostname: "s3.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-southeast-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-southeast-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "ap-southeast-3", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-southeast-3", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-southeast-3.amazonaws.com", }, endpoints.EndpointKey{ Region: "ap-southeast-4", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ap-southeast-4", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ap-southeast-4.amazonaws.com", }, endpoints.EndpointKey{ Region: "aws-global", }: endpoints.Endpoint{ Hostname: "s3.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-east-1", }, }, endpoints.EndpointKey{ Region: "ca-central-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "ca-central-1", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.ca-central-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "ca-central-1", Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.ca-central-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "ca-central-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.ca-central-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-central-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-central-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-central-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-central-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-central-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-north-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-north-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-north-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-south-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-south-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-south-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-south-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-south-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-south-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-west-1", }: endpoints.Endpoint{ Hostname: "s3.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "eu-west-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "eu-west-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-west-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-west-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "eu-west-3", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-west-3", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.eu-west-3.amazonaws.com", }, endpoints.EndpointKey{ Region: "fips-ca-central-1", }: endpoints.Endpoint{ Hostname: "s3-fips.ca-central-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "ca-central-1", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "fips-us-east-1", }: endpoints.Endpoint{ Hostname: "s3-fips.us-east-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-east-1", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "fips-us-east-2", }: endpoints.Endpoint{ Hostname: "s3-fips.us-east-2.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-east-2", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "fips-us-west-1", }: endpoints.Endpoint{ Hostname: "s3-fips.us-west-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-west-1", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "fips-us-west-2", }: endpoints.Endpoint{ Hostname: "s3-fips.us-west-2.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-west-2", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "me-central-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "me-central-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.me-central-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "me-south-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "me-south-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.me-south-1.amazonaws.com", }, endpoints.EndpointKey{ Region: "s3-external-1", }: endpoints.Endpoint{ Hostname: "s3-external-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, CredentialScope: endpoints.CredentialScope{ Region: "us-east-1", }, }, endpoints.EndpointKey{ Region: "sa-east-1", }: endpoints.Endpoint{ Hostname: "s3.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "sa-east-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.sa-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-east-1", }: endpoints.Endpoint{ Hostname: "s3.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-east-1", Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-east-1", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-east-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-east-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-east-2", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "us-east-2", Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.us-east-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "us-east-2", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-east-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "us-east-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-east-2.amazonaws.com", }, endpoints.EndpointKey{ Region: "us-west-1", }: endpoints.Endpoint{ Hostname: "s3.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-1", Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-1", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-2", }: endpoints.Endpoint{ Hostname: "s3.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-2", Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-2", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, endpoints.EndpointKey{ Region: "us-west-2", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-west-2.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, }, }, }, { ID: "aws-cn", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.{region}.amazonaws.com.cn", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.amazonaws.com.cn", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.{region}.api.amazonwebservices.com.cn", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.amazonaws.com.cn", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, }, RegionRegex: partitionRegexp.AwsCn, IsRegionalized: true, Endpoints: endpoints.Endpoints{ endpoints.EndpointKey{ Region: "cn-north-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "cn-north-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.cn-north-1.amazonaws.com.cn", }, endpoints.EndpointKey{ Region: "cn-northwest-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "cn-northwest-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.cn-northwest-1.amazonaws.com.cn", }, }, }, { ID: "aws-iso", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.c2s.ic.gov", Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.c2s.ic.gov", Protocols: []string{"https"}, SignatureVersions: []string{"s3v4"}, }, }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, Endpoints: endpoints.Endpoints{ endpoints.EndpointKey{ Region: "us-iso-east-1", }: endpoints.Endpoint{ Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, endpoints.EndpointKey{ Region: "us-iso-west-1", }: endpoints.Endpoint{}, }, }, { ID: "aws-iso-b", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.sc2s.sgov.gov", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.sc2s.sgov.gov", Protocols: []string{"http", "https"}, SignatureVersions: []string{"s3v4"}, }, }, RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, Endpoints: endpoints.Endpoints{ endpoints.EndpointKey{ Region: "us-isob-east-1", }: endpoints.Endpoint{}, }, }, { ID: "aws-iso-e", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.cloud.adc-e.uk", Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.cloud.adc-e.uk", Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, }, RegionRegex: partitionRegexp.AwsIsoE, IsRegionalized: true, }, { ID: "aws-iso-f", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.csp.hci.ic.gov", Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.csp.hci.ic.gov", Protocols: []string{"https"}, SignatureVersions: []string{"v4"}, }, }, RegionRegex: partitionRegexp.AwsIsoF, IsRegionalized: true, }, { ID: "aws-us-gov", Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ { Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.{region}.amazonaws.com", Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, { Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.{region}.amazonaws.com", Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, { Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, }: { Hostname: "s3-fips.dualstack.{region}.amazonaws.com", Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, { Variant: 0, }: { Hostname: "s3.{region}.amazonaws.com", Protocols: []string{"https"}, SignatureVersions: []string{"s3", "s3v4"}, }, }, RegionRegex: partitionRegexp.AwsUsGov, IsRegionalized: true, Endpoints: endpoints.Endpoints{ endpoints.EndpointKey{ Region: "fips-us-gov-east-1", }: endpoints.Endpoint{ Hostname: "s3-fips.us-gov-east-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-gov-east-1", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "fips-us-gov-west-1", }: endpoints.Endpoint{ Hostname: "s3-fips.us-gov-west-1.amazonaws.com", CredentialScope: endpoints.CredentialScope{ Region: "us-gov-west-1", }, Deprecated: aws.TrueTernary, }, endpoints.EndpointKey{ Region: "us-gov-east-1", }: endpoints.Endpoint{ Hostname: "s3.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, endpoints.EndpointKey{ Region: "us-gov-east-1", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, endpoints.EndpointKey{ Region: "us-gov-east-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-gov-east-1.amazonaws.com", Protocols: []string{"http", "https"}, }, endpoints.EndpointKey{ Region: "us-gov-west-1", }: endpoints.Endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, endpoints.EndpointKey{ Region: "us-gov-west-1", Variant: endpoints.FIPSVariant, }: { Hostname: "s3-fips.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, endpoints.EndpointKey{ Region: "us-gov-west-1", Variant: endpoints.DualStackVariant, }: { Hostname: "s3.dualstack.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, }, }, } // GetDNSSuffix returns the dnsSuffix URL component for the given partition id func GetDNSSuffix(id string, options Options) (string, error) { variant := transformToSharedOptions(options).GetEndpointVariant() switch { case strings.EqualFold(id, "aws"): switch variant { case endpoints.DualStackVariant: return "amazonaws.com", nil case endpoints.FIPSVariant: return "amazonaws.com", nil case endpoints.FIPSVariant | endpoints.DualStackVariant: return "amazonaws.com", nil case 0: return "amazonaws.com", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-cn"): switch variant { case endpoints.DualStackVariant: return "amazonaws.com.cn", nil case endpoints.FIPSVariant: return "amazonaws.com.cn", nil case endpoints.FIPSVariant | endpoints.DualStackVariant: return "api.amazonwebservices.com.cn", nil case 0: return "amazonaws.com.cn", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-iso"): switch variant { case endpoints.FIPSVariant: return "c2s.ic.gov", nil case 0: return "c2s.ic.gov", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-iso-b"): switch variant { case endpoints.FIPSVariant: return "sc2s.sgov.gov", nil case 0: return "sc2s.sgov.gov", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-iso-e"): switch variant { case endpoints.FIPSVariant: return "cloud.adc-e.uk", nil case 0: return "cloud.adc-e.uk", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-iso-f"): switch variant { case endpoints.FIPSVariant: return "csp.hci.ic.gov", nil case 0: return "csp.hci.ic.gov", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } case strings.EqualFold(id, "aws-us-gov"): switch variant { case endpoints.DualStackVariant: return "amazonaws.com", nil case endpoints.FIPSVariant: return "amazonaws.com", nil case endpoints.FIPSVariant | endpoints.DualStackVariant: return "amazonaws.com", nil case 0: return "amazonaws.com", nil default: return "", fmt.Errorf("unsupported endpoint variant %v, in partition %s", variant, id) } default: return "", fmt.Errorf("unknown partition") } } // GetDNSSuffixFromRegion returns the DNS suffix for the provided region and // options. func GetDNSSuffixFromRegion(region string, options Options) (string, error) { switch { case partitionRegexp.Aws.MatchString(region): return GetDNSSuffix("aws", options) case partitionRegexp.AwsCn.MatchString(region): return GetDNSSuffix("aws-cn", options) case partitionRegexp.AwsIso.MatchString(region): return GetDNSSuffix("aws-iso", options) case partitionRegexp.AwsIsoB.MatchString(region): return GetDNSSuffix("aws-iso-b", options) case partitionRegexp.AwsIsoE.MatchString(region): return GetDNSSuffix("aws-iso-e", options) case partitionRegexp.AwsIsoF.MatchString(region): return GetDNSSuffix("aws-iso-f", options) case partitionRegexp.AwsUsGov.MatchString(region): return GetDNSSuffix("aws-us-gov", options) default: return GetDNSSuffix("aws", options) } }
951
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package endpoints import ( "testing" ) func TestRegexCompile(t *testing.T) { _ = defaultPartitions }
12
aws-sdk-go-v2
aws
Go
package s3testing import ( "fmt" "math/rand" "github.com/aws/aws-sdk-go-v2/internal/sdkio" ) var randBytes = func() []byte { b := make([]byte, 10*sdkio.MebiByte) if _, err := rand.Read(b); err != nil { panic(fmt.Sprintf("failed to read random bytes, %v", err)) } return b }() // GetTestBytes returns a pseudo-random []byte of length size func GetTestBytes(size int) []byte { if len(randBytes) >= size { return randBytes[:size] } b := append(randBytes, GetTestBytes(size-len(randBytes))...) return b }
28
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package types type AnalyticsS3ExportFileFormat string // Enum values for AnalyticsS3ExportFileFormat const ( AnalyticsS3ExportFileFormatCsv AnalyticsS3ExportFileFormat = "CSV" ) // Values returns all known values for AnalyticsS3ExportFileFormat. 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 (AnalyticsS3ExportFileFormat) Values() []AnalyticsS3ExportFileFormat { return []AnalyticsS3ExportFileFormat{ "CSV", } } type ArchiveStatus string // Enum values for ArchiveStatus const ( ArchiveStatusArchiveAccess ArchiveStatus = "ARCHIVE_ACCESS" ArchiveStatusDeepArchiveAccess ArchiveStatus = "DEEP_ARCHIVE_ACCESS" ) // Values returns all known values for ArchiveStatus. 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 (ArchiveStatus) Values() []ArchiveStatus { return []ArchiveStatus{ "ARCHIVE_ACCESS", "DEEP_ARCHIVE_ACCESS", } } type BucketAccelerateStatus string // Enum values for BucketAccelerateStatus const ( BucketAccelerateStatusEnabled BucketAccelerateStatus = "Enabled" BucketAccelerateStatusSuspended BucketAccelerateStatus = "Suspended" ) // Values returns all known values for BucketAccelerateStatus. 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 (BucketAccelerateStatus) Values() []BucketAccelerateStatus { return []BucketAccelerateStatus{ "Enabled", "Suspended", } } type BucketCannedACL string // Enum values for BucketCannedACL const ( BucketCannedACLPrivate BucketCannedACL = "private" BucketCannedACLPublicRead BucketCannedACL = "public-read" BucketCannedACLPublicReadWrite BucketCannedACL = "public-read-write" BucketCannedACLAuthenticatedRead BucketCannedACL = "authenticated-read" ) // Values returns all known values for BucketCannedACL. 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 (BucketCannedACL) Values() []BucketCannedACL { return []BucketCannedACL{ "private", "public-read", "public-read-write", "authenticated-read", } } type BucketLocationConstraint string // Enum values for BucketLocationConstraint const ( BucketLocationConstraintAfSouth1 BucketLocationConstraint = "af-south-1" BucketLocationConstraintApEast1 BucketLocationConstraint = "ap-east-1" BucketLocationConstraintApNortheast1 BucketLocationConstraint = "ap-northeast-1" BucketLocationConstraintApNortheast2 BucketLocationConstraint = "ap-northeast-2" BucketLocationConstraintApNortheast3 BucketLocationConstraint = "ap-northeast-3" BucketLocationConstraintApSouth1 BucketLocationConstraint = "ap-south-1" BucketLocationConstraintApSoutheast1 BucketLocationConstraint = "ap-southeast-1" BucketLocationConstraintApSoutheast2 BucketLocationConstraint = "ap-southeast-2" BucketLocationConstraintApSoutheast3 BucketLocationConstraint = "ap-southeast-3" BucketLocationConstraintCaCentral1 BucketLocationConstraint = "ca-central-1" BucketLocationConstraintCnNorth1 BucketLocationConstraint = "cn-north-1" BucketLocationConstraintCnNorthwest1 BucketLocationConstraint = "cn-northwest-1" BucketLocationConstraintEu BucketLocationConstraint = "EU" BucketLocationConstraintEuCentral1 BucketLocationConstraint = "eu-central-1" BucketLocationConstraintEuNorth1 BucketLocationConstraint = "eu-north-1" BucketLocationConstraintEuSouth1 BucketLocationConstraint = "eu-south-1" BucketLocationConstraintEuWest1 BucketLocationConstraint = "eu-west-1" BucketLocationConstraintEuWest2 BucketLocationConstraint = "eu-west-2" BucketLocationConstraintEuWest3 BucketLocationConstraint = "eu-west-3" BucketLocationConstraintMeSouth1 BucketLocationConstraint = "me-south-1" BucketLocationConstraintSaEast1 BucketLocationConstraint = "sa-east-1" BucketLocationConstraintUsEast2 BucketLocationConstraint = "us-east-2" BucketLocationConstraintUsGovEast1 BucketLocationConstraint = "us-gov-east-1" BucketLocationConstraintUsGovWest1 BucketLocationConstraint = "us-gov-west-1" BucketLocationConstraintUsWest1 BucketLocationConstraint = "us-west-1" BucketLocationConstraintUsWest2 BucketLocationConstraint = "us-west-2" ) // Values returns all known values for BucketLocationConstraint. 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 (BucketLocationConstraint) Values() []BucketLocationConstraint { return []BucketLocationConstraint{ "af-south-1", "ap-east-1", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ap-southeast-3", "ca-central-1", "cn-north-1", "cn-northwest-1", "EU", "eu-central-1", "eu-north-1", "eu-south-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-2", "us-gov-east-1", "us-gov-west-1", "us-west-1", "us-west-2", } } type BucketLogsPermission string // Enum values for BucketLogsPermission const ( BucketLogsPermissionFullControl BucketLogsPermission = "FULL_CONTROL" BucketLogsPermissionRead BucketLogsPermission = "READ" BucketLogsPermissionWrite BucketLogsPermission = "WRITE" ) // Values returns all known values for BucketLogsPermission. 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 (BucketLogsPermission) Values() []BucketLogsPermission { return []BucketLogsPermission{ "FULL_CONTROL", "READ", "WRITE", } } type BucketVersioningStatus string // Enum values for BucketVersioningStatus const ( BucketVersioningStatusEnabled BucketVersioningStatus = "Enabled" BucketVersioningStatusSuspended BucketVersioningStatus = "Suspended" ) // Values returns all known values for BucketVersioningStatus. 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 (BucketVersioningStatus) Values() []BucketVersioningStatus { return []BucketVersioningStatus{ "Enabled", "Suspended", } } type ChecksumAlgorithm string // Enum values for ChecksumAlgorithm const ( ChecksumAlgorithmCrc32 ChecksumAlgorithm = "CRC32" ChecksumAlgorithmCrc32c ChecksumAlgorithm = "CRC32C" ChecksumAlgorithmSha1 ChecksumAlgorithm = "SHA1" ChecksumAlgorithmSha256 ChecksumAlgorithm = "SHA256" ) // Values returns all known values for ChecksumAlgorithm. 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 (ChecksumAlgorithm) Values() []ChecksumAlgorithm { return []ChecksumAlgorithm{ "CRC32", "CRC32C", "SHA1", "SHA256", } } type ChecksumMode string // Enum values for ChecksumMode const ( ChecksumModeEnabled ChecksumMode = "ENABLED" ) // Values returns all known values for ChecksumMode. 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 (ChecksumMode) Values() []ChecksumMode { return []ChecksumMode{ "ENABLED", } } type CompressionType string // Enum values for CompressionType const ( CompressionTypeNone CompressionType = "NONE" CompressionTypeGzip CompressionType = "GZIP" CompressionTypeBzip2 CompressionType = "BZIP2" ) // Values returns all known values for CompressionType. 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 (CompressionType) Values() []CompressionType { return []CompressionType{ "NONE", "GZIP", "BZIP2", } } type DeleteMarkerReplicationStatus string // Enum values for DeleteMarkerReplicationStatus const ( DeleteMarkerReplicationStatusEnabled DeleteMarkerReplicationStatus = "Enabled" DeleteMarkerReplicationStatusDisabled DeleteMarkerReplicationStatus = "Disabled" ) // Values returns all known values for DeleteMarkerReplicationStatus. 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 (DeleteMarkerReplicationStatus) Values() []DeleteMarkerReplicationStatus { return []DeleteMarkerReplicationStatus{ "Enabled", "Disabled", } } type EncodingType string // Enum values for EncodingType const ( EncodingTypeUrl EncodingType = "url" ) // Values returns all known values for EncodingType. 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 (EncodingType) Values() []EncodingType { return []EncodingType{ "url", } } type Event string // Enum values for Event const ( EventS3ReducedRedundancyLostObject Event = "s3:ReducedRedundancyLostObject" EventS3ObjectCreated Event = "s3:ObjectCreated:*" EventS3ObjectCreatedPut Event = "s3:ObjectCreated:Put" EventS3ObjectCreatedPost Event = "s3:ObjectCreated:Post" EventS3ObjectCreatedCopy Event = "s3:ObjectCreated:Copy" EventS3ObjectCreatedCompleteMultipartUpload Event = "s3:ObjectCreated:CompleteMultipartUpload" EventS3ObjectRemoved Event = "s3:ObjectRemoved:*" EventS3ObjectRemovedDelete Event = "s3:ObjectRemoved:Delete" EventS3ObjectRemovedDeleteMarkerCreated Event = "s3:ObjectRemoved:DeleteMarkerCreated" EventS3ObjectRestore Event = "s3:ObjectRestore:*" EventS3ObjectRestorePost Event = "s3:ObjectRestore:Post" EventS3ObjectRestoreCompleted Event = "s3:ObjectRestore:Completed" EventS3Replication Event = "s3:Replication:*" EventS3ReplicationOperationFailedReplication Event = "s3:Replication:OperationFailedReplication" EventS3ReplicationOperationNotTracked Event = "s3:Replication:OperationNotTracked" EventS3ReplicationOperationMissedThreshold Event = "s3:Replication:OperationMissedThreshold" EventS3ReplicationOperationReplicatedAfterThreshold Event = "s3:Replication:OperationReplicatedAfterThreshold" EventS3ObjectRestoreDelete Event = "s3:ObjectRestore:Delete" EventS3LifecycleTransition Event = "s3:LifecycleTransition" EventS3IntelligentTiering Event = "s3:IntelligentTiering" EventS3ObjectAclPut Event = "s3:ObjectAcl:Put" EventS3LifecycleExpiration Event = "s3:LifecycleExpiration:*" EventS3LifecycleExpirationDelete Event = "s3:LifecycleExpiration:Delete" EventS3LifecycleExpirationDeleteMarkerCreated Event = "s3:LifecycleExpiration:DeleteMarkerCreated" EventS3ObjectTagging Event = "s3:ObjectTagging:*" EventS3ObjectTaggingPut Event = "s3:ObjectTagging:Put" EventS3ObjectTaggingDelete Event = "s3:ObjectTagging:Delete" ) // Values returns all known values for Event. 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 (Event) Values() []Event { return []Event{ "s3:ReducedRedundancyLostObject", "s3:ObjectCreated:*", "s3:ObjectCreated:Put", "s3:ObjectCreated:Post", "s3:ObjectCreated:Copy", "s3:ObjectCreated:CompleteMultipartUpload", "s3:ObjectRemoved:*", "s3:ObjectRemoved:Delete", "s3:ObjectRemoved:DeleteMarkerCreated", "s3:ObjectRestore:*", "s3:ObjectRestore:Post", "s3:ObjectRestore:Completed", "s3:Replication:*", "s3:Replication:OperationFailedReplication", "s3:Replication:OperationNotTracked", "s3:Replication:OperationMissedThreshold", "s3:Replication:OperationReplicatedAfterThreshold", "s3:ObjectRestore:Delete", "s3:LifecycleTransition", "s3:IntelligentTiering", "s3:ObjectAcl:Put", "s3:LifecycleExpiration:*", "s3:LifecycleExpiration:Delete", "s3:LifecycleExpiration:DeleteMarkerCreated", "s3:ObjectTagging:*", "s3:ObjectTagging:Put", "s3:ObjectTagging:Delete", } } type ExistingObjectReplicationStatus string // Enum values for ExistingObjectReplicationStatus const ( ExistingObjectReplicationStatusEnabled ExistingObjectReplicationStatus = "Enabled" ExistingObjectReplicationStatusDisabled ExistingObjectReplicationStatus = "Disabled" ) // Values returns all known values for ExistingObjectReplicationStatus. 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 (ExistingObjectReplicationStatus) Values() []ExistingObjectReplicationStatus { return []ExistingObjectReplicationStatus{ "Enabled", "Disabled", } } type ExpirationStatus string // Enum values for ExpirationStatus const ( ExpirationStatusEnabled ExpirationStatus = "Enabled" ExpirationStatusDisabled ExpirationStatus = "Disabled" ) // Values returns all known values for ExpirationStatus. 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 (ExpirationStatus) Values() []ExpirationStatus { return []ExpirationStatus{ "Enabled", "Disabled", } } type ExpressionType string // Enum values for ExpressionType const ( ExpressionTypeSql ExpressionType = "SQL" ) // Values returns all known values for ExpressionType. 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 (ExpressionType) Values() []ExpressionType { return []ExpressionType{ "SQL", } } type FileHeaderInfo string // Enum values for FileHeaderInfo const ( FileHeaderInfoUse FileHeaderInfo = "USE" FileHeaderInfoIgnore FileHeaderInfo = "IGNORE" FileHeaderInfoNone FileHeaderInfo = "NONE" ) // Values returns all known values for FileHeaderInfo. 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 (FileHeaderInfo) Values() []FileHeaderInfo { return []FileHeaderInfo{ "USE", "IGNORE", "NONE", } } type FilterRuleName string // Enum values for FilterRuleName const ( FilterRuleNamePrefix FilterRuleName = "prefix" FilterRuleNameSuffix FilterRuleName = "suffix" ) // Values returns all known values for FilterRuleName. 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 (FilterRuleName) Values() []FilterRuleName { return []FilterRuleName{ "prefix", "suffix", } } type IntelligentTieringAccessTier string // Enum values for IntelligentTieringAccessTier const ( IntelligentTieringAccessTierArchiveAccess IntelligentTieringAccessTier = "ARCHIVE_ACCESS" IntelligentTieringAccessTierDeepArchiveAccess IntelligentTieringAccessTier = "DEEP_ARCHIVE_ACCESS" ) // Values returns all known values for IntelligentTieringAccessTier. 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 (IntelligentTieringAccessTier) Values() []IntelligentTieringAccessTier { return []IntelligentTieringAccessTier{ "ARCHIVE_ACCESS", "DEEP_ARCHIVE_ACCESS", } } type IntelligentTieringStatus string // Enum values for IntelligentTieringStatus const ( IntelligentTieringStatusEnabled IntelligentTieringStatus = "Enabled" IntelligentTieringStatusDisabled IntelligentTieringStatus = "Disabled" ) // Values returns all known values for IntelligentTieringStatus. 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 (IntelligentTieringStatus) Values() []IntelligentTieringStatus { return []IntelligentTieringStatus{ "Enabled", "Disabled", } } type InventoryFormat string // Enum values for InventoryFormat const ( InventoryFormatCsv InventoryFormat = "CSV" InventoryFormatOrc InventoryFormat = "ORC" InventoryFormatParquet InventoryFormat = "Parquet" ) // Values returns all known values for InventoryFormat. 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 (InventoryFormat) Values() []InventoryFormat { return []InventoryFormat{ "CSV", "ORC", "Parquet", } } type InventoryFrequency string // Enum values for InventoryFrequency const ( InventoryFrequencyDaily InventoryFrequency = "Daily" InventoryFrequencyWeekly InventoryFrequency = "Weekly" ) // Values returns all known values for InventoryFrequency. 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 (InventoryFrequency) Values() []InventoryFrequency { return []InventoryFrequency{ "Daily", "Weekly", } } type InventoryIncludedObjectVersions string // Enum values for InventoryIncludedObjectVersions const ( InventoryIncludedObjectVersionsAll InventoryIncludedObjectVersions = "All" InventoryIncludedObjectVersionsCurrent InventoryIncludedObjectVersions = "Current" ) // Values returns all known values for InventoryIncludedObjectVersions. 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 (InventoryIncludedObjectVersions) Values() []InventoryIncludedObjectVersions { return []InventoryIncludedObjectVersions{ "All", "Current", } } type InventoryOptionalField string // Enum values for InventoryOptionalField const ( InventoryOptionalFieldSize InventoryOptionalField = "Size" InventoryOptionalFieldLastModifiedDate InventoryOptionalField = "LastModifiedDate" InventoryOptionalFieldStorageClass InventoryOptionalField = "StorageClass" InventoryOptionalFieldETag InventoryOptionalField = "ETag" InventoryOptionalFieldIsMultipartUploaded InventoryOptionalField = "IsMultipartUploaded" InventoryOptionalFieldReplicationStatus InventoryOptionalField = "ReplicationStatus" InventoryOptionalFieldEncryptionStatus InventoryOptionalField = "EncryptionStatus" InventoryOptionalFieldObjectLockRetainUntilDate InventoryOptionalField = "ObjectLockRetainUntilDate" InventoryOptionalFieldObjectLockMode InventoryOptionalField = "ObjectLockMode" InventoryOptionalFieldObjectLockLegalHoldStatus InventoryOptionalField = "ObjectLockLegalHoldStatus" InventoryOptionalFieldIntelligentTieringAccessTier InventoryOptionalField = "IntelligentTieringAccessTier" InventoryOptionalFieldBucketKeyStatus InventoryOptionalField = "BucketKeyStatus" InventoryOptionalFieldChecksumAlgorithm InventoryOptionalField = "ChecksumAlgorithm" ) // Values returns all known values for InventoryOptionalField. 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 (InventoryOptionalField) Values() []InventoryOptionalField { return []InventoryOptionalField{ "Size", "LastModifiedDate", "StorageClass", "ETag", "IsMultipartUploaded", "ReplicationStatus", "EncryptionStatus", "ObjectLockRetainUntilDate", "ObjectLockMode", "ObjectLockLegalHoldStatus", "IntelligentTieringAccessTier", "BucketKeyStatus", "ChecksumAlgorithm", } } type JSONType string // Enum values for JSONType const ( JSONTypeDocument JSONType = "DOCUMENT" JSONTypeLines JSONType = "LINES" ) // Values returns all known values for JSONType. 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 (JSONType) Values() []JSONType { return []JSONType{ "DOCUMENT", "LINES", } } type MetadataDirective string // Enum values for MetadataDirective const ( MetadataDirectiveCopy MetadataDirective = "COPY" MetadataDirectiveReplace MetadataDirective = "REPLACE" ) // Values returns all known values for MetadataDirective. 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 (MetadataDirective) Values() []MetadataDirective { return []MetadataDirective{ "COPY", "REPLACE", } } type MetricsStatus string // Enum values for MetricsStatus const ( MetricsStatusEnabled MetricsStatus = "Enabled" MetricsStatusDisabled MetricsStatus = "Disabled" ) // Values returns all known values for MetricsStatus. 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 (MetricsStatus) Values() []MetricsStatus { return []MetricsStatus{ "Enabled", "Disabled", } } type MFADelete string // Enum values for MFADelete const ( MFADeleteEnabled MFADelete = "Enabled" MFADeleteDisabled MFADelete = "Disabled" ) // Values returns all known values for MFADelete. 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 (MFADelete) Values() []MFADelete { return []MFADelete{ "Enabled", "Disabled", } } type MFADeleteStatus string // Enum values for MFADeleteStatus const ( MFADeleteStatusEnabled MFADeleteStatus = "Enabled" MFADeleteStatusDisabled MFADeleteStatus = "Disabled" ) // Values returns all known values for MFADeleteStatus. 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 (MFADeleteStatus) Values() []MFADeleteStatus { return []MFADeleteStatus{ "Enabled", "Disabled", } } type ObjectAttributes string // Enum values for ObjectAttributes const ( ObjectAttributesEtag ObjectAttributes = "ETag" ObjectAttributesChecksum ObjectAttributes = "Checksum" ObjectAttributesObjectParts ObjectAttributes = "ObjectParts" ObjectAttributesStorageClass ObjectAttributes = "StorageClass" ObjectAttributesObjectSize ObjectAttributes = "ObjectSize" ) // Values returns all known values for ObjectAttributes. 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 (ObjectAttributes) Values() []ObjectAttributes { return []ObjectAttributes{ "ETag", "Checksum", "ObjectParts", "StorageClass", "ObjectSize", } } type ObjectCannedACL string // Enum values for ObjectCannedACL const ( ObjectCannedACLPrivate ObjectCannedACL = "private" ObjectCannedACLPublicRead ObjectCannedACL = "public-read" ObjectCannedACLPublicReadWrite ObjectCannedACL = "public-read-write" ObjectCannedACLAuthenticatedRead ObjectCannedACL = "authenticated-read" ObjectCannedACLAwsExecRead ObjectCannedACL = "aws-exec-read" ObjectCannedACLBucketOwnerRead ObjectCannedACL = "bucket-owner-read" ObjectCannedACLBucketOwnerFullControl ObjectCannedACL = "bucket-owner-full-control" ) // Values returns all known values for ObjectCannedACL. 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 (ObjectCannedACL) Values() []ObjectCannedACL { return []ObjectCannedACL{ "private", "public-read", "public-read-write", "authenticated-read", "aws-exec-read", "bucket-owner-read", "bucket-owner-full-control", } } type ObjectLockEnabled string // Enum values for ObjectLockEnabled const ( ObjectLockEnabledEnabled ObjectLockEnabled = "Enabled" ) // Values returns all known values for ObjectLockEnabled. 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 (ObjectLockEnabled) Values() []ObjectLockEnabled { return []ObjectLockEnabled{ "Enabled", } } type ObjectLockLegalHoldStatus string // Enum values for ObjectLockLegalHoldStatus const ( ObjectLockLegalHoldStatusOn ObjectLockLegalHoldStatus = "ON" ObjectLockLegalHoldStatusOff ObjectLockLegalHoldStatus = "OFF" ) // Values returns all known values for ObjectLockLegalHoldStatus. 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 (ObjectLockLegalHoldStatus) Values() []ObjectLockLegalHoldStatus { return []ObjectLockLegalHoldStatus{ "ON", "OFF", } } type ObjectLockMode string // Enum values for ObjectLockMode const ( ObjectLockModeGovernance ObjectLockMode = "GOVERNANCE" ObjectLockModeCompliance ObjectLockMode = "COMPLIANCE" ) // Values returns all known values for ObjectLockMode. 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 (ObjectLockMode) Values() []ObjectLockMode { return []ObjectLockMode{ "GOVERNANCE", "COMPLIANCE", } } type ObjectLockRetentionMode string // Enum values for ObjectLockRetentionMode const ( ObjectLockRetentionModeGovernance ObjectLockRetentionMode = "GOVERNANCE" ObjectLockRetentionModeCompliance ObjectLockRetentionMode = "COMPLIANCE" ) // Values returns all known values for ObjectLockRetentionMode. 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 (ObjectLockRetentionMode) Values() []ObjectLockRetentionMode { return []ObjectLockRetentionMode{ "GOVERNANCE", "COMPLIANCE", } } type ObjectOwnership string // Enum values for ObjectOwnership const ( ObjectOwnershipBucketOwnerPreferred ObjectOwnership = "BucketOwnerPreferred" ObjectOwnershipObjectWriter ObjectOwnership = "ObjectWriter" ObjectOwnershipBucketOwnerEnforced ObjectOwnership = "BucketOwnerEnforced" ) // Values returns all known values for ObjectOwnership. 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 (ObjectOwnership) Values() []ObjectOwnership { return []ObjectOwnership{ "BucketOwnerPreferred", "ObjectWriter", "BucketOwnerEnforced", } } type ObjectStorageClass string // Enum values for ObjectStorageClass const ( ObjectStorageClassStandard ObjectStorageClass = "STANDARD" ObjectStorageClassReducedRedundancy ObjectStorageClass = "REDUCED_REDUNDANCY" ObjectStorageClassGlacier ObjectStorageClass = "GLACIER" ObjectStorageClassStandardIa ObjectStorageClass = "STANDARD_IA" ObjectStorageClassOnezoneIa ObjectStorageClass = "ONEZONE_IA" ObjectStorageClassIntelligentTiering ObjectStorageClass = "INTELLIGENT_TIERING" ObjectStorageClassDeepArchive ObjectStorageClass = "DEEP_ARCHIVE" ObjectStorageClassOutposts ObjectStorageClass = "OUTPOSTS" ObjectStorageClassGlacierIr ObjectStorageClass = "GLACIER_IR" ObjectStorageClassSnow ObjectStorageClass = "SNOW" ) // Values returns all known values for ObjectStorageClass. 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 (ObjectStorageClass) Values() []ObjectStorageClass { return []ObjectStorageClass{ "STANDARD", "REDUCED_REDUNDANCY", "GLACIER", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "DEEP_ARCHIVE", "OUTPOSTS", "GLACIER_IR", "SNOW", } } type ObjectVersionStorageClass string // Enum values for ObjectVersionStorageClass const ( ObjectVersionStorageClassStandard ObjectVersionStorageClass = "STANDARD" ) // Values returns all known values for ObjectVersionStorageClass. 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 (ObjectVersionStorageClass) Values() []ObjectVersionStorageClass { return []ObjectVersionStorageClass{ "STANDARD", } } type OptionalObjectAttributes string // Enum values for OptionalObjectAttributes const ( OptionalObjectAttributesRestoreStatus OptionalObjectAttributes = "RestoreStatus" ) // Values returns all known values for OptionalObjectAttributes. 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 (OptionalObjectAttributes) Values() []OptionalObjectAttributes { return []OptionalObjectAttributes{ "RestoreStatus", } } type OwnerOverride string // Enum values for OwnerOverride const ( OwnerOverrideDestination OwnerOverride = "Destination" ) // Values returns all known values for OwnerOverride. 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 (OwnerOverride) Values() []OwnerOverride { return []OwnerOverride{ "Destination", } } type Payer string // Enum values for Payer const ( PayerRequester Payer = "Requester" PayerBucketOwner Payer = "BucketOwner" ) // Values returns all known values for Payer. 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 (Payer) Values() []Payer { return []Payer{ "Requester", "BucketOwner", } } type Permission string // Enum values for Permission const ( PermissionFullControl Permission = "FULL_CONTROL" PermissionWrite Permission = "WRITE" PermissionWriteAcp Permission = "WRITE_ACP" PermissionRead Permission = "READ" PermissionReadAcp Permission = "READ_ACP" ) // Values returns all known values for Permission. 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 (Permission) Values() []Permission { return []Permission{ "FULL_CONTROL", "WRITE", "WRITE_ACP", "READ", "READ_ACP", } } type Protocol string // Enum values for Protocol const ( ProtocolHttp Protocol = "http" ProtocolHttps Protocol = "https" ) // Values returns all known values for Protocol. 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 (Protocol) Values() []Protocol { return []Protocol{ "http", "https", } } type QuoteFields string // Enum values for QuoteFields const ( QuoteFieldsAlways QuoteFields = "ALWAYS" QuoteFieldsAsneeded QuoteFields = "ASNEEDED" ) // Values returns all known values for QuoteFields. 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 (QuoteFields) Values() []QuoteFields { return []QuoteFields{ "ALWAYS", "ASNEEDED", } } type ReplicaModificationsStatus string // Enum values for ReplicaModificationsStatus const ( ReplicaModificationsStatusEnabled ReplicaModificationsStatus = "Enabled" ReplicaModificationsStatusDisabled ReplicaModificationsStatus = "Disabled" ) // Values returns all known values for ReplicaModificationsStatus. 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 (ReplicaModificationsStatus) Values() []ReplicaModificationsStatus { return []ReplicaModificationsStatus{ "Enabled", "Disabled", } } type ReplicationRuleStatus string // Enum values for ReplicationRuleStatus const ( ReplicationRuleStatusEnabled ReplicationRuleStatus = "Enabled" ReplicationRuleStatusDisabled ReplicationRuleStatus = "Disabled" ) // Values returns all known values for ReplicationRuleStatus. 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 (ReplicationRuleStatus) Values() []ReplicationRuleStatus { return []ReplicationRuleStatus{ "Enabled", "Disabled", } } type ReplicationStatus string // Enum values for ReplicationStatus const ( ReplicationStatusComplete ReplicationStatus = "COMPLETE" ReplicationStatusPending ReplicationStatus = "PENDING" ReplicationStatusFailed ReplicationStatus = "FAILED" ReplicationStatusReplica ReplicationStatus = "REPLICA" ) // Values returns all known values for ReplicationStatus. 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 (ReplicationStatus) Values() []ReplicationStatus { return []ReplicationStatus{ "COMPLETE", "PENDING", "FAILED", "REPLICA", } } type ReplicationTimeStatus string // Enum values for ReplicationTimeStatus const ( ReplicationTimeStatusEnabled ReplicationTimeStatus = "Enabled" ReplicationTimeStatusDisabled ReplicationTimeStatus = "Disabled" ) // Values returns all known values for ReplicationTimeStatus. 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 (ReplicationTimeStatus) Values() []ReplicationTimeStatus { return []ReplicationTimeStatus{ "Enabled", "Disabled", } } type RequestCharged string // Enum values for RequestCharged const ( RequestChargedRequester RequestCharged = "requester" ) // Values returns all known values for RequestCharged. 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 (RequestCharged) Values() []RequestCharged { return []RequestCharged{ "requester", } } type RequestPayer string // Enum values for RequestPayer const ( RequestPayerRequester RequestPayer = "requester" ) // Values returns all known values for RequestPayer. 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 (RequestPayer) Values() []RequestPayer { return []RequestPayer{ "requester", } } type RestoreRequestType string // Enum values for RestoreRequestType const ( RestoreRequestTypeSelect RestoreRequestType = "SELECT" ) // Values returns all known values for RestoreRequestType. 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 (RestoreRequestType) Values() []RestoreRequestType { return []RestoreRequestType{ "SELECT", } } type ServerSideEncryption string // Enum values for ServerSideEncryption const ( ServerSideEncryptionAes256 ServerSideEncryption = "AES256" ServerSideEncryptionAwsKms ServerSideEncryption = "aws:kms" ServerSideEncryptionAwsKmsDsse ServerSideEncryption = "aws:kms:dsse" ) // Values returns all known values for ServerSideEncryption. 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 (ServerSideEncryption) Values() []ServerSideEncryption { return []ServerSideEncryption{ "AES256", "aws:kms", "aws:kms:dsse", } } type SseKmsEncryptedObjectsStatus string // Enum values for SseKmsEncryptedObjectsStatus const ( SseKmsEncryptedObjectsStatusEnabled SseKmsEncryptedObjectsStatus = "Enabled" SseKmsEncryptedObjectsStatusDisabled SseKmsEncryptedObjectsStatus = "Disabled" ) // Values returns all known values for SseKmsEncryptedObjectsStatus. 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 (SseKmsEncryptedObjectsStatus) Values() []SseKmsEncryptedObjectsStatus { return []SseKmsEncryptedObjectsStatus{ "Enabled", "Disabled", } } type StorageClass string // Enum values for StorageClass const ( StorageClassStandard StorageClass = "STANDARD" StorageClassReducedRedundancy StorageClass = "REDUCED_REDUNDANCY" StorageClassStandardIa StorageClass = "STANDARD_IA" StorageClassOnezoneIa StorageClass = "ONEZONE_IA" StorageClassIntelligentTiering StorageClass = "INTELLIGENT_TIERING" StorageClassGlacier StorageClass = "GLACIER" StorageClassDeepArchive StorageClass = "DEEP_ARCHIVE" StorageClassOutposts StorageClass = "OUTPOSTS" StorageClassGlacierIr StorageClass = "GLACIER_IR" StorageClassSnow StorageClass = "SNOW" ) // Values returns all known values for StorageClass. 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 (StorageClass) Values() []StorageClass { return []StorageClass{ "STANDARD", "REDUCED_REDUNDANCY", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "GLACIER", "DEEP_ARCHIVE", "OUTPOSTS", "GLACIER_IR", "SNOW", } } type StorageClassAnalysisSchemaVersion string // Enum values for StorageClassAnalysisSchemaVersion const ( StorageClassAnalysisSchemaVersionV1 StorageClassAnalysisSchemaVersion = "V_1" ) // Values returns all known values for StorageClassAnalysisSchemaVersion. 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 (StorageClassAnalysisSchemaVersion) Values() []StorageClassAnalysisSchemaVersion { return []StorageClassAnalysisSchemaVersion{ "V_1", } } type TaggingDirective string // Enum values for TaggingDirective const ( TaggingDirectiveCopy TaggingDirective = "COPY" TaggingDirectiveReplace TaggingDirective = "REPLACE" ) // Values returns all known values for TaggingDirective. 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 (TaggingDirective) Values() []TaggingDirective { return []TaggingDirective{ "COPY", "REPLACE", } } type Tier string // Enum values for Tier const ( TierStandard Tier = "Standard" TierBulk Tier = "Bulk" TierExpedited Tier = "Expedited" ) // Values returns all known values for Tier. 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 (Tier) Values() []Tier { return []Tier{ "Standard", "Bulk", "Expedited", } } type TransitionStorageClass string // Enum values for TransitionStorageClass const ( TransitionStorageClassGlacier TransitionStorageClass = "GLACIER" TransitionStorageClassStandardIa TransitionStorageClass = "STANDARD_IA" TransitionStorageClassOnezoneIa TransitionStorageClass = "ONEZONE_IA" TransitionStorageClassIntelligentTiering TransitionStorageClass = "INTELLIGENT_TIERING" TransitionStorageClassDeepArchive TransitionStorageClass = "DEEP_ARCHIVE" TransitionStorageClassGlacierIr TransitionStorageClass = "GLACIER_IR" ) // Values returns all known values for TransitionStorageClass. 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 (TransitionStorageClass) Values() []TransitionStorageClass { return []TransitionStorageClass{ "GLACIER", "STANDARD_IA", "ONEZONE_IA", "INTELLIGENT_TIERING", "DEEP_ARCHIVE", "GLACIER_IR", } } type Type string // Enum values for Type const ( TypeCanonicalUser Type = "CanonicalUser" TypeAmazonCustomerByEmail Type = "AmazonCustomerByEmail" TypeGroup Type = "Group" ) // Values returns all known values for Type. 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 (Type) Values() []Type { return []Type{ "CanonicalUser", "AmazonCustomerByEmail", "Group", } }
1,258
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package types import ( "fmt" smithy "github.com/aws/smithy-go" ) // The requested bucket name is not available. The bucket namespace is shared by // all users of the system. Select a different name and try again. type BucketAlreadyExists struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *BucketAlreadyExists) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *BucketAlreadyExists) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *BucketAlreadyExists) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "BucketAlreadyExists" } return *e.ErrorCodeOverride } func (e *BucketAlreadyExists) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The bucket you tried to create already exists, and you own it. Amazon S3 // returns this error in all Amazon Web Services Regions except in the North // Virginia Region. For legacy compatibility, if you re-create an existing bucket // that you already own in the North Virginia Region, Amazon S3 returns 200 OK and // resets the bucket access control lists (ACLs). type BucketAlreadyOwnedByYou struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *BucketAlreadyOwnedByYou) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *BucketAlreadyOwnedByYou) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *BucketAlreadyOwnedByYou) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "BucketAlreadyOwnedByYou" } return *e.ErrorCodeOverride } func (e *BucketAlreadyOwnedByYou) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // Object is archived and inaccessible until restored. type InvalidObjectState struct { Message *string ErrorCodeOverride *string StorageClass StorageClass AccessTier IntelligentTieringAccessTier noSmithyDocumentSerde } func (e *InvalidObjectState) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *InvalidObjectState) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *InvalidObjectState) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "InvalidObjectState" } return *e.ErrorCodeOverride } func (e *InvalidObjectState) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The specified bucket does not exist. type NoSuchBucket struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *NoSuchBucket) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *NoSuchBucket) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *NoSuchBucket) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "NoSuchBucket" } return *e.ErrorCodeOverride } func (e *NoSuchBucket) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The specified key does not exist. type NoSuchKey struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *NoSuchKey) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *NoSuchKey) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *NoSuchKey) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "NoSuchKey" } return *e.ErrorCodeOverride } func (e *NoSuchKey) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The specified multipart upload does not exist. type NoSuchUpload struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *NoSuchUpload) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *NoSuchUpload) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *NoSuchUpload) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "NoSuchUpload" } return *e.ErrorCodeOverride } func (e *NoSuchUpload) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The specified content does not exist. type NotFound struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *NotFound) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *NotFound) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *NotFound) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "NotFound" } return *e.ErrorCodeOverride } func (e *NotFound) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // This action is not allowed against this storage tier. type ObjectAlreadyInActiveTierError struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *ObjectAlreadyInActiveTierError) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *ObjectAlreadyInActiveTierError) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *ObjectAlreadyInActiveTierError) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "ObjectAlreadyInActiveTierError" } return *e.ErrorCodeOverride } func (e *ObjectAlreadyInActiveTierError) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } // The source object of the COPY action is not in the active tier and is only // stored in Amazon S3 Glacier. type ObjectNotInActiveTierError struct { Message *string ErrorCodeOverride *string noSmithyDocumentSerde } func (e *ObjectNotInActiveTierError) Error() string { return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) } func (e *ObjectNotInActiveTierError) ErrorMessage() string { if e.Message == nil { return "" } return *e.Message } func (e *ObjectNotInActiveTierError) ErrorCode() string { if e == nil || e.ErrorCodeOverride == nil { return "ObjectNotInActiveTierError" } return *e.ErrorCodeOverride } func (e *ObjectNotInActiveTierError) ErrorFault() smithy.ErrorFault { return smithy.FaultClient }
252
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package types import ( smithydocument "github.com/aws/smithy-go/document" "time" ) // Specifies the days since the initiation of an incomplete multipart upload that // Amazon S3 will wait before permanently removing all parts of the upload. For // more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) // in the Amazon S3 User Guide. type AbortIncompleteMultipartUpload struct { // Specifies the number of days after which Amazon S3 aborts an incomplete // multipart upload. DaysAfterInitiation int32 noSmithyDocumentSerde } // Configures the transfer acceleration state for an Amazon S3 bucket. For more // information, see Amazon S3 Transfer Acceleration (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) // in the Amazon S3 User Guide. type AccelerateConfiguration struct { // Specifies the transfer acceleration status of the bucket. Status BucketAccelerateStatus noSmithyDocumentSerde } // Contains the elements that set the ACL permissions for an object per grantee. type AccessControlPolicy struct { // A list of grants. Grants []Grant // Container for the bucket owner's display name and ID. Owner *Owner noSmithyDocumentSerde } // A container for information about access control for replicas. type AccessControlTranslation struct { // Specifies the replica ownership. For default and valid values, see PUT bucket // replication (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) // in the Amazon S3 API Reference. // // This member is required. Owner OwnerOverride noSmithyDocumentSerde } // A conjunction (logical AND) of predicates, which is used in evaluating a // metrics filter. The operator must have at least two predicates in any // combination, and an object must match all of the predicates for the filter to // apply. type AnalyticsAndOperator struct { // The prefix to use when evaluating an AND predicate: The prefix that an object // must have to be included in the metrics results. Prefix *string // The list of tags to use when evaluating an AND predicate. Tags []Tag noSmithyDocumentSerde } // Specifies the configuration and any analyses for the analytics filter of an // Amazon S3 bucket. type AnalyticsConfiguration struct { // The ID that identifies the analytics configuration. // // This member is required. Id *string // Contains data related to access patterns to be collected and made available to // analyze the tradeoffs between different storage classes. // // This member is required. StorageClassAnalysis *StorageClassAnalysis // The filter used to describe a set of objects for analyses. A filter must have // exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). If no // filter is provided, all objects will be considered in any analysis. Filter AnalyticsFilter noSmithyDocumentSerde } // Where to publish the analytics results. type AnalyticsExportDestination struct { // A destination signifying output to an S3 bucket. // // This member is required. S3BucketDestination *AnalyticsS3BucketDestination noSmithyDocumentSerde } // The filter used to describe a set of objects for analyses. A filter must have // exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). If no // filter is provided, all objects will be considered in any analysis. // // The following types satisfy this interface: // // AnalyticsFilterMemberAnd // AnalyticsFilterMemberPrefix // AnalyticsFilterMemberTag type AnalyticsFilter interface { isAnalyticsFilter() } // A conjunction (logical AND) of predicates, which is used in evaluating an // analytics filter. The operator must have at least two predicates. type AnalyticsFilterMemberAnd struct { Value AnalyticsAndOperator noSmithyDocumentSerde } func (*AnalyticsFilterMemberAnd) isAnalyticsFilter() {} // The prefix to use when evaluating an analytics filter. type AnalyticsFilterMemberPrefix struct { Value string noSmithyDocumentSerde } func (*AnalyticsFilterMemberPrefix) isAnalyticsFilter() {} // The tag to use when evaluating an analytics filter. type AnalyticsFilterMemberTag struct { Value Tag noSmithyDocumentSerde } func (*AnalyticsFilterMemberTag) isAnalyticsFilter() {} // Contains information about where to publish the analytics results. type AnalyticsS3BucketDestination struct { // The Amazon Resource Name (ARN) of the bucket to which data is exported. // // This member is required. Bucket *string // Specifies the file format used when exporting data to Amazon S3. // // This member is required. Format AnalyticsS3ExportFileFormat // The account ID that owns the destination S3 bucket. If no account ID is // provided, the owner is not validated before exporting data. Although this value // is optional, we strongly recommend that you set it to help prevent problems if // the destination bucket ownership changes. BucketAccountId *string // The prefix to use when exporting data. The prefix is prepended to all results. Prefix *string noSmithyDocumentSerde } // In terms of implementation, a Bucket is a resource. An Amazon S3 bucket name is // globally unique, and the namespace is shared by all Amazon Web Services // accounts. type Bucket struct { // Date the bucket was created. This date can change when making changes to your // bucket, such as editing its bucket policy. CreationDate *time.Time // The name of the bucket. Name *string noSmithyDocumentSerde } // Specifies the lifecycle configuration for objects in an Amazon S3 bucket. For // more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) // in the Amazon S3 User Guide. type BucketLifecycleConfiguration struct { // A lifecycle rule for individual objects in an Amazon S3 bucket. // // This member is required. Rules []LifecycleRule noSmithyDocumentSerde } // Container for logging status information. type BucketLoggingStatus struct { // Describes where logs are stored and the prefix that Amazon S3 assigns to all // log object keys for a bucket. For more information, see PUT Bucket logging (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) // in the Amazon S3 API Reference. LoggingEnabled *LoggingEnabled noSmithyDocumentSerde } // Contains all the possible checksum or digest values for an object. type Checksum struct { // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string noSmithyDocumentSerde } // Container for all (if there are any) keys between Prefix and the next // occurrence of the string specified by a delimiter. CommonPrefixes lists keys // that act like subdirectories in the directory specified by Prefix. For example, // if the prefix is notes/ and the delimiter is a slash (/) as in // notes/summer/july, the common prefix is notes/summer/. type CommonPrefix struct { // Container for the specified common prefix. Prefix *string noSmithyDocumentSerde } // The container for the completed multipart upload details. type CompletedMultipartUpload struct { // Array of CompletedPart data types. If you do not supply a valid Part with your // request, the service sends back an HTTP 400 response. Parts []CompletedPart noSmithyDocumentSerde } // Details of the parts that were uploaded. type CompletedPart struct { // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Entity tag returned when the part was uploaded. ETag *string // Part number that identifies the part. This is a positive integer between 1 and // 10,000. PartNumber int32 noSmithyDocumentSerde } // A container for describing a condition that must be met for the specified // redirect to apply. For example, 1. If request is for pages in the /docs folder, // redirect to the /documents folder. 2. If request results in HTTP error 4xx, // redirect request to another host where you might process the error. type Condition struct { // The HTTP error code when the redirect is applied. In the event of an error, if // the error code equals this value, then the specified redirect is applied. // Required when parent element Condition is specified and sibling KeyPrefixEquals // is not specified. If both are specified, then both must be true for the redirect // to be applied. HttpErrorCodeReturnedEquals *string // The object key name prefix when the redirect is applied. For example, to // redirect requests for ExamplePage.html , the key prefix will be ExamplePage.html // . To redirect request for all pages with the prefix docs/ , the key prefix will // be /docs , which identifies all objects in the docs/ folder. Required when the // parent element Condition is specified and sibling HttpErrorCodeReturnedEquals // is not specified. If both conditions are specified, both must be true for the // redirect to be applied. Replacement must be made for object keys containing // special characters (such as carriage returns) when using XML requests. For more // information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . KeyPrefixEquals *string noSmithyDocumentSerde } type ContinuationEvent struct { noSmithyDocumentSerde } // Container for all response elements. type CopyObjectResult struct { // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Returns the ETag of the new object. The ETag reflects only changes to the // contents of an object, not its metadata. ETag *string // Creation date of the object. LastModified *time.Time noSmithyDocumentSerde } // Container for all response elements. type CopyPartResult struct { // The base64-encoded, 32-bit CRC32 checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Entity tag of the object. ETag *string // Date and time at which the object was uploaded. LastModified *time.Time noSmithyDocumentSerde } // Describes the cross-origin access configuration for objects in an Amazon S3 // bucket. For more information, see Enabling Cross-Origin Resource Sharing (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) // in the Amazon S3 User Guide. type CORSConfiguration struct { // A set of origins and methods (cross-origin access that you want to allow). You // can add up to 100 rules to the configuration. // // This member is required. CORSRules []CORSRule noSmithyDocumentSerde } // Specifies a cross-origin access rule for an Amazon S3 bucket. type CORSRule struct { // An HTTP method that you allow the origin to execute. Valid values are GET , PUT // , HEAD , POST , and DELETE . // // This member is required. AllowedMethods []string // One or more origins you want customers to be able to access the bucket from. // // This member is required. AllowedOrigins []string // Headers that are specified in the Access-Control-Request-Headers header. These // headers are allowed in a preflight OPTIONS request. In response to any preflight // OPTIONS request, Amazon S3 returns any requested headers that are allowed. AllowedHeaders []string // One or more headers in the response that you want customers to be able to // access from their applications (for example, from a JavaScript XMLHttpRequest // object). ExposeHeaders []string // Unique identifier for the rule. The value cannot be longer than 255 characters. ID *string // The time in seconds that your browser is to cache the preflight response for // the specified resource. MaxAgeSeconds int32 noSmithyDocumentSerde } // The configuration information for the bucket. type CreateBucketConfiguration struct { // Specifies the Region where the bucket will be created. If you don't specify a // Region, the bucket is created in the US East (N. Virginia) Region (us-east-1). LocationConstraint BucketLocationConstraint noSmithyDocumentSerde } // Describes how an uncompressed comma-separated values (CSV)-formatted input // object is formatted. type CSVInput struct { // Specifies that CSV field values may contain quoted record delimiters and such // records should be allowed. Default value is FALSE. Setting this value to TRUE // may lower performance. AllowQuotedRecordDelimiter bool // A single character used to indicate that a row should be ignored when the // character is present at the start of that row. You can specify any character to // indicate a comment line. The default character is # . Default: # Comments *string // A single character used to separate individual fields in a record. You can // specify an arbitrary delimiter. FieldDelimiter *string // Describes the first line of input. Valid values are: // - NONE : First line is not a header. // - IGNORE : First line is a header, but you can't use the header values to // indicate the column in an expression. You can use column position (such as _1, // _2, …) to indicate the column ( SELECT s._1 FROM OBJECT s ). // - Use : First line is a header, and you can use the header value to identify a // column in an expression ( SELECT "name" FROM OBJECT ). FileHeaderInfo FileHeaderInfo // A single character used for escaping when the field delimiter is part of the // value. For example, if the value is a, b , Amazon S3 wraps this field value in // quotation marks, as follows: " a , b " . Type: String Default: " Ancestors: CSV QuoteCharacter *string // A single character used for escaping the quotation mark character inside an // already escaped value. For example, the value """ a , b """ is parsed as " a , // b " . QuoteEscapeCharacter *string // A single character used to separate individual records in the input. Instead of // the default value, you can specify an arbitrary delimiter. RecordDelimiter *string noSmithyDocumentSerde } // Describes how uncompressed comma-separated values (CSV)-formatted results are // formatted. type CSVOutput struct { // The value used to separate individual fields in a record. You can specify an // arbitrary delimiter. FieldDelimiter *string // A single character used for escaping when the field delimiter is part of the // value. For example, if the value is a, b , Amazon S3 wraps this field value in // quotation marks, as follows: " a , b " . QuoteCharacter *string // The single character used for escaping the quote character inside an already // escaped value. QuoteEscapeCharacter *string // Indicates whether to use quotation marks around output fields. // - ALWAYS : Always use quotation marks for output fields. // - ASNEEDED : Use quotation marks for output fields when needed. QuoteFields QuoteFields // A single character used to separate individual records in the output. Instead // of the default value, you can specify an arbitrary delimiter. RecordDelimiter *string noSmithyDocumentSerde } // The container element for specifying the default Object Lock retention settings // for new objects placed in the specified bucket. // - The DefaultRetention settings require both a mode and a period. // - The DefaultRetention period can be either Days or Years but you must select // one. You cannot specify Days and Years at the same time. type DefaultRetention struct { // The number of days that you want to specify for the default retention period. // Must be used with Mode . Days int32 // The default Object Lock retention mode you want to apply to new objects placed // in the specified bucket. Must be used with either Days or Years . Mode ObjectLockRetentionMode // The number of years that you want to specify for the default retention period. // Must be used with Mode . Years int32 noSmithyDocumentSerde } // Container for the objects to delete. type Delete struct { // The object to delete. // // This member is required. Objects []ObjectIdentifier // Element to enable quiet mode for the request. When you add this element, you // must set its value to true. Quiet bool noSmithyDocumentSerde } // Information about the deleted object. type DeletedObject struct { // Specifies whether the versioned object that was permanently deleted was (true) // or was not (false) a delete marker. In a simple DELETE, this header indicates // whether (true) or not (false) a delete marker was created. DeleteMarker bool // The version ID of the delete marker created as a result of the DELETE // operation. If you delete a specific object version, the value returned by this // header is the version ID of the object version deleted. DeleteMarkerVersionId *string // The name of the deleted object. Key *string // The version ID of the deleted object. VersionId *string noSmithyDocumentSerde } // Information about the delete marker. type DeleteMarkerEntry struct { // Specifies whether the object is (true) or is not (false) the latest version of // an object. IsLatest bool // The object key. Key *string // Date and time the object was last modified. LastModified *time.Time // The account that created the delete marker.> Owner *Owner // Version ID of an object. VersionId *string noSmithyDocumentSerde } // Specifies whether Amazon S3 replicates delete markers. If you specify a Filter // in your replication configuration, you must also include a // DeleteMarkerReplication element. If your Filter includes a Tag element, the // DeleteMarkerReplication Status must be set to Disabled, because Amazon S3 does // not support replicating delete markers for tag-based rules. For an example // configuration, see Basic Rule Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-config-min-rule-config) // . For more information about delete marker replication, see Basic Rule // Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/delete-marker-replication.html) // . If you are using an earlier version of the replication configuration, Amazon // S3 handles replication of delete markers differently. For more information, see // Backward Compatibility (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations) // . type DeleteMarkerReplication struct { // Indicates whether to replicate delete markers. Indicates whether to replicate // delete markers. Status DeleteMarkerReplicationStatus noSmithyDocumentSerde } // Specifies information about where to publish analysis or configuration results // for an Amazon S3 bucket and S3 Replication Time Control (S3 RTC). type Destination struct { // The Amazon Resource Name (ARN) of the bucket where you want Amazon S3 to store // the results. // // This member is required. Bucket *string // Specify this only in a cross-account scenario (where source and destination // bucket owners are not the same), and you want to change replica ownership to the // Amazon Web Services account that owns the destination bucket. If this is not // specified in the replication configuration, the replicas are owned by same // Amazon Web Services account that owns the source object. AccessControlTranslation *AccessControlTranslation // Destination bucket owner account ID. In a cross-account scenario, if you direct // Amazon S3 to change replica ownership to the Amazon Web Services account that // owns the destination bucket by specifying the AccessControlTranslation // property, this is the account ID of the destination bucket owner. For more // information, see Replication Additional Configuration: Changing the Replica // Owner (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-change-owner.html) // in the Amazon S3 User Guide. Account *string // A container that provides information about encryption. If // SourceSelectionCriteria is specified, you must specify this element. EncryptionConfiguration *EncryptionConfiguration // A container specifying replication metrics-related settings enabling // replication metrics and events. Metrics *Metrics // A container specifying S3 Replication Time Control (S3 RTC), including whether // S3 RTC is enabled and the time when all objects and operations on objects must // be replicated. Must be specified together with a Metrics block. ReplicationTime *ReplicationTime // The storage class to use when replicating objects, such as S3 Standard or // reduced redundancy. By default, Amazon S3 uses the storage class of the source // object to create the object replica. For valid values, see the StorageClass // element of the PUT Bucket replication (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTreplication.html) // action in the Amazon S3 API Reference. StorageClass StorageClass noSmithyDocumentSerde } // Contains the type of server-side encryption used. type Encryption struct { // The server-side encryption algorithm used when storing job results in Amazon S3 // (for example, AES256, aws:kms ). // // This member is required. EncryptionType ServerSideEncryption // If the encryption type is aws:kms , this optional value can be used to specify // the encryption context for the restore results. KMSContext *string // If the encryption type is aws:kms , this optional value specifies the ID of the // symmetric encryption customer managed key to use for encryption of job results. // Amazon S3 only supports symmetric encryption KMS keys. For more information, see // Asymmetric keys in KMS (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) // in the Amazon Web Services Key Management Service Developer Guide. KMSKeyId *string noSmithyDocumentSerde } // Specifies encryption-related information for an Amazon S3 bucket that is a // destination for replicated objects. type EncryptionConfiguration struct { // Specifies the ID (Key ARN or Alias ARN) of the customer managed Amazon Web // Services KMS key stored in Amazon Web Services Key Management Service (KMS) for // the destination bucket. Amazon S3 uses this key to encrypt replica objects. // Amazon S3 only supports symmetric encryption KMS keys. For more information, see // Asymmetric keys in Amazon Web Services KMS (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) // in the Amazon Web Services Key Management Service Developer Guide. ReplicaKmsKeyID *string noSmithyDocumentSerde } // A message that indicates the request is complete and no more messages will be // sent. You should not assume that the request is complete until the client // receives an EndEvent . type EndEvent struct { noSmithyDocumentSerde } // Container for all error elements. type Error struct { // The error code is a string that uniquely identifies an error condition. It is // meant to be read and understood by programs that detect and handle errors by // type. The following is a list of Amazon S3 error codes. For more information, // see Error responses (https://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html) // . // - Code: AccessDenied // - Description: Access Denied // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: AccountProblem // - Description: There is a problem with your Amazon Web Services account that // prevents the action from completing successfully. Contact Amazon Web Services // Support for further assistance. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: AllAccessDisabled // - Description: All access to this Amazon S3 resource has been disabled. // Contact Amazon Web Services Support for further assistance. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: AmbiguousGrantByEmailAddress // - Description: The email address you provided is associated with more than // one account. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: AuthorizationHeaderMalformed // - Description: The authorization header you provided is invalid. // - HTTP Status Code: 400 Bad Request // - HTTP Status Code: N/A // - Code: BadDigest // - Description: The Content-MD5 you specified did not match what we received. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: BucketAlreadyExists // - Description: The requested bucket name is not available. The bucket // namespace is shared by all users of the system. Please select a different name // and try again. // - HTTP Status Code: 409 Conflict // - SOAP Fault Code Prefix: Client // - Code: BucketAlreadyOwnedByYou // - Description: The bucket you tried to create already exists, and you own it. // Amazon S3 returns this error in all Amazon Web Services Regions except in the // North Virginia Region. For legacy compatibility, if you re-create an existing // bucket that you already own in the North Virginia Region, Amazon S3 returns 200 // OK and resets the bucket access control lists (ACLs). // - Code: 409 Conflict (in all Regions except the North Virginia Region) // - SOAP Fault Code Prefix: Client // - Code: BucketNotEmpty // - Description: The bucket you tried to delete is not empty. // - HTTP Status Code: 409 Conflict // - SOAP Fault Code Prefix: Client // - Code: CredentialsNotSupported // - Description: This request does not support credentials. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: CrossLocationLoggingProhibited // - Description: Cross-location logging not allowed. Buckets in one geographic // location cannot log information to a bucket in another location. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: EntityTooSmall // - Description: Your proposed upload is smaller than the minimum allowed // object size. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: EntityTooLarge // - Description: Your proposed upload exceeds the maximum allowed object size. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: ExpiredToken // - Description: The provided token has expired. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: IllegalVersioningConfigurationException // - Description: Indicates that the versioning configuration specified in the // request is invalid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: IncompleteBody // - Description: You did not provide the number of bytes specified by the // Content-Length HTTP header // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: IncorrectNumberOfFilesInPostRequest // - Description: POST requires exactly one file upload per request. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InlineDataTooLarge // - Description: Inline data exceeds the maximum allowed size. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InternalError // - Description: We encountered an internal error. Please try again. // - HTTP Status Code: 500 Internal Server Error // - SOAP Fault Code Prefix: Server // - Code: InvalidAccessKeyId // - Description: The Amazon Web Services access key ID you provided does not // exist in our records. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: InvalidAddressingHeader // - Description: You must specify the Anonymous role. // - HTTP Status Code: N/A // - SOAP Fault Code Prefix: Client // - Code: InvalidArgument // - Description: Invalid Argument // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidBucketName // - Description: The specified bucket is not valid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidBucketState // - Description: The request is not valid with the current state of the bucket. // - HTTP Status Code: 409 Conflict // - SOAP Fault Code Prefix: Client // - Code: InvalidDigest // - Description: The Content-MD5 you specified is not valid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidEncryptionAlgorithmError // - Description: The encryption request you specified is not valid. The valid // value is AES256. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidLocationConstraint // - Description: The specified location constraint is not valid. For more // information about Regions, see How to Select a Region for Your Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro) // . // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidObjectState // - Description: The action is not valid for the current state of the object. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: InvalidPart // - Description: One or more of the specified parts could not be found. The // part might not have been uploaded, or the specified entity tag might not have // matched the part's entity tag. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidPartOrder // - Description: The list of parts was not in ascending order. Parts list must // be specified in order by part number. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidPayer // - Description: All access to this object has been disabled. Please contact // Amazon Web Services Support for further assistance. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: InvalidPolicyDocument // - Description: The content of the form does not meet the conditions specified // in the policy document. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidRange // - Description: The requested range cannot be satisfied. // - HTTP Status Code: 416 Requested Range Not Satisfiable // - SOAP Fault Code Prefix: Client // - Code: InvalidRequest // - Description: Please use AWS4-HMAC-SHA256 . // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: SOAP requests must be made over an HTTPS connection. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidRequest // - Description: Amazon S3 Transfer Acceleration is not supported for buckets // with non-DNS compliant names. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Acceleration is not supported for buckets // with periods (.) in their names. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Accelerate endpoint only supports virtual // style requests. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Accelerate is not configured on this // bucket. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Accelerate is disabled on this bucket. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Acceleration is not supported on this // bucket. Contact Amazon Web Services Support for more information. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidRequest // - Description: Amazon S3 Transfer Acceleration cannot be enabled on this // bucket. Contact Amazon Web Services Support for more information. // - HTTP Status Code: 400 Bad Request // - Code: N/A // - Code: InvalidSecurity // - Description: The provided security credentials are not valid. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: InvalidSOAPRequest // - Description: The SOAP request body is invalid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidStorageClass // - Description: The storage class you specified is not valid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidTargetBucketForLogging // - Description: The target bucket for logging does not exist, is not owned by // you, or does not have the appropriate grants for the log-delivery group. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidToken // - Description: The provided token is malformed or otherwise invalid. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: InvalidURI // - Description: Couldn't parse the specified URI. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: KeyTooLongError // - Description: Your key is too long. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MalformedACLError // - Description: The XML you provided was not well-formed or did not validate // against our published schema. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MalformedPOSTRequest // - Description: The body of your POST request is not well-formed // multipart/form-data. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MalformedXML // - Description: This happens when the user sends malformed XML (XML that // doesn't conform to the published XSD) for the configuration. The error message // is, "The XML you provided was not well-formed or did not validate against our // published schema." // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MaxMessageLengthExceeded // - Description: Your request was too big. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MaxPostPreDataLengthExceededError // - Description: Your POST request fields preceding the upload file were too // large. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MetadataTooLarge // - Description: Your metadata headers exceed the maximum allowed metadata // size. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MethodNotAllowed // - Description: The specified method is not allowed against this resource. // - HTTP Status Code: 405 Method Not Allowed // - SOAP Fault Code Prefix: Client // - Code: MissingAttachment // - Description: A SOAP attachment was expected, but none were found. // - HTTP Status Code: N/A // - SOAP Fault Code Prefix: Client // - Code: MissingContentLength // - Description: You must provide the Content-Length HTTP header. // - HTTP Status Code: 411 Length Required // - SOAP Fault Code Prefix: Client // - Code: MissingRequestBodyError // - Description: This happens when the user sends an empty XML document as a // request. The error message is, "Request body is empty." // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MissingSecurityElement // - Description: The SOAP 1.1 request is missing a security element. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: MissingSecurityHeader // - Description: Your request is missing a required header. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: NoLoggingStatusForKey // - Description: There is no such thing as a logging status subresource for a // key. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: NoSuchBucket // - Description: The specified bucket does not exist. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NoSuchBucketPolicy // - Description: The specified bucket does not have a bucket policy. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NoSuchKey // - Description: The specified key does not exist. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NoSuchLifecycleConfiguration // - Description: The lifecycle configuration does not exist. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NoSuchUpload // - Description: The specified multipart upload does not exist. The upload ID // might be invalid, or the multipart upload might have been aborted or completed. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NoSuchVersion // - Description: Indicates that the version ID specified in the request does // not match an existing version. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // - Code: NotImplemented // - Description: A header you provided implies functionality that is not // implemented. // - HTTP Status Code: 501 Not Implemented // - SOAP Fault Code Prefix: Server // - Code: NotSignedUp // - Description: Your account is not signed up for the Amazon S3 service. You // must sign up before you can use Amazon S3. You can sign up at the following URL: // Amazon S3 (http://aws.amazon.com/s3) // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: OperationAborted // - Description: A conflicting conditional action is currently in progress // against this resource. Try again. // - HTTP Status Code: 409 Conflict // - SOAP Fault Code Prefix: Client // - Code: PermanentRedirect // - Description: The bucket you are attempting to access must be addressed // using the specified endpoint. Send all future requests to this endpoint. // - HTTP Status Code: 301 Moved Permanently // - SOAP Fault Code Prefix: Client // - Code: PreconditionFailed // - Description: At least one of the preconditions you specified did not hold. // - HTTP Status Code: 412 Precondition Failed // - SOAP Fault Code Prefix: Client // - Code: Redirect // - Description: Temporary redirect. // - HTTP Status Code: 307 Moved Temporarily // - SOAP Fault Code Prefix: Client // - Code: RestoreAlreadyInProgress // - Description: Object restore is already in progress. // - HTTP Status Code: 409 Conflict // - SOAP Fault Code Prefix: Client // - Code: RequestIsNotMultiPartContent // - Description: Bucket POST must be of the enclosure-type multipart/form-data. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: RequestTimeout // - Description: Your socket connection to the server was not read from or // written to within the timeout period. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: RequestTimeTooSkewed // - Description: The difference between the request time and the server's time // is too large. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: RequestTorrentOfBucketError // - Description: Requesting the torrent file of a bucket is not permitted. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: SignatureDoesNotMatch // - Description: The request signature we calculated does not match the // signature you provided. Check your Amazon Web Services secret access key and // signing method. For more information, see REST Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/RESTAuthentication.html) // and SOAP Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/SOAPAuthentication.html) // for details. // - HTTP Status Code: 403 Forbidden // - SOAP Fault Code Prefix: Client // - Code: ServiceUnavailable // - Description: Service is unable to handle request. // - HTTP Status Code: 503 Service Unavailable // - SOAP Fault Code Prefix: Server // - Code: SlowDown // - Description: Reduce your request rate. // - HTTP Status Code: 503 Slow Down // - SOAP Fault Code Prefix: Server // - Code: TemporaryRedirect // - Description: You are being redirected to the bucket while DNS updates. // - HTTP Status Code: 307 Moved Temporarily // - SOAP Fault Code Prefix: Client // - Code: TokenRefreshRequired // - Description: The provided token must be refreshed. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: TooManyBuckets // - Description: You have attempted to create more buckets than allowed. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: UnexpectedContent // - Description: This request does not support content. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: UnresolvableGrantByEmailAddress // - Description: The email address you provided does not match any account on // record. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client // - Code: UserKeyMustBeSpecified // - Description: The bucket POST must contain the specified field name. If it // is specified, check the order of the fields. // - HTTP Status Code: 400 Bad Request // - SOAP Fault Code Prefix: Client Code *string // The error key. Key *string // The error message contains a generic description of the error condition in // English. It is intended for a human audience. Simple programs display the // message directly to the end user if they encounter an error condition they don't // know how or don't care to handle. Sophisticated programs with more exhaustive // error handling and proper internationalization are more likely to ignore the // error message. Message *string // The version ID of the error. VersionId *string noSmithyDocumentSerde } // The error information. type ErrorDocument struct { // The object key name to use when a 4XX class error occurs. Replacement must be // made for object keys containing special characters (such as carriage returns) // when using XML requests. For more information, see XML related object key // constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . // // This member is required. Key *string noSmithyDocumentSerde } // A container for specifying the configuration for Amazon EventBridge. type EventBridgeConfiguration struct { noSmithyDocumentSerde } // Optional configuration to replicate existing source bucket objects. For more // information, see Replicating Existing Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-what-is-isnot-replicated.html#existing-object-replication) // in the Amazon S3 User Guide. type ExistingObjectReplication struct { // Specifies whether Amazon S3 replicates existing source bucket objects. // // This member is required. Status ExistingObjectReplicationStatus noSmithyDocumentSerde } // Specifies the Amazon S3 object key name to filter on and whether to filter on // the suffix or prefix of the key name. type FilterRule struct { // The object key name prefix or suffix identifying one or more objects to which // the filtering rule applies. The maximum length is 1,024 characters. Overlapping // prefixes and suffixes are not supported. For more information, see Configuring // Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon S3 User Guide. Name FilterRuleName // The value that the filter searches for in object key names. Value *string noSmithyDocumentSerde } // A collection of parts associated with a multipart upload. type GetObjectAttributesParts struct { // Indicates whether the returned list of parts is truncated. A value of true // indicates that the list was truncated. A list can be truncated if the number of // parts exceeds the limit returned in the MaxParts element. IsTruncated bool // The maximum number of parts allowed in the response. MaxParts int32 // When a list is truncated, this element specifies the last part in the list, as // well as the value to use for the PartNumberMarker request parameter in a // subsequent request. NextPartNumberMarker *string // The marker for the current part. PartNumberMarker *string // A container for elements related to a particular part. A response can contain // zero or more Parts elements. Parts []ObjectPart // The total number of parts. TotalPartsCount int32 noSmithyDocumentSerde } // Container for S3 Glacier job parameters. type GlacierJobParameters struct { // Retrieval tier at which the restore will be processed. // // This member is required. Tier Tier noSmithyDocumentSerde } // Container for grant information. type Grant struct { // The person being granted permissions. Grantee *Grantee // Specifies the permission given to the grantee. Permission Permission noSmithyDocumentSerde } // Container for the person being granted permissions. type Grantee struct { // Type of grantee // // This member is required. Type Type // Screen name of the grantee. DisplayName *string // Email address of the grantee. Using email addresses to specify a grantee is // only supported in the following Amazon Web Services Regions: // - US East (N. Virginia) // - US West (N. California) // - US West (Oregon) // - Asia Pacific (Singapore) // - Asia Pacific (Sydney) // - Asia Pacific (Tokyo) // - Europe (Ireland) // - South America (São Paulo) // For a list of all the Amazon S3 supported Regions and endpoints, see Regions // and Endpoints (https://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) // in the Amazon Web Services General Reference. EmailAddress *string // The canonical user ID of the grantee. ID *string // URI of the grantee group. URI *string noSmithyDocumentSerde } // Container for the Suffix element. type IndexDocument struct { // A suffix that is appended to a request that is for a directory on the website // endpoint (for example,if the suffix is index.html and you make a request to // samplebucket/images/ the data that is returned will be for the object with the // key name images/index.html) The suffix must not be empty and must not include a // slash character. Replacement must be made for object keys containing special // characters (such as carriage returns) when using XML requests. For more // information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . // // This member is required. Suffix *string noSmithyDocumentSerde } // Container element that identifies who initiated the multipart upload. type Initiator struct { // Name of the Principal. DisplayName *string // If the principal is an Amazon Web Services account, it provides the Canonical // User ID. If the principal is an IAM User, it provides a user ARN value. ID *string noSmithyDocumentSerde } // Describes the serialization format of the object. type InputSerialization struct { // Describes the serialization of a CSV-encoded object. CSV *CSVInput // Specifies object's compression format. Valid values: NONE, GZIP, BZIP2. Default // Value: NONE. CompressionType CompressionType // Specifies JSON as object's input serialization format. JSON *JSONInput // Specifies Parquet as object's input serialization format. Parquet *ParquetInput noSmithyDocumentSerde } // A container for specifying S3 Intelligent-Tiering filters. The filters // determine the subset of objects to which the rule applies. type IntelligentTieringAndOperator struct { // An object key name prefix that identifies the subset of objects to which the // configuration applies. Prefix *string // All of these tags must exist in the object's tag set in order for the // configuration to apply. Tags []Tag noSmithyDocumentSerde } // Specifies the S3 Intelligent-Tiering configuration for an Amazon S3 bucket. For // information about the S3 Intelligent-Tiering storage class, see Storage class // for automatically optimizing frequently and infrequently accessed objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html#sc-dynamic-data-access) // . type IntelligentTieringConfiguration struct { // The ID used to identify the S3 Intelligent-Tiering configuration. // // This member is required. Id *string // Specifies the status of the configuration. // // This member is required. Status IntelligentTieringStatus // Specifies the S3 Intelligent-Tiering storage class tier of the configuration. // // This member is required. Tierings []Tiering // Specifies a bucket filter. The configuration only includes objects that meet // the filter's criteria. Filter *IntelligentTieringFilter noSmithyDocumentSerde } // The Filter is used to identify objects that the S3 Intelligent-Tiering // configuration applies to. type IntelligentTieringFilter struct { // A conjunction (logical AND) of predicates, which is used in evaluating a // metrics filter. The operator must have at least two predicates, and an object // must match all of the predicates in order for the filter to apply. And *IntelligentTieringAndOperator // An object key name prefix that identifies the subset of objects to which the // rule applies. Replacement must be made for object keys containing special // characters (such as carriage returns) when using XML requests. For more // information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . Prefix *string // A container of a key value name pair. Tag *Tag noSmithyDocumentSerde } // Specifies the inventory configuration for an Amazon S3 bucket. For more // information, see GET Bucket inventory (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETInventoryConfig.html) // in the Amazon S3 API Reference. type InventoryConfiguration struct { // Contains information about where to publish the inventory results. // // This member is required. Destination *InventoryDestination // The ID used to identify the inventory configuration. // // This member is required. Id *string // Object versions to include in the inventory list. If set to All , the list // includes all the object versions, which adds the version-related fields // VersionId , IsLatest , and DeleteMarker to the list. If set to Current , the // list does not contain these version-related fields. // // This member is required. IncludedObjectVersions InventoryIncludedObjectVersions // Specifies whether the inventory is enabled or disabled. If set to True , an // inventory list is generated. If set to False , no inventory list is generated. // // This member is required. IsEnabled bool // Specifies the schedule for generating inventory results. // // This member is required. Schedule *InventorySchedule // Specifies an inventory filter. The inventory only includes objects that meet // the filter's criteria. Filter *InventoryFilter // Contains the optional fields that are included in the inventory results. OptionalFields []InventoryOptionalField noSmithyDocumentSerde } // Specifies the inventory configuration for an Amazon S3 bucket. type InventoryDestination struct { // Contains the bucket name, file format, bucket owner (optional), and prefix // (optional) where inventory results are published. // // This member is required. S3BucketDestination *InventoryS3BucketDestination noSmithyDocumentSerde } // Contains the type of server-side encryption used to encrypt the inventory // results. type InventoryEncryption struct { // Specifies the use of SSE-KMS to encrypt delivered inventory reports. SSEKMS *SSEKMS // Specifies the use of SSE-S3 to encrypt delivered inventory reports. SSES3 *SSES3 noSmithyDocumentSerde } // Specifies an inventory filter. The inventory only includes objects that meet // the filter's criteria. type InventoryFilter struct { // The prefix that an object must have to be included in the inventory results. // // This member is required. Prefix *string noSmithyDocumentSerde } // Contains the bucket name, file format, bucket owner (optional), and prefix // (optional) where inventory results are published. type InventoryS3BucketDestination struct { // The Amazon Resource Name (ARN) of the bucket where inventory results will be // published. // // This member is required. Bucket *string // Specifies the output format of the inventory results. // // This member is required. Format InventoryFormat // The account ID that owns the destination S3 bucket. If no account ID is // provided, the owner is not validated before exporting data. Although this value // is optional, we strongly recommend that you set it to help prevent problems if // the destination bucket ownership changes. AccountId *string // Contains the type of server-side encryption used to encrypt the inventory // results. Encryption *InventoryEncryption // The prefix that is prepended to all inventory results. Prefix *string noSmithyDocumentSerde } // Specifies the schedule for generating inventory results. type InventorySchedule struct { // Specifies how frequently inventory results are produced. // // This member is required. Frequency InventoryFrequency noSmithyDocumentSerde } // Specifies JSON as object's input serialization format. type JSONInput struct { // The type of JSON. Valid values: Document, Lines. Type JSONType noSmithyDocumentSerde } // Specifies JSON as request's output serialization format. type JSONOutput struct { // The value used to separate individual records in the output. If no value is // specified, Amazon S3 uses a newline character ('\n'). RecordDelimiter *string noSmithyDocumentSerde } // A container for specifying the configuration for Lambda notifications. type LambdaFunctionConfiguration struct { // The Amazon S3 bucket event for which to invoke the Lambda function. For more // information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon S3 User Guide. // // This member is required. Events []Event // The Amazon Resource Name (ARN) of the Lambda function that Amazon S3 invokes // when the specified event type occurs. // // This member is required. LambdaFunctionArn *string // Specifies object key name filtering rules. For information about key name // filtering, see Configuring event notifications using object key name filtering (https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter // An optional unique identifier for configurations in a notification // configuration. If you don't provide one, Amazon S3 will assign an ID. Id *string noSmithyDocumentSerde } // Container for the expiration for the lifecycle of the object. For more // information see, Managing your storage lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) // in the Amazon S3 User Guide. type LifecycleExpiration struct { // Indicates at what date the object is to be moved or deleted. The date value // must conform to the ISO 8601 format. The time is always midnight UTC. Date *time.Time // Indicates the lifetime, in days, of the objects that are subject to the rule. // The value must be a non-zero positive integer. Days int32 // Indicates whether Amazon S3 will remove a delete marker with no noncurrent // versions. If set to true, the delete marker will be expired; if set to false the // policy takes no action. This cannot be specified with Days or Date in a // Lifecycle Expiration Policy. ExpiredObjectDeleteMarker bool noSmithyDocumentSerde } // A lifecycle rule for individual objects in an Amazon S3 bucket. For more // information see, Managing your storage lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lifecycle-mgmt.html) // in the Amazon S3 User Guide. type LifecycleRule struct { // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule is // not currently being applied. // // This member is required. Status ExpirationStatus // Specifies the days since the initiation of an incomplete multipart upload that // Amazon S3 will wait before permanently removing all parts of the upload. For // more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) // in the Amazon S3 User Guide. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload // Specifies the expiration for the lifecycle of the object in the form of date, // days and, whether the object has a delete marker. Expiration *LifecycleExpiration // The Filter is used to identify objects that a Lifecycle Rule applies to. A // Filter must have exactly one of Prefix , Tag , or And specified. Filter is // required if the LifecycleRule does not contain a Prefix element. Filter LifecycleRuleFilter // Unique identifier for the rule. The value cannot be longer than 255 characters. ID *string // Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 // permanently deletes the noncurrent object versions. You set this lifecycle // configuration action on a bucket that has versioning enabled (or suspended) to // request that Amazon S3 delete noncurrent object versions at a specific period in // the object's lifetime. NoncurrentVersionExpiration *NoncurrentVersionExpiration // Specifies the transition rule for the lifecycle rule that describes when // noncurrent objects transition to a specific storage class. If your bucket is // versioning-enabled (or versioning is suspended), you can set this action to // request that Amazon S3 transition noncurrent object versions to a specific // storage class at a set period in the object's lifetime. NoncurrentVersionTransitions []NoncurrentVersionTransition // Prefix identifying one or more objects to which the rule applies. This is no // longer used; use Filter instead. Replacement must be made for object keys // containing special characters (such as carriage returns) when using XML // requests. For more information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . // // Deprecated: This member has been deprecated. Prefix *string // Specifies when an Amazon S3 object transitions to a specified storage class. Transitions []Transition noSmithyDocumentSerde } // This is used in a Lifecycle Rule Filter to apply a logical AND to two or more // predicates. The Lifecycle Rule will apply to any object matching all of the // predicates configured inside the And operator. type LifecycleRuleAndOperator struct { // Minimum object size to which the rule applies. ObjectSizeGreaterThan int64 // Maximum object size to which the rule applies. ObjectSizeLessThan int64 // Prefix identifying one or more objects to which the rule applies. Prefix *string // All of these tags must exist in the object's tag set in order for the rule to // apply. Tags []Tag noSmithyDocumentSerde } // The Filter is used to identify objects that a Lifecycle Rule applies to. A // Filter must have exactly one of Prefix , Tag , or And specified. // // The following types satisfy this interface: // // LifecycleRuleFilterMemberAnd // LifecycleRuleFilterMemberObjectSizeGreaterThan // LifecycleRuleFilterMemberObjectSizeLessThan // LifecycleRuleFilterMemberPrefix // LifecycleRuleFilterMemberTag type LifecycleRuleFilter interface { isLifecycleRuleFilter() } // This is used in a Lifecycle Rule Filter to apply a logical AND to two or more // predicates. The Lifecycle Rule will apply to any object matching all of the // predicates configured inside the And operator. type LifecycleRuleFilterMemberAnd struct { Value LifecycleRuleAndOperator noSmithyDocumentSerde } func (*LifecycleRuleFilterMemberAnd) isLifecycleRuleFilter() {} // Minimum object size to which the rule applies. type LifecycleRuleFilterMemberObjectSizeGreaterThan struct { Value int64 noSmithyDocumentSerde } func (*LifecycleRuleFilterMemberObjectSizeGreaterThan) isLifecycleRuleFilter() {} // Maximum object size to which the rule applies. type LifecycleRuleFilterMemberObjectSizeLessThan struct { Value int64 noSmithyDocumentSerde } func (*LifecycleRuleFilterMemberObjectSizeLessThan) isLifecycleRuleFilter() {} // Prefix identifying one or more objects to which the rule applies. Replacement // must be made for object keys containing special characters (such as carriage // returns) when using XML requests. For more information, see XML related object // key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . type LifecycleRuleFilterMemberPrefix struct { Value string noSmithyDocumentSerde } func (*LifecycleRuleFilterMemberPrefix) isLifecycleRuleFilter() {} // This tag must exist in the object's tag set in order for the rule to apply. type LifecycleRuleFilterMemberTag struct { Value Tag noSmithyDocumentSerde } func (*LifecycleRuleFilterMemberTag) isLifecycleRuleFilter() {} // Describes where logs are stored and the prefix that Amazon S3 assigns to all // log object keys for a bucket. For more information, see PUT Bucket logging (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlogging.html) // in the Amazon S3 API Reference. type LoggingEnabled struct { // Specifies the bucket where you want Amazon S3 to store server access logs. You // can have your logs delivered to any bucket that you own, including the same // bucket that is being logged. You can also configure multiple buckets to deliver // their logs to the same target bucket. In this case, you should choose a // different TargetPrefix for each source bucket so that the delivered log files // can be distinguished by key. // // This member is required. TargetBucket *string // A prefix for all log object keys. If you store log files from multiple Amazon // S3 buckets in a single bucket, you can use a prefix to distinguish which log // files came from which bucket. // // This member is required. TargetPrefix *string // Container for granting information. Buckets that use the bucket owner enforced // setting for Object Ownership don't support target grants. For more information, // see Permissions for server access log delivery (https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general) // in the Amazon S3 User Guide. TargetGrants []TargetGrant noSmithyDocumentSerde } // A metadata key-value pair to store with an object. type MetadataEntry struct { // Name of the object. Name *string // Value of the object. Value *string noSmithyDocumentSerde } // A container specifying replication metrics-related settings enabling // replication metrics and events. type Metrics struct { // Specifies whether the replication metrics are enabled. // // This member is required. Status MetricsStatus // A container specifying the time threshold for emitting the // s3:Replication:OperationMissedThreshold event. EventThreshold *ReplicationTimeValue noSmithyDocumentSerde } // A conjunction (logical AND) of predicates, which is used in evaluating a // metrics filter. The operator must have at least two predicates, and an object // must match all of the predicates in order for the filter to apply. type MetricsAndOperator struct { // The access point ARN used when evaluating an AND predicate. AccessPointArn *string // The prefix used when evaluating an AND predicate. Prefix *string // The list of tags used when evaluating an AND predicate. Tags []Tag noSmithyDocumentSerde } // Specifies a metrics configuration for the CloudWatch request metrics (specified // by the metrics configuration ID) from an Amazon S3 bucket. If you're updating an // existing metrics configuration, note that this is a full replacement of the // existing metrics configuration. If you don't include the elements you want to // keep, they are erased. For more information, see PutBucketMetricsConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTMetricConfiguration.html) // . type MetricsConfiguration struct { // The ID used to identify the metrics configuration. The ID has a 64 character // limit and can only contain letters, numbers, periods, dashes, and underscores. // // This member is required. Id *string // Specifies a metrics configuration filter. The metrics configuration will only // include objects that meet the filter's criteria. A filter must be a prefix, an // object tag, an access point ARN, or a conjunction (MetricsAndOperator). Filter MetricsFilter noSmithyDocumentSerde } // Specifies a metrics configuration filter. The metrics configuration only // includes objects that meet the filter's criteria. A filter must be a prefix, an // object tag, an access point ARN, or a conjunction (MetricsAndOperator). For more // information, see PutBucketMetricsConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketMetricsConfiguration.html) // . // // The following types satisfy this interface: // // MetricsFilterMemberAccessPointArn // MetricsFilterMemberAnd // MetricsFilterMemberPrefix // MetricsFilterMemberTag type MetricsFilter interface { isMetricsFilter() } // The access point ARN used when evaluating a metrics filter. type MetricsFilterMemberAccessPointArn struct { Value string noSmithyDocumentSerde } func (*MetricsFilterMemberAccessPointArn) isMetricsFilter() {} // A conjunction (logical AND) of predicates, which is used in evaluating a // metrics filter. The operator must have at least two predicates, and an object // must match all of the predicates in order for the filter to apply. type MetricsFilterMemberAnd struct { Value MetricsAndOperator noSmithyDocumentSerde } func (*MetricsFilterMemberAnd) isMetricsFilter() {} // The prefix used when evaluating a metrics filter. type MetricsFilterMemberPrefix struct { Value string noSmithyDocumentSerde } func (*MetricsFilterMemberPrefix) isMetricsFilter() {} // The tag used when evaluating a metrics filter. type MetricsFilterMemberTag struct { Value Tag noSmithyDocumentSerde } func (*MetricsFilterMemberTag) isMetricsFilter() {} // Container for the MultipartUpload for the Amazon S3 object. type MultipartUpload struct { // The algorithm that was used to create a checksum of the object. ChecksumAlgorithm ChecksumAlgorithm // Date and time at which the multipart upload was initiated. Initiated *time.Time // Identifies who initiated the multipart upload. Initiator *Initiator // Key of the object for which the multipart upload was initiated. Key *string // Specifies the owner of the object that is part of the multipart upload. Owner *Owner // The class of storage used to store the object. StorageClass StorageClass // Upload ID that identifies the multipart upload. UploadId *string noSmithyDocumentSerde } // Specifies when noncurrent object versions expire. Upon expiration, Amazon S3 // permanently deletes the noncurrent object versions. You set this lifecycle // configuration action on a bucket that has versioning enabled (or suspended) to // request that Amazon S3 delete noncurrent object versions at a specific period in // the object's lifetime. type NoncurrentVersionExpiration struct { // Specifies how many noncurrent versions Amazon S3 will retain. If there are this // many more recent noncurrent versions, Amazon S3 will take the associated action. // For more information about noncurrent versions, see Lifecycle configuration // elements (https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html) // in the Amazon S3 User Guide. NewerNoncurrentVersions int32 // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. The value must be a non-zero positive integer. // For information about the noncurrent days calculations, see How Amazon S3 // Calculates When an Object Became Noncurrent (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) // in the Amazon S3 User Guide. NoncurrentDays int32 noSmithyDocumentSerde } // Container for the transition rule that describes when noncurrent objects // transition to the STANDARD_IA , ONEZONE_IA , INTELLIGENT_TIERING , GLACIER_IR , // GLACIER , or DEEP_ARCHIVE storage class. If your bucket is versioning-enabled // (or versioning is suspended), you can set this action to request that Amazon S3 // transition noncurrent object versions to the STANDARD_IA , ONEZONE_IA , // INTELLIGENT_TIERING , GLACIER_IR , GLACIER , or DEEP_ARCHIVE storage class at a // specific period in the object's lifetime. type NoncurrentVersionTransition struct { // Specifies how many noncurrent versions Amazon S3 will retain. If there are this // many more recent noncurrent versions, Amazon S3 will take the associated action. // For more information about noncurrent versions, see Lifecycle configuration // elements (https://docs.aws.amazon.com/AmazonS3/latest/userguide/intro-lifecycle-rules.html) // in the Amazon S3 User Guide. NewerNoncurrentVersions int32 // Specifies the number of days an object is noncurrent before Amazon S3 can // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates How Long an Object Has Been // Noncurrent (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) // in the Amazon S3 User Guide. NoncurrentDays int32 // The class of storage used to store the object. StorageClass TransitionStorageClass noSmithyDocumentSerde } // A container for specifying the notification configuration of the bucket. If // this element is empty, notifications are turned off for the bucket. type NotificationConfiguration struct { // Enables delivery of events to Amazon EventBridge. EventBridgeConfiguration *EventBridgeConfiguration // Describes the Lambda functions to invoke and the events for which to invoke // them. LambdaFunctionConfigurations []LambdaFunctionConfiguration // The Amazon Simple Queue Service queues to publish messages to and the events // for which to publish messages. QueueConfigurations []QueueConfiguration // The topic to which notifications are sent and the events for which // notifications are generated. TopicConfigurations []TopicConfiguration noSmithyDocumentSerde } // Specifies object key name filtering rules. For information about key name // filtering, see Configuring event notifications using object key name filtering (https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) // in the Amazon S3 User Guide. type NotificationConfigurationFilter struct { // A container for object key name prefix and suffix filtering rules. Key *S3KeyFilter noSmithyDocumentSerde } // An object consists of data and its descriptive metadata. type Object struct { // The algorithm that was used to create a checksum of the object. ChecksumAlgorithm []ChecksumAlgorithm // The entity tag is a hash of the object. The ETag reflects changes only to the // contents of an object, not its metadata. The ETag may or may not be an MD5 // digest of the object data. Whether or not it is depends on how the object was // created and how it is encrypted as described below: // - Objects created by the PUT Object, POST Object, or Copy operation, or // through the Amazon Web Services Management Console, and are encrypted by SSE-S3 // or plaintext, have ETags that are an MD5 digest of their object data. // - Objects created by the PUT Object, POST Object, or Copy operation, or // through the Amazon Web Services Management Console, and are encrypted by SSE-C // or SSE-KMS, have ETags that are not an MD5 digest of their object data. // - If an object is created by either the Multipart Upload or Part Copy // operation, the ETag is not an MD5 digest, regardless of the method of // encryption. If an object is larger than 16 MB, the Amazon Web Services // Management Console will upload or copy that object as a Multipart Upload, and // therefore the ETag will not be an MD5 digest. ETag *string // The name that you assign to an object. You use the object key to retrieve the // object. Key *string // Creation date of the object. LastModified *time.Time // The owner of the object Owner *Owner // Specifies the restoration status of an object. Objects in certain storage // classes must be restored before they can be retrieved. For more information // about these storage classes and how to work with archived objects, see Working // with archived objects (https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html) // in the Amazon S3 User Guide. RestoreStatus *RestoreStatus // Size in bytes of the object Size int64 // The class of storage used to store the object. StorageClass ObjectStorageClass noSmithyDocumentSerde } // Object Identifier is unique value to identify objects. type ObjectIdentifier struct { // Key name of the object. Replacement must be made for object keys containing // special characters (such as carriage returns) when using XML requests. For more // information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . // // This member is required. Key *string // VersionId for the specific version of the object to delete. VersionId *string noSmithyDocumentSerde } // The container element for Object Lock configuration parameters. type ObjectLockConfiguration struct { // Indicates whether this bucket has an Object Lock configuration enabled. Enable // ObjectLockEnabled when you apply ObjectLockConfiguration to a bucket. ObjectLockEnabled ObjectLockEnabled // Specifies the Object Lock rule for the specified object. Enable the this rule // when you apply ObjectLockConfiguration to a bucket. Bucket settings require // both a mode and a period. The period can be either Days or Years but you must // select one. You cannot specify Days and Years at the same time. Rule *ObjectLockRule noSmithyDocumentSerde } // A legal hold configuration for an object. type ObjectLockLegalHold struct { // Indicates whether the specified object has a legal hold in place. Status ObjectLockLegalHoldStatus noSmithyDocumentSerde } // A Retention configuration for an object. type ObjectLockRetention struct { // Indicates the Retention mode for the specified object. Mode ObjectLockRetentionMode // The date on which this Object Lock Retention will expire. RetainUntilDate *time.Time noSmithyDocumentSerde } // The container element for an Object Lock rule. type ObjectLockRule struct { // The default Object Lock retention mode and period that you want to apply to new // objects placed in the specified bucket. Bucket settings require both a mode and // a period. The period can be either Days or Years but you must select one. You // cannot specify Days and Years at the same time. DefaultRetention *DefaultRetention noSmithyDocumentSerde } // A container for elements related to an individual part. type ObjectPart struct { // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32 checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // The base64-encoded, 256-bit SHA-256 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA256 *string // The part number identifying the part. This value is a positive integer between // 1 and 10,000. PartNumber int32 // The size of the uploaded part in bytes. Size int64 noSmithyDocumentSerde } // The version of an object. type ObjectVersion struct { // The algorithm that was used to create a checksum of the object. ChecksumAlgorithm []ChecksumAlgorithm // The entity tag is an MD5 hash of that version of the object. ETag *string // Specifies whether the object is (true) or is not (false) the latest version of // an object. IsLatest bool // The object key. Key *string // Date and time the object was last modified. LastModified *time.Time // Specifies the owner of the object. Owner *Owner // Specifies the restoration status of an object. Objects in certain storage // classes must be restored before they can be retrieved. For more information // about these storage classes and how to work with archived objects, see Working // with archived objects (https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html) // in the Amazon S3 User Guide. RestoreStatus *RestoreStatus // Size in bytes of the object. Size int64 // The class of storage used to store the object. StorageClass ObjectVersionStorageClass // Version ID of an object. VersionId *string noSmithyDocumentSerde } // Describes the location where the restore job's output is stored. type OutputLocation struct { // Describes an S3 location that will receive the results of the restore request. S3 *S3Location noSmithyDocumentSerde } // Describes how results of the Select job are serialized. type OutputSerialization struct { // Describes the serialization of CSV-encoded Select results. CSV *CSVOutput // Specifies JSON as request's output serialization format. JSON *JSONOutput noSmithyDocumentSerde } // Container for the owner's display name and ID. type Owner struct { // Container for the display name of the owner. This value is only supported in // the following Amazon Web Services Regions: // - US East (N. Virginia) // - US West (N. California) // - US West (Oregon) // - Asia Pacific (Singapore) // - Asia Pacific (Sydney) // - Asia Pacific (Tokyo) // - Europe (Ireland) // - South America (São Paulo) DisplayName *string // Container for the ID of the owner. ID *string noSmithyDocumentSerde } // The container element for a bucket's ownership controls. type OwnershipControls struct { // The container element for an ownership control rule. // // This member is required. Rules []OwnershipControlsRule noSmithyDocumentSerde } // The container element for an ownership control rule. type OwnershipControlsRule struct { // The container element for object ownership for a bucket's ownership controls. // BucketOwnerPreferred - Objects uploaded to the bucket change ownership to the // bucket owner if the objects are uploaded with the bucket-owner-full-control // canned ACL. ObjectWriter - The uploading account will own the object if the // object is uploaded with the bucket-owner-full-control canned ACL. // BucketOwnerEnforced - Access control lists (ACLs) are disabled and no longer // affect permissions. The bucket owner automatically owns and has full control // over every object in the bucket. The bucket only accepts PUT requests that don't // specify an ACL or bucket owner full control ACLs, such as the // bucket-owner-full-control canned ACL or an equivalent form of this ACL expressed // in the XML format. // // This member is required. ObjectOwnership ObjectOwnership noSmithyDocumentSerde } // Container for Parquet. type ParquetInput struct { noSmithyDocumentSerde } // Container for elements related to a part. type Part struct { // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 32-bit CRC32 checksum of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumCRC32 *string // The base64-encoded, 32-bit CRC32C checksum of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumCRC32C *string // The base64-encoded, 160-bit SHA-1 digest of the object. This will only be // present if it was uploaded with the object. With multipart uploads, this may not // be a checksum value of the object. For more information about how checksums are // calculated with multipart uploads, see Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html#large-object-checksums) // in the Amazon S3 User Guide. ChecksumSHA1 *string // This header can be used as a data integrity check to verify that the data // received is the same data that was originally sent. This header specifies the // base64-encoded, 256-bit SHA-256 digest of the object. For more information, see // Checking object integrity (https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html) // in the Amazon S3 User Guide. ChecksumSHA256 *string // Entity tag returned when the part was uploaded. ETag *string // Date and time at which the part was uploaded. LastModified *time.Time // Part number identifying the part. This is a positive integer between 1 and // 10,000. PartNumber int32 // Size in bytes of the uploaded part data. Size int64 noSmithyDocumentSerde } // The container element for a bucket's policy status. type PolicyStatus struct { // The policy status for this bucket. TRUE indicates that this bucket is public. // FALSE indicates that the bucket is not public. IsPublic bool noSmithyDocumentSerde } // This data type contains information about progress of an operation. type Progress struct { // The current number of uncompressed object bytes processed. BytesProcessed int64 // The current number of bytes of records payload data returned. BytesReturned int64 // The current number of object bytes scanned. BytesScanned int64 noSmithyDocumentSerde } // This data type contains information about the progress event of an operation. type ProgressEvent struct { // The Progress event details. Details *Progress noSmithyDocumentSerde } // The PublicAccessBlock configuration that you want to apply to this Amazon S3 // bucket. You can enable the configuration options in any combination. For more // information about when Amazon S3 considers a bucket or object public, see The // Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) // in the Amazon S3 User Guide. type PublicAccessBlockConfiguration struct { // Specifies whether Amazon S3 should block public access control lists (ACLs) for // this bucket and objects in this bucket. Setting this element to TRUE causes the // following behavior: // - PUT Bucket ACL and PUT Object ACL calls fail if the specified ACL is // public. // - PUT Object calls fail if the request includes a public ACL. // - PUT Bucket calls fail if the request includes a public ACL. // Enabling this setting doesn't affect existing policies or ACLs. BlockPublicAcls bool // Specifies whether Amazon S3 should block public bucket policies for this // bucket. Setting this element to TRUE causes Amazon S3 to reject calls to PUT // Bucket policy if the specified bucket policy allows public access. Enabling this // setting doesn't affect existing bucket policies. BlockPublicPolicy bool // Specifies whether Amazon S3 should ignore public ACLs for this bucket and // objects in this bucket. Setting this element to TRUE causes Amazon S3 to ignore // all public ACLs on this bucket and objects in this bucket. Enabling this setting // doesn't affect the persistence of any existing ACLs and doesn't prevent new // public ACLs from being set. IgnorePublicAcls bool // Specifies whether Amazon S3 should restrict public bucket policies for this // bucket. Setting this element to TRUE restricts access to this bucket to only // Amazon Web Service principals and authorized users within this account if the // bucket has a public policy. Enabling this setting doesn't affect previously // stored bucket policies, except that public and cross-account access within any // public bucket policy, including non-public delegation to specific accounts, is // blocked. RestrictPublicBuckets bool noSmithyDocumentSerde } // Specifies the configuration for publishing messages to an Amazon Simple Queue // Service (Amazon SQS) queue when Amazon S3 detects specified events. type QueueConfiguration struct { // A collection of bucket events for which to send notifications // // This member is required. Events []Event // The Amazon Resource Name (ARN) of the Amazon SQS queue to which Amazon S3 // publishes a message when it detects events of the specified type. // // This member is required. QueueArn *string // Specifies object key name filtering rules. For information about key name // filtering, see Configuring event notifications using object key name filtering (https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter // An optional unique identifier for configurations in a notification // configuration. If you don't provide one, Amazon S3 will assign an ID. Id *string noSmithyDocumentSerde } // The container for the records event. type RecordsEvent struct { // The byte array of partial, one or more result records. Payload []byte noSmithyDocumentSerde } // Specifies how requests are redirected. In the event of an error, you can // specify a different error code to return. type Redirect struct { // The host name to use in the redirect request. HostName *string // The HTTP redirect code to use on the response. Not required if one of the // siblings is present. HttpRedirectCode *string // Protocol to use when redirecting requests. The default is the protocol that is // used in the original request. Protocol Protocol // The object key prefix to use in the redirect request. For example, to redirect // requests for all pages with prefix docs/ (objects in the docs/ folder) to // documents/ , you can set a condition block with KeyPrefixEquals set to docs/ // and in the Redirect set ReplaceKeyPrefixWith to /documents . Not required if one // of the siblings is present. Can be present only if ReplaceKeyWith is not // provided. Replacement must be made for object keys containing special characters // (such as carriage returns) when using XML requests. For more information, see // XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . ReplaceKeyPrefixWith *string // The specific object key to use in the redirect request. For example, redirect // request to error.html . Not required if one of the siblings is present. Can be // present only if ReplaceKeyPrefixWith is not provided. Replacement must be made // for object keys containing special characters (such as carriage returns) when // using XML requests. For more information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . ReplaceKeyWith *string noSmithyDocumentSerde } // Specifies the redirect behavior of all requests to a website endpoint of an // Amazon S3 bucket. type RedirectAllRequestsTo struct { // Name of the host where requests are redirected. // // This member is required. HostName *string // Protocol to use when redirecting requests. The default is the protocol that is // used in the original request. Protocol Protocol noSmithyDocumentSerde } // A filter that you can specify for selection for modifications on replicas. // Amazon S3 doesn't replicate replica modifications by default. In the latest // version of replication configuration (when Filter is specified), you can // specify this element and set the status to Enabled to replicate modifications // on replicas. If you don't specify the Filter element, Amazon S3 assumes that // the replication configuration is the earlier version, V1. In the earlier // version, this element is not allowed. type ReplicaModifications struct { // Specifies whether Amazon S3 replicates modifications on replicas. // // This member is required. Status ReplicaModificationsStatus noSmithyDocumentSerde } // A container for replication rules. You can add up to 1,000 rules. The maximum // size of a replication configuration is 2 MB. type ReplicationConfiguration struct { // The Amazon Resource Name (ARN) of the Identity and Access Management (IAM) role // that Amazon S3 assumes when replicating objects. For more information, see How // to Set Up Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-how-setup.html) // in the Amazon S3 User Guide. // // This member is required. Role *string // A container for one or more replication rules. A replication configuration must // have at least one rule and can contain a maximum of 1,000 rules. // // This member is required. Rules []ReplicationRule noSmithyDocumentSerde } // Specifies which Amazon S3 objects to replicate and where to store the replicas. type ReplicationRule struct { // A container for information about the replication destination and its // configurations including enabling the S3 Replication Time Control (S3 RTC). // // This member is required. Destination *Destination // Specifies whether the rule is enabled. // // This member is required. Status ReplicationRuleStatus // Specifies whether Amazon S3 replicates delete markers. If you specify a Filter // in your replication configuration, you must also include a // DeleteMarkerReplication element. If your Filter includes a Tag element, the // DeleteMarkerReplication Status must be set to Disabled, because Amazon S3 does // not support replicating delete markers for tag-based rules. For an example // configuration, see Basic Rule Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-config-min-rule-config) // . For more information about delete marker replication, see Basic Rule // Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/delete-marker-replication.html) // . If you are using an earlier version of the replication configuration, Amazon // S3 handles replication of delete markers differently. For more information, see // Backward Compatibility (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-add-config.html#replication-backward-compat-considerations) // . DeleteMarkerReplication *DeleteMarkerReplication // Optional configuration to replicate existing source bucket objects. For more // information, see Replicating Existing Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-what-is-isnot-replicated.html#existing-object-replication) // in the Amazon S3 User Guide. ExistingObjectReplication *ExistingObjectReplication // A filter that identifies the subset of objects to which the replication rule // applies. A Filter must specify exactly one Prefix , Tag , or an And child // element. Filter ReplicationRuleFilter // A unique identifier for the rule. The maximum value is 255 characters. ID *string // An object key name prefix that identifies the object or objects to which the // rule applies. The maximum prefix length is 1,024 characters. To include all // objects in a bucket, specify an empty string. Replacement must be made for // object keys containing special characters (such as carriage returns) when using // XML requests. For more information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . // // Deprecated: This member has been deprecated. Prefix *string // The priority indicates which rule has precedence whenever two or more // replication rules conflict. Amazon S3 will attempt to replicate objects // according to all replication rules. However, if there are two or more rules with // the same destination bucket, then objects will be replicated according to the // rule with the highest priority. The higher the number, the higher the priority. // For more information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) // in the Amazon S3 User Guide. Priority int32 // A container that describes additional filters for identifying the source // objects that you want to replicate. You can choose to enable or disable the // replication of these objects. Currently, Amazon S3 supports only the filter that // you can specify for objects created with server-side encryption using a customer // managed key stored in Amazon Web Services Key Management Service (SSE-KMS). SourceSelectionCriteria *SourceSelectionCriteria noSmithyDocumentSerde } // A container for specifying rule filters. The filters determine the subset of // objects to which the rule applies. This element is required only if you specify // more than one filter. For example: // - If you specify both a Prefix and a Tag filter, wrap these filters in an And // tag. // - If you specify a filter based on multiple tags, wrap the Tag elements in an // And tag. type ReplicationRuleAndOperator struct { // An object key name prefix that identifies the subset of objects to which the // rule applies. Prefix *string // An array of tags containing key and value pairs. Tags []Tag noSmithyDocumentSerde } // A filter that identifies the subset of objects to which the replication rule // applies. A Filter must specify exactly one Prefix , Tag , or an And child // element. // // The following types satisfy this interface: // // ReplicationRuleFilterMemberAnd // ReplicationRuleFilterMemberPrefix // ReplicationRuleFilterMemberTag type ReplicationRuleFilter interface { isReplicationRuleFilter() } // A container for specifying rule filters. The filters determine the subset of // objects to which the rule applies. This element is required only if you specify // more than one filter. For example: // - If you specify both a Prefix and a Tag filter, wrap these filters in an And // tag. // - If you specify a filter based on multiple tags, wrap the Tag elements in an // And tag. type ReplicationRuleFilterMemberAnd struct { Value ReplicationRuleAndOperator noSmithyDocumentSerde } func (*ReplicationRuleFilterMemberAnd) isReplicationRuleFilter() {} // An object key name prefix that identifies the subset of objects to which the // rule applies. Replacement must be made for object keys containing special // characters (such as carriage returns) when using XML requests. For more // information, see XML related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints) // . type ReplicationRuleFilterMemberPrefix struct { Value string noSmithyDocumentSerde } func (*ReplicationRuleFilterMemberPrefix) isReplicationRuleFilter() {} // A container for specifying a tag key and value. The rule applies only to // objects that have the tag in their tag set. type ReplicationRuleFilterMemberTag struct { Value Tag noSmithyDocumentSerde } func (*ReplicationRuleFilterMemberTag) isReplicationRuleFilter() {} // A container specifying S3 Replication Time Control (S3 RTC) related // information, including whether S3 RTC is enabled and the time when all objects // and operations on objects must be replicated. Must be specified together with a // Metrics block. type ReplicationTime struct { // Specifies whether the replication time is enabled. // // This member is required. Status ReplicationTimeStatus // A container specifying the time by which replication should be complete for all // objects and operations on objects. // // This member is required. Time *ReplicationTimeValue noSmithyDocumentSerde } // A container specifying the time value for S3 Replication Time Control (S3 RTC) // and replication metrics EventThreshold . type ReplicationTimeValue struct { // Contains an integer specifying time in minutes. Valid value: 15 Minutes int32 noSmithyDocumentSerde } // Container for Payer. type RequestPaymentConfiguration struct { // Specifies who pays for the download and request fees. // // This member is required. Payer Payer noSmithyDocumentSerde } // Container for specifying if periodic QueryProgress messages should be sent. type RequestProgress struct { // Specifies whether periodic QueryProgress frames should be sent. Valid values: // TRUE, FALSE. Default value: FALSE. Enabled bool noSmithyDocumentSerde } // Container for restore job parameters. type RestoreRequest struct { // Lifetime of the active copy in days. Do not use with restores that specify // OutputLocation . The Days element is required for regular restores, and must not // be provided for select requests. Days int32 // The optional description for the job. Description *string // S3 Glacier related parameters pertaining to this job. Do not use with restores // that specify OutputLocation . GlacierJobParameters *GlacierJobParameters // Describes the location where the restore job's output is stored. OutputLocation *OutputLocation // Describes the parameters for Select job types. SelectParameters *SelectParameters // Retrieval tier at which the restore will be processed. Tier Tier // Type of restore request. Type RestoreRequestType noSmithyDocumentSerde } // Specifies the restoration status of an object. Objects in certain storage // classes must be restored before they can be retrieved. For more information // about these storage classes and how to work with archived objects, see Working // with archived objects (https://docs.aws.amazon.com/AmazonS3/latest/userguide/archived-objects.html) // in the Amazon S3 User Guide. type RestoreStatus struct { // Specifies whether the object is currently being restored. If the object // restoration is in progress, the header returns the value TRUE . For example: // x-amz-optional-object-attributes: IsRestoreInProgress="true" If the object // restoration has completed, the header returns the value FALSE . For example: // x-amz-optional-object-attributes: IsRestoreInProgress="false", // RestoreExpiryDate="2012-12-21T00:00:00.000Z" If the object hasn't been restored, // there is no header response. IsRestoreInProgress bool // Indicates when the restored copy will expire. This value is populated only if // the object has already been restored. For example: // x-amz-optional-object-attributes: IsRestoreInProgress="false", // RestoreExpiryDate="2012-12-21T00:00:00.000Z" RestoreExpiryDate *time.Time noSmithyDocumentSerde } // Specifies the redirect behavior and when a redirect is applied. For more // information about routing rules, see Configuring advanced conditional redirects (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html#advanced-conditional-redirects) // in the Amazon S3 User Guide. type RoutingRule struct { // Container for redirect information. You can redirect requests to another host, // to another page, or with another protocol. In the event of an error, you can // specify a different error code to return. // // This member is required. Redirect *Redirect // A container for describing a condition that must be met for the specified // redirect to apply. For example, 1. If request is for pages in the /docs folder, // redirect to the /documents folder. 2. If request results in HTTP error 4xx, // redirect request to another host where you might process the error. Condition *Condition noSmithyDocumentSerde } // A container for object key name prefix and suffix filtering rules. type S3KeyFilter struct { // A list of containers for the key-value pair that defines the criteria for the // filter rule. FilterRules []FilterRule noSmithyDocumentSerde } // Describes an Amazon S3 location that will receive the results of the restore // request. type S3Location struct { // The name of the bucket where the restore results will be placed. // // This member is required. BucketName *string // The prefix that is prepended to the restore results for this request. // // This member is required. Prefix *string // A list of grants that control access to the staged results. AccessControlList []Grant // The canned ACL to apply to the restore results. CannedACL ObjectCannedACL // Contains the type of server-side encryption used. Encryption *Encryption // The class of storage used to store the restore results. StorageClass StorageClass // The tag-set that is applied to the restore results. Tagging *Tagging // A list of metadata to store with the restore results in S3. UserMetadata []MetadataEntry noSmithyDocumentSerde } // Specifies the byte range of the object to get the records from. A record is // processed when its first byte is contained by the range. This parameter is // optional, but when specified, it must not be empty. See RFC 2616, Section // 14.35.1 about how to specify the start and end of the range. type ScanRange struct { // Specifies the end of the byte range. This parameter is optional. Valid values: // non-negative integers. The default value is one less than the size of the object // being queried. If only the End parameter is supplied, it is interpreted to mean // scan the last N bytes of the file. For example, 50 means scan the last 50 bytes. End int64 // Specifies the start of the byte range. This parameter is optional. Valid // values: non-negative integers. The default value is 0. If only start is // supplied, it means scan from that point to the end of the file. For example, 50 // means scan from byte 50 until the end of the file. Start int64 noSmithyDocumentSerde } // The container for selecting objects from a content event stream. // // The following types satisfy this interface: // // SelectObjectContentEventStreamMemberCont // SelectObjectContentEventStreamMemberEnd // SelectObjectContentEventStreamMemberProgress // SelectObjectContentEventStreamMemberRecords // SelectObjectContentEventStreamMemberStats type SelectObjectContentEventStream interface { isSelectObjectContentEventStream() } // The Continuation Event. type SelectObjectContentEventStreamMemberCont struct { Value ContinuationEvent noSmithyDocumentSerde } func (*SelectObjectContentEventStreamMemberCont) isSelectObjectContentEventStream() {} // The End Event. type SelectObjectContentEventStreamMemberEnd struct { Value EndEvent noSmithyDocumentSerde } func (*SelectObjectContentEventStreamMemberEnd) isSelectObjectContentEventStream() {} // The Progress Event. type SelectObjectContentEventStreamMemberProgress struct { Value ProgressEvent noSmithyDocumentSerde } func (*SelectObjectContentEventStreamMemberProgress) isSelectObjectContentEventStream() {} // The Records Event. type SelectObjectContentEventStreamMemberRecords struct { Value RecordsEvent noSmithyDocumentSerde } func (*SelectObjectContentEventStreamMemberRecords) isSelectObjectContentEventStream() {} // The Stats Event. type SelectObjectContentEventStreamMemberStats struct { Value StatsEvent noSmithyDocumentSerde } func (*SelectObjectContentEventStreamMemberStats) isSelectObjectContentEventStream() {} // Describes the parameters for Select job types. type SelectParameters struct { // The expression that is used to query the object. // // This member is required. Expression *string // The type of the provided expression (for example, SQL). // // This member is required. ExpressionType ExpressionType // Describes the serialization format of the object. // // This member is required. InputSerialization *InputSerialization // Describes how the results of the Select job are serialized. // // This member is required. OutputSerialization *OutputSerialization noSmithyDocumentSerde } // Describes the default server-side encryption to apply to new objects in the // bucket. If a PUT Object request doesn't specify any server-side encryption, this // default encryption will be applied. If you don't specify a customer managed key // at configuration, Amazon S3 automatically creates an Amazon Web Services KMS key // in your Amazon Web Services account the first time that you add an object // encrypted with SSE-KMS to a bucket. By default, Amazon S3 uses this KMS key for // SSE-KMS. For more information, see PUT Bucket encryption (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTencryption.html) // in the Amazon S3 API Reference. type ServerSideEncryptionByDefault struct { // Server-side encryption algorithm to use for the default encryption. // // This member is required. SSEAlgorithm ServerSideEncryption // Amazon Web Services Key Management Service (KMS) customer Amazon Web Services // KMS key ID to use for the default encryption. This parameter is allowed if and // only if SSEAlgorithm is set to aws:kms . You can specify the key ID or the // Amazon Resource Name (ARN) of the KMS key. If you use a key ID, you can run into // a LogDestination undeliverable error when creating a VPC flow log. If you are // using encryption with cross-account or Amazon Web Services service operations // you must use a fully qualified KMS key ARN. For more information, see Using // encryption for cross-account operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html#bucket-encryption-update-bucket-policy) // . // - Key ID: 1234abcd-12ab-34cd-56ef-1234567890ab // - Key ARN: // arn:aws:kms:us-east-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab // Amazon S3 only supports symmetric encryption KMS keys. For more information, // see Asymmetric keys in Amazon Web Services KMS (https://docs.aws.amazon.com/kms/latest/developerguide/symmetric-asymmetric.html) // in the Amazon Web Services Key Management Service Developer Guide. KMSMasterKeyID *string noSmithyDocumentSerde } // Specifies the default server-side-encryption configuration. type ServerSideEncryptionConfiguration struct { // Container for information about a particular server-side encryption // configuration rule. // // This member is required. Rules []ServerSideEncryptionRule noSmithyDocumentSerde } // Specifies the default server-side encryption configuration. type ServerSideEncryptionRule struct { // Specifies the default server-side encryption to apply to new objects in the // bucket. If a PUT Object request doesn't specify any server-side encryption, this // default encryption will be applied. ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault // Specifies whether Amazon S3 should use an S3 Bucket Key with server-side // encryption using KMS (SSE-KMS) for new objects in the bucket. Existing objects // are not affected. Setting the BucketKeyEnabled element to true causes Amazon S3 // to use an S3 Bucket Key. By default, S3 Bucket Key is not enabled. For more // information, see Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) // in the Amazon S3 User Guide. BucketKeyEnabled bool noSmithyDocumentSerde } // A container that describes additional filters for identifying the source // objects that you want to replicate. You can choose to enable or disable the // replication of these objects. Currently, Amazon S3 supports only the filter that // you can specify for objects created with server-side encryption using a customer // managed key stored in Amazon Web Services Key Management Service (SSE-KMS). type SourceSelectionCriteria struct { // A filter that you can specify for selections for modifications on replicas. // Amazon S3 doesn't replicate replica modifications by default. In the latest // version of replication configuration (when Filter is specified), you can // specify this element and set the status to Enabled to replicate modifications // on replicas. If you don't specify the Filter element, Amazon S3 assumes that // the replication configuration is the earlier version, V1. In the earlier // version, this element is not allowed ReplicaModifications *ReplicaModifications // A container for filter information for the selection of Amazon S3 objects // encrypted with Amazon Web Services KMS. If you include SourceSelectionCriteria // in the replication configuration, this element is required. SseKmsEncryptedObjects *SseKmsEncryptedObjects noSmithyDocumentSerde } // Specifies the use of SSE-KMS to encrypt delivered inventory reports. type SSEKMS struct { // Specifies the ID of the Key Management Service (KMS) symmetric encryption // customer managed key to use for encrypting inventory reports. // // This member is required. KeyId *string noSmithyDocumentSerde } // A container for filter information for the selection of S3 objects encrypted // with Amazon Web Services KMS. type SseKmsEncryptedObjects struct { // Specifies whether Amazon S3 replicates objects created with server-side // encryption using an Amazon Web Services KMS key stored in Amazon Web Services // Key Management Service. // // This member is required. Status SseKmsEncryptedObjectsStatus noSmithyDocumentSerde } // Specifies the use of SSE-S3 to encrypt delivered inventory reports. type SSES3 struct { noSmithyDocumentSerde } // Container for the stats details. type Stats struct { // The total number of uncompressed object bytes processed. BytesProcessed int64 // The total number of bytes of records payload data returned. BytesReturned int64 // The total number of object bytes scanned. BytesScanned int64 noSmithyDocumentSerde } // Container for the Stats Event. type StatsEvent struct { // The Stats event details. Details *Stats noSmithyDocumentSerde } // Specifies data related to access patterns to be collected and made available to // analyze the tradeoffs between different storage classes for an Amazon S3 bucket. type StorageClassAnalysis struct { // Specifies how data related to the storage class analysis for an Amazon S3 // bucket should be exported. DataExport *StorageClassAnalysisDataExport noSmithyDocumentSerde } // Container for data related to the storage class analysis for an Amazon S3 // bucket for export. type StorageClassAnalysisDataExport struct { // The place to store the data for an analysis. // // This member is required. Destination *AnalyticsExportDestination // The version of the output schema to use when exporting data. Must be V_1 . // // This member is required. OutputSchemaVersion StorageClassAnalysisSchemaVersion noSmithyDocumentSerde } // A container of a key value name pair. type Tag struct { // Name of the object key. // // This member is required. Key *string // Value of the tag. // // This member is required. Value *string noSmithyDocumentSerde } // Container for TagSet elements. type Tagging struct { // A collection for a set of tags // // This member is required. TagSet []Tag noSmithyDocumentSerde } // Container for granting information. Buckets that use the bucket owner enforced // setting for Object Ownership don't support target grants. For more information, // see Permissions server access log delivery (https://docs.aws.amazon.com/AmazonS3/latest/userguide/enable-server-access-logging.html#grant-log-delivery-permissions-general) // in the Amazon S3 User Guide. type TargetGrant struct { // Container for the person being granted permissions. Grantee *Grantee // Logging permissions assigned to the grantee for the bucket. Permission BucketLogsPermission noSmithyDocumentSerde } // The S3 Intelligent-Tiering storage class is designed to optimize storage costs // by automatically moving data to the most cost-effective storage access tier, // without additional operational overhead. type Tiering struct { // S3 Intelligent-Tiering access tier. See Storage class for automatically // optimizing frequently and infrequently accessed objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html#sc-dynamic-data-access) // for a list of access tiers in the S3 Intelligent-Tiering storage class. // // This member is required. AccessTier IntelligentTieringAccessTier // The number of consecutive days of no access after which an object will be // eligible to be transitioned to the corresponding tier. The minimum number of // days specified for Archive Access tier must be at least 90 days and Deep Archive // Access tier must be at least 180 days. The maximum can be up to 2 years (730 // days). // // This member is required. Days int32 noSmithyDocumentSerde } // A container for specifying the configuration for publication of messages to an // Amazon Simple Notification Service (Amazon SNS) topic when Amazon S3 detects // specified events. type TopicConfiguration struct { // The Amazon S3 bucket event about which to send notifications. For more // information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) // in the Amazon S3 User Guide. // // This member is required. Events []Event // The Amazon Resource Name (ARN) of the Amazon SNS topic to which Amazon S3 // publishes a message when it detects events of the specified type. // // This member is required. TopicArn *string // Specifies object key name filtering rules. For information about key name // filtering, see Configuring event notifications using object key name filtering (https://docs.aws.amazon.com/AmazonS3/latest/userguide/notification-how-to-filtering.html) // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter // An optional unique identifier for configurations in a notification // configuration. If you don't provide one, Amazon S3 will assign an ID. Id *string noSmithyDocumentSerde } // Specifies when an object transitions to a specified storage class. For more // information about Amazon S3 lifecycle configuration rules, see Transitioning // Objects Using Amazon S3 Lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html) // in the Amazon S3 User Guide. type Transition struct { // Indicates when objects are transitioned to the specified storage class. The // date value must be in ISO 8601 format. The time is always midnight UTC. Date *time.Time // Indicates the number of days after creation when objects are transitioned to // the specified storage class. The value must be a positive integer. Days int32 // The storage class to which you want the object to transition. StorageClass TransitionStorageClass noSmithyDocumentSerde } // Describes the versioning state of an Amazon S3 bucket. For more information, // see PUT Bucket versioning (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTVersioningStatus.html) // in the Amazon S3 API Reference. type VersioningConfiguration struct { // Specifies whether MFA delete is enabled in the bucket versioning configuration. // This element is only returned if the bucket has been configured with MFA delete. // If the bucket has never been so configured, this element is not returned. MFADelete MFADelete // The versioning state of the bucket. Status BucketVersioningStatus noSmithyDocumentSerde } // Specifies website configuration parameters for an Amazon S3 bucket. type WebsiteConfiguration struct { // The name of the error document for the website. ErrorDocument *ErrorDocument // The name of the index document for the website. IndexDocument *IndexDocument // The redirect behavior for every request to this bucket's website endpoint. If // you specify this property, you can't specify any other property. RedirectAllRequestsTo *RedirectAllRequestsTo // Rules that define when a redirect is applied and the redirect behavior. RoutingRules []RoutingRule noSmithyDocumentSerde } type noSmithyDocumentSerde = smithydocument.NoSerde // UnknownUnionMember is returned when a union member is returned over the wire, // but has an unknown tag. type UnknownUnionMember struct { Tag string Value []byte noSmithyDocumentSerde } func (*UnknownUnionMember) isAnalyticsFilter() {} func (*UnknownUnionMember) isLifecycleRuleFilter() {} func (*UnknownUnionMember) isMetricsFilter() {} func (*UnknownUnionMember) isReplicationRuleFilter() {} func (*UnknownUnionMember) isSelectObjectContentEventStream() {}
3,323
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package types_test import ( "fmt" "github.com/aws/aws-sdk-go-v2/service/s3/types" ) func ExampleAnalyticsFilter_outputUsage() { var union types.AnalyticsFilter // type switches can be used to check the union value switch v := union.(type) { case *types.AnalyticsFilterMemberAnd: _ = v.Value // Value is types.AnalyticsAndOperator case *types.AnalyticsFilterMemberPrefix: _ = v.Value // Value is string case *types.AnalyticsFilterMemberTag: _ = v.Value // Value is types.Tag case *types.UnknownUnionMember: fmt.Println("unknown tag:", v.Tag) default: fmt.Println("union is nil or unknown type") } } var _ *string var _ *types.Tag var _ *types.AnalyticsAndOperator func ExampleLifecycleRuleFilter_outputUsage() { var union types.LifecycleRuleFilter // type switches can be used to check the union value switch v := union.(type) { case *types.LifecycleRuleFilterMemberAnd: _ = v.Value // Value is types.LifecycleRuleAndOperator case *types.LifecycleRuleFilterMemberObjectSizeGreaterThan: _ = v.Value // Value is int64 case *types.LifecycleRuleFilterMemberObjectSizeLessThan: _ = v.Value // Value is int64 case *types.LifecycleRuleFilterMemberPrefix: _ = v.Value // Value is string case *types.LifecycleRuleFilterMemberTag: _ = v.Value // Value is types.Tag case *types.UnknownUnionMember: fmt.Println("unknown tag:", v.Tag) default: fmt.Println("union is nil or unknown type") } } var _ *string var _ *types.LifecycleRuleAndOperator var _ int64 var _ int64 var _ *types.Tag func ExampleMetricsFilter_outputUsage() { var union types.MetricsFilter // type switches can be used to check the union value switch v := union.(type) { case *types.MetricsFilterMemberAccessPointArn: _ = v.Value // Value is string case *types.MetricsFilterMemberAnd: _ = v.Value // Value is types.MetricsAndOperator case *types.MetricsFilterMemberPrefix: _ = v.Value // Value is string case *types.MetricsFilterMemberTag: _ = v.Value // Value is types.Tag case *types.UnknownUnionMember: fmt.Println("unknown tag:", v.Tag) default: fmt.Println("union is nil or unknown type") } } var _ *string var _ *string var _ *types.Tag var _ *types.MetricsAndOperator func ExampleReplicationRuleFilter_outputUsage() { var union types.ReplicationRuleFilter // type switches can be used to check the union value switch v := union.(type) { case *types.ReplicationRuleFilterMemberAnd: _ = v.Value // Value is types.ReplicationRuleAndOperator case *types.ReplicationRuleFilterMemberPrefix: _ = v.Value // Value is string case *types.ReplicationRuleFilterMemberTag: _ = v.Value // Value is types.Tag case *types.UnknownUnionMember: fmt.Println("unknown tag:", v.Tag) default: fmt.Println("union is nil or unknown type") } } var _ *string var _ *types.Tag var _ *types.ReplicationRuleAndOperator func ExampleSelectObjectContentEventStream_outputUsage() { var union types.SelectObjectContentEventStream // type switches can be used to check the union value switch v := union.(type) { case *types.SelectObjectContentEventStreamMemberCont: _ = v.Value // Value is types.ContinuationEvent case *types.SelectObjectContentEventStreamMemberEnd: _ = v.Value // Value is types.EndEvent case *types.SelectObjectContentEventStreamMemberProgress: _ = v.Value // Value is types.ProgressEvent case *types.SelectObjectContentEventStreamMemberRecords: _ = v.Value // Value is types.RecordsEvent case *types.SelectObjectContentEventStreamMemberStats: _ = v.Value // Value is types.StatsEvent case *types.UnknownUnionMember: fmt.Println("unknown tag:", v.Tag) default: fmt.Println("union is nil or unknown type") } } var _ *types.RecordsEvent var _ *types.StatsEvent var _ *types.ContinuationEvent var _ *types.EndEvent var _ *types.ProgressEvent
159
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" cryptorand "crypto/rand" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/aws/defaults" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/retry" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" "github.com/aws/aws-sdk-go-v2/service/internal/s3shared" s3sharedconfig "github.com/aws/aws-sdk-go-v2/service/internal/s3shared/config" smithy "github.com/aws/smithy-go" smithydocument "github.com/aws/smithy-go/document" "github.com/aws/smithy-go/logging" "github.com/aws/smithy-go/middleware" smithyrand "github.com/aws/smithy-go/rand" smithyhttp "github.com/aws/smithy-go/transport/http" "net" "net/http" "time" ) const ServiceID = "S3 Control" const ServiceAPIVersion = "2018-08-20" // Client provides the API client to make operations call for AWS S3 Control. type Client struct { options Options } // New returns an initialized Client based on the functional options. Provide // additional functional options to further configure the behavior of the client, // such as changing the client's endpoint or adding custom middleware behavior. func New(options Options, optFns ...func(*Options)) *Client { options = options.Copy() resolveDefaultLogger(&options) setResolvedDefaultsMode(&options) resolveRetryer(&options) resolveHTTPClient(&options) resolveHTTPSignerV4(&options) resolveDefaultEndpointConfiguration(&options) resolveIdempotencyTokenProvider(&options) for _, fn := range optFns { fn(&options) } client := &Client{ options: options, } return client } type Options struct { // Set of options to modify how an operation is invoked. These apply to all // operations invoked for this client. Use functional options on operation call to // modify this list for per operation behavior. APIOptions []func(*middleware.Stack) error // Configures the events that will be sent to the configured logger. ClientLogMode aws.ClientLogMode // The credentials object to use when signing requests. Credentials aws.CredentialsProvider // The configuration DefaultsMode that the SDK should use when constructing the // clients initial default settings. DefaultsMode aws.DefaultsMode // The endpoint options to be used when attempting to resolve an endpoint. EndpointOptions EndpointResolverOptions // The service endpoint resolver. EndpointResolver EndpointResolver // Signature Version 4 (SigV4) Signer HTTPSignerV4 HTTPSignerV4 // Provides idempotency tokens values that will be automatically populated into // idempotent API operations. IdempotencyTokenProvider IdempotencyTokenProvider // The logger writer interface to write logging messages to. Logger logging.Logger // The region to send requests to. (Required) Region string // RetryMaxAttempts specifies the maximum number attempts an API client will call // an operation that fails with a retryable error. A value of 0 is ignored, and // will not be used to configure the API client created default retryer, or modify // per operation call's retry max attempts. When creating a new API Clients this // member will only be used if the Retryer Options member is nil. This value will // be ignored if Retryer is not nil. If specified in an operation call's functional // options with a value that is different than the constructed client's Options, // the Client's Retryer will be wrapped to use the operation's specific // RetryMaxAttempts value. RetryMaxAttempts int // RetryMode specifies the retry mode the API client will be created with, if // Retryer option is not also specified. When creating a new API Clients this // member will only be used if the Retryer Options member is nil. This value will // be ignored if Retryer is not nil. Currently does not support per operation call // overrides, may in the future. RetryMode aws.RetryMode // Retryer guides how HTTP requests should be retried in case of recoverable // failures. When nil the API client will use a default retryer. The kind of // default retry created by the API client can be changed with the RetryMode // option. Retryer aws.Retryer // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You // should not populate this structure programmatically, or rely on the values here // within your applications. RuntimeEnvironment aws.RuntimeEnvironment // Allows you to enable arn region support for the service. UseARNRegion bool // Allows you to enable dual-stack endpoint support for the service. // // Deprecated: Set dual-stack by setting UseDualStackEndpoint on // EndpointResolverOptions. When EndpointResolverOptions' UseDualStackEndpoint // field is set it overrides this field value. UseDualstack bool // The initial DefaultsMode used when the client options were constructed. If the // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved // value was at that point in time. Currently does not support per operation call // overrides, may in the future. resolvedDefaultsMode aws.DefaultsMode // The HTTP client to invoke API calls with. Defaults to client's default HTTP // implementation if nil. HTTPClient HTTPClient } // WithAPIOptions returns a functional option for setting the Client's APIOptions // option. func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { return func(o *Options) { o.APIOptions = append(o.APIOptions, optFns...) } } // WithEndpointResolver returns a functional option for setting the Client's // EndpointResolver option. func WithEndpointResolver(v EndpointResolver) func(*Options) { return func(o *Options) { o.EndpointResolver = v } } type HTTPClient interface { Do(*http.Request) (*http.Response, error) } // Copy creates a clone where the APIOptions list is deep copied. func (o Options) Copy() Options { to := o to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions)) copy(to.APIOptions, o.APIOptions) return to } func (c *Client) invokeOperation(ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error) (result interface{}, metadata middleware.Metadata, err error) { ctx = middleware.ClearStackValues(ctx) stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) options := c.options.Copy() for _, fn := range optFns { fn(&options) } finalizeRetryMaxAttemptOptions(&options, *c) finalizeClientEndpointResolverOptions(&options) for _, fn := range stackFns { if err := fn(stack, options); err != nil { return nil, metadata, err } } for _, fn := range options.APIOptions { if err := fn(stack); err != nil { return nil, metadata, err } } handler := middleware.DecorateHandler(smithyhttp.NewClientHandler(options.HTTPClient), stack) result, metadata, err = handler.Handle(ctx, params) if err != nil { err = &smithy.OperationError{ ServiceID: ServiceID, OperationName: opID, Err: err, } } return result, metadata, err } type noSmithyDocumentSerde = smithydocument.NoSerde func resolveDefaultLogger(o *Options) { if o.Logger != nil { return } o.Logger = logging.Nop{} } func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error { return middleware.AddSetLoggerMiddleware(stack, o.Logger) } func setResolvedDefaultsMode(o *Options) { if len(o.resolvedDefaultsMode) > 0 { return } var mode aws.DefaultsMode mode.SetFromString(string(o.DefaultsMode)) if mode == aws.DefaultsModeAuto { mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment) } o.resolvedDefaultsMode = mode } // NewFromConfig returns a new client from the provided config. func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { opts := Options{ Region: cfg.Region, DefaultsMode: cfg.DefaultsMode, RuntimeEnvironment: cfg.RuntimeEnvironment, HTTPClient: cfg.HTTPClient, Credentials: cfg.Credentials, APIOptions: cfg.APIOptions, Logger: cfg.Logger, ClientLogMode: cfg.ClientLogMode, } resolveAWSRetryerProvider(cfg, &opts) resolveAWSRetryMaxAttempts(cfg, &opts) resolveAWSRetryMode(cfg, &opts) resolveAWSEndpointResolver(cfg, &opts) resolveUseARNRegion(cfg, &opts) resolveUseDualStackEndpoint(cfg, &opts) resolveUseFIPSEndpoint(cfg, &opts) return New(opts, optFns...) } func resolveHTTPClient(o *Options) { var buildable *awshttp.BuildableClient if o.HTTPClient != nil { var ok bool buildable, ok = o.HTTPClient.(*awshttp.BuildableClient) if !ok { return } } else { buildable = awshttp.NewBuildableClient() } modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) if err == nil { buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) { if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok { dialer.Timeout = dialerTimeout } }) buildable = buildable.WithTransportOptions(func(transport *http.Transport) { if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok { transport.TLSHandshakeTimeout = tlsHandshakeTimeout } }) } o.HTTPClient = buildable } func resolveRetryer(o *Options) { if o.Retryer != nil { return } if len(o.RetryMode) == 0 { modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) if err == nil { o.RetryMode = modeConfig.RetryMode } } if len(o.RetryMode) == 0 { o.RetryMode = aws.RetryModeStandard } var standardOptions []func(*retry.StandardOptions) if v := o.RetryMaxAttempts; v != 0 { standardOptions = append(standardOptions, func(so *retry.StandardOptions) { so.MaxAttempts = v }) } switch o.RetryMode { case aws.RetryModeAdaptive: var adaptiveOptions []func(*retry.AdaptiveModeOptions) if len(standardOptions) != 0 { adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) { ao.StandardOptions = append(ao.StandardOptions, standardOptions...) }) } o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...) default: o.Retryer = retry.NewStandard(standardOptions...) } } func resolveAWSRetryerProvider(cfg aws.Config, o *Options) { if cfg.Retryer == nil { return } o.Retryer = cfg.Retryer() } func resolveAWSRetryMode(cfg aws.Config, o *Options) { if len(cfg.RetryMode) == 0 { return } o.RetryMode = cfg.RetryMode } func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { if cfg.RetryMaxAttempts == 0 { return } o.RetryMaxAttempts = cfg.RetryMaxAttempts } func finalizeRetryMaxAttemptOptions(o *Options, client Client) { if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { return } o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) } func resolveAWSEndpointResolver(cfg aws.Config, o *Options) { if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil { return } o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions, NewDefaultEndpointResolver()) } func addClientUserAgent(stack *middleware.Stack) error { return awsmiddleware.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "s3control", goModuleVersion)(stack) } func addHTTPSignerV4Middleware(stack *middleware.Stack, o Options) error { mw := v4.NewSignHTTPRequestMiddleware(v4.SignHTTPRequestMiddlewareOptions{ CredentialsProvider: o.Credentials, Signer: o.HTTPSignerV4, LogSigning: o.ClientLogMode.IsSigning(), }) return stack.Finalize.Add(mw, middleware.After) } type HTTPSignerV4 interface { SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error } func resolveHTTPSignerV4(o *Options) { if o.HTTPSignerV4 != nil { return } o.HTTPSignerV4 = newDefaultV4Signer(*o) } func newDefaultV4Signer(o Options) *v4.Signer { return v4.NewSigner(func(so *v4.SignerOptions) { so.Logger = o.Logger so.LogSigning = o.ClientLogMode.IsSigning() }) } func resolveIdempotencyTokenProvider(o *Options) { if o.IdempotencyTokenProvider != nil { return } o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader) } func addRetryMiddlewares(stack *middleware.Stack, o Options) error { mo := retry.AddRetryMiddlewaresOptions{ Retryer: o.Retryer, LogRetryAttempts: o.ClientLogMode.IsRetries(), } return retry.AddRetryMiddlewares(stack, mo) } // resolves UseARNRegion S3 configuration func resolveUseARNRegion(cfg aws.Config, o *Options) error { if len(cfg.ConfigSources) == 0 { return nil } value, found, err := s3sharedconfig.ResolveUseARNRegion(context.Background(), cfg.ConfigSources) if err != nil { return err } if found { o.UseARNRegion = value } return nil } // resolves dual-stack endpoint configuration func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error { if len(cfg.ConfigSources) == 0 { return nil } value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources) if err != nil { return err } if found { o.EndpointOptions.UseDualStackEndpoint = value } return nil } // resolves FIPS endpoint configuration func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error { if len(cfg.ConfigSources) == 0 { return nil } value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources) if err != nil { return err } if found { o.EndpointOptions.UseFIPSEndpoint = value } return nil } // IdempotencyTokenProvider interface for providing idempotency token type IdempotencyTokenProvider interface { GetIdempotencyToken() (string, error) } func addMetadataRetrieverMiddleware(stack *middleware.Stack) error { return s3shared.AddMetadataRetrieverMiddleware(stack) } // nopGetOutpostIDFromInput provides a nop accessor function to be used when // endpoint customization behavior is not based on presence of outpost id member if // any func nopGetOutpostIDFromInput(input interface{}) (*string, bool) { return nil, false } // nopGetARNAccessor provides a nop get accessor function to be used when a // certain operation does not support ARNs func nopGetARNAccessor(input interface{}) (*string, bool) { return nil, false } // nopSetARNAccessor provides a nop set accessor function to be used when a // certain operation does not support ARNs func nopSetARNAccessor(input interface{}, v string) error { return nil } // nopBackfillAccountIDAccessor provides a nop accessor function to be used when a // certain operation does not need to validate and backfill account id func nopBackfillAccountIDAccessor(input interface{}, v string) error { return nil } func addResponseErrorMiddleware(stack *middleware.Stack) error { return s3shared.AddResponseErrorMiddleware(stack) } // ResponseError provides the HTTP centric error type wrapping the underlying // error with the HTTP response value and the deserialized RequestID. type ResponseError interface { error ServiceHostID() string ServiceRequestID() string } var _ ResponseError = (*s3shared.ResponseError)(nil) // GetHostIDMetadata retrieves the host id from middleware metadata returns host // id as string along with a boolean indicating presence of hostId on middleware // metadata. func GetHostIDMetadata(metadata middleware.Metadata) (string, bool) { return s3shared.GetHostIDMetadata(metadata) } func addRequestResponseLogging(stack *middleware.Stack, o Options) error { return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ LogRequest: o.ClientLogMode.IsRequest(), LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), LogResponse: o.ClientLogMode.IsResponse(), LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), }, middleware.After) }
525
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "io/ioutil" "net/http" "strings" "testing" ) func TestClient_resolveRetryOptions(t *testing.T) { nopClient := smithyhttp.ClientDoFunc(func(_ *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: 200, Header: http.Header{}, Body: ioutil.NopCloser(strings.NewReader("")), }, nil }) cases := map[string]struct { defaultsMode aws.DefaultsMode retryer aws.Retryer retryMaxAttempts int opRetryMaxAttempts *int retryMode aws.RetryMode expectClientRetryMode aws.RetryMode expectClientMaxAttempts int expectOpMaxAttempts int }{ "defaults": { defaultsMode: aws.DefaultsModeStandard, expectClientRetryMode: aws.RetryModeStandard, expectClientMaxAttempts: 3, expectOpMaxAttempts: 3, }, "custom default retry": { retryMode: aws.RetryModeAdaptive, retryMaxAttempts: 10, expectClientRetryMode: aws.RetryModeAdaptive, expectClientMaxAttempts: 10, expectOpMaxAttempts: 10, }, "custom op max attempts": { retryMode: aws.RetryModeAdaptive, retryMaxAttempts: 10, opRetryMaxAttempts: aws.Int(2), expectClientRetryMode: aws.RetryModeAdaptive, expectClientMaxAttempts: 10, expectOpMaxAttempts: 2, }, "custom op no change max attempts": { retryMode: aws.RetryModeAdaptive, retryMaxAttempts: 10, opRetryMaxAttempts: aws.Int(10), expectClientRetryMode: aws.RetryModeAdaptive, expectClientMaxAttempts: 10, expectOpMaxAttempts: 10, }, "custom op 0 max attempts": { retryMode: aws.RetryModeAdaptive, retryMaxAttempts: 10, opRetryMaxAttempts: aws.Int(0), expectClientRetryMode: aws.RetryModeAdaptive, expectClientMaxAttempts: 10, expectOpMaxAttempts: 10, }, } for name, c := range cases { t.Run(name, func(t *testing.T) { client := NewFromConfig(aws.Config{ DefaultsMode: c.defaultsMode, Retryer: func() func() aws.Retryer { if c.retryer == nil { return nil } return func() aws.Retryer { return c.retryer } }(), HTTPClient: nopClient, RetryMaxAttempts: c.retryMaxAttempts, RetryMode: c.retryMode, }) if e, a := c.expectClientRetryMode, client.options.RetryMode; e != a { t.Errorf("expect %v retry mode, got %v", e, a) } if e, a := c.expectClientMaxAttempts, client.options.Retryer.MaxAttempts(); e != a { t.Errorf("expect %v max attempts, got %v", e, a) } _, _, err := client.invokeOperation(context.Background(), "mockOperation", struct{}{}, []func(*Options){ func(o *Options) { if c.opRetryMaxAttempts == nil { return } o.RetryMaxAttempts = *c.opRetryMaxAttempts }, }, func(s *middleware.Stack, o Options) error { s.Initialize.Clear() s.Serialize.Clear() s.Build.Clear() s.Finalize.Clear() s.Deserialize.Clear() if e, a := c.expectOpMaxAttempts, o.Retryer.MaxAttempts(); e != a { t.Errorf("expect %v op max attempts, got %v", e, a) } return nil }) if err != nil { t.Fatalf("expect no operation error, got %v", err) } }) } }
124
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Creates an access point and associates it with the specified bucket. For more // information, see Managing Data Access with Amazon S3 Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) // in the Amazon S3 User Guide. S3 on Outposts only supports VPC-style access // points. For more information, see Accessing Amazon S3 on Outposts using virtual // private cloud (VPC) only access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. All Amazon S3 on Outposts REST API requests for // this action require an additional parameter of x-amz-outpost-id to be passed // with the request. In addition, you must use an S3 on Outposts endpoint hostname // prefix instead of s3-control . For an example of the request syntax for Amazon // S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the // x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html#API_control_CreateAccessPoint_Examples) // section. The following actions are related to CreateAccessPoint : // - GetAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html) // - DeleteAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html) // - ListAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPoints.html) func (c *Client) CreateAccessPoint(ctx context.Context, params *CreateAccessPointInput, optFns ...func(*Options)) (*CreateAccessPointOutput, error) { if params == nil { params = &CreateAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateAccessPoint", params, optFns, c.addOperationCreateAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*CreateAccessPointOutput) out.ResultMetadata = metadata return out, nil } type CreateAccessPointInput struct { // The Amazon Web Services account ID for the account that owns the specified // access point. // // This member is required. AccountId *string // The name of the bucket that you want to associate this access point with. For // using this parameter with Amazon S3 on Outposts with the REST API, you must // specify the name and the x-amz-outpost-id as well. For using this parameter with // S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify the // ARN of the bucket accessed in the format arn:aws:s3-outposts:::outpost//bucket/ // . For example, to access the bucket reports through Outpost my-outpost owned by // account 123456789012 in Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string // The name you want to assign to this access point. // // This member is required. Name *string // The Amazon Web Services account ID associated with the S3 bucket associated // with this access point. BucketAccountId *string // The PublicAccessBlock configuration that you want to apply to the access point. PublicAccessBlockConfiguration *types.PublicAccessBlockConfiguration // If you include this field, Amazon S3 restricts access to this access point to // requests from the specified virtual private cloud (VPC). This is required for // creating an access point for Amazon S3 on Outposts buckets. VpcConfiguration *types.VpcConfiguration noSmithyDocumentSerde } type CreateAccessPointOutput struct { // The ARN of the access point. This is only supported by Amazon S3 on Outposts. AccessPointArn *string // The name or alias of the access point. Alias *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpCreateAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateAccessPoint{}, 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 = addEndpointPrefix_opCreateAccessPointMiddleware(stack); err != nil { return err } if err = addOpCreateAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addCreateAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opCreateAccessPointMiddleware struct { } func (*endpointPrefix_opCreateAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opCreateAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*CreateAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opCreateAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opCreateAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opCreateAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "CreateAccessPoint", } } func copyCreateAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*CreateAccessPointInput) if !ok { return nil, fmt.Errorf("expect *CreateAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func getCreateAccessPointARNMember(input interface{}) (*string, bool) { in := input.(*CreateAccessPointInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setCreateAccessPointARNMember(input interface{}, v string) error { in := input.(*CreateAccessPointInput) in.Bucket = &v return nil } func backFillCreateAccessPointAccountID(input interface{}, v string) error { in := input.(*CreateAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addCreateAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getCreateAccessPointARNMember, BackfillAccountID: backFillCreateAccessPointAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setCreateAccessPointARNMember, CopyInput: copyCreateAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
272
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Creates an Object Lambda Access Point. For more information, see Transforming // objects with Object Lambda Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/transforming-objects.html) // in the Amazon S3 User Guide. The following actions are related to // CreateAccessPointForObjectLambda : // - DeleteAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointForObjectLambda.html) // - GetAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointForObjectLambda.html) // - ListAccessPointsForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPointsForObjectLambda.html) func (c *Client) CreateAccessPointForObjectLambda(ctx context.Context, params *CreateAccessPointForObjectLambdaInput, optFns ...func(*Options)) (*CreateAccessPointForObjectLambdaOutput, error) { if params == nil { params = &CreateAccessPointForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateAccessPointForObjectLambda", params, optFns, c.addOperationCreateAccessPointForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*CreateAccessPointForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type CreateAccessPointForObjectLambdaInput struct { // The Amazon Web Services account ID for owner of the specified Object Lambda // Access Point. // // This member is required. AccountId *string // Object Lambda Access Point configuration as a JSON document. // // This member is required. Configuration *types.ObjectLambdaConfiguration // The name you want to assign to this Object Lambda Access Point. // // This member is required. Name *string noSmithyDocumentSerde } type CreateAccessPointForObjectLambdaOutput struct { // The alias of the Object Lambda Access Point. Alias *types.ObjectLambdaAccessPointAlias // Specifies the ARN for the Object Lambda Access Point. ObjectLambdaAccessPointArn *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateAccessPointForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpCreateAccessPointForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateAccessPointForObjectLambda{}, 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 = addEndpointPrefix_opCreateAccessPointForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpCreateAccessPointForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAccessPointForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addCreateAccessPointForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opCreateAccessPointForObjectLambdaMiddleware struct { } func (*endpointPrefix_opCreateAccessPointForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opCreateAccessPointForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*CreateAccessPointForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opCreateAccessPointForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opCreateAccessPointForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opCreateAccessPointForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "CreateAccessPointForObjectLambda", } } func copyCreateAccessPointForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*CreateAccessPointForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *CreateAccessPointForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillCreateAccessPointForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*CreateAccessPointForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addCreateAccessPointForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyCreateAccessPointForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
232
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" ) // This action creates an Amazon S3 on Outposts bucket. To create an S3 bucket, // see Create Bucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateBucket.html) // in the Amazon S3 API Reference. Creates a new Outposts bucket. By creating the // bucket, you become the bucket owner. To create an Outposts bucket, you must have // S3 on Outposts. For more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in Amazon S3 User Guide. Not every string is an acceptable bucket name. For // information on bucket naming restrictions, see Working with Amazon S3 Buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/BucketRestrictions.html#bucketnamingrules) // . S3 on Outposts buckets support: // - Tags // - LifecycleConfigurations for deleting expired objects // // For a complete list of restrictions and Amazon S3 feature limitations on S3 on // Outposts, see Amazon S3 on Outposts Restrictions and Limitations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OnOutpostsRestrictionsLimitations.html) // . For an example of the request syntax for Amazon S3 on Outposts that uses the // S3 on Outposts endpoint hostname prefix and x-amz-outpost-id in your API // request, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html#API_control_CreateBucket_Examples) // section. The following actions are related to CreateBucket for Amazon S3 on // Outposts: // - PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) // - GetBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html) // - DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucket.html) // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - PutAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html) func (c *Client) CreateBucket(ctx context.Context, params *CreateBucketInput, optFns ...func(*Options)) (*CreateBucketOutput, error) { if params == nil { params = &CreateBucketInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateBucket", params, optFns, c.addOperationCreateBucketMiddlewares) if err != nil { return nil, err } out := result.(*CreateBucketOutput) out.ResultMetadata = metadata return out, nil } type CreateBucketInput struct { // The name of the bucket. // // This member is required. Bucket *string // The canned ACL to apply to the bucket. This is not supported by Amazon S3 on // Outposts buckets. ACL types.BucketCannedACL // The configuration information for the bucket. This is not supported by Amazon // S3 on Outposts buckets. CreateBucketConfiguration *types.CreateBucketConfiguration // Allows grantee the read, write, read ACP, and write ACP permissions on the // bucket. This is not supported by Amazon S3 on Outposts buckets. GrantFullControl *string // Allows grantee to list the objects in the bucket. This is not supported by // Amazon S3 on Outposts buckets. GrantRead *string // Allows grantee to read the bucket ACL. This is not supported by Amazon S3 on // Outposts buckets. GrantReadACP *string // Allows grantee to create, overwrite, and delete any object in the bucket. This // is not supported by Amazon S3 on Outposts buckets. GrantWrite *string // Allows grantee to write the ACL for the applicable bucket. This is not // supported by Amazon S3 on Outposts buckets. GrantWriteACP *string // Specifies whether you want S3 Object Lock to be enabled for the new bucket. // This is not supported by Amazon S3 on Outposts buckets. ObjectLockEnabledForBucket bool // The ID of the Outposts where the bucket is being created. This ID is required // by Amazon S3 on Outposts buckets. OutpostId *string noSmithyDocumentSerde } type CreateBucketOutput struct { // The Amazon Resource Name (ARN) of the bucket. For using this parameter with // Amazon S3 on Outposts with the REST API, you must specify the name and the // x-amz-outpost-id as well. For using this parameter with S3 on Outposts with the // Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed // in the format arn:aws:s3-outposts:::outpost//bucket/ . For example, to access // the bucket reports through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. BucketArn *string // The location of the bucket. Location *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateBucketMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpCreateBucket{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateBucket{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addOpCreateBucketValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateBucket(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addCreateBucketUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } func newServiceMetadataMiddleware_opCreateBucket(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "CreateBucket", } } func copyCreateBucketInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*CreateBucketInput) if !ok { return nil, fmt.Errorf("expect *CreateBucketInput type, got %T", params) } cpy := *input return &cpy, nil } // getCreateBucketOutpostIDMember returns a pointer to string denoting a provided // outpost-id member value and a boolean indicating if the input has a modeled // outpost-id, func getCreateBucketOutpostIDMember(input interface{}) (*string, bool) { in := input.(*CreateBucketInput) if in.OutpostId == nil { return nil, false } return in.OutpostId, true } func addCreateBucketUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: getCreateBucketOutpostIDMember, UpdateARNField: nopSetARNAccessor, CopyInput: copyCreateBucketInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
238
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // You can use S3 Batch Operations to perform large-scale batch actions on Amazon // S3 objects. Batch Operations can run a single action on lists of Amazon S3 // objects that you specify. For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) // in the Amazon S3 User Guide. This action creates a S3 Batch Operations job. // Related actions include: // - DescribeJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - UpdateJobPriority (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobPriority.html) // - UpdateJobStatus (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobStatus.html) // - JobOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_JobOperation.html) func (c *Client) CreateJob(ctx context.Context, params *CreateJobInput, optFns ...func(*Options)) (*CreateJobOutput, error) { if params == nil { params = &CreateJobInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateJob", params, optFns, c.addOperationCreateJobMiddlewares) if err != nil { return nil, err } out := result.(*CreateJobOutput) out.ResultMetadata = metadata return out, nil } type CreateJobInput struct { // The Amazon Web Services account ID that creates the job. // // This member is required. AccountId *string // An idempotency token to ensure that you don't accidentally submit the same // request twice. You can use any string up to the maximum length. // // This member is required. ClientRequestToken *string // The action that you want this job to perform on every object listed in the // manifest. For more information about the available actions, see Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-actions.html) // in the Amazon S3 User Guide. // // This member is required. Operation *types.JobOperation // The numerical priority for this job. Higher numbers indicate higher priority. // // This member is required. Priority *int32 // Configuration parameters for the optional job-completion report. // // This member is required. Report *types.JobReport // The Amazon Resource Name (ARN) for the Identity and Access Management (IAM) // role that Batch Operations will use to run this job's action on every object in // the manifest. // // This member is required. RoleArn *string // Indicates whether confirmation is required before Amazon S3 runs the job. // Confirmation is only required for jobs created through the Amazon S3 console. ConfirmationRequired *bool // A description for this job. You can use any string within the permitted length. // Descriptions don't need to be unique and can be used for multiple jobs. Description *string // Configuration parameters for the manifest. Manifest *types.JobManifest // The attribute container for the ManifestGenerator details. Jobs must be created // with either a manifest file or a ManifestGenerator, but not both. ManifestGenerator types.JobManifestGenerator // A set of tags to associate with the S3 Batch Operations job. This is an // optional parameter. Tags []types.S3Tag noSmithyDocumentSerde } type CreateJobOutput struct { // The ID for this job. Amazon S3 generates this ID automatically and returns it // after a successful Create Job request. JobId *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateJobMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpCreateJob{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateJob{}, 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 = addEndpointPrefix_opCreateJobMiddleware(stack); err != nil { return err } if err = addIdempotencyToken_opCreateJobMiddleware(stack, options); err != nil { return err } if err = addOpCreateJobValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateJob(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addCreateJobUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opCreateJobMiddleware struct { } func (*endpointPrefix_opCreateJobMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opCreateJobMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*CreateJobInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opCreateJobMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opCreateJobMiddleware{}, `OperationSerializer`, middleware.After) } type idempotencyToken_initializeOpCreateJob struct { tokenProvider IdempotencyTokenProvider } func (*idempotencyToken_initializeOpCreateJob) ID() string { return "OperationIdempotencyTokenAutoFill" } func (m *idempotencyToken_initializeOpCreateJob) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { if m.tokenProvider == nil { return next.HandleInitialize(ctx, in) } input, ok := in.Parameters.(*CreateJobInput) if !ok { return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateJobInput ") } if input.ClientRequestToken == nil { t, err := m.tokenProvider.GetIdempotencyToken() if err != nil { return out, metadata, err } input.ClientRequestToken = &t } return next.HandleInitialize(ctx, in) } func addIdempotencyToken_opCreateJobMiddleware(stack *middleware.Stack, cfg Options) error { return stack.Initialize.Add(&idempotencyToken_initializeOpCreateJob{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) } func newServiceMetadataMiddleware_opCreateJob(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "CreateJob", } } func copyCreateJobInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*CreateJobInput) if !ok { return nil, fmt.Errorf("expect *CreateJobInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillCreateJobAccountID(input interface{}, v string) error { in := input.(*CreateJobInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addCreateJobUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyCreateJobInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
307
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Creates a Multi-Region Access Point and associates it with the specified // buckets. For more information about creating Multi-Region Access Points, see // Creating Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. This action will always be routed to the US West // (Oregon) Region. For more information about the restrictions around managing // Multi-Region Access Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. This request is asynchronous, meaning that you // might receive a response before the command has completed. When this request // provides a response, it provides a token that you can use to monitor the status // of the request with DescribeMultiRegionAccessPointOperation . The following // actions are related to CreateMultiRegionAccessPoint : // - DeleteMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteMultiRegionAccessPoint.html) // - DescribeMultiRegionAccessPointOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html) // - GetMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPoint.html) // - ListMultiRegionAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListMultiRegionAccessPoints.html) func (c *Client) CreateMultiRegionAccessPoint(ctx context.Context, params *CreateMultiRegionAccessPointInput, optFns ...func(*Options)) (*CreateMultiRegionAccessPointOutput, error) { if params == nil { params = &CreateMultiRegionAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "CreateMultiRegionAccessPoint", params, optFns, c.addOperationCreateMultiRegionAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*CreateMultiRegionAccessPointOutput) out.ResultMetadata = metadata return out, nil } type CreateMultiRegionAccessPointInput struct { // The Amazon Web Services account ID for the owner of the Multi-Region Access // Point. The owner of the Multi-Region Access Point also must own the underlying // buckets. // // This member is required. AccountId *string // An idempotency token used to identify the request and guarantee that requests // are unique. // // This member is required. ClientToken *string // A container element containing details about the Multi-Region Access Point. // // This member is required. Details *types.CreateMultiRegionAccessPointInput noSmithyDocumentSerde } type CreateMultiRegionAccessPointOutput struct { // The request token associated with the request. You can use this token with // DescribeMultiRegionAccessPointOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html) // to determine the status of asynchronous requests. RequestTokenARN *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationCreateMultiRegionAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpCreateMultiRegionAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpCreateMultiRegionAccessPoint{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addEndpointPrefix_opCreateMultiRegionAccessPointMiddleware(stack); err != nil { return err } if err = addIdempotencyToken_opCreateMultiRegionAccessPointMiddleware(stack, options); err != nil { return err } if err = addOpCreateMultiRegionAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateMultiRegionAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addCreateMultiRegionAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opCreateMultiRegionAccessPointMiddleware struct { } func (*endpointPrefix_opCreateMultiRegionAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opCreateMultiRegionAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*CreateMultiRegionAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opCreateMultiRegionAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opCreateMultiRegionAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } type idempotencyToken_initializeOpCreateMultiRegionAccessPoint struct { tokenProvider IdempotencyTokenProvider } func (*idempotencyToken_initializeOpCreateMultiRegionAccessPoint) ID() string { return "OperationIdempotencyTokenAutoFill" } func (m *idempotencyToken_initializeOpCreateMultiRegionAccessPoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { if m.tokenProvider == nil { return next.HandleInitialize(ctx, in) } input, ok := in.Parameters.(*CreateMultiRegionAccessPointInput) if !ok { return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateMultiRegionAccessPointInput ") } if input.ClientToken == nil { t, err := m.tokenProvider.GetIdempotencyToken() if err != nil { return out, metadata, err } input.ClientToken = &t } return next.HandleInitialize(ctx, in) } func addIdempotencyToken_opCreateMultiRegionAccessPointMiddleware(stack *middleware.Stack, cfg Options) error { return stack.Initialize.Add(&idempotencyToken_initializeOpCreateMultiRegionAccessPoint{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) } func newServiceMetadataMiddleware_opCreateMultiRegionAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "CreateMultiRegionAccessPoint", } } func copyCreateMultiRegionAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*CreateMultiRegionAccessPointInput) if !ok { return nil, fmt.Errorf("expect *CreateMultiRegionAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillCreateMultiRegionAccessPointAccountID(input interface{}, v string) error { in := input.(*CreateMultiRegionAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addCreateMultiRegionAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyCreateMultiRegionAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
280
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes the specified access point. All Amazon S3 on Outposts REST API requests // for this action require an additional parameter of x-amz-outpost-id to be // passed with the request. In addition, you must use an S3 on Outposts endpoint // hostname prefix instead of s3-control . For an example of the request syntax for // Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and // the x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html#API_control_DeleteAccessPoint_Examples) // section. The following actions are related to DeleteAccessPoint : // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - GetAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html) // - ListAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPoints.html) func (c *Client) DeleteAccessPoint(ctx context.Context, params *DeleteAccessPointInput, optFns ...func(*Options)) (*DeleteAccessPointOutput, error) { if params == nil { params = &DeleteAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteAccessPoint", params, optFns, c.addOperationDeleteAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*DeleteAccessPointOutput) out.ResultMetadata = metadata return out, nil } type DeleteAccessPointInput struct { // The Amazon Web Services account ID for the account that owns the specified // access point. // // This member is required. AccountId *string // The name of the access point you want to delete. For using this parameter with // Amazon S3 on Outposts with the REST API, you must specify the name and the // x-amz-outpost-id as well. For using this parameter with S3 on Outposts with the // Amazon Web Services SDK and CLI, you must specify the ARN of the access point // accessed in the format arn:aws:s3-outposts:::outpost//accesspoint/ . For // example, to access the access point reports-ap through Outpost my-outpost owned // by account 123456789012 in Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap // . The value must be URL encoded. // // This member is required. Name *string noSmithyDocumentSerde } type DeleteAccessPointOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteAccessPoint{}, 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 = addEndpointPrefix_opDeleteAccessPointMiddleware(stack); err != nil { return err } if err = addOpDeleteAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteAccessPointMiddleware struct { } func (*endpointPrefix_opDeleteAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteAccessPoint", } } func copyDeleteAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteAccessPointInput) if !ok { return nil, fmt.Errorf("expect *DeleteAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteAccessPointARNMember(input interface{}) (*string, bool) { in := input.(*DeleteAccessPointInput) if in.Name == nil { return nil, false } return in.Name, true } func setDeleteAccessPointARNMember(input interface{}, v string) error { in := input.(*DeleteAccessPointInput) in.Name = &v return nil } func backFillDeleteAccessPointAccountID(input interface{}, v string) error { in := input.(*DeleteAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteAccessPointARNMember, BackfillAccountID: backFillDeleteAccessPointAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteAccessPointARNMember, CopyInput: copyDeleteAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
242
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes the specified Object Lambda Access Point. The following actions are // related to DeleteAccessPointForObjectLambda : // - CreateAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPointForObjectLambda.html) // - GetAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointForObjectLambda.html) // - ListAccessPointsForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPointsForObjectLambda.html) func (c *Client) DeleteAccessPointForObjectLambda(ctx context.Context, params *DeleteAccessPointForObjectLambdaInput, optFns ...func(*Options)) (*DeleteAccessPointForObjectLambdaOutput, error) { if params == nil { params = &DeleteAccessPointForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteAccessPointForObjectLambda", params, optFns, c.addOperationDeleteAccessPointForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*DeleteAccessPointForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type DeleteAccessPointForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the access point you want to delete. // // This member is required. Name *string noSmithyDocumentSerde } type DeleteAccessPointForObjectLambdaOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteAccessPointForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteAccessPointForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteAccessPointForObjectLambda{}, 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 = addEndpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpDeleteAccessPointForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccessPointForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteAccessPointForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware struct { } func (*endpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteAccessPointForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteAccessPointForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteAccessPointForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteAccessPointForObjectLambda", } } func copyDeleteAccessPointForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteAccessPointForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *DeleteAccessPointForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteAccessPointForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*DeleteAccessPointForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteAccessPointForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteAccessPointForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
217
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes the access point policy for the specified access point. All Amazon S3 // on Outposts REST API requests for this action require an additional parameter of // x-amz-outpost-id to be passed with the request. In addition, you must use an S3 // on Outposts endpoint hostname prefix instead of s3-control . For an example of // the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts // endpoint hostname prefix and the x-amz-outpost-id derived by using the access // point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html#API_control_DeleteAccessPointPolicy_Examples) // section. The following actions are related to DeleteAccessPointPolicy : // - PutAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html) // - GetAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointPolicy.html) func (c *Client) DeleteAccessPointPolicy(ctx context.Context, params *DeleteAccessPointPolicyInput, optFns ...func(*Options)) (*DeleteAccessPointPolicyOutput, error) { if params == nil { params = &DeleteAccessPointPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteAccessPointPolicy", params, optFns, c.addOperationDeleteAccessPointPolicyMiddlewares) if err != nil { return nil, err } out := result.(*DeleteAccessPointPolicyOutput) out.ResultMetadata = metadata return out, nil } type DeleteAccessPointPolicyInput struct { // The account ID for the account that owns the specified access point. // // This member is required. AccountId *string // The name of the access point whose policy you want to delete. For using this // parameter with Amazon S3 on Outposts with the REST API, you must specify the // name and the x-amz-outpost-id as well. For using this parameter with S3 on // Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of // the access point accessed in the format // arn:aws:s3-outposts:::outpost//accesspoint/ . For example, to access the access // point reports-ap through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap // . The value must be URL encoded. // // This member is required. Name *string noSmithyDocumentSerde } type DeleteAccessPointPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteAccessPointPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteAccessPointPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteAccessPointPolicy{}, 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 = addEndpointPrefix_opDeleteAccessPointPolicyMiddleware(stack); err != nil { return err } if err = addOpDeleteAccessPointPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccessPointPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteAccessPointPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteAccessPointPolicyMiddleware struct { } func (*endpointPrefix_opDeleteAccessPointPolicyMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteAccessPointPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteAccessPointPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteAccessPointPolicyMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteAccessPointPolicyMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteAccessPointPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteAccessPointPolicy", } } func copyDeleteAccessPointPolicyInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteAccessPointPolicyInput) if !ok { return nil, fmt.Errorf("expect *DeleteAccessPointPolicyInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteAccessPointPolicyARNMember(input interface{}) (*string, bool) { in := input.(*DeleteAccessPointPolicyInput) if in.Name == nil { return nil, false } return in.Name, true } func setDeleteAccessPointPolicyARNMember(input interface{}, v string) error { in := input.(*DeleteAccessPointPolicyInput) in.Name = &v return nil } func backFillDeleteAccessPointPolicyAccountID(input interface{}, v string) error { in := input.(*DeleteAccessPointPolicyInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteAccessPointPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteAccessPointPolicyARNMember, BackfillAccountID: backFillDeleteAccessPointPolicyAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteAccessPointPolicyARNMember, CopyInput: copyDeleteAccessPointPolicyInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
242
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Removes the resource policy for an Object Lambda Access Point. The following // actions are related to DeleteAccessPointPolicyForObjectLambda : // - GetAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPointPolicyForObjectLambda.html) // - PutAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicyForObjectLambda.html) func (c *Client) DeleteAccessPointPolicyForObjectLambda(ctx context.Context, params *DeleteAccessPointPolicyForObjectLambdaInput, optFns ...func(*Options)) (*DeleteAccessPointPolicyForObjectLambdaOutput, error) { if params == nil { params = &DeleteAccessPointPolicyForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteAccessPointPolicyForObjectLambda", params, optFns, c.addOperationDeleteAccessPointPolicyForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*DeleteAccessPointPolicyForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type DeleteAccessPointPolicyForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the Object Lambda Access Point you want to delete the policy for. // // This member is required. Name *string noSmithyDocumentSerde } type DeleteAccessPointPolicyForObjectLambdaOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteAccessPointPolicyForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteAccessPointPolicyForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteAccessPointPolicyForObjectLambda{}, 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 = addEndpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpDeleteAccessPointPolicyForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAccessPointPolicyForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteAccessPointPolicyForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware struct { } func (*endpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteAccessPointPolicyForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteAccessPointPolicyForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteAccessPointPolicyForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteAccessPointPolicyForObjectLambda", } } func copyDeleteAccessPointPolicyForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteAccessPointPolicyForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *DeleteAccessPointPolicyForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteAccessPointPolicyForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*DeleteAccessPointPolicyForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteAccessPointPolicyForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteAccessPointPolicyForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
216
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action deletes an Amazon S3 on Outposts bucket. To delete an S3 bucket, // see DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucket.html) // in the Amazon S3 API Reference. Deletes the Amazon S3 on Outposts bucket. All // objects (including all object versions and delete markers) in the bucket must be // deleted before the bucket itself can be deleted. For more information, see // Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in Amazon S3 User Guide. All Amazon S3 on Outposts REST API requests for this // action require an additional parameter of x-amz-outpost-id to be passed with // the request. In addition, you must use an S3 on Outposts endpoint hostname // prefix instead of s3-control . For an example of the request syntax for Amazon // S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the // x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucket.html#API_control_DeleteBucket_Examples) // section. Related Resources // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html) // - GetBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html) // - DeleteObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html) func (c *Client) DeleteBucket(ctx context.Context, params *DeleteBucketInput, optFns ...func(*Options)) (*DeleteBucketOutput, error) { if params == nil { params = &DeleteBucketInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteBucket", params, optFns, c.addOperationDeleteBucketMiddlewares) if err != nil { return nil, err } out := result.(*DeleteBucketOutput) out.ResultMetadata = metadata return out, nil } type DeleteBucketInput struct { // The account ID that owns the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket being deleted. For using this parameter with Amazon S3 on // Outposts with the REST API, you must specify the name and the x-amz-outpost-id // as well. For using this parameter with S3 on Outposts with the Amazon Web // Services SDK and CLI, you must specify the ARN of the bucket accessed in the // format arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the // bucket reports through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type DeleteBucketOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteBucketMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteBucket{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteBucket{}, 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 = addEndpointPrefix_opDeleteBucketMiddleware(stack); err != nil { return err } if err = addOpDeleteBucketValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBucket(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteBucketUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteBucketMiddleware struct { } func (*endpointPrefix_opDeleteBucketMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteBucketMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteBucketInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteBucketMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteBucketMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteBucket(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteBucket", } } func copyDeleteBucketInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteBucketInput) if !ok { return nil, fmt.Errorf("expect *DeleteBucketInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteBucketARNMember(input interface{}) (*string, bool) { in := input.(*DeleteBucketInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setDeleteBucketARNMember(input interface{}, v string) error { in := input.(*DeleteBucketInput) in.Bucket = &v return nil } func backFillDeleteBucketAccountID(input interface{}, v string) error { in := input.(*DeleteBucketInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteBucketUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteBucketARNMember, BackfillAccountID: backFillDeleteBucketAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteBucketARNMember, CopyInput: copyDeleteBucketInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
247
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action deletes an Amazon S3 on Outposts bucket's lifecycle configuration. // To delete an S3 bucket's lifecycle configuration, see DeleteBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketLifecycle.html) // in the Amazon S3 API Reference. Deletes the lifecycle configuration from the // specified Outposts bucket. Amazon S3 on Outposts removes all the lifecycle // configuration rules in the lifecycle subresource associated with the bucket. // Your objects never expire, and Amazon S3 on Outposts no longer automatically // deletes any objects on the basis of rules contained in the deleted lifecycle // configuration. For more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in Amazon S3 User Guide. To use this action, you must have permission to perform // the s3-outposts:DeleteLifecycleConfiguration action. By default, the bucket // owner has this permission and the Outposts bucket owner can grant this // permission to others. All Amazon S3 on Outposts REST API requests for this // action require an additional parameter of x-amz-outpost-id to be passed with // the request. In addition, you must use an S3 on Outposts endpoint hostname // prefix instead of s3-control . For an example of the request syntax for Amazon // S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the // x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketLifecycleConfiguration.html#API_control_DeleteBucketLifecycleConfiguration_Examples) // section. For more information about object expiration, see Elements to Describe // Lifecycle Actions (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#intro-lifecycle-rules-actions) // . Related actions include: // - PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html) // - GetBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html) func (c *Client) DeleteBucketLifecycleConfiguration(ctx context.Context, params *DeleteBucketLifecycleConfigurationInput, optFns ...func(*Options)) (*DeleteBucketLifecycleConfigurationOutput, error) { if params == nil { params = &DeleteBucketLifecycleConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteBucketLifecycleConfiguration", params, optFns, c.addOperationDeleteBucketLifecycleConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*DeleteBucketLifecycleConfigurationOutput) out.ResultMetadata = metadata return out, nil } type DeleteBucketLifecycleConfigurationInput struct { // The account ID of the lifecycle configuration to delete. // // This member is required. AccountId *string // Specifies the bucket. For using this parameter with Amazon S3 on Outposts with // the REST API, you must specify the name and the x-amz-outpost-id as well. For // using this parameter with S3 on Outposts with the Amazon Web Services SDK and // CLI, you must specify the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type DeleteBucketLifecycleConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteBucketLifecycleConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteBucketLifecycleConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteBucketLifecycleConfiguration{}, 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 = addEndpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware(stack); err != nil { return err } if err = addOpDeleteBucketLifecycleConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBucketLifecycleConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteBucketLifecycleConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware struct { } func (*endpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteBucketLifecycleConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteBucketLifecycleConfigurationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteBucketLifecycleConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteBucketLifecycleConfiguration", } } func copyDeleteBucketLifecycleConfigurationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteBucketLifecycleConfigurationInput) if !ok { return nil, fmt.Errorf("expect *DeleteBucketLifecycleConfigurationInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteBucketLifecycleConfigurationARNMember(input interface{}) (*string, bool) { in := input.(*DeleteBucketLifecycleConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setDeleteBucketLifecycleConfigurationARNMember(input interface{}, v string) error { in := input.(*DeleteBucketLifecycleConfigurationInput) in.Bucket = &v return nil } func backFillDeleteBucketLifecycleConfigurationAccountID(input interface{}, v string) error { in := input.(*DeleteBucketLifecycleConfigurationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteBucketLifecycleConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteBucketLifecycleConfigurationARNMember, BackfillAccountID: backFillDeleteBucketLifecycleConfigurationAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteBucketLifecycleConfigurationARNMember, CopyInput: copyDeleteBucketLifecycleConfigurationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
253
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action deletes an Amazon S3 on Outposts bucket policy. To delete an S3 // bucket policy, see DeleteBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketPolicy.html) // in the Amazon S3 API Reference. This implementation of the DELETE action uses // the policy subresource to delete the policy of a specified Amazon S3 on Outposts // bucket. If you are using an identity other than the root user of the Amazon Web // Services account that owns the bucket, the calling identity must have the // s3-outposts:DeleteBucketPolicy permissions on the specified Outposts bucket and // belong to the bucket owner's account to use this action. For more information, // see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in Amazon S3 User Guide. If you don't have DeleteBucketPolicy permissions, // Amazon S3 returns a 403 Access Denied error. If you have the correct // permissions, but you're not using an identity that belongs to the bucket owner's // account, Amazon S3 returns a 405 Method Not Allowed error. As a security // precaution, the root user of the Amazon Web Services account that owns a bucket // can always use this action, even if the policy explicitly denies the root user // the ability to perform this action. For more information about bucket policies, // see Using Bucket Policies and User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html) // . All Amazon S3 on Outposts REST API requests for this action require an // additional parameter of x-amz-outpost-id to be passed with the request. In // addition, you must use an S3 on Outposts endpoint hostname prefix instead of // s3-control . For an example of the request syntax for Amazon S3 on Outposts that // uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id // derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketPolicy.html#API_control_DeleteBucketPolicy_Examples) // section. The following actions are related to DeleteBucketPolicy : // - GetBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketPolicy.html) // - PutBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketPolicy.html) func (c *Client) DeleteBucketPolicy(ctx context.Context, params *DeleteBucketPolicyInput, optFns ...func(*Options)) (*DeleteBucketPolicyOutput, error) { if params == nil { params = &DeleteBucketPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteBucketPolicy", params, optFns, c.addOperationDeleteBucketPolicyMiddlewares) if err != nil { return nil, err } out := result.(*DeleteBucketPolicyOutput) out.ResultMetadata = metadata return out, nil } type DeleteBucketPolicyInput struct { // The account ID of the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket. For using this parameter with Amazon S3 on Outposts with // the REST API, you must specify the name and the x-amz-outpost-id as well. For // using this parameter with S3 on Outposts with the Amazon Web Services SDK and // CLI, you must specify the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type DeleteBucketPolicyOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteBucketPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteBucketPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteBucketPolicy{}, 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 = addEndpointPrefix_opDeleteBucketPolicyMiddleware(stack); err != nil { return err } if err = addOpDeleteBucketPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBucketPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteBucketPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteBucketPolicyMiddleware struct { } func (*endpointPrefix_opDeleteBucketPolicyMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteBucketPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteBucketPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteBucketPolicyMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteBucketPolicyMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteBucketPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteBucketPolicy", } } func copyDeleteBucketPolicyInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteBucketPolicyInput) if !ok { return nil, fmt.Errorf("expect *DeleteBucketPolicyInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteBucketPolicyARNMember(input interface{}) (*string, bool) { in := input.(*DeleteBucketPolicyInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setDeleteBucketPolicyARNMember(input interface{}, v string) error { in := input.(*DeleteBucketPolicyInput) in.Bucket = &v return nil } func backFillDeleteBucketPolicyAccountID(input interface{}, v string) error { in := input.(*DeleteBucketPolicyInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteBucketPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteBucketPolicyARNMember, BackfillAccountID: backFillDeleteBucketPolicyAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteBucketPolicyARNMember, CopyInput: copyDeleteBucketPolicyInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
257
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This operation deletes an Amazon S3 on Outposts bucket's replication // configuration. To delete an S3 bucket's replication configuration, see // DeleteBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketReplication.html) // in the Amazon S3 API Reference. Deletes the replication configuration from the // specified S3 on Outposts bucket. To use this operation, you must have // permissions to perform the s3-outposts:PutReplicationConfiguration action. The // Outposts bucket owner has this permission by default and can grant it to others. // For more information about permissions, see Setting up IAM with S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsIAM.html) // and Managing access to S3 on Outposts buckets (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsBucketPolicy.html) // in the Amazon S3 User Guide. It can take a while to propagate PUT or DELETE // requests for a replication configuration to all S3 on Outposts systems. // Therefore, the replication configuration that's returned by a GET request soon // after a PUT or DELETE request might return a more recent result than what's on // the Outpost. If an Outpost is offline, the delay in updating the replication // configuration on that Outpost can be significant. All Amazon S3 on Outposts REST // API requests for this action require an additional parameter of x-amz-outpost-id // to be passed with the request. In addition, you must use an S3 on Outposts // endpoint hostname prefix instead of s3-control . For an example of the request // syntax for Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname // prefix and the x-amz-outpost-id derived by using the access point ARN, see the // Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketReplication.html#API_control_DeleteBucketReplication_Examples) // section. For information about S3 replication on Outposts configuration, see // Replicating objects for S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsReplication.html) // in the Amazon S3 User Guide. The following operations are related to // DeleteBucketReplication : // - PutBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketReplication.html) // - GetBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketReplication.html) func (c *Client) DeleteBucketReplication(ctx context.Context, params *DeleteBucketReplicationInput, optFns ...func(*Options)) (*DeleteBucketReplicationOutput, error) { if params == nil { params = &DeleteBucketReplicationInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteBucketReplication", params, optFns, c.addOperationDeleteBucketReplicationMiddlewares) if err != nil { return nil, err } out := result.(*DeleteBucketReplicationOutput) out.ResultMetadata = metadata return out, nil } type DeleteBucketReplicationInput struct { // The Amazon Web Services account ID of the Outposts bucket to delete the // replication configuration for. // // This member is required. AccountId *string // Specifies the S3 on Outposts bucket to delete the replication configuration // for. For using this parameter with Amazon S3 on Outposts with the REST API, you // must specify the name and the x-amz-outpost-id as well. For using this parameter // with S3 on Outposts with the Amazon Web Services SDK and CLI, you must specify // the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type DeleteBucketReplicationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteBucketReplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteBucketReplication{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteBucketReplication{}, 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 = addEndpointPrefix_opDeleteBucketReplicationMiddleware(stack); err != nil { return err } if err = addOpDeleteBucketReplicationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBucketReplication(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteBucketReplicationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteBucketReplicationMiddleware struct { } func (*endpointPrefix_opDeleteBucketReplicationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteBucketReplicationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteBucketReplicationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteBucketReplicationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteBucketReplicationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteBucketReplication(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteBucketReplication", } } func copyDeleteBucketReplicationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteBucketReplicationInput) if !ok { return nil, fmt.Errorf("expect *DeleteBucketReplicationInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteBucketReplicationARNMember(input interface{}) (*string, bool) { in := input.(*DeleteBucketReplicationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setDeleteBucketReplicationARNMember(input interface{}, v string) error { in := input.(*DeleteBucketReplicationInput) in.Bucket = &v return nil } func backFillDeleteBucketReplicationAccountID(input interface{}, v string) error { in := input.(*DeleteBucketReplicationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteBucketReplicationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteBucketReplicationARNMember, BackfillAccountID: backFillDeleteBucketReplicationAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteBucketReplicationARNMember, CopyInput: copyDeleteBucketReplicationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
260
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action deletes an Amazon S3 on Outposts bucket's tags. To delete an S3 // bucket tags, see DeleteBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketTagging.html) // in the Amazon S3 API Reference. Deletes the tags from the Outposts bucket. For // more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in Amazon S3 User Guide. To use this action, you must have permission to perform // the PutBucketTagging action. By default, the bucket owner has this permission // and can grant this permission to others. All Amazon S3 on Outposts REST API // requests for this action require an additional parameter of x-amz-outpost-id to // be passed with the request. In addition, you must use an S3 on Outposts endpoint // hostname prefix instead of s3-control . For an example of the request syntax for // Amazon S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and // the x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketTagging.html#API_control_DeleteBucketTagging_Examples) // section. The following actions are related to DeleteBucketTagging : // - GetBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketTagging.html) // - PutBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketTagging.html) func (c *Client) DeleteBucketTagging(ctx context.Context, params *DeleteBucketTaggingInput, optFns ...func(*Options)) (*DeleteBucketTaggingOutput, error) { if params == nil { params = &DeleteBucketTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteBucketTagging", params, optFns, c.addOperationDeleteBucketTaggingMiddlewares) if err != nil { return nil, err } out := result.(*DeleteBucketTaggingOutput) out.ResultMetadata = metadata return out, nil } type DeleteBucketTaggingInput struct { // The Amazon Web Services account ID of the Outposts bucket tag set to be removed. // // This member is required. AccountId *string // The bucket ARN that has the tag set to be removed. For using this parameter // with Amazon S3 on Outposts with the REST API, you must specify the name and the // x-amz-outpost-id as well. For using this parameter with S3 on Outposts with the // Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed // in the format arn:aws:s3-outposts:::outpost//bucket/ . For example, to access // the bucket reports through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type DeleteBucketTaggingOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteBucketTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteBucketTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteBucketTagging{}, 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 = addEndpointPrefix_opDeleteBucketTaggingMiddleware(stack); err != nil { return err } if err = addOpDeleteBucketTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteBucketTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteBucketTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteBucketTaggingMiddleware struct { } func (*endpointPrefix_opDeleteBucketTaggingMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteBucketTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteBucketTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteBucketTaggingMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteBucketTaggingMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteBucketTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteBucketTagging", } } func copyDeleteBucketTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteBucketTaggingInput) if !ok { return nil, fmt.Errorf("expect *DeleteBucketTaggingInput type, got %T", params) } cpy := *input return &cpy, nil } func getDeleteBucketTaggingARNMember(input interface{}) (*string, bool) { in := input.(*DeleteBucketTaggingInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setDeleteBucketTaggingARNMember(input interface{}, v string) error { in := input.(*DeleteBucketTaggingInput) in.Bucket = &v return nil } func backFillDeleteBucketTaggingAccountID(input interface{}, v string) error { in := input.(*DeleteBucketTaggingInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteBucketTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getDeleteBucketTaggingARNMember, BackfillAccountID: backFillDeleteBucketTaggingAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setDeleteBucketTaggingARNMember, CopyInput: copyDeleteBucketTaggingInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
246
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Removes the entire tag set from the specified S3 Batch Operations job. To use // the DeleteJobTagging operation, you must have permission to perform the // s3:DeleteJobTagging action. For more information, see Controlling access and // labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) // in the Amazon S3 User Guide. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - GetJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetJobTagging.html) // - PutJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutJobTagging.html) func (c *Client) DeleteJobTagging(ctx context.Context, params *DeleteJobTaggingInput, optFns ...func(*Options)) (*DeleteJobTaggingOutput, error) { if params == nil { params = &DeleteJobTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteJobTagging", params, optFns, c.addOperationDeleteJobTaggingMiddlewares) if err != nil { return nil, err } out := result.(*DeleteJobTaggingOutput) out.ResultMetadata = metadata return out, nil } type DeleteJobTaggingInput struct { // The Amazon Web Services account ID associated with the S3 Batch Operations job. // // This member is required. AccountId *string // The ID for the S3 Batch Operations job whose tags you want to delete. // // This member is required. JobId *string noSmithyDocumentSerde } type DeleteJobTaggingOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteJobTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteJobTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteJobTagging{}, 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 = addEndpointPrefix_opDeleteJobTaggingMiddleware(stack); err != nil { return err } if err = addOpDeleteJobTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteJobTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteJobTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteJobTaggingMiddleware struct { } func (*endpointPrefix_opDeleteJobTaggingMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteJobTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteJobTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteJobTaggingMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteJobTaggingMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteJobTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteJobTagging", } } func copyDeleteJobTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteJobTaggingInput) if !ok { return nil, fmt.Errorf("expect *DeleteJobTaggingInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteJobTaggingAccountID(input interface{}, v string) error { in := input.(*DeleteJobTaggingInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteJobTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteJobTaggingInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
219
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes a Multi-Region Access Point. This action does not delete the buckets // associated with the Multi-Region Access Point, only the Multi-Region Access // Point itself. This action will always be routed to the US West (Oregon) Region. // For more information about the restrictions around managing Multi-Region Access // Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. This request is asynchronous, meaning that you // might receive a response before the command has completed. When this request // provides a response, it provides a token that you can use to monitor the status // of the request with DescribeMultiRegionAccessPointOperation . The following // actions are related to DeleteMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) // - DescribeMultiRegionAccessPointOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html) // - GetMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPoint.html) // - ListMultiRegionAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListMultiRegionAccessPoints.html) func (c *Client) DeleteMultiRegionAccessPoint(ctx context.Context, params *DeleteMultiRegionAccessPointInput, optFns ...func(*Options)) (*DeleteMultiRegionAccessPointOutput, error) { if params == nil { params = &DeleteMultiRegionAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteMultiRegionAccessPoint", params, optFns, c.addOperationDeleteMultiRegionAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*DeleteMultiRegionAccessPointOutput) out.ResultMetadata = metadata return out, nil } type DeleteMultiRegionAccessPointInput struct { // The Amazon Web Services account ID for the owner of the Multi-Region Access // Point. // // This member is required. AccountId *string // An idempotency token used to identify the request and guarantee that requests // are unique. // // This member is required. ClientToken *string // A container element containing details about the Multi-Region Access Point. // // This member is required. Details *types.DeleteMultiRegionAccessPointInput noSmithyDocumentSerde } type DeleteMultiRegionAccessPointOutput struct { // The request token associated with the request. You can use this token with // DescribeMultiRegionAccessPointOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html) // to determine the status of asynchronous requests. RequestTokenARN *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteMultiRegionAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteMultiRegionAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteMultiRegionAccessPoint{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addEndpointPrefix_opDeleteMultiRegionAccessPointMiddleware(stack); err != nil { return err } if err = addIdempotencyToken_opDeleteMultiRegionAccessPointMiddleware(stack, options); err != nil { return err } if err = addOpDeleteMultiRegionAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteMultiRegionAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteMultiRegionAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteMultiRegionAccessPointMiddleware struct { } func (*endpointPrefix_opDeleteMultiRegionAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteMultiRegionAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteMultiRegionAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteMultiRegionAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteMultiRegionAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } type idempotencyToken_initializeOpDeleteMultiRegionAccessPoint struct { tokenProvider IdempotencyTokenProvider } func (*idempotencyToken_initializeOpDeleteMultiRegionAccessPoint) ID() string { return "OperationIdempotencyTokenAutoFill" } func (m *idempotencyToken_initializeOpDeleteMultiRegionAccessPoint) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( out middleware.InitializeOutput, metadata middleware.Metadata, err error, ) { if m.tokenProvider == nil { return next.HandleInitialize(ctx, in) } input, ok := in.Parameters.(*DeleteMultiRegionAccessPointInput) if !ok { return out, metadata, fmt.Errorf("expected middleware input to be of type *DeleteMultiRegionAccessPointInput ") } if input.ClientToken == nil { t, err := m.tokenProvider.GetIdempotencyToken() if err != nil { return out, metadata, err } input.ClientToken = &t } return next.HandleInitialize(ctx, in) } func addIdempotencyToken_opDeleteMultiRegionAccessPointMiddleware(stack *middleware.Stack, cfg Options) error { return stack.Initialize.Add(&idempotencyToken_initializeOpDeleteMultiRegionAccessPoint{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) } func newServiceMetadataMiddleware_opDeleteMultiRegionAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteMultiRegionAccessPoint", } } func copyDeleteMultiRegionAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteMultiRegionAccessPointInput) if !ok { return nil, fmt.Errorf("expect *DeleteMultiRegionAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteMultiRegionAccessPointAccountID(input interface{}, v string) error { in := input.(*DeleteMultiRegionAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteMultiRegionAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteMultiRegionAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
278
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Removes the PublicAccessBlock configuration for an Amazon Web Services account. // For more information, see Using Amazon S3 block public access (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html) // . Related actions include: // - GetPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetPublicAccessBlock.html) // - PutPublicAccessBlock (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutPublicAccessBlock.html) func (c *Client) DeletePublicAccessBlock(ctx context.Context, params *DeletePublicAccessBlockInput, optFns ...func(*Options)) (*DeletePublicAccessBlockOutput, error) { if params == nil { params = &DeletePublicAccessBlockInput{} } result, metadata, err := c.invokeOperation(ctx, "DeletePublicAccessBlock", params, optFns, c.addOperationDeletePublicAccessBlockMiddlewares) if err != nil { return nil, err } out := result.(*DeletePublicAccessBlockOutput) out.ResultMetadata = metadata return out, nil } type DeletePublicAccessBlockInput struct { // The account ID for the Amazon Web Services account whose PublicAccessBlock // configuration you want to remove. // // This member is required. AccountId *string noSmithyDocumentSerde } type DeletePublicAccessBlockOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeletePublicAccessBlockMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeletePublicAccessBlock{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeletePublicAccessBlock{}, 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 = addEndpointPrefix_opDeletePublicAccessBlockMiddleware(stack); err != nil { return err } if err = addOpDeletePublicAccessBlockValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeletePublicAccessBlock(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeletePublicAccessBlockUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeletePublicAccessBlockMiddleware struct { } func (*endpointPrefix_opDeletePublicAccessBlockMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeletePublicAccessBlockMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeletePublicAccessBlockInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeletePublicAccessBlockMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeletePublicAccessBlockMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeletePublicAccessBlock(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeletePublicAccessBlock", } } func copyDeletePublicAccessBlockInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeletePublicAccessBlockInput) if !ok { return nil, fmt.Errorf("expect *DeletePublicAccessBlockInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeletePublicAccessBlockAccountID(input interface{}, v string) error { in := input.(*DeletePublicAccessBlockInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeletePublicAccessBlockUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeletePublicAccessBlockInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
212
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes the Amazon S3 Storage Lens configuration. For more information about S3 // Storage Lens, see Assessing your storage activity and usage with Amazon S3 // Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:DeleteStorageLensConfiguration action. For more information, see // Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) // in the Amazon S3 User Guide. func (c *Client) DeleteStorageLensConfiguration(ctx context.Context, params *DeleteStorageLensConfigurationInput, optFns ...func(*Options)) (*DeleteStorageLensConfigurationOutput, error) { if params == nil { params = &DeleteStorageLensConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteStorageLensConfiguration", params, optFns, c.addOperationDeleteStorageLensConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*DeleteStorageLensConfigurationOutput) out.ResultMetadata = metadata return out, nil } type DeleteStorageLensConfigurationInput struct { // The account ID of the requester. // // This member is required. AccountId *string // The ID of the S3 Storage Lens configuration. // // This member is required. ConfigId *string noSmithyDocumentSerde } type DeleteStorageLensConfigurationOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteStorageLensConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteStorageLensConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteStorageLensConfiguration{}, 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 = addEndpointPrefix_opDeleteStorageLensConfigurationMiddleware(stack); err != nil { return err } if err = addOpDeleteStorageLensConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteStorageLensConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteStorageLensConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteStorageLensConfigurationMiddleware struct { } func (*endpointPrefix_opDeleteStorageLensConfigurationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteStorageLensConfigurationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteStorageLensConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteStorageLensConfigurationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteStorageLensConfigurationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteStorageLensConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteStorageLensConfiguration", } } func copyDeleteStorageLensConfigurationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteStorageLensConfigurationInput) if !ok { return nil, fmt.Errorf("expect *DeleteStorageLensConfigurationInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteStorageLensConfigurationAccountID(input interface{}, v string) error { in := input.(*DeleteStorageLensConfigurationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteStorageLensConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteStorageLensConfigurationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
218
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Deletes the Amazon S3 Storage Lens configuration tags. For more information // about S3 Storage Lens, see Assessing your storage activity and usage with // Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the s3:DeleteStorageLensConfigurationTagging action. For more // information, see Setting permissions to use Amazon S3 Storage Lens (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage_lens_iam_permissions.html) // in the Amazon S3 User Guide. func (c *Client) DeleteStorageLensConfigurationTagging(ctx context.Context, params *DeleteStorageLensConfigurationTaggingInput, optFns ...func(*Options)) (*DeleteStorageLensConfigurationTaggingOutput, error) { if params == nil { params = &DeleteStorageLensConfigurationTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "DeleteStorageLensConfigurationTagging", params, optFns, c.addOperationDeleteStorageLensConfigurationTaggingMiddlewares) if err != nil { return nil, err } out := result.(*DeleteStorageLensConfigurationTaggingOutput) out.ResultMetadata = metadata return out, nil } type DeleteStorageLensConfigurationTaggingInput struct { // The account ID of the requester. // // This member is required. AccountId *string // The ID of the S3 Storage Lens configuration. // // This member is required. ConfigId *string noSmithyDocumentSerde } type DeleteStorageLensConfigurationTaggingOutput struct { // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDeleteStorageLensConfigurationTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteStorageLensConfigurationTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteStorageLensConfigurationTagging{}, 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 = addEndpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware(stack); err != nil { return err } if err = addOpDeleteStorageLensConfigurationTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteStorageLensConfigurationTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDeleteStorageLensConfigurationTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware struct { } func (*endpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DeleteStorageLensConfigurationTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDeleteStorageLensConfigurationTaggingMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDeleteStorageLensConfigurationTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DeleteStorageLensConfigurationTagging", } } func copyDeleteStorageLensConfigurationTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DeleteStorageLensConfigurationTaggingInput) if !ok { return nil, fmt.Errorf("expect *DeleteStorageLensConfigurationTaggingInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDeleteStorageLensConfigurationTaggingAccountID(input interface{}, v string) error { in := input.(*DeleteStorageLensConfigurationTaggingInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDeleteStorageLensConfigurationTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDeleteStorageLensConfigurationTaggingInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
218
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Retrieves the configuration parameters and status for a Batch Operations job. // For more information, see S3 Batch Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/batch-ops.html) // in the Amazon S3 User Guide. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - ListJobs (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListJobs.html) // - UpdateJobPriority (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobPriority.html) // - UpdateJobStatus (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_UpdateJobStatus.html) func (c *Client) DescribeJob(ctx context.Context, params *DescribeJobInput, optFns ...func(*Options)) (*DescribeJobOutput, error) { if params == nil { params = &DescribeJobInput{} } result, metadata, err := c.invokeOperation(ctx, "DescribeJob", params, optFns, c.addOperationDescribeJobMiddlewares) if err != nil { return nil, err } out := result.(*DescribeJobOutput) out.ResultMetadata = metadata return out, nil } type DescribeJobInput struct { // The Amazon Web Services account ID associated with the S3 Batch Operations job. // // This member is required. AccountId *string // The ID for the job whose information you want to retrieve. // // This member is required. JobId *string noSmithyDocumentSerde } type DescribeJobOutput struct { // Contains the configuration parameters and status for the job specified in the // Describe Job request. Job *types.JobDescriptor // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDescribeJobMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDescribeJob{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDescribeJob{}, 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 = addEndpointPrefix_opDescribeJobMiddleware(stack); err != nil { return err } if err = addOpDescribeJobValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeJob(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDescribeJobUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDescribeJobMiddleware struct { } func (*endpointPrefix_opDescribeJobMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDescribeJobMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DescribeJobInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDescribeJobMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDescribeJobMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDescribeJob(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DescribeJob", } } func copyDescribeJobInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DescribeJobInput) if !ok { return nil, fmt.Errorf("expect *DescribeJobInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDescribeJobAccountID(input interface{}, v string) error { in := input.(*DescribeJobInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDescribeJobUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDescribeJobInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
224
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Retrieves the status of an asynchronous request to manage a Multi-Region Access // Point. For more information about managing Multi-Region Access Points and how // asynchronous requests work, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) // - DeleteMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteMultiRegionAccessPoint.html) // - GetMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPoint.html) // - ListMultiRegionAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListMultiRegionAccessPoints.html) func (c *Client) DescribeMultiRegionAccessPointOperation(ctx context.Context, params *DescribeMultiRegionAccessPointOperationInput, optFns ...func(*Options)) (*DescribeMultiRegionAccessPointOperationOutput, error) { if params == nil { params = &DescribeMultiRegionAccessPointOperationInput{} } result, metadata, err := c.invokeOperation(ctx, "DescribeMultiRegionAccessPointOperation", params, optFns, c.addOperationDescribeMultiRegionAccessPointOperationMiddlewares) if err != nil { return nil, err } out := result.(*DescribeMultiRegionAccessPointOperationOutput) out.ResultMetadata = metadata return out, nil } type DescribeMultiRegionAccessPointOperationInput struct { // The Amazon Web Services account ID for the owner of the Multi-Region Access // Point. // // This member is required. AccountId *string // The request token associated with the request you want to know about. This // request token is returned as part of the response when you make an asynchronous // request. You provide this token to query about the status of the asynchronous // action. // // This member is required. RequestTokenARN *string noSmithyDocumentSerde } type DescribeMultiRegionAccessPointOperationOutput struct { // A container element containing the details of the asynchronous operation. AsyncOperation *types.AsyncOperation // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationDescribeMultiRegionAccessPointOperationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpDescribeMultiRegionAccessPointOperation{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpDescribeMultiRegionAccessPointOperation{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addEndpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware(stack); err != nil { return err } if err = addOpDescribeMultiRegionAccessPointOperationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDescribeMultiRegionAccessPointOperation(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addDescribeMultiRegionAccessPointOperationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware struct { } func (*endpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*DescribeMultiRegionAccessPointOperationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opDescribeMultiRegionAccessPointOperationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opDescribeMultiRegionAccessPointOperation(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "DescribeMultiRegionAccessPointOperation", } } func copyDescribeMultiRegionAccessPointOperationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*DescribeMultiRegionAccessPointOperationInput) if !ok { return nil, fmt.Errorf("expect *DescribeMultiRegionAccessPointOperationInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillDescribeMultiRegionAccessPointOperationAccountID(input interface{}, v string) error { in := input.(*DescribeMultiRegionAccessPointOperationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addDescribeMultiRegionAccessPointOperationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyDescribeMultiRegionAccessPointOperationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
232
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" "time" ) // Returns configuration information about the specified access point. All Amazon // S3 on Outposts REST API requests for this action require an additional parameter // of x-amz-outpost-id to be passed with the request. In addition, you must use an // S3 on Outposts endpoint hostname prefix instead of s3-control . For an example // of the request syntax for Amazon S3 on Outposts that uses the S3 on Outposts // endpoint hostname prefix and the x-amz-outpost-id derived by using the access // point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetAccessPoint.html#API_control_GetAccessPoint_Examples) // section. The following actions are related to GetAccessPoint : // - CreateAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPoint.html) // - DeleteAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPoint.html) // - ListAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPoints.html) func (c *Client) GetAccessPoint(ctx context.Context, params *GetAccessPointInput, optFns ...func(*Options)) (*GetAccessPointOutput, error) { if params == nil { params = &GetAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPoint", params, optFns, c.addOperationGetAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointInput struct { // The Amazon Web Services account ID for the account that owns the specified // access point. // // This member is required. AccountId *string // The name of the access point whose configuration information you want to // retrieve. For using this parameter with Amazon S3 on Outposts with the REST API, // you must specify the name and the x-amz-outpost-id as well. For using this // parameter with S3 on Outposts with the Amazon Web Services SDK and CLI, you must // specify the ARN of the access point accessed in the format // arn:aws:s3-outposts:::outpost//accesspoint/ . For example, to access the access // point reports-ap through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap // . The value must be URL encoded. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointOutput struct { // The ARN of the access point. AccessPointArn *string // The name or alias of the access point. Alias *string // The name of the bucket associated with the specified access point. Bucket *string // The Amazon Web Services account ID associated with the S3 bucket associated // with this access point. BucketAccountId *string // The date and time when the specified access point was created. CreationDate *time.Time // The VPC endpoint for the access point. Endpoints map[string]string // The name of the specified access point. Name *string // Indicates whether this access point allows access from the public internet. If // VpcConfiguration is specified for this access point, then NetworkOrigin is VPC , // and the access point doesn't allow access from the public internet. Otherwise, // NetworkOrigin is Internet , and the access point allows access from the public // internet, subject to the access point and bucket access policies. This will // always be true for an Amazon S3 on Outposts access point NetworkOrigin types.NetworkOrigin // The PublicAccessBlock configuration that you want to apply to this Amazon S3 // account. You can enable the configuration options in any combination. For more // information about when Amazon S3 considers a bucket or object public, see The // Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) // in the Amazon S3 User Guide. This data type is not supported for Amazon S3 on // Outposts. PublicAccessBlockConfiguration *types.PublicAccessBlockConfiguration // Contains the virtual private cloud (VPC) configuration for the specified access // point. This element is empty if this access point is an Amazon S3 on Outposts // access point that is used by other Amazon Web Services. VpcConfiguration *types.VpcConfiguration // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPoint{}, 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 = addEndpointPrefix_opGetAccessPointMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointMiddleware struct { } func (*endpointPrefix_opGetAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPoint", } } func copyGetAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetAccessPointARNMember(input interface{}) (*string, bool) { in := input.(*GetAccessPointInput) if in.Name == nil { return nil, false } return in.Name, true } func setGetAccessPointARNMember(input interface{}, v string) error { in := input.(*GetAccessPointInput) in.Name = &v return nil } func backFillGetAccessPointAccountID(input interface{}, v string) error { in := input.(*GetAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetAccessPointARNMember, BackfillAccountID: backFillGetAccessPointAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetAccessPointARNMember, CopyInput: copyGetAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
290
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns configuration for an Object Lambda Access Point. The following actions // are related to GetAccessPointConfigurationForObjectLambda : // - PutAccessPointConfigurationForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointConfigurationForObjectLambda.html) func (c *Client) GetAccessPointConfigurationForObjectLambda(ctx context.Context, params *GetAccessPointConfigurationForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointConfigurationForObjectLambdaOutput, error) { if params == nil { params = &GetAccessPointConfigurationForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointConfigurationForObjectLambda", params, optFns, c.addOperationGetAccessPointConfigurationForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointConfigurationForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointConfigurationForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the Object Lambda Access Point you want to return the configuration // for. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointConfigurationForObjectLambdaOutput struct { // Object Lambda Access Point configuration document. Configuration *types.ObjectLambdaConfiguration // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointConfigurationForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointConfigurationForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointConfigurationForObjectLambda{}, 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 = addEndpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointConfigurationForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointConfigurationForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointConfigurationForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware struct { } func (*endpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointConfigurationForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointConfigurationForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointConfigurationForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointConfigurationForObjectLambda", } } func copyGetAccessPointConfigurationForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointConfigurationForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointConfigurationForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetAccessPointConfigurationForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*GetAccessPointConfigurationForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointConfigurationForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetAccessPointConfigurationForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
221
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" "time" ) // Returns configuration information about the specified Object Lambda Access // Point The following actions are related to GetAccessPointForObjectLambda : // - CreateAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateAccessPointForObjectLambda.html) // - DeleteAccessPointForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointForObjectLambda.html) // - ListAccessPointsForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListAccessPointsForObjectLambda.html) func (c *Client) GetAccessPointForObjectLambda(ctx context.Context, params *GetAccessPointForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointForObjectLambdaOutput, error) { if params == nil { params = &GetAccessPointForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointForObjectLambda", params, optFns, c.addOperationGetAccessPointForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the Object Lambda Access Point. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointForObjectLambdaOutput struct { // The alias of the Object Lambda Access Point. Alias *types.ObjectLambdaAccessPointAlias // The date and time when the specified Object Lambda Access Point was created. CreationDate *time.Time // The name of the Object Lambda Access Point. Name *string // Configuration to block all public access. This setting is turned on and can not // be edited. PublicAccessBlockConfiguration *types.PublicAccessBlockConfiguration // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointForObjectLambda{}, 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 = addEndpointPrefix_opGetAccessPointForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointForObjectLambdaMiddleware struct { } func (*endpointPrefix_opGetAccessPointForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointForObjectLambda", } } func copyGetAccessPointForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetAccessPointForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*GetAccessPointForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetAccessPointForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
233
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns the access point policy associated with the specified access point. The // following actions are related to GetAccessPointPolicy : // - PutAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicy.html) // - DeleteAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicy.html) func (c *Client) GetAccessPointPolicy(ctx context.Context, params *GetAccessPointPolicyInput, optFns ...func(*Options)) (*GetAccessPointPolicyOutput, error) { if params == nil { params = &GetAccessPointPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointPolicy", params, optFns, c.addOperationGetAccessPointPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointPolicyInput struct { // The account ID for the account that owns the specified access point. // // This member is required. AccountId *string // The name of the access point whose policy you want to retrieve. For using this // parameter with Amazon S3 on Outposts with the REST API, you must specify the // name and the x-amz-outpost-id as well. For using this parameter with S3 on // Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of // the access point accessed in the format // arn:aws:s3-outposts:::outpost//accesspoint/ . For example, to access the access // point reports-ap through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/accesspoint/reports-ap // . The value must be URL encoded. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointPolicyOutput struct { // The access point policy associated with the specified access point. Policy *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointPolicy{}, 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 = addEndpointPrefix_opGetAccessPointPolicyMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointPolicyMiddleware struct { } func (*endpointPrefix_opGetAccessPointPolicyMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointPolicyMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointPolicyMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointPolicy", } } func copyGetAccessPointPolicyInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointPolicyInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointPolicyInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetAccessPointPolicyARNMember(input interface{}) (*string, bool) { in := input.(*GetAccessPointPolicyInput) if in.Name == nil { return nil, false } return in.Name, true } func setGetAccessPointPolicyARNMember(input interface{}, v string) error { in := input.(*GetAccessPointPolicyInput) in.Name = &v return nil } func backFillGetAccessPointPolicyAccountID(input interface{}, v string) error { in := input.(*GetAccessPointPolicyInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetAccessPointPolicyARNMember, BackfillAccountID: backFillGetAccessPointPolicyAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetAccessPointPolicyARNMember, CopyInput: copyGetAccessPointPolicyInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
240
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns the resource policy for an Object Lambda Access Point. The following // actions are related to GetAccessPointPolicyForObjectLambda : // - DeleteAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteAccessPointPolicyForObjectLambda.html) // - PutAccessPointPolicyForObjectLambda (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutAccessPointPolicyForObjectLambda.html) func (c *Client) GetAccessPointPolicyForObjectLambda(ctx context.Context, params *GetAccessPointPolicyForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointPolicyForObjectLambdaOutput, error) { if params == nil { params = &GetAccessPointPolicyForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointPolicyForObjectLambda", params, optFns, c.addOperationGetAccessPointPolicyForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointPolicyForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointPolicyForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the Object Lambda Access Point. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointPolicyForObjectLambdaOutput struct { // Object Lambda Access Point resource policy document. Policy *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointPolicyForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointPolicyForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointPolicyForObjectLambda{}, 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 = addEndpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointPolicyForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointPolicyForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointPolicyForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware struct { } func (*endpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointPolicyForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointPolicyForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointPolicyForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointPolicyForObjectLambda", } } func copyGetAccessPointPolicyForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointPolicyForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointPolicyForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetAccessPointPolicyForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*GetAccessPointPolicyForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointPolicyForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetAccessPointPolicyForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
220
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Indicates whether the specified access point currently has a policy that allows // public access. For more information about public access through access points, // see Managing Data Access with Amazon S3 access points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html) // in the Amazon S3 User Guide. func (c *Client) GetAccessPointPolicyStatus(ctx context.Context, params *GetAccessPointPolicyStatusInput, optFns ...func(*Options)) (*GetAccessPointPolicyStatusOutput, error) { if params == nil { params = &GetAccessPointPolicyStatusInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointPolicyStatus", params, optFns, c.addOperationGetAccessPointPolicyStatusMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointPolicyStatusOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointPolicyStatusInput struct { // The account ID for the account that owns the specified access point. // // This member is required. AccountId *string // The name of the access point whose policy status you want to retrieve. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointPolicyStatusOutput struct { // Indicates the current policy status of the specified access point. PolicyStatus *types.PolicyStatus // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointPolicyStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointPolicyStatus{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointPolicyStatus{}, 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 = addEndpointPrefix_opGetAccessPointPolicyStatusMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointPolicyStatusValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointPolicyStatus(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointPolicyStatusUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointPolicyStatusMiddleware struct { } func (*endpointPrefix_opGetAccessPointPolicyStatusMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointPolicyStatusMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointPolicyStatusInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointPolicyStatusMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointPolicyStatusMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointPolicyStatus(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointPolicyStatus", } } func copyGetAccessPointPolicyStatusInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointPolicyStatusInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointPolicyStatusInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetAccessPointPolicyStatusAccountID(input interface{}, v string) error { in := input.(*GetAccessPointPolicyStatusInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointPolicyStatusUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetAccessPointPolicyStatusInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
220
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns the status of the resource policy associated with an Object Lambda // Access Point. func (c *Client) GetAccessPointPolicyStatusForObjectLambda(ctx context.Context, params *GetAccessPointPolicyStatusForObjectLambdaInput, optFns ...func(*Options)) (*GetAccessPointPolicyStatusForObjectLambdaOutput, error) { if params == nil { params = &GetAccessPointPolicyStatusForObjectLambdaInput{} } result, metadata, err := c.invokeOperation(ctx, "GetAccessPointPolicyStatusForObjectLambda", params, optFns, c.addOperationGetAccessPointPolicyStatusForObjectLambdaMiddlewares) if err != nil { return nil, err } out := result.(*GetAccessPointPolicyStatusForObjectLambdaOutput) out.ResultMetadata = metadata return out, nil } type GetAccessPointPolicyStatusForObjectLambdaInput struct { // The account ID for the account that owns the specified Object Lambda Access // Point. // // This member is required. AccountId *string // The name of the Object Lambda Access Point. // // This member is required. Name *string noSmithyDocumentSerde } type GetAccessPointPolicyStatusForObjectLambdaOutput struct { // Indicates whether this access point policy is public. For more information // about how Amazon S3 evaluates policies to determine whether they are public, see // The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) // in the Amazon S3 User Guide. PolicyStatus *types.PolicyStatus // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetAccessPointPolicyStatusForObjectLambdaMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetAccessPointPolicyStatusForObjectLambda{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetAccessPointPolicyStatusForObjectLambda{}, 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 = addEndpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware(stack); err != nil { return err } if err = addOpGetAccessPointPolicyStatusForObjectLambdaValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAccessPointPolicyStatusForObjectLambda(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetAccessPointPolicyStatusForObjectLambdaUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware struct { } func (*endpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetAccessPointPolicyStatusForObjectLambdaInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetAccessPointPolicyStatusForObjectLambdaMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetAccessPointPolicyStatusForObjectLambda(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetAccessPointPolicyStatusForObjectLambda", } } func copyGetAccessPointPolicyStatusForObjectLambdaInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetAccessPointPolicyStatusForObjectLambdaInput) if !ok { return nil, fmt.Errorf("expect *GetAccessPointPolicyStatusForObjectLambdaInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetAccessPointPolicyStatusForObjectLambdaAccountID(input interface{}, v string) error { in := input.(*GetAccessPointPolicyStatusForObjectLambdaInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetAccessPointPolicyStatusForObjectLambdaUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetAccessPointPolicyStatusForObjectLambdaInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
222
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" "time" ) // Gets an Amazon S3 on Outposts bucket. For more information, see Using Amazon // S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. If you are using an identity other than the root // user of the Amazon Web Services account that owns the Outposts bucket, the // calling identity must have the s3-outposts:GetBucket permissions on the // specified Outposts bucket and belong to the Outposts bucket owner's account in // order to use this action. Only users from Outposts bucket owner account with the // right permissions can perform actions on an Outposts bucket. If you don't have // s3-outposts:GetBucket permissions or you're not using an identity that belongs // to the bucket owner's account, Amazon S3 returns a 403 Access Denied error. The // following actions are related to GetBucket for Amazon S3 on Outposts: All // Amazon S3 on Outposts REST API requests for this action require an additional // parameter of x-amz-outpost-id to be passed with the request. In addition, you // must use an S3 on Outposts endpoint hostname prefix instead of s3-control . For // an example of the request syntax for Amazon S3 on Outposts that uses the S3 on // Outposts endpoint hostname prefix and the x-amz-outpost-id derived by using the // access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html#API_control_GetBucket_Examples) // section. // - PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) // - CreateBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateBucket.html) // - DeleteBucket (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucket.html) func (c *Client) GetBucket(ctx context.Context, params *GetBucketInput, optFns ...func(*Options)) (*GetBucketOutput, error) { if params == nil { params = &GetBucketInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucket", params, optFns, c.addOperationGetBucketMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketOutput) out.ResultMetadata = metadata return out, nil } type GetBucketInput struct { // The Amazon Web Services account ID of the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket. For using this parameter with Amazon S3 on Outposts with // the REST API, you must specify the name and the x-amz-outpost-id as well. For // using this parameter with S3 on Outposts with the Amazon Web Services SDK and // CLI, you must specify the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketOutput struct { // The Outposts bucket requested. Bucket *string // The creation date of the Outposts bucket. CreationDate *time.Time // PublicAccessBlockEnabled bool // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucket{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucket{}, 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 = addEndpointPrefix_opGetBucketMiddleware(stack); err != nil { return err } if err = addOpGetBucketValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucket(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketMiddleware struct { } func (*endpointPrefix_opGetBucketMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucket(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucket", } } func copyGetBucketInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketInput) if !ok { return nil, fmt.Errorf("expect *GetBucketInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketARNMember(input interface{}, v string) error { in := input.(*GetBucketInput) in.Bucket = &v return nil } func backFillGetBucketAccountID(input interface{}, v string) error { in := input.(*GetBucketInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketARNMember, BackfillAccountID: backFillGetBucketAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketARNMember, CopyInput: copyGetBucketInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
263
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action gets an Amazon S3 on Outposts bucket's lifecycle configuration. To // get an S3 bucket's lifecycle configuration, see GetBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycleConfiguration.html) // in the Amazon S3 API Reference. Returns the lifecycle configuration information // set on the Outposts bucket. For more information, see Using Amazon S3 on // Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // and for information about lifecycle configuration, see Object Lifecycle // Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) // in Amazon S3 User Guide. To use this action, you must have permission to perform // the s3-outposts:GetLifecycleConfiguration action. The Outposts bucket owner has // this permission, by default. The bucket owner can grant this permission to // others. For more information about permissions, see Permissions Related to // Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) // and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // . All Amazon S3 on Outposts REST API requests for this action require an // additional parameter of x-amz-outpost-id to be passed with the request. In // addition, you must use an S3 on Outposts endpoint hostname prefix instead of // s3-control . For an example of the request syntax for Amazon S3 on Outposts that // uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id // derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html#API_control_GetBucketLifecycleConfiguration_Examples) // section. GetBucketLifecycleConfiguration has the following special error: // - Error code: NoSuchLifecycleConfiguration // - Description: The lifecycle configuration does not exist. // - HTTP Status Code: 404 Not Found // - SOAP Fault Code Prefix: Client // // The following actions are related to GetBucketLifecycleConfiguration : // - PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html) // - DeleteBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketLifecycleConfiguration.html) func (c *Client) GetBucketLifecycleConfiguration(ctx context.Context, params *GetBucketLifecycleConfigurationInput, optFns ...func(*Options)) (*GetBucketLifecycleConfigurationOutput, error) { if params == nil { params = &GetBucketLifecycleConfigurationInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucketLifecycleConfiguration", params, optFns, c.addOperationGetBucketLifecycleConfigurationMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketLifecycleConfigurationOutput) out.ResultMetadata = metadata return out, nil } type GetBucketLifecycleConfigurationInput struct { // The Amazon Web Services account ID of the Outposts bucket. // // This member is required. AccountId *string // The Amazon Resource Name (ARN) of the bucket. For using this parameter with // Amazon S3 on Outposts with the REST API, you must specify the name and the // x-amz-outpost-id as well. For using this parameter with S3 on Outposts with the // Amazon Web Services SDK and CLI, you must specify the ARN of the bucket accessed // in the format arn:aws:s3-outposts:::outpost//bucket/ . For example, to access // the bucket reports through Outpost my-outpost owned by account 123456789012 in // Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketLifecycleConfigurationOutput struct { // Container for the lifecycle rule of the Outposts bucket. Rules []types.LifecycleRule // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketLifecycleConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketLifecycleConfiguration{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketLifecycleConfiguration{}, 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 = addEndpointPrefix_opGetBucketLifecycleConfigurationMiddleware(stack); err != nil { return err } if err = addOpGetBucketLifecycleConfigurationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketLifecycleConfiguration(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketLifecycleConfigurationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketLifecycleConfigurationMiddleware struct { } func (*endpointPrefix_opGetBucketLifecycleConfigurationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketLifecycleConfigurationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketLifecycleConfigurationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketLifecycleConfigurationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketLifecycleConfigurationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucketLifecycleConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucketLifecycleConfiguration", } } func copyGetBucketLifecycleConfigurationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketLifecycleConfigurationInput) if !ok { return nil, fmt.Errorf("expect *GetBucketLifecycleConfigurationInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketLifecycleConfigurationARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketLifecycleConfigurationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketLifecycleConfigurationARNMember(input interface{}, v string) error { in := input.(*GetBucketLifecycleConfigurationInput) in.Bucket = &v return nil } func backFillGetBucketLifecycleConfigurationAccountID(input interface{}, v string) error { in := input.(*GetBucketLifecycleConfigurationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketLifecycleConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketLifecycleConfigurationARNMember, BackfillAccountID: backFillGetBucketLifecycleConfigurationAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketLifecycleConfigurationARNMember, CopyInput: copyGetBucketLifecycleConfigurationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
264
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action gets a bucket policy for an Amazon S3 on Outposts bucket. To get a // policy for an S3 bucket, see GetBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketPolicy.html) // in the Amazon S3 API Reference. Returns the policy of a specified Outposts // bucket. For more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. If you are using an identity other than the root // user of the Amazon Web Services account that owns the bucket, the calling // identity must have the GetBucketPolicy permissions on the specified bucket and // belong to the bucket owner's account in order to use this action. Only users // from Outposts bucket owner account with the right permissions can perform // actions on an Outposts bucket. If you don't have s3-outposts:GetBucketPolicy // permissions or you're not using an identity that belongs to the bucket owner's // account, Amazon S3 returns a 403 Access Denied error. As a security precaution, // the root user of the Amazon Web Services account that owns a bucket can always // use this action, even if the policy explicitly denies the root user the ability // to perform this action. For more information about bucket policies, see Using // Bucket Policies and User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html) // . All Amazon S3 on Outposts REST API requests for this action require an // additional parameter of x-amz-outpost-id to be passed with the request. In // addition, you must use an S3 on Outposts endpoint hostname prefix instead of // s3-control . For an example of the request syntax for Amazon S3 on Outposts that // uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id // derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketPolicy.html#API_control_GetBucketPolicy_Examples) // section. The following actions are related to GetBucketPolicy : // - GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // - PutBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketPolicy.html) // - DeleteBucketPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketPolicy.html) func (c *Client) GetBucketPolicy(ctx context.Context, params *GetBucketPolicyInput, optFns ...func(*Options)) (*GetBucketPolicyOutput, error) { if params == nil { params = &GetBucketPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucketPolicy", params, optFns, c.addOperationGetBucketPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetBucketPolicyInput struct { // The Amazon Web Services account ID of the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket. For using this parameter with Amazon S3 on Outposts with // the REST API, you must specify the name and the x-amz-outpost-id as well. For // using this parameter with S3 on Outposts with the Amazon Web Services SDK and // CLI, you must specify the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketPolicyOutput struct { // The policy of the Outposts bucket. Policy *string // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketPolicy{}, 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 = addEndpointPrefix_opGetBucketPolicyMiddleware(stack); err != nil { return err } if err = addOpGetBucketPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketPolicyMiddleware struct { } func (*endpointPrefix_opGetBucketPolicyMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketPolicyMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketPolicyMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucketPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucketPolicy", } } func copyGetBucketPolicyInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketPolicyInput) if !ok { return nil, fmt.Errorf("expect *GetBucketPolicyInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketPolicyARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketPolicyInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketPolicyARNMember(input interface{}, v string) error { in := input.(*GetBucketPolicyInput) in.Bucket = &v return nil } func backFillGetBucketPolicyAccountID(input interface{}, v string) error { in := input.(*GetBucketPolicyInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketPolicyARNMember, BackfillAccountID: backFillGetBucketPolicyAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketPolicyARNMember, CopyInput: copyGetBucketPolicyInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
261
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This operation gets an Amazon S3 on Outposts bucket's replication // configuration. To get an S3 bucket's replication configuration, see // GetBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketReplication.html) // in the Amazon S3 API Reference. Returns the replication configuration of an S3 // on Outposts bucket. For more information about S3 on Outposts, see Using Amazon // S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. For information about S3 replication on Outposts // configuration, see Replicating objects for S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsReplication.html) // in the Amazon S3 User Guide. It can take a while to propagate PUT or DELETE // requests for a replication configuration to all S3 on Outposts systems. // Therefore, the replication configuration that's returned by a GET request soon // after a PUT or DELETE request might return a more recent result than what's on // the Outpost. If an Outpost is offline, the delay in updating the replication // configuration on that Outpost can be significant. This action requires // permissions for the s3-outposts:GetReplicationConfiguration action. The // Outposts bucket owner has this permission by default and can grant it to others. // For more information about permissions, see Setting up IAM with S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsIAM.html) // and Managing access to S3 on Outposts bucket (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3OutpostsBucketPolicy.html) // in the Amazon S3 User Guide. All Amazon S3 on Outposts REST API requests for // this action require an additional parameter of x-amz-outpost-id to be passed // with the request. In addition, you must use an S3 on Outposts endpoint hostname // prefix instead of s3-control . For an example of the request syntax for Amazon // S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the // x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketReplication.html#API_control_GetBucketReplication_Examples) // section. If you include the Filter element in a replication configuration, you // must also include the DeleteMarkerReplication , Status , and Priority elements. // The response also returns those elements. For information about S3 on Outposts // replication failure reasons, see Replication failure reasons (https://docs.aws.amazon.com/AmazonS3/latest/userguide/outposts-replication-eventbridge.html#outposts-replication-failure-codes) // in the Amazon S3 User Guide. The following operations are related to // GetBucketReplication : // - PutBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketReplication.html) // - DeleteBucketReplication (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketReplication.html) func (c *Client) GetBucketReplication(ctx context.Context, params *GetBucketReplicationInput, optFns ...func(*Options)) (*GetBucketReplicationOutput, error) { if params == nil { params = &GetBucketReplicationInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucketReplication", params, optFns, c.addOperationGetBucketReplicationMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketReplicationOutput) out.ResultMetadata = metadata return out, nil } type GetBucketReplicationInput struct { // The Amazon Web Services account ID of the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket to get the replication information for. For using this // parameter with Amazon S3 on Outposts with the REST API, you must specify the // name and the x-amz-outpost-id as well. For using this parameter with S3 on // Outposts with the Amazon Web Services SDK and CLI, you must specify the ARN of // the bucket accessed in the format arn:aws:s3-outposts:::outpost//bucket/ . For // example, to access the bucket reports through Outpost my-outpost owned by // account 123456789012 in Region us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketReplicationOutput struct { // A container for one or more replication rules. A replication configuration must // have at least one rule and you can add up to 100 rules. The maximum size of a // replication configuration is 128 KB. ReplicationConfiguration *types.ReplicationConfiguration // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketReplicationMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketReplication{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketReplication{}, 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 = addEndpointPrefix_opGetBucketReplicationMiddleware(stack); err != nil { return err } if err = addOpGetBucketReplicationValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketReplication(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketReplicationUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketReplicationMiddleware struct { } func (*endpointPrefix_opGetBucketReplicationMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketReplicationMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketReplicationInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketReplicationMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketReplicationMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucketReplication(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucketReplication", } } func copyGetBucketReplicationInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketReplicationInput) if !ok { return nil, fmt.Errorf("expect *GetBucketReplicationInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketReplicationARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketReplicationInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketReplicationARNMember(input interface{}, v string) error { in := input.(*GetBucketReplicationInput) in.Bucket = &v return nil } func backFillGetBucketReplicationAccountID(input interface{}, v string) error { in := input.(*GetBucketReplicationInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketReplicationUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketReplicationARNMember, BackfillAccountID: backFillGetBucketReplicationAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketReplicationARNMember, CopyInput: copyGetBucketReplicationInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
270
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This action gets an Amazon S3 on Outposts bucket's tags. To get an S3 bucket // tags, see GetBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketTagging.html) // in the Amazon S3 API Reference. Returns the tag set associated with the Outposts // bucket. For more information, see Using Amazon S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) // in the Amazon S3 User Guide. To use this action, you must have permission to // perform the GetBucketTagging action. By default, the bucket owner has this // permission and can grant this permission to others. GetBucketTagging has the // following special error: // - Error code: NoSuchTagSetError // - Description: There is no tag set associated with the bucket. // // All Amazon S3 on Outposts REST API requests for this action require an // additional parameter of x-amz-outpost-id to be passed with the request. In // addition, you must use an S3 on Outposts endpoint hostname prefix instead of // s3-control . For an example of the request syntax for Amazon S3 on Outposts that // uses the S3 on Outposts endpoint hostname prefix and the x-amz-outpost-id // derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketTagging.html#API_control_GetBucketTagging_Examples) // section. The following actions are related to GetBucketTagging : // - PutBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketTagging.html) // - DeleteBucketTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteBucketTagging.html) func (c *Client) GetBucketTagging(ctx context.Context, params *GetBucketTaggingInput, optFns ...func(*Options)) (*GetBucketTaggingOutput, error) { if params == nil { params = &GetBucketTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucketTagging", params, optFns, c.addOperationGetBucketTaggingMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketTaggingOutput) out.ResultMetadata = metadata return out, nil } type GetBucketTaggingInput struct { // The Amazon Web Services account ID of the Outposts bucket. // // This member is required. AccountId *string // Specifies the bucket. For using this parameter with Amazon S3 on Outposts with // the REST API, you must specify the name and the x-amz-outpost-id as well. For // using this parameter with S3 on Outposts with the Amazon Web Services SDK and // CLI, you must specify the ARN of the bucket accessed in the format // arn:aws:s3-outposts:::outpost//bucket/ . For example, to access the bucket // reports through Outpost my-outpost owned by account 123456789012 in Region // us-west-2 , use the URL encoding of // arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/bucket/reports . // The value must be URL encoded. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketTaggingOutput struct { // The tags set of the Outposts bucket. // // This member is required. TagSet []types.S3Tag // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketTagging{}, 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 = addEndpointPrefix_opGetBucketTaggingMiddleware(stack); err != nil { return err } if err = addOpGetBucketTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketTaggingMiddleware struct { } func (*endpointPrefix_opGetBucketTaggingMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketTaggingMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketTaggingMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucketTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucketTagging", } } func copyGetBucketTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketTaggingInput) if !ok { return nil, fmt.Errorf("expect *GetBucketTaggingInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketTaggingARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketTaggingInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketTaggingARNMember(input interface{}, v string) error { in := input.(*GetBucketTaggingInput) in.Bucket = &v return nil } func backFillGetBucketTaggingAccountID(input interface{}, v string) error { in := input.(*GetBucketTaggingInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketTaggingARNMember, BackfillAccountID: backFillGetBucketTaggingAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketTaggingARNMember, CopyInput: copyGetBucketTaggingInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
258
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // This operation returns the versioning state for S3 on Outposts buckets only. To // return the versioning state for an S3 bucket, see GetBucketVersioning (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketVersioning.html) // in the Amazon S3 API Reference. Returns the versioning state for an S3 on // Outposts bucket. With S3 Versioning, you can save multiple distinct copies of // your objects and recover from unintended user actions and application failures. // If you've never set versioning on your bucket, it has no versioning state. In // that case, the GetBucketVersioning request does not return a versioning state // value. For more information about versioning, see Versioning (https://docs.aws.amazon.com/AmazonS3/latest/userguide/Versioning.html) // in the Amazon S3 User Guide. All Amazon S3 on Outposts REST API requests for // this action require an additional parameter of x-amz-outpost-id to be passed // with the request. In addition, you must use an S3 on Outposts endpoint hostname // prefix instead of s3-control . For an example of the request syntax for Amazon // S3 on Outposts that uses the S3 on Outposts endpoint hostname prefix and the // x-amz-outpost-id derived by using the access point ARN, see the Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketVersioning.html#API_control_GetBucketVersioning_Examples) // section. The following operations are related to GetBucketVersioning for S3 on // Outposts. // - PutBucketVersioning (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketVersioning.html) // - PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutBucketLifecycleConfiguration.html) // - GetBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucketLifecycleConfiguration.html) func (c *Client) GetBucketVersioning(ctx context.Context, params *GetBucketVersioningInput, optFns ...func(*Options)) (*GetBucketVersioningOutput, error) { if params == nil { params = &GetBucketVersioningInput{} } result, metadata, err := c.invokeOperation(ctx, "GetBucketVersioning", params, optFns, c.addOperationGetBucketVersioningMiddlewares) if err != nil { return nil, err } out := result.(*GetBucketVersioningOutput) out.ResultMetadata = metadata return out, nil } type GetBucketVersioningInput struct { // The Amazon Web Services account ID of the S3 on Outposts bucket. // // This member is required. AccountId *string // The S3 on Outposts bucket to return the versioning state for. // // This member is required. Bucket *string noSmithyDocumentSerde } type GetBucketVersioningOutput struct { // Specifies whether MFA delete is enabled in the bucket versioning configuration. // This element is returned only if the bucket has been configured with MFA delete. // If MFA delete has never been configured for the bucket, this element is not // returned. MFADelete types.MFADeleteStatus // The versioning state of the S3 on Outposts bucket. Status types.BucketVersioningStatus // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetBucketVersioningMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketVersioning{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketVersioning{}, 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 = addEndpointPrefix_opGetBucketVersioningMiddleware(stack); err != nil { return err } if err = addOpGetBucketVersioningValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketVersioning(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetBucketVersioningUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetBucketVersioningMiddleware struct { } func (*endpointPrefix_opGetBucketVersioningMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetBucketVersioningMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetBucketVersioningInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetBucketVersioningMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetBucketVersioningMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetBucketVersioning(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetBucketVersioning", } } func copyGetBucketVersioningInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetBucketVersioningInput) if !ok { return nil, fmt.Errorf("expect *GetBucketVersioningInput type, got %T", params) } cpy := *input return &cpy, nil } func getGetBucketVersioningARNMember(input interface{}) (*string, bool) { in := input.(*GetBucketVersioningInput) if in.Bucket == nil { return nil, false } return in.Bucket, true } func setGetBucketVersioningARNMember(input interface{}, v string) error { in := input.(*GetBucketVersioningInput) in.Bucket = &v return nil } func backFillGetBucketVersioningAccountID(input interface{}, v string) error { in := input.(*GetBucketVersioningInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetBucketVersioningUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: getGetBucketVersioningARNMember, BackfillAccountID: backFillGetBucketVersioningAccountID, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: setGetBucketVersioningARNMember, CopyInput: copyGetBucketVersioningInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
253
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns the tags on an S3 Batch Operations job. To use the GetJobTagging // operation, you must have permission to perform the s3:GetJobTagging action. For // more information, see Controlling access and labeling jobs using tags (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags) // in the Amazon S3 User Guide. Related actions include: // - CreateJob (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html) // - PutJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutJobTagging.html) // - DeleteJobTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteJobTagging.html) func (c *Client) GetJobTagging(ctx context.Context, params *GetJobTaggingInput, optFns ...func(*Options)) (*GetJobTaggingOutput, error) { if params == nil { params = &GetJobTaggingInput{} } result, metadata, err := c.invokeOperation(ctx, "GetJobTagging", params, optFns, c.addOperationGetJobTaggingMiddlewares) if err != nil { return nil, err } out := result.(*GetJobTaggingOutput) out.ResultMetadata = metadata return out, nil } type GetJobTaggingInput struct { // The Amazon Web Services account ID associated with the S3 Batch Operations job. // // This member is required. AccountId *string // The ID for the S3 Batch Operations job whose tags you want to retrieve. // // This member is required. JobId *string noSmithyDocumentSerde } type GetJobTaggingOutput struct { // The set of tags associated with the S3 Batch Operations job. Tags []types.S3Tag // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetJobTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetJobTagging{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetJobTagging{}, 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 = addEndpointPrefix_opGetJobTaggingMiddleware(stack); err != nil { return err } if err = addOpGetJobTaggingValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetJobTagging(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetJobTaggingUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetJobTaggingMiddleware struct { } func (*endpointPrefix_opGetJobTaggingMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetJobTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetJobTaggingInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetJobTaggingMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetJobTaggingMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetJobTagging(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetJobTagging", } } func copyGetJobTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetJobTaggingInput) if !ok { return nil, fmt.Errorf("expect *GetJobTaggingInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetJobTaggingAccountID(input interface{}, v string) error { in := input.(*GetJobTaggingInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetJobTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetJobTaggingInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
223
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns configuration information about the specified Multi-Region Access // Point. This action will always be routed to the US West (Oregon) Region. For // more information about the restrictions around managing Multi-Region Access // Points, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPoint : // - CreateMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateMultiRegionAccessPoint.html) // - DeleteMultiRegionAccessPoint (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DeleteMultiRegionAccessPoint.html) // - DescribeMultiRegionAccessPointOperation (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_DescribeMultiRegionAccessPointOperation.html) // - ListMultiRegionAccessPoints (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_ListMultiRegionAccessPoints.html) func (c *Client) GetMultiRegionAccessPoint(ctx context.Context, params *GetMultiRegionAccessPointInput, optFns ...func(*Options)) (*GetMultiRegionAccessPointOutput, error) { if params == nil { params = &GetMultiRegionAccessPointInput{} } result, metadata, err := c.invokeOperation(ctx, "GetMultiRegionAccessPoint", params, optFns, c.addOperationGetMultiRegionAccessPointMiddlewares) if err != nil { return nil, err } out := result.(*GetMultiRegionAccessPointOutput) out.ResultMetadata = metadata return out, nil } type GetMultiRegionAccessPointInput struct { // The Amazon Web Services account ID for the owner of the Multi-Region Access // Point. // // This member is required. AccountId *string // The name of the Multi-Region Access Point whose configuration information you // want to receive. The name of the Multi-Region Access Point is different from the // alias. For more information about the distinction between the name and the alias // of an Multi-Region Access Point, see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming) // in the Amazon S3 User Guide. // // This member is required. Name *string noSmithyDocumentSerde } type GetMultiRegionAccessPointOutput struct { // A container element containing the details of the requested Multi-Region Access // Point. AccessPoint *types.MultiRegionAccessPointReport // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetMultiRegionAccessPointMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetMultiRegionAccessPoint{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetMultiRegionAccessPoint{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addEndpointPrefix_opGetMultiRegionAccessPointMiddleware(stack); err != nil { return err } if err = addOpGetMultiRegionAccessPointValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMultiRegionAccessPoint(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetMultiRegionAccessPointUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetMultiRegionAccessPointMiddleware struct { } func (*endpointPrefix_opGetMultiRegionAccessPointMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetMultiRegionAccessPointMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetMultiRegionAccessPointInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetMultiRegionAccessPointMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetMultiRegionAccessPointMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetMultiRegionAccessPoint(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetMultiRegionAccessPoint", } } func copyGetMultiRegionAccessPointInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetMultiRegionAccessPointInput) if !ok { return nil, fmt.Errorf("expect *GetMultiRegionAccessPointInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetMultiRegionAccessPointAccountID(input interface{}, v string) error { in := input.(*GetMultiRegionAccessPointInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetMultiRegionAccessPointUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetMultiRegionAccessPointInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
235
aws-sdk-go-v2
aws
Go
// Code generated by smithy-go-codegen DO NOT EDIT. package s3control import ( "context" "fmt" awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" "github.com/aws/aws-sdk-go-v2/aws/signer/v4" s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations" "github.com/aws/aws-sdk-go-v2/service/s3control/types" smithy "github.com/aws/smithy-go" "github.com/aws/smithy-go/middleware" smithyhttp "github.com/aws/smithy-go/transport/http" "strings" ) // Returns the access control policy of the specified Multi-Region Access Point. // This action will always be routed to the US West (Oregon) Region. For more // information about the restrictions around managing Multi-Region Access Points, // see Managing Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManagingMultiRegionAccessPoints.html) // in the Amazon S3 User Guide. The following actions are related to // GetMultiRegionAccessPointPolicy : // - GetMultiRegionAccessPointPolicyStatus (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetMultiRegionAccessPointPolicyStatus.html) // - PutMultiRegionAccessPointPolicy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutMultiRegionAccessPointPolicy.html) func (c *Client) GetMultiRegionAccessPointPolicy(ctx context.Context, params *GetMultiRegionAccessPointPolicyInput, optFns ...func(*Options)) (*GetMultiRegionAccessPointPolicyOutput, error) { if params == nil { params = &GetMultiRegionAccessPointPolicyInput{} } result, metadata, err := c.invokeOperation(ctx, "GetMultiRegionAccessPointPolicy", params, optFns, c.addOperationGetMultiRegionAccessPointPolicyMiddlewares) if err != nil { return nil, err } out := result.(*GetMultiRegionAccessPointPolicyOutput) out.ResultMetadata = metadata return out, nil } type GetMultiRegionAccessPointPolicyInput struct { // The Amazon Web Services account ID for the owner of the Multi-Region Access // Point. // // This member is required. AccountId *string // Specifies the Multi-Region Access Point. The name of the Multi-Region Access // Point is different from the alias. For more information about the distinction // between the name and the alias of an Multi-Region Access Point, see Managing // Multi-Region Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/CreatingMultiRegionAccessPoints.html#multi-region-access-point-naming) // in the Amazon S3 User Guide. // // This member is required. Name *string noSmithyDocumentSerde } type GetMultiRegionAccessPointPolicyOutput struct { // The policy associated with the specified Multi-Region Access Point. Policy *types.MultiRegionAccessPointPolicyDocument // Metadata pertaining to the operation's result. ResultMetadata middleware.Metadata noSmithyDocumentSerde } func (c *Client) addOperationGetMultiRegionAccessPointPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) { err = stack.Serialize.Add(&awsRestxml_serializeOpGetMultiRegionAccessPointPolicy{}, middleware.After) if err != nil { return err } err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetMultiRegionAccessPointPolicy{}, 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 = smithyhttp.AddContentChecksumMiddleware(stack); err != nil { return err } if err = addEndpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware(stack); err != nil { return err } if err = addOpGetMultiRegionAccessPointPolicyValidationMiddleware(stack); err != nil { return err } if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetMultiRegionAccessPointPolicy(options.Region), middleware.Before); err != nil { return err } if err = addMetadataRetrieverMiddleware(stack); err != nil { return err } if err = awsmiddleware.AddRecursionDetection(stack); err != nil { return err } if err = addGetMultiRegionAccessPointPolicyUpdateEndpoint(stack, options); err != nil { return err } if err = addResponseErrorMiddleware(stack); err != nil { return err } if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { return err } if err = addRequestResponseLogging(stack, options); err != nil { return err } return nil } type endpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware struct { } func (*endpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware) ID() string { return "EndpointHostPrefix" } func (m *endpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( out middleware.SerializeOutput, metadata middleware.Metadata, err error, ) { if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) { return next.HandleSerialize(ctx, in) } req, ok := in.Request.(*smithyhttp.Request) if !ok { return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) } input, ok := in.Parameters.(*GetMultiRegionAccessPointPolicyInput) if !ok { return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters) } var prefix strings.Builder if input.AccountId == nil { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")} } else if !smithyhttp.ValidHostLabel(*input.AccountId) { return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)} } else { prefix.WriteString(*input.AccountId) } prefix.WriteString(".") req.URL.Host = prefix.String() + req.URL.Host return next.HandleSerialize(ctx, in) } func addEndpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware(stack *middleware.Stack) error { return stack.Serialize.Insert(&endpointPrefix_opGetMultiRegionAccessPointPolicyMiddleware{}, `OperationSerializer`, middleware.After) } func newServiceMetadataMiddleware_opGetMultiRegionAccessPointPolicy(region string) *awsmiddleware.RegisterServiceMetadata { return &awsmiddleware.RegisterServiceMetadata{ Region: region, ServiceID: ServiceID, SigningName: "s3", OperationName: "GetMultiRegionAccessPointPolicy", } } func copyGetMultiRegionAccessPointPolicyInputForUpdateEndpoint(params interface{}) (interface{}, error) { input, ok := params.(*GetMultiRegionAccessPointPolicyInput) if !ok { return nil, fmt.Errorf("expect *GetMultiRegionAccessPointPolicyInput type, got %T", params) } cpy := *input return &cpy, nil } func backFillGetMultiRegionAccessPointPolicyAccountID(input interface{}, v string) error { in := input.(*GetMultiRegionAccessPointPolicyInput) if in.AccountId != nil { if !strings.EqualFold(*in.AccountId, v) { return fmt.Errorf("error backfilling account id") } return nil } in.AccountId = &v return nil } func addGetMultiRegionAccessPointPolicyUpdateEndpoint(stack *middleware.Stack, options Options) error { return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{ Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor, BackfillAccountID: nopBackfillAccountIDAccessor, GetOutpostIDInput: nopGetOutpostIDFromInput, UpdateARNField: nopSetARNAccessor, CopyInput: copyGetMultiRegionAccessPointPolicyInputForUpdateEndpoint, }, EndpointResolver: options.EndpointResolver, EndpointResolverOptions: options.EndpointOptions, UseARNRegion: options.UseARNRegion, }) }
232