1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package s3control
4
5import (
6	"context"
7	"fmt"
8	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
9	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
10	s3controlcust "github.com/aws/aws-sdk-go-v2/service/s3control/internal/customizations"
11	smithy "github.com/aws/smithy-go"
12	"github.com/aws/smithy-go/middleware"
13	smithyhttp "github.com/aws/smithy-go/transport/http"
14	"strings"
15)
16
17// Removes the entire tag set from the specified S3 Batch Operations job. To use
18// this operation, you must have permission to perform the s3:DeleteJobTagging
19// action. For more information, see Controlling access and labeling jobs using
20// tags
21// (https://docs.aws.amazon.com/AmazonS3/latest/dev/batch-ops-managing-jobs.html#batch-ops-job-tags)
22// in the Amazon S3 User Guide. Related actions include:
23//
24// * CreateJob
25// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_CreateJob.html)
26//
27// *
28// GetJobTagging
29// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetJobTagging.html)
30//
31// *
32// PutJobTagging
33// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_PutJobTagging.html)
34func (c *Client) DeleteJobTagging(ctx context.Context, params *DeleteJobTaggingInput, optFns ...func(*Options)) (*DeleteJobTaggingOutput, error) {
35	if params == nil {
36		params = &DeleteJobTaggingInput{}
37	}
38
39	result, metadata, err := c.invokeOperation(ctx, "DeleteJobTagging", params, optFns, addOperationDeleteJobTaggingMiddlewares)
40	if err != nil {
41		return nil, err
42	}
43
44	out := result.(*DeleteJobTaggingOutput)
45	out.ResultMetadata = metadata
46	return out, nil
47}
48
49type DeleteJobTaggingInput struct {
50
51	// The AWS account ID associated with the S3 Batch Operations job.
52	//
53	// This member is required.
54	AccountId *string
55
56	// The ID for the S3 Batch Operations job whose tags you want to delete.
57	//
58	// This member is required.
59	JobId *string
60}
61
62type DeleteJobTaggingOutput struct {
63	// Metadata pertaining to the operation's result.
64	ResultMetadata middleware.Metadata
65}
66
67func addOperationDeleteJobTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) {
68	err = stack.Serialize.Add(&awsRestxml_serializeOpDeleteJobTagging{}, middleware.After)
69	if err != nil {
70		return err
71	}
72	err = stack.Deserialize.Add(&awsRestxml_deserializeOpDeleteJobTagging{}, middleware.After)
73	if err != nil {
74		return err
75	}
76	if err = addSetLoggerMiddleware(stack, options); err != nil {
77		return err
78	}
79	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
80		return err
81	}
82	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
83		return err
84	}
85	if err = addResolveEndpointMiddleware(stack, options); err != nil {
86		return err
87	}
88	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
89		return err
90	}
91	if err = addRetryMiddlewares(stack, options); err != nil {
92		return err
93	}
94	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
95		return err
96	}
97	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
98		return err
99	}
100	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
101		return err
102	}
103	if err = addClientUserAgent(stack); err != nil {
104		return err
105	}
106	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
107		return err
108	}
109	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
110		return err
111	}
112	if err = addEndpointPrefix_opDeleteJobTaggingMiddleware(stack); err != nil {
113		return err
114	}
115	if err = addOpDeleteJobTaggingValidationMiddleware(stack); err != nil {
116		return err
117	}
118	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteJobTagging(options.Region), middleware.Before); err != nil {
119		return err
120	}
121	if err = addMetadataRetrieverMiddleware(stack); err != nil {
122		return err
123	}
124	if err = addDeleteJobTaggingUpdateEndpoint(stack, options); err != nil {
125		return err
126	}
127	if err = addResponseErrorMiddleware(stack); err != nil {
128		return err
129	}
130	if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addRequestResponseLogging(stack, options); err != nil {
134		return err
135	}
136	return nil
137}
138
139type endpointPrefix_opDeleteJobTaggingMiddleware struct {
140}
141
142func (*endpointPrefix_opDeleteJobTaggingMiddleware) ID() string {
143	return "EndpointHostPrefix"
144}
145
146func (m *endpointPrefix_opDeleteJobTaggingMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) (
147	out middleware.SerializeOutput, metadata middleware.Metadata, err error,
148) {
149	if smithyhttp.GetHostnameImmutable(ctx) || smithyhttp.IsEndpointHostPrefixDisabled(ctx) {
150		return next.HandleSerialize(ctx, in)
151	}
152
153	req, ok := in.Request.(*smithyhttp.Request)
154	if !ok {
155		return out, metadata, fmt.Errorf("unknown transport type %T", in.Request)
156	}
157
158	input, ok := in.Parameters.(*DeleteJobTaggingInput)
159	if !ok {
160		return out, metadata, fmt.Errorf("unknown input type %T", in.Parameters)
161	}
162
163	var prefix strings.Builder
164	if input.AccountId == nil {
165		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so may not be nil")}
166	} else if !smithyhttp.ValidHostLabel(*input.AccountId) {
167		return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("AccountId forms part of the endpoint host and so must match \"[a-zA-Z0-9-]{1,63}\", but was \"%s\"", *input.AccountId)}
168	} else {
169		prefix.WriteString(*input.AccountId)
170	}
171	prefix.WriteString(".")
172	req.URL.Host = prefix.String() + req.URL.Host
173
174	return next.HandleSerialize(ctx, in)
175}
176func addEndpointPrefix_opDeleteJobTaggingMiddleware(stack *middleware.Stack) error {
177	return stack.Serialize.Insert(&endpointPrefix_opDeleteJobTaggingMiddleware{}, `OperationSerializer`, middleware.After)
178}
179
180func newServiceMetadataMiddleware_opDeleteJobTagging(region string) *awsmiddleware.RegisterServiceMetadata {
181	return &awsmiddleware.RegisterServiceMetadata{
182		Region:        region,
183		ServiceID:     ServiceID,
184		SigningName:   "s3",
185		OperationName: "DeleteJobTagging",
186	}
187}
188
189func copyDeleteJobTaggingInputForUpdateEndpoint(params interface{}) (interface{}, error) {
190	input, ok := params.(*DeleteJobTaggingInput)
191	if !ok {
192		return nil, fmt.Errorf("expect *DeleteJobTaggingInput type, got %T", params)
193	}
194	cpy := *input
195	return &cpy, nil
196}
197func backFillDeleteJobTaggingAccountID(input interface{}, v string) error {
198	in := input.(*DeleteJobTaggingInput)
199	if in.AccountId != nil {
200		if !strings.EqualFold(*in.AccountId, v) {
201			return fmt.Errorf("error backfilling account id")
202		}
203		return nil
204	}
205	in.AccountId = &v
206	return nil
207}
208func addDeleteJobTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error {
209	return s3controlcust.UpdateEndpoint(stack, s3controlcust.UpdateEndpointOptions{
210		Accessor: s3controlcust.UpdateEndpointParameterAccessor{GetARNInput: nopGetARNAccessor,
211			BackfillAccountID: nopBackfillAccountIDAccessor,
212			GetOutpostIDInput: nopGetOutpostIDFromInput,
213			UpdateARNField:    nopSetARNAccessor,
214			CopyInput:         copyDeleteJobTaggingInputForUpdateEndpoint,
215		},
216		EndpointResolver:        options.EndpointResolver,
217		EndpointResolverOptions: options.EndpointOptions,
218		UseDualstack:            options.UseDualstack,
219		UseARNRegion:            options.UseARNRegion,
220	})
221}
222