mirror of
https://github.com/minio/minio.git
synced 2025-11-21 02:09:08 -05:00
Add ObjectTagging Support (#8754)
This PR adds support for AWS S3 ObjectTagging API as explained here https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html
This commit is contained in:
committed by
kannappanr
parent
dd93eee1e3
commit
61c17c8933
@@ -31,6 +31,7 @@ import (
|
||||
"github.com/minio/minio/pkg/madmin"
|
||||
"github.com/minio/minio/pkg/policy"
|
||||
"github.com/minio/minio/pkg/sync/errgroup"
|
||||
"github.com/minio/minio/pkg/tagging"
|
||||
)
|
||||
|
||||
type xlZones struct {
|
||||
@@ -1374,3 +1375,63 @@ func (z *xlZones) GetMetrics(ctx context.Context) (*Metrics, error) {
|
||||
func (z *xlZones) IsReady(ctx context.Context) bool {
|
||||
return z.zones[0].IsReady(ctx)
|
||||
}
|
||||
|
||||
// PutObjectTag - replace or add tags to an existing object
|
||||
func (z *xlZones) PutObjectTag(ctx context.Context, bucket, object string, tags string) error {
|
||||
if z.SingleZone() {
|
||||
return z.zones[0].PutObjectTag(ctx, bucket, object, tags)
|
||||
}
|
||||
for _, zone := range z.zones {
|
||||
err := zone.PutObjectTag(ctx, bucket, object, tags)
|
||||
if err != nil {
|
||||
if isErrBucketNotFound(err) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return BucketNotFound{
|
||||
Bucket: bucket,
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteObjectTag - delete object tags from an existing object
|
||||
func (z *xlZones) DeleteObjectTag(ctx context.Context, bucket, object string) error {
|
||||
if z.SingleZone() {
|
||||
return z.zones[0].DeleteObjectTag(ctx, bucket, object)
|
||||
}
|
||||
for _, zone := range z.zones {
|
||||
err := zone.DeleteObjectTag(ctx, bucket, object)
|
||||
if err != nil {
|
||||
if isErrBucketNotFound(err) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
return BucketNotFound{
|
||||
Bucket: bucket,
|
||||
}
|
||||
}
|
||||
|
||||
// GetObjectTag - get object tags from an existing object
|
||||
func (z *xlZones) GetObjectTag(ctx context.Context, bucket, object string) (tagging.Tagging, error) {
|
||||
if z.SingleZone() {
|
||||
return z.zones[0].GetObjectTag(ctx, bucket, object)
|
||||
}
|
||||
for _, zone := range z.zones {
|
||||
tags, err := zone.GetObjectTag(ctx, bucket, object)
|
||||
if err != nil {
|
||||
if isErrBucketNotFound(err) {
|
||||
continue
|
||||
}
|
||||
return tags, err
|
||||
}
|
||||
return tags, nil
|
||||
}
|
||||
return tagging.Tagging{}, BucketNotFound{
|
||||
Bucket: bucket,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user