MCPcopy
hub / github.com/minio/minio-go / Marshal

Method Marshal

api-compose-object.go:213–237  ·  view source on GitHub ↗

Marshal converts all the CopySrcOptions into their equivalent HTTP header representation

(header http.Header)

Source from the content-addressed store, hash-verified

211// Marshal converts all the CopySrcOptions into their
212// equivalent HTTP header representation
213func (opts CopySrcOptions) Marshal(header http.Header) {
214 // Set the source header
215 header.Set("x-amz-copy-source", s3utils.EncodePath(opts.Bucket+"/"+opts.Object))
216 if opts.VersionID != "" {
217 header.Set("x-amz-copy-source", s3utils.EncodePath(opts.Bucket+"/"+opts.Object)+"?versionId="+opts.VersionID)
218 }
219
220 if opts.MatchETag != "" {
221 header.Set("x-amz-copy-source-if-match", opts.MatchETag)
222 }
223 if opts.NoMatchETag != "" {
224 header.Set("x-amz-copy-source-if-none-match", opts.NoMatchETag)
225 }
226
227 if !opts.MatchModifiedSince.IsZero() {
228 header.Set("x-amz-copy-source-if-modified-since", opts.MatchModifiedSince.Format(http.TimeFormat))
229 }
230 if !opts.MatchUnmodifiedSince.IsZero() {
231 header.Set("x-amz-copy-source-if-unmodified-since", opts.MatchUnmodifiedSince.Format(http.TimeFormat))
232 }
233
234 if opts.Encryption != nil {
235 encrypt.SSECopy(opts.Encryption).Marshal(header)
236 }
237}
238
239func (opts CopySrcOptions) validate() (err error) {
240 // Input validation.

Callers

nothing calls this directly

Calls 4

EncodePathFunction · 0.92
SSECopyFunction · 0.92
MarshalMethod · 0.65
SetMethod · 0.45

Tested by

no test coverage detected