Skip to content

Commit 5415e6c

Browse files
authored
Add fields to tagging opts for replication (#1913)
1 parent a5c27bd commit 5415e6c

File tree

1 file changed

+29
-9
lines changed

1 file changed

+29
-9
lines changed

api-object-tagging.go

+29-9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ import (
3232
// to update tag(s) of a specific object version
3333
type PutObjectTaggingOptions struct {
3434
VersionID string
35+
Internal AdvancedObjectTaggingOptions
36+
}
37+
38+
// AdvancedObjectTaggingOptions for internal use by MinIO server - not intended for client use.
39+
type AdvancedObjectTaggingOptions struct {
40+
ReplicationProxyRequest string
3541
}
3642

3743
// PutObjectTagging replaces or creates object tag(s) and can target
@@ -50,7 +56,10 @@ func (c *Client) PutObjectTagging(ctx context.Context, bucketName, objectName st
5056
if opts.VersionID != "" {
5157
urlValues.Set("versionId", opts.VersionID)
5258
}
53-
59+
headers := make(http.Header, 0)
60+
if opts.Internal.ReplicationProxyRequest != "" {
61+
headers.Set(minIOBucketReplicationProxyRequest, opts.Internal.ReplicationProxyRequest)
62+
}
5463
reqBytes, err := xml.Marshal(otags)
5564
if err != nil {
5665
return err
@@ -63,6 +72,7 @@ func (c *Client) PutObjectTagging(ctx context.Context, bucketName, objectName st
6372
contentBody: bytes.NewReader(reqBytes),
6473
contentLength: int64(len(reqBytes)),
6574
contentMD5Base64: sumMD5Base64(reqBytes),
75+
customHeader: headers,
6676
}
6777

6878
// Execute PUT to set a object tagging.
@@ -83,6 +93,7 @@ func (c *Client) PutObjectTagging(ctx context.Context, bucketName, objectName st
8393
// to fetch the tagging key/value pairs
8494
type GetObjectTaggingOptions struct {
8595
VersionID string
96+
Internal AdvancedObjectTaggingOptions
8697
}
8798

8899
// GetObjectTagging fetches object tag(s) with options to target
@@ -96,12 +107,16 @@ func (c *Client) GetObjectTagging(ctx context.Context, bucketName, objectName st
96107
if opts.VersionID != "" {
97108
urlValues.Set("versionId", opts.VersionID)
98109
}
99-
110+
headers := make(http.Header, 0)
111+
if opts.Internal.ReplicationProxyRequest != "" {
112+
headers.Set(minIOBucketReplicationProxyRequest, opts.Internal.ReplicationProxyRequest)
113+
}
100114
// Execute GET on object to get object tag(s)
101115
resp, err := c.executeMethod(ctx, http.MethodGet, requestMetadata{
102-
bucketName: bucketName,
103-
objectName: objectName,
104-
queryValues: urlValues,
116+
bucketName: bucketName,
117+
objectName: objectName,
118+
queryValues: urlValues,
119+
customHeader: headers,
105120
})
106121

107122
defer closeResponse(resp)
@@ -121,6 +136,7 @@ func (c *Client) GetObjectTagging(ctx context.Context, bucketName, objectName st
121136
// RemoveObjectTaggingOptions holds the version id of the object to remove
122137
type RemoveObjectTaggingOptions struct {
123138
VersionID string
139+
Internal AdvancedObjectTaggingOptions
124140
}
125141

126142
// RemoveObjectTagging removes object tag(s) with options to control a specific object
@@ -134,12 +150,16 @@ func (c *Client) RemoveObjectTagging(ctx context.Context, bucketName, objectName
134150
if opts.VersionID != "" {
135151
urlValues.Set("versionId", opts.VersionID)
136152
}
137-
153+
headers := make(http.Header, 0)
154+
if opts.Internal.ReplicationProxyRequest != "" {
155+
headers.Set(minIOBucketReplicationProxyRequest, opts.Internal.ReplicationProxyRequest)
156+
}
138157
// Execute DELETE on object to remove object tag(s)
139158
resp, err := c.executeMethod(ctx, http.MethodDelete, requestMetadata{
140-
bucketName: bucketName,
141-
objectName: objectName,
142-
queryValues: urlValues,
159+
bucketName: bucketName,
160+
objectName: objectName,
161+
queryValues: urlValues,
162+
customHeader: headers,
143163
})
144164

145165
defer closeResponse(resp)

0 commit comments

Comments
 (0)