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/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Removes the entire tag set from the specified object. For more information about
15// managing object tags, see  Object Tagging
16// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). To use
17// this operation, you must have permission to perform the s3:DeleteObjectTagging
18// action. To delete tags of a specific object version, add the versionId query
19// parameter in the request. You will need permission for the
20// s3:DeleteObjectVersionTagging action. The following operations are related to
21// DeleteBucketMetricsConfiguration:
22//
23// * PutObjectTagging
24// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html)
25//
26// *
27// GetObjectTagging
28// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html)
29func (c *Client) DeleteObjectTagging(ctx context.Context, params *DeleteObjectTaggingInput, optFns ...func(*Options)) (*DeleteObjectTaggingOutput, error) {
30	if params == nil {
31		params = &DeleteObjectTaggingInput{}
32	}
33
34	result, metadata, err := c.invokeOperation(ctx, "DeleteObjectTagging", params, optFns, addOperationDeleteObjectTaggingMiddlewares)
35	if err != nil {
36		return nil, err
37	}
38
39	out := result.(*DeleteObjectTaggingOutput)
40	out.ResultMetadata = metadata
41	return out, nil
42}
43
44type DeleteObjectTaggingInput struct {
45
46	// The bucket name containing the objects from which to remove the tags. When using
47	// this action with an access point, you must direct requests to the access point
48	// hostname. The access point hostname takes the form
49	// AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this
50	// action with an access point through the AWS SDKs, you provide the access point
51	// ARN in place of the bucket name. For more information about access point ARNs,
52	// see Using Access Points
53	// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html)
54	// in the Amazon S3 User Guide. When using this action with Amazon S3 on Outposts,
55	// you must direct requests to the S3 on Outposts hostname. The S3 on Outposts
56	// hostname takes the form
57	// AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using
58	// this action using S3 on Outposts through the AWS SDKs, you provide the Outposts
59	// bucket ARN in place of the bucket name. For more information about S3 on
60	// Outposts ARNs, see Using S3 on Outposts
61	// (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) in the
62	// Amazon S3 User Guide.
63	//
64	// This member is required.
65	Bucket *string
66
67	// The key that identifies the object in the bucket from which to remove all tags.
68	//
69	// This member is required.
70	Key *string
71
72	// The account ID of the expected bucket owner. If the bucket is owned by a
73	// different account, the request will fail with an HTTP 403 (Access Denied) error.
74	ExpectedBucketOwner *string
75
76	// The versionId of the object that the tag-set will be removed from.
77	VersionId *string
78}
79
80type DeleteObjectTaggingOutput struct {
81
82	// The versionId of the object the tag-set was removed from.
83	VersionId *string
84
85	// Metadata pertaining to the operation's result.
86	ResultMetadata middleware.Metadata
87}
88
89func addOperationDeleteObjectTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) {
90	err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteObjectTagging{}, middleware.After)
91	if err != nil {
92		return err
93	}
94	err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteObjectTagging{}, middleware.After)
95	if err != nil {
96		return err
97	}
98	if err = addSetLoggerMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
102		return err
103	}
104	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
105		return err
106	}
107	if err = addResolveEndpointMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
111		return err
112	}
113	if err = addRetryMiddlewares(stack, options); err != nil {
114		return err
115	}
116	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
117		return err
118	}
119	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
120		return err
121	}
122	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
123		return err
124	}
125	if err = addClientUserAgent(stack); err != nil {
126		return err
127	}
128	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
129		return err
130	}
131	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addOpDeleteObjectTaggingValidationMiddleware(stack); err != nil {
135		return err
136	}
137	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteObjectTagging(options.Region), middleware.Before); err != nil {
138		return err
139	}
140	if err = addMetadataRetrieverMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addDeleteObjectTaggingUpdateEndpoint(stack, options); err != nil {
144		return err
145	}
146	if err = addResponseErrorMiddleware(stack); err != nil {
147		return err
148	}
149	if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil {
150		return err
151	}
152	if err = disableAcceptEncodingGzip(stack); err != nil {
153		return err
154	}
155	if err = addRequestResponseLogging(stack, options); err != nil {
156		return err
157	}
158	return nil
159}
160
161func newServiceMetadataMiddleware_opDeleteObjectTagging(region string) *awsmiddleware.RegisterServiceMetadata {
162	return &awsmiddleware.RegisterServiceMetadata{
163		Region:        region,
164		ServiceID:     ServiceID,
165		SigningName:   "s3",
166		OperationName: "DeleteObjectTagging",
167	}
168}
169
170// getDeleteObjectTaggingBucketMember returns a pointer to string denoting a
171// provided bucket member valueand a boolean indicating if the input has a modeled
172// bucket name,
173func getDeleteObjectTaggingBucketMember(input interface{}) (*string, bool) {
174	in := input.(*DeleteObjectTaggingInput)
175	if in.Bucket == nil {
176		return nil, false
177	}
178	return in.Bucket, true
179}
180func addDeleteObjectTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error {
181	return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{
182		Accessor: s3cust.UpdateEndpointParameterAccessor{
183			GetBucketFromInput: getDeleteObjectTaggingBucketMember,
184		},
185		UsePathStyle:            options.UsePathStyle,
186		UseAccelerate:           options.UseAccelerate,
187		SupportsAccelerate:      true,
188		TargetS3ObjectLambda:    false,
189		EndpointResolver:        options.EndpointResolver,
190		EndpointResolverOptions: options.EndpointOptions,
191		UseDualstack:            options.UseDualstack,
192		UseARNRegion:            options.UseARNRegion,
193	})
194}
195