Copyright | (c) 2013-2023 Brendan Hay |
---|---|
License | Mozilla Public License, v. 2.0. |
Maintainer | Brendan Hay |
Stability | auto-generated |
Portability | non-portable (GHC extensions) |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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_checksumAlgorithm :: Lens' PutObjectTagging (Maybe ChecksumAlgorithm)
- putObjectTagging_contentMD5 :: Lens' PutObjectTagging (Maybe Text)
- putObjectTagging_expectedBucketOwner :: Lens' PutObjectTagging (Maybe Text)
- putObjectTagging_requestPayer :: Lens' PutObjectTagging (Maybe RequestPayer)
- putObjectTagging_versionId :: Lens' PutObjectTagging (Maybe ObjectVersionId)
- 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:
PutObjectTagging
, putObjectTagging_checksumAlgorithm
- Indicates the algorithm used to create the checksum for the object when
using the SDK. This header will not provide any additional functionality
if not using the SDK. When sending this header, there must be a
corresponding x-amz-checksum
or x-amz-trailer
header sent.
Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request
. For more information, see
Checking object integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm
parameter.
$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 fails with the HTTP status code
403 Forbidden
(access denied).
$sel:requestPayer:PutObjectTagging'
, putObjectTagging_requestPayer
- Undocumented member.
PutObjectTagging
, putObjectTagging_versionId
- The versionId of the object that the tag-set will be added to.
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 with 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 Amazon S3 on Outposts
in the Amazon S3 User Guide.
PutObjectTagging
, putObjectTagging_key
- Name of the object key.
PutObjectTagging
, putObjectTagging_tagging
- Container for the TagSet
and Tag
elements
Request Lenses
putObjectTagging_checksumAlgorithm :: Lens' PutObjectTagging (Maybe ChecksumAlgorithm) Source #
Indicates the algorithm used to create the checksum for the object when
using the SDK. This header will not provide any additional functionality
if not using the SDK. When sending this header, there must be a
corresponding x-amz-checksum
or x-amz-trailer
header sent.
Otherwise, Amazon S3 fails the request with the HTTP status code
400 Bad Request
. For more information, see
Checking object integrity
in the Amazon S3 User Guide.
If you provide an individual checksum, Amazon S3 ignores any provided
ChecksumAlgorithm
parameter.
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 fails with the HTTP status code
403 Forbidden
(access denied).
putObjectTagging_requestPayer :: Lens' PutObjectTagging (Maybe RequestPayer) Source #
Undocumented member.
putObjectTagging_versionId :: Lens' PutObjectTagging (Maybe ObjectVersionId) Source #
The versionId of the object that the tag-set will be added to.
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 with 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 Amazon 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:
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.