@@ -93,6 +93,28 @@ type PutObjectOptions struct {
93
93
// This can be used for faster uploads on non-seekable or slow-to-seek input.
94
94
ConcurrentStreamParts bool
95
95
Internal AdvancedPutOptions
96
+
97
+ customHeaders http.Header
98
+ }
99
+
100
+ // SetMatchETag if etag matches while PUT MinIO returns an error
101
+ // this is a MinIO specific extension to support optimistic locking
102
+ // semantics.
103
+ func (opts * PutObjectOptions ) SetMatchETag (etag string ) {
104
+ if opts .customHeaders == nil {
105
+ opts .customHeaders = http.Header {}
106
+ }
107
+ opts .customHeaders .Set ("If-Match" , "\" " + etag + "\" " )
108
+ }
109
+
110
+ // SetMatchETagExcept if etag does not match while PUT MinIO returns an
111
+ // error this is a MinIO specific extension to support optimistic locking
112
+ // semantics.
113
+ func (opts * PutObjectOptions ) SetMatchETagExcept (etag string ) {
114
+ if opts .customHeaders == nil {
115
+ opts .customHeaders = http.Header {}
116
+ }
117
+ opts .customHeaders .Set ("If-None-Match" , "\" " + etag + "\" " )
96
118
}
97
119
98
120
// getNumThreads - gets the number of threads to be used in the multipart
@@ -187,6 +209,12 @@ func (opts PutObjectOptions) Header() (header http.Header) {
187
209
header .Set ("x-amz-meta-" + k , v )
188
210
}
189
211
}
212
+
213
+ // set any other additional custom headers.
214
+ for k , v := range opts .customHeaders {
215
+ header [k ] = v
216
+ }
217
+
190
218
return
191
219
}
192
220
0 commit comments