1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package s3
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	s3cust "github.com/aws/aws-sdk-go-v2/service/s3/internal/customizations"
10	"github.com/aws/aws-sdk-go-v2/service/s3/types"
11	"github.com/aws/smithy-go/middleware"
12	smithyhttp "github.com/aws/smithy-go/transport/http"
13)
14
15// Puts a S3 Intelligent-Tiering configuration to the specified bucket. The S3
16// Intelligent-Tiering storage class is designed to optimize storage costs by
17// automatically moving data to the most cost-effective storage access tier,
18// without additional operational overhead. S3 Intelligent-Tiering delivers
19// automatic cost savings by moving data between access tiers, when access patterns
20// change. The S3 Intelligent-Tiering storage class is suitable for objects larger
21// than 128 KB that you plan to store for at least 30 days. If the size of an
22// object is less than 128 KB, it is not eligible for auto-tiering. Smaller objects
23// can be stored, but they are always charged at the frequent access tier rates in
24// the S3 Intelligent-Tiering storage class. If you delete an object before the end
25// of the 30-day minimum storage duration period, you are charged for 30 days. For
26// more information, see Storage class for automatically optimizing frequently and
27// infrequently accessed objects
28// (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html#sc-dynamic-data-access).
29// Operations related to PutBucketIntelligentTieringConfiguration include:
30//
31// *
32// DeleteBucketIntelligentTieringConfiguration
33// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketIntelligentTieringConfiguration.html)
34//
35// *
36// GetBucketIntelligentTieringConfiguration
37// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketIntelligentTieringConfiguration.html)
38//
39// *
40// ListBucketIntelligentTieringConfigurations
41// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketIntelligentTieringConfigurations.html)
42func (c *Client) PutBucketIntelligentTieringConfiguration(ctx context.Context, params *PutBucketIntelligentTieringConfigurationInput, optFns ...func(*Options)) (*PutBucketIntelligentTieringConfigurationOutput, error) {
43	if params == nil {
44		params = &PutBucketIntelligentTieringConfigurationInput{}
45	}
46
47	result, metadata, err := c.invokeOperation(ctx, "PutBucketIntelligentTieringConfiguration", params, optFns, addOperationPutBucketIntelligentTieringConfigurationMiddlewares)
48	if err != nil {
49		return nil, err
50	}
51
52	out := result.(*PutBucketIntelligentTieringConfigurationOutput)
53	out.ResultMetadata = metadata
54	return out, nil
55}
56
57type PutBucketIntelligentTieringConfigurationInput struct {
58
59	// The name of the Amazon S3 bucket whose configuration you want to modify or
60	// retrieve.
61	//
62	// This member is required.
63	Bucket *string
64
65	// The ID used to identify the S3 Intelligent-Tiering configuration.
66	//
67	// This member is required.
68	Id *string
69
70	// Container for S3 Intelligent-Tiering configuration.
71	//
72	// This member is required.
73	IntelligentTieringConfiguration *types.IntelligentTieringConfiguration
74}
75
76type PutBucketIntelligentTieringConfigurationOutput struct {
77	// Metadata pertaining to the operation's result.
78	ResultMetadata middleware.Metadata
79}
80
81func addOperationPutBucketIntelligentTieringConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) {
82	err = stack.Serialize.Add(&awsRestxml_serializeOpPutBucketIntelligentTieringConfiguration{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	err = stack.Deserialize.Add(&awsRestxml_deserializeOpPutBucketIntelligentTieringConfiguration{}, middleware.After)
87	if err != nil {
88		return err
89	}
90	if err = addSetLoggerMiddleware(stack, options); err != nil {
91		return err
92	}
93	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
94		return err
95	}
96	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
97		return err
98	}
99	if err = addResolveEndpointMiddleware(stack, options); err != nil {
100		return err
101	}
102	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
103		return err
104	}
105	if err = addRetryMiddlewares(stack, options); err != nil {
106		return err
107	}
108	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
112		return err
113	}
114	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
115		return err
116	}
117	if err = addClientUserAgent(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
124		return err
125	}
126	if err = addOpPutBucketIntelligentTieringConfigurationValidationMiddleware(stack); err != nil {
127		return err
128	}
129	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opPutBucketIntelligentTieringConfiguration(options.Region), middleware.Before); err != nil {
130		return err
131	}
132	if err = addMetadataRetrieverMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addPutBucketIntelligentTieringConfigurationUpdateEndpoint(stack, options); err != nil {
136		return err
137	}
138	if err = addResponseErrorMiddleware(stack); err != nil {
139		return err
140	}
141	if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil {
142		return err
143	}
144	if err = disableAcceptEncodingGzip(stack); err != nil {
145		return err
146	}
147	if err = addRequestResponseLogging(stack, options); err != nil {
148		return err
149	}
150	return nil
151}
152
153func newServiceMetadataMiddleware_opPutBucketIntelligentTieringConfiguration(region string) *awsmiddleware.RegisterServiceMetadata {
154	return &awsmiddleware.RegisterServiceMetadata{
155		Region:        region,
156		ServiceID:     ServiceID,
157		SigningName:   "s3",
158		OperationName: "PutBucketIntelligentTieringConfiguration",
159	}
160}
161
162// getPutBucketIntelligentTieringConfigurationBucketMember returns a pointer to
163// string denoting a provided bucket member valueand a boolean indicating if the
164// input has a modeled bucket name,
165func getPutBucketIntelligentTieringConfigurationBucketMember(input interface{}) (*string, bool) {
166	in := input.(*PutBucketIntelligentTieringConfigurationInput)
167	if in.Bucket == nil {
168		return nil, false
169	}
170	return in.Bucket, true
171}
172func addPutBucketIntelligentTieringConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error {
173	return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{
174		Accessor: s3cust.UpdateEndpointParameterAccessor{
175			GetBucketFromInput: getPutBucketIntelligentTieringConfigurationBucketMember,
176		},
177		UsePathStyle:            options.UsePathStyle,
178		UseAccelerate:           options.UseAccelerate,
179		SupportsAccelerate:      true,
180		EndpointResolver:        options.EndpointResolver,
181		EndpointResolverOptions: options.EndpointOptions,
182		UseDualstack:            options.UseDualstack,
183		UseARNRegion:            options.UseARNRegion,
184	})
185}
186