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