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// Lists the metrics configurations for the bucket. The metrics configurations are 16// only for the request metrics of the bucket and do not provide information on 17// daily storage metrics. You can have up to 1,000 configurations per bucket. This 18// action supports list pagination and does not return more than 100 configurations 19// at a time. Always check the IsTruncated element in the response. If there are no 20// more configurations to list, IsTruncated is set to false. If there are more 21// configurations to list, IsTruncated is set to true, and there is a value in 22// NextContinuationToken. You use the NextContinuationToken value to continue the 23// pagination of the list by passing the value in continuation-token in the request 24// to GET the next page. To use this operation, you must have permissions to 25// perform the s3:GetMetricsConfiguration action. The bucket owner has this 26// permission by default. The bucket owner can grant this permission to others. For 27// more information about permissions, see Permissions Related to Bucket 28// Subresource Operations 29// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) 30// and Managing Access Permissions to Your Amazon S3 Resources 31// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). 32// For more information about metrics configurations and CloudWatch request 33// metrics, see Monitoring Metrics with Amazon CloudWatch 34// (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). 35// The following operations are related to ListBucketMetricsConfigurations: 36// 37// * 38// PutBucketMetricsConfiguration 39// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketMetricsConfiguration.html) 40// 41// * 42// GetBucketMetricsConfiguration 43// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketMetricsConfiguration.html) 44// 45// * 46// DeleteBucketMetricsConfiguration 47// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteBucketMetricsConfiguration.html) 48func (c *Client) ListBucketMetricsConfigurations(ctx context.Context, params *ListBucketMetricsConfigurationsInput, optFns ...func(*Options)) (*ListBucketMetricsConfigurationsOutput, error) { 49 if params == nil { 50 params = &ListBucketMetricsConfigurationsInput{} 51 } 52 53 result, metadata, err := c.invokeOperation(ctx, "ListBucketMetricsConfigurations", params, optFns, c.addOperationListBucketMetricsConfigurationsMiddlewares) 54 if err != nil { 55 return nil, err 56 } 57 58 out := result.(*ListBucketMetricsConfigurationsOutput) 59 out.ResultMetadata = metadata 60 return out, nil 61} 62 63type ListBucketMetricsConfigurationsInput struct { 64 65 // The name of the bucket containing the metrics configurations to retrieve. 66 // 67 // This member is required. 68 Bucket *string 69 70 // The marker that is used to continue a metrics configuration listing that has 71 // been truncated. Use the NextContinuationToken from a previously truncated list 72 // response to continue the listing. The continuation token is an opaque value that 73 // Amazon S3 understands. 74 ContinuationToken *string 75 76 // The account ID of the expected bucket owner. If the bucket is owned by a 77 // different account, the request will fail with an HTTP 403 (Access Denied) error. 78 ExpectedBucketOwner *string 79 80 noSmithyDocumentSerde 81} 82 83type ListBucketMetricsConfigurationsOutput struct { 84 85 // The marker that is used as a starting point for this metrics configuration list 86 // response. This value is present if it was sent in the request. 87 ContinuationToken *string 88 89 // Indicates whether the returned list of metrics configurations is complete. A 90 // value of true indicates that the list is not complete and the 91 // NextContinuationToken will be provided for a subsequent request. 92 IsTruncated bool 93 94 // The list of metrics configurations for a bucket. 95 MetricsConfigurationList []types.MetricsConfiguration 96 97 // The marker used to continue a metrics configuration listing that has been 98 // truncated. Use the NextContinuationToken from a previously truncated list 99 // response to continue the listing. The continuation token is an opaque value that 100 // Amazon S3 understands. 101 NextContinuationToken *string 102 103 // Metadata pertaining to the operation's result. 104 ResultMetadata middleware.Metadata 105 106 noSmithyDocumentSerde 107} 108 109func (c *Client) addOperationListBucketMetricsConfigurationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 110 err = stack.Serialize.Add(&awsRestxml_serializeOpListBucketMetricsConfigurations{}, middleware.After) 111 if err != nil { 112 return err 113 } 114 err = stack.Deserialize.Add(&awsRestxml_deserializeOpListBucketMetricsConfigurations{}, middleware.After) 115 if err != nil { 116 return err 117 } 118 if err = addSetLoggerMiddleware(stack, options); err != nil { 119 return err 120 } 121 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 122 return err 123 } 124 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 125 return err 126 } 127 if err = addResolveEndpointMiddleware(stack, options); err != nil { 128 return err 129 } 130 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 131 return err 132 } 133 if err = addRetryMiddlewares(stack, options); err != nil { 134 return err 135 } 136 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 137 return err 138 } 139 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 140 return err 141 } 142 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 143 return err 144 } 145 if err = addClientUserAgent(stack); err != nil { 146 return err 147 } 148 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 149 return err 150 } 151 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 152 return err 153 } 154 if err = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { 155 return err 156 } 157 if err = addOpListBucketMetricsConfigurationsValidationMiddleware(stack); err != nil { 158 return err 159 } 160 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListBucketMetricsConfigurations(options.Region), middleware.Before); err != nil { 161 return err 162 } 163 if err = addMetadataRetrieverMiddleware(stack); err != nil { 164 return err 165 } 166 if err = addListBucketMetricsConfigurationsUpdateEndpoint(stack, options); err != nil { 167 return err 168 } 169 if err = addResponseErrorMiddleware(stack); err != nil { 170 return err 171 } 172 if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { 173 return err 174 } 175 if err = disableAcceptEncodingGzip(stack); err != nil { 176 return err 177 } 178 if err = addRequestResponseLogging(stack, options); err != nil { 179 return err 180 } 181 return nil 182} 183 184func newServiceMetadataMiddleware_opListBucketMetricsConfigurations(region string) *awsmiddleware.RegisterServiceMetadata { 185 return &awsmiddleware.RegisterServiceMetadata{ 186 Region: region, 187 ServiceID: ServiceID, 188 SigningName: "s3", 189 OperationName: "ListBucketMetricsConfigurations", 190 } 191} 192 193// getListBucketMetricsConfigurationsBucketMember returns a pointer to string 194// denoting a provided bucket member valueand a boolean indicating if the input has 195// a modeled bucket name, 196func getListBucketMetricsConfigurationsBucketMember(input interface{}) (*string, bool) { 197 in := input.(*ListBucketMetricsConfigurationsInput) 198 if in.Bucket == nil { 199 return nil, false 200 } 201 return in.Bucket, true 202} 203func addListBucketMetricsConfigurationsUpdateEndpoint(stack *middleware.Stack, options Options) error { 204 return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ 205 Accessor: s3cust.UpdateEndpointParameterAccessor{ 206 GetBucketFromInput: getListBucketMetricsConfigurationsBucketMember, 207 }, 208 UsePathStyle: options.UsePathStyle, 209 UseAccelerate: options.UseAccelerate, 210 SupportsAccelerate: true, 211 TargetS3ObjectLambda: false, 212 EndpointResolver: options.EndpointResolver, 213 EndpointResolverOptions: options.EndpointOptions, 214 UseDualstack: options.UseDualstack, 215 UseARNRegion: options.UseARNRegion, 216 DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, 217 }) 218} 219