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// This implementation of the GET operation returns an analytics configuration 16// (identified by the analytics configuration ID) from the bucket. To use this 17// operation, you must have permissions to perform the s3:GetAnalyticsConfiguration 18// action. The bucket owner has this permission by default. The bucket owner can 19// grant this permission to others. For more information about permissions, see 20// Permissions Related to Bucket Subresource Operations 21// (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) 22// and Managing Access Permissions to Your Amazon S3 Resources 23// (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) in the 24// Amazon Simple Storage Service Developer Guide. For information about Amazon S3 25// analytics feature, see Amazon S3 Analytics – Storage Class Analysis 26// (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html) 27// in the Amazon Simple Storage Service Developer Guide. Related Resources 28// 29// * 30// DeleteBucketAnalyticsConfiguration 31// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketAnalyticsConfiguration.html) 32// 33// * 34// ListBucketAnalyticsConfigurations 35// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketAnalyticsConfigurations.html) 36// 37// * 38// PutBucketAnalyticsConfiguration 39// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketAnalyticsConfiguration.html) 40func (c *Client) GetBucketAnalyticsConfiguration(ctx context.Context, params *GetBucketAnalyticsConfigurationInput, optFns ...func(*Options)) (*GetBucketAnalyticsConfigurationOutput, error) { 41 if params == nil { 42 params = &GetBucketAnalyticsConfigurationInput{} 43 } 44 45 result, metadata, err := c.invokeOperation(ctx, "GetBucketAnalyticsConfiguration", params, optFns, addOperationGetBucketAnalyticsConfigurationMiddlewares) 46 if err != nil { 47 return nil, err 48 } 49 50 out := result.(*GetBucketAnalyticsConfigurationOutput) 51 out.ResultMetadata = metadata 52 return out, nil 53} 54 55type GetBucketAnalyticsConfigurationInput struct { 56 57 // The name of the bucket from which an analytics configuration is retrieved. 58 // 59 // This member is required. 60 Bucket *string 61 62 // The ID that identifies the analytics configuration. 63 // 64 // This member is required. 65 Id *string 66 67 // The account id of the expected bucket owner. If the bucket is owned by a 68 // different account, the request will fail with an HTTP 403 (Access Denied) error. 69 ExpectedBucketOwner *string 70} 71 72type GetBucketAnalyticsConfigurationOutput struct { 73 74 // The configuration and any analyses for the analytics filter. 75 AnalyticsConfiguration *types.AnalyticsConfiguration 76 77 // Metadata pertaining to the operation's result. 78 ResultMetadata middleware.Metadata 79} 80 81func addOperationGetBucketAnalyticsConfigurationMiddlewares(stack *middleware.Stack, options Options) (err error) { 82 err = stack.Serialize.Add(&awsRestxml_serializeOpGetBucketAnalyticsConfiguration{}, middleware.After) 83 if err != nil { 84 return err 85 } 86 err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetBucketAnalyticsConfiguration{}, 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 = addOpGetBucketAnalyticsConfigurationValidationMiddleware(stack); err != nil { 127 return err 128 } 129 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetBucketAnalyticsConfiguration(options.Region), middleware.Before); err != nil { 130 return err 131 } 132 if err = addMetadataRetrieverMiddleware(stack); err != nil { 133 return err 134 } 135 if err = addGetBucketAnalyticsConfigurationUpdateEndpoint(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_opGetBucketAnalyticsConfiguration(region string) *awsmiddleware.RegisterServiceMetadata { 154 return &awsmiddleware.RegisterServiceMetadata{ 155 Region: region, 156 ServiceID: ServiceID, 157 SigningName: "s3", 158 OperationName: "GetBucketAnalyticsConfiguration", 159 } 160} 161 162// getGetBucketAnalyticsConfigurationBucketMember returns a pointer to string 163// denoting a provided bucket member valueand a boolean indicating if the input has 164// a modeled bucket name, 165func getGetBucketAnalyticsConfigurationBucketMember(input interface{}) (*string, bool) { 166 in := input.(*GetBucketAnalyticsConfigurationInput) 167 if in.Bucket == nil { 168 return nil, false 169 } 170 return in.Bucket, true 171} 172func addGetBucketAnalyticsConfigurationUpdateEndpoint(stack *middleware.Stack, options Options) error { 173 return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ 174 Accessor: s3cust.UpdateEndpointParameterAccessor{ 175 GetBucketFromInput: getGetBucketAnalyticsConfigurationBucketMember, 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