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// Returns the tag-set of an object. You send the GET request against the tagging 16// subresource associated with the object. To use this operation, you must have 17// permission to perform the s3:GetObjectTagging action. By default, the GET action 18// returns information about current version of an object. For a versioned bucket, 19// you can have multiple versions of an object in your bucket. To retrieve tags of 20// any other version, use the versionId query parameter. You also need permission 21// for the s3:GetObjectVersionTagging action. By default, the bucket owner has this 22// permission and can grant this permission to others. For information about the 23// Amazon S3 object tagging feature, see Object Tagging 24// (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). The 25// following action is related to GetObjectTagging: 26// 27// * PutObjectTagging 28// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html) 29// 30// * 31// DeleteObjectTagging 32// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html) 33func (c *Client) GetObjectTagging(ctx context.Context, params *GetObjectTaggingInput, optFns ...func(*Options)) (*GetObjectTaggingOutput, error) { 34 if params == nil { 35 params = &GetObjectTaggingInput{} 36 } 37 38 result, metadata, err := c.invokeOperation(ctx, "GetObjectTagging", params, optFns, c.addOperationGetObjectTaggingMiddlewares) 39 if err != nil { 40 return nil, err 41 } 42 43 out := result.(*GetObjectTaggingOutput) 44 out.ResultMetadata = metadata 45 return out, nil 46} 47 48type GetObjectTaggingInput struct { 49 50 // The bucket name containing the object for which to get the tagging information. 51 // When using this action with an access point, you must direct requests to the 52 // access point hostname. The access point hostname takes the form 53 // AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this 54 // action with an access point through the Amazon Web Services SDKs, you provide 55 // the access point ARN in place of the bucket name. For more information about 56 // access point ARNs, see Using access points 57 // (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) 58 // in the Amazon S3 User Guide. When using this action with Amazon S3 on Outposts, 59 // you must direct requests to the S3 on Outposts hostname. The S3 on Outposts 60 // hostname takes the form 61 // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using 62 // this action using S3 on Outposts through the Amazon Web Services SDKs, you 63 // provide the Outposts bucket ARN in place of the bucket name. For more 64 // information about S3 on Outposts ARNs, see Using S3 on Outposts 65 // (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) in the 66 // Amazon S3 User Guide. 67 // 68 // This member is required. 69 Bucket *string 70 71 // Object key for which to get the tagging information. 72 // 73 // This member is required. 74 Key *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 // Confirms that the requester knows that they will be charged for the request. 81 // Bucket owners need not specify this parameter in their requests. For information 82 // about downloading objects from requester pays buckets, see Downloading Objects 83 // in Requestor Pays Buckets 84 // (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) 85 // in the Amazon S3 User Guide. 86 RequestPayer types.RequestPayer 87 88 // The versionId of the object for which to get the tagging information. 89 VersionId *string 90 91 noSmithyDocumentSerde 92} 93 94type GetObjectTaggingOutput struct { 95 96 // Contains the tag set. 97 // 98 // This member is required. 99 TagSet []types.Tag 100 101 // The versionId of the object for which you got the tagging information. 102 VersionId *string 103 104 // Metadata pertaining to the operation's result. 105 ResultMetadata middleware.Metadata 106 107 noSmithyDocumentSerde 108} 109 110func (c *Client) addOperationGetObjectTaggingMiddlewares(stack *middleware.Stack, options Options) (err error) { 111 err = stack.Serialize.Add(&awsRestxml_serializeOpGetObjectTagging{}, middleware.After) 112 if err != nil { 113 return err 114 } 115 err = stack.Deserialize.Add(&awsRestxml_deserializeOpGetObjectTagging{}, middleware.After) 116 if err != nil { 117 return err 118 } 119 if err = addSetLoggerMiddleware(stack, options); err != nil { 120 return err 121 } 122 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 123 return err 124 } 125 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 126 return err 127 } 128 if err = addResolveEndpointMiddleware(stack, options); err != nil { 129 return err 130 } 131 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 132 return err 133 } 134 if err = addRetryMiddlewares(stack, options); err != nil { 135 return err 136 } 137 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 138 return err 139 } 140 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 141 return err 142 } 143 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 144 return err 145 } 146 if err = addClientUserAgent(stack); err != nil { 147 return err 148 } 149 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 150 return err 151 } 152 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 153 return err 154 } 155 if err = swapWithCustomHTTPSignerMiddleware(stack, options); err != nil { 156 return err 157 } 158 if err = addOpGetObjectTaggingValidationMiddleware(stack); err != nil { 159 return err 160 } 161 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetObjectTagging(options.Region), middleware.Before); err != nil { 162 return err 163 } 164 if err = addMetadataRetrieverMiddleware(stack); err != nil { 165 return err 166 } 167 if err = addGetObjectTaggingUpdateEndpoint(stack, options); err != nil { 168 return err 169 } 170 if err = addResponseErrorMiddleware(stack); err != nil { 171 return err 172 } 173 if err = v4.AddContentSHA256HeaderMiddleware(stack); err != nil { 174 return err 175 } 176 if err = disableAcceptEncodingGzip(stack); err != nil { 177 return err 178 } 179 if err = addRequestResponseLogging(stack, options); err != nil { 180 return err 181 } 182 return nil 183} 184 185func newServiceMetadataMiddleware_opGetObjectTagging(region string) *awsmiddleware.RegisterServiceMetadata { 186 return &awsmiddleware.RegisterServiceMetadata{ 187 Region: region, 188 ServiceID: ServiceID, 189 SigningName: "s3", 190 OperationName: "GetObjectTagging", 191 } 192} 193 194// getGetObjectTaggingBucketMember returns a pointer to string denoting a provided 195// bucket member valueand a boolean indicating if the input has a modeled bucket 196// name, 197func getGetObjectTaggingBucketMember(input interface{}) (*string, bool) { 198 in := input.(*GetObjectTaggingInput) 199 if in.Bucket == nil { 200 return nil, false 201 } 202 return in.Bucket, true 203} 204func addGetObjectTaggingUpdateEndpoint(stack *middleware.Stack, options Options) error { 205 return s3cust.UpdateEndpoint(stack, s3cust.UpdateEndpointOptions{ 206 Accessor: s3cust.UpdateEndpointParameterAccessor{ 207 GetBucketFromInput: getGetObjectTaggingBucketMember, 208 }, 209 UsePathStyle: options.UsePathStyle, 210 UseAccelerate: options.UseAccelerate, 211 SupportsAccelerate: true, 212 TargetS3ObjectLambda: false, 213 EndpointResolver: options.EndpointResolver, 214 EndpointResolverOptions: options.EndpointOptions, 215 UseDualstack: options.UseDualstack, 216 UseARNRegion: options.UseARNRegion, 217 DisableMultiRegionAccessPoints: options.DisableMultiRegionAccessPoints, 218 }) 219} 220