// Code generated by smithy-go-codegen DO NOT EDIT.

package cloudwatchlogs

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
)

// Sets the storage tier policy for your account. When you set the storage tier to
// INTELLIGENT_TIERING , CloudWatch Logs automatically moves your log data between
// storage tiers based on access patterns to optimize costs.
func (c *Client) PutStorageTierPolicy(ctx context.Context, params *PutStorageTierPolicyInput, optFns ...func(*Options)) (*PutStorageTierPolicyOutput, error) {
	if params == nil {
		params = &PutStorageTierPolicyInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "PutStorageTierPolicy", params, optFns, c.addOperationPutStorageTierPolicyMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*PutStorageTierPolicyOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type PutStorageTierPolicyInput struct {

	// The storage tier to set for the account. Valid values are STANDARD and
	// INTELLIGENT_TIERING .
	//
	// This member is required.
	StorageTier types.StorageTier

	noSmithyDocumentSerde
}

type PutStorageTierPolicyOutput struct {

	// The time when the storage tier policy was last updated, expressed as the number
	// of milliseconds after Jan 1, 1970 00:00:00 UTC .
	LastUpdatedTime *int64

	// The storage tier that was set.
	StorageTier types.StorageTier

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationPutStorageTierPolicyMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsAwsjson11_serializeOpPutStorageTierPolicy{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpPutStorageTierPolicy{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack, options); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpPutStorageTierPolicyValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "PutStorageTierPolicy"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
