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// operation supports list pagination and does not return more than 100 19// configurations at a time. Always check the IsTruncated element in the response. 20// If there are no more configurations to list, IsTruncated is set to false. If 21// there are more configurations to list, IsTruncated is set to true, and there is 22// a value in NextContinuationToken. You use the NextContinuationToken value to 23// continue the pagination of the list by passing the value in continuation-token 24// in the request to GET the next page. To use this operation, you must have 25// permissions to perform the s3:GetMetricsConfiguration action. The bucket owner 26// has this permission by default. The bucket owner can grant this permission to 27// others. For more information about permissions, see Permissions Related to 28// Bucket Subresource Operations 29// (https://docs.aws.amazon.com/AmazonS3/latest/dev/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/dev/s3-access-control.html). For 32// more information about metrics configurations and CloudWatch request metrics, 33// 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, 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 81type ListBucketMetricsConfigurationsOutput struct { 82 83 // The marker that is used as a starting point for this metrics configuration list 84 // response. This value is present if it was sent in the request. 85 ContinuationToken *string 86 87 // Indicates whether the returned list of metrics configurations is complete. A 88 // value of true indicates that the list is not complete and the 89 // NextContinuationToken will be provided for a subsequent request. 90 IsTruncated bool 91 92 // The list of metrics configurations for a bucket. 93 MetricsConfigurationList []types.MetricsConfiguration 94 95 // The marker used to continue a metrics configuration listing that has been 96 // truncated. Use the NextContinuationToken from a previously truncated list 97 // response to continue the listing. The continuation token is an opaque value that 98 // Amazon S3 understands. 99 NextContinuationToken *string 100 101 // Metadata pertaining to the operation's result. 102 ResultMetadata middleware.Metadata 103} 104 105func addOperationListBucketMetricsConfigurationsMiddlewares(stack *middleware.Stack, options Options) (err error) { 106 err = stack.Serialize.Add(&awsRestxml_serializeOpListBucketMetricsConfigurations{}, middleware.After) 107 if err != nil { 108 return err 109 } 110 err = stack.Deserialize.Add(&awsRestxml_deserializeOpListBucketMetricsConfigurations{}, middleware.After) 111 if err != nil { 112 return err 113 } 114 if err = addSetLoggerMiddleware(stack, options); err != nil { 115 return err 116 } 117 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 118 return err 119 } 120 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 121 return err 122 } 123 if err = addResolveEndpointMiddleware(stack, options); err != nil { 124 return err 125 } 126 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 127 return err 128 } 129 if err = addRetryMiddlewares(stack, options); err != nil { 130 return err 131 } 132 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 133 return err 134 } 135 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 136 return err 137 } 138 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 139 return err 140 } 141 if err = addClientUserAgent(stack); err != nil { 142 return err 143 } 144 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 145 return err 146 } 147 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 148 return err 149 } 150 if err = addOpListBucketMetricsConfigurationsValidationMiddleware(stack); err != nil { 151 return err 152 } 153 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListBucketMetricsConfigurations(options.Region), middleware.Before); err != nil { 154 return err 155 } 156 if err = addMetadataRetrieverMiddleware(stack); err != nil { 157 return err 158 } 159 if err = addListBucketMetricsConfigurationsUpdateEndpoint(stack, options); err != nil { 160 return err 161 } 162 if err = addResponseErrorMiddleware(stack); err != nil { 163 return err 164 } 165 if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { 166 return err 167 } 168 if err = disableAcceptEncodingGzip(stack); err != nil { 169 return err 170 } 171 if err = addRequestResponseLogging(stack, options); err != nil { 172 return err 173 } 174 return nil 175} 176 177func newServiceMetadataMiddleware_opListBucketMetricsConfigurations(region string) *awsmiddleware.RegisterServiceMetadata { 178 return &awsmiddleware.RegisterServiceMetadata{ 179 Region: region, 180 ServiceID: ServiceID, 181 SigningName: "s3", 182 OperationName: "ListBucketMetricsConfigurations", 183 } 184} 185 186// getListBucketMetricsConfigurationsBucketMember returns a pointer to string 187// denoting a provided bucket member valueand a boolean indicating if the input has 188// a modeled bucket name, 189func getListBucketMetricsConfigurationsBucketMember(input interface{}) (*string, bool) { 190 in := input.(*ListBucketMetricsConfigurationsInput) 191 if in.Bucket == nil { 192 return nil, false 193 } 194 return in.Bucket, true 195} 196func addListBucketMetricsConfigurationsUpdateEndpoint(stack *middleware.Stack, options Options) error { 197 return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ 198 Accessor: s3cust.UpdateEndpointParameterAccessor{ 199 GetBucketFromInput: getListBucketMetricsConfigurationsBucketMember, 200 }, 201 UsePathStyle: options.UsePathStyle, 202 UseAccelerate: options.UseAccelerate, 203 SupportsAccelerate: true, 204 EndpointResolver: options.EndpointResolver, 205 EndpointResolverOptions: options.EndpointOptions, 206 UseDualstack: options.UseDualstack, 207 UseARNRegion: options.UseARNRegion, 208 }) 209} 210