Copyright | (c) 2013-2021 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay <brendan.g.hay+amazonka@gmail.com> |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | None |
Sets the supplied tag-set to an object that already exists in a bucket.
A tag is a key-value pair. You can associate tags with an object by sending a PUT request against the tagging subresource that is associated with the object. You can retrieve tags by sending a GET request. For more information, see GetObjectTagging.
For tagging-related restrictions related to characters and encodings, see Tag Restrictions. Note that Amazon S3 limits the maximum number of tags to 10 tags per object.
To use this operation, you must have permission to perform the
s3:PutObjectTagging
action. By default, the bucket owner has this
permission and can grant this permission to others.
To put tags of any other version, use the versionId
query parameter.
You also need permission for the s3:PutObjectVersionTagging
action.
For information about the Amazon S3 object tagging feature, see Object Tagging.
Special Errors
- Code: InvalidTagError
- /Cause: The tag provided was not a valid tag. This error can occur if the tag did not pass input validation. For more information, see Object Tagging./
- Code: MalformedXMLError
- Cause: The XML provided does not match the schema.
- Code: OperationAbortedError
- /Cause: A conflicting conditional action is currently in progress against this resource. Please try again./
- Code: InternalError
- /Cause: The service was unable to apply the provided tag to the object./
Related Resources
Synopsis
- data PutObjectTagging = PutObjectTagging' {}
- newPutObjectTagging :: BucketName -> ObjectKey -> Tagging -> PutObjectTagging
- putObjectTagging_versionId :: Lens' PutObjectTagging (Maybe ObjectVersionId)
- putObjectTagging_requestPayer :: Lens' PutObjectTagging (Maybe RequestPayer)
- putObjectTagging_contentMD5 :: Lens' PutObjectTagging (Maybe Text)
- putObjectTagging_expectedBucketOwner :: Lens' PutObjectTagging (Maybe Text)
- putObjectTagging_bucket :: Lens' PutObjectTagging BucketName
- putObjectTagging_key :: Lens' PutObjectTagging ObjectKey
- putObjectTagging_tagging :: Lens' PutObjectTagging Tagging
- data PutObjectTaggingResponse = PutObjectTaggingResponse' {}
- newPutObjectTaggingResponse :: Int -> PutObjectTaggingResponse
- putObjectTaggingResponse_versionId :: Lens' PutObjectTaggingResponse (Maybe ObjectVersionId)
- putObjectTaggingResponse_httpStatus :: Lens' PutObjectTaggingResponse Int
Creating a Request
data PutObjectTagging Source #
See: newPutObjectTagging
smart constructor.
PutObjectTagging' | |
|
Instances
:: BucketName | |
-> ObjectKey | |
-> Tagging | |
-> PutObjectTagging |
Create a value of PutObjectTagging
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:versionId:PutObjectTagging'
, putObjectTagging_versionId
- The versionId of the object that the tag-set will be added to.
$sel:requestPayer:PutObjectTagging'
, putObjectTagging_requestPayer
- Undocumented member.
$sel:contentMD5:PutObjectTagging'
, putObjectTagging_contentMD5
- The MD5 hash for the request body.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
$sel:expectedBucketOwner:PutObjectTagging'
, putObjectTagging_expectedBucketOwner
- The account ID of the expected bucket owner. If the bucket is owned by a
different account, the request will fail with an HTTP
403 (Access Denied)
error.
$sel:bucket:PutObjectTagging'
, putObjectTagging_bucket
- The bucket name containing the object.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts in the Amazon S3 User Guide.
$sel:key:PutObjectTagging'
, putObjectTagging_key
- Name of the object key.
$sel:tagging:PutObjectTagging'
, putObjectTagging_tagging
- Container for the TagSet
and Tag
elements
Request Lenses
putObjectTagging_versionId :: Lens' PutObjectTagging (Maybe ObjectVersionId) Source #
The versionId of the object that the tag-set will be added to.
putObjectTagging_requestPayer :: Lens' PutObjectTagging (Maybe RequestPayer) Source #
Undocumented member.
putObjectTagging_contentMD5 :: Lens' PutObjectTagging (Maybe Text) Source #
The MD5 hash for the request body.
For requests made using the Amazon Web Services Command Line Interface (CLI) or Amazon Web Services SDKs, this field is calculated automatically.
putObjectTagging_expectedBucketOwner :: Lens' PutObjectTagging (Maybe Text) Source #
The account ID of the expected bucket owner. If the bucket is owned by a
different account, the request will fail with an HTTP
403 (Access Denied)
error.
putObjectTagging_bucket :: Lens' PutObjectTagging BucketName Source #
The bucket name containing the object.
When using this action with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this action with an access point through the Amazon Web Services SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using access points in the Amazon S3 User Guide.
When using this action with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this action using S3 on Outposts through the Amazon Web Services SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts in the Amazon S3 User Guide.
putObjectTagging_key :: Lens' PutObjectTagging ObjectKey Source #
Name of the object key.
putObjectTagging_tagging :: Lens' PutObjectTagging Tagging Source #
Container for the TagSet
and Tag
elements
Destructuring the Response
data PutObjectTaggingResponse Source #
See: newPutObjectTaggingResponse
smart constructor.
PutObjectTaggingResponse' | |
|
Instances
newPutObjectTaggingResponse Source #
Create a value of PutObjectTaggingResponse
with all optional fields omitted.
Use generic-lens or optics to modify other optional fields.
The following record fields are available, with the corresponding lenses provided for backwards compatibility:
$sel:versionId:PutObjectTagging'
, putObjectTaggingResponse_versionId
- The versionId of the object the tag-set was added to.
$sel:httpStatus:PutObjectTaggingResponse'
, putObjectTaggingResponse_httpStatus
- The response's http status code.
Response Lenses
putObjectTaggingResponse_versionId :: Lens' PutObjectTaggingResponse (Maybe ObjectVersionId) Source #
The versionId of the object the tag-set was added to.
putObjectTaggingResponse_httpStatus :: Lens' PutObjectTaggingResponse Int Source #
The response's http status code.