Gargi-jais11 opened a new pull request, #10644:
URL: https://github.com/apache/ozone/pull/10644
## What changes were proposed in this pull request?
This is the final PR which implements End-to-End flow for **BucketTagging in
Ozone**.
Expose AWS S3-compatible bucket tagging over HTTP at `/{bucket}?tagging.`
Validate XML input per AWS rules (max 50 tags, key/value length limits, no
duplicate keys, no aws: prefix). Map OM **NoSuchTagSet** behavior on GET when
no tags exist.
Scope:
- BucketTaggingHandler.java — PUT/GET/DELETE handlers
- BucketEndpoint.java — route ?tagging sub-resource
- EndpointBase.validateAndGetTagging() — reuse with
S3Consts.TAG_BUCKET_NUM_LIMIT (50)
- S3Tagging.java — XML model (if not shared with object tagging)
- S3GatewayMetrics.java ** — success/failure counters and latency
- S3GAction audit entries
- Unit tests
1. TestBucketTaggingPut.java — validation, malformed XML, limits
2. TestBucketTaggingGet.java ** — happy path, NoSuchTagSet
3. TestBucketTaggingDelete.java
4. TestS3GatewayMetrics.java — metric updates
- Acceptance test
buckettagging.robot — full put/get/delete/overwrite flow via aws s3api
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-15512
## How was this patch tested?
Added multiple UT, IT and Acceptance Test
```
bash-5.1$ aws s3api get-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT"
An error occurred (NoSuchTagSet) when calling the GetBucketTagging
operation: The specified tag does not exist.
bash-5.1$ aws s3api put-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT" --tagging '{"TagSet": [{"Key": "env", "Value": "dev"}, {"Key":
"team", "Value": "ozone"}]}'
bash-5.1$ aws s3api get-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT"
{
"TagSet": [
{
"Key": "env",
"Value": "dev"
},
{
"Key": "team",
"Value": "ozone"
}
]
}
// put should override the previous tag
bash-5.1$ aws s3api put-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT" \
--tagging '{"TagSet": [{"Key": "env", "Value": "prod"}]}'
bash-5.1$ aws s3api get-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT"
{
"TagSet": [
{
"Key": "env",
"Value": "prod"
}
]
}
bash-5.1$ aws s3api delete-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT"
bash-5.1$ aws s3api get-bucket-tagging --bucket "$BUCKET" --endpoint-url
"$ENDPOINT"
An error occurred (NoSuchTagSet) when calling the GetBucketTagging
operation: The specified tag does not exist.
// put bucket tag on non-existing bucket should fail
bash-5.1$ aws s3api put-bucket-tagging --bucket no-such-bucket
--endpoint-url "$ENDPOINT" \
--tagging '{"TagSet": [{"Key": "k", "Value": "v"}]}'
An error occurred (NoSuchBucket) when calling the PutBucketTagging
operation: The specified bucket does not exist
// Link bucket working
bash-5.1$ ozone sh bucket link /vol1/linkb1 /s3v/link-buck-tag
bash-5.1$ LINK=link-buck-tag
bash-5.1$ aws s3api get-bucket-tagging --bucket "$LINK" --endpoint-url
"$ENDPOINT"
An error occurred (NoSuchTagSet) when calling the GetBucketTagging
operation: The specified tag does not exist.
bash-5.1$ aws s3api put-bucket-tagging --bucket "$LINK" --endpoint-url
"$ENDPOINT" \
--tagging '{"TagSet": [{"Key": "tag-key1", "Value": "tag-value1"}]}'
bash-5.1$ aws s3api get-bucket-tagging --bucket "$LINK" --endpoint-url
"$ENDPOINT"
{
"TagSet": [
{
"Key": "tag-key1",
"Value": "tag-value1"
}
]
}
bash-5.1$ aws s3api get-bucket-tagging --bucket linkb1 --endpoint-url
"$ENDPOINT"
An error occurred (NoSuchBucket) when calling the GetBucketTagging
operation: The specified bucket does not exist
bash-5.1$ aws s3api delete-bucket-tagging --bucket "$LINK" --endpoint-url
"$ENDPOINT"
bash-5.1$ aws s3api get-bucket-tagging --bucket "$LINK" --endpoint-url
"$ENDPOINT"
An error occurred (NoSuchTagSet) when calling the GetBucketTagging
operation: The specified tag does not exist.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]