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

Method Marshal

api-compose-object.go:195–219  ·  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

193// Marshal converts all the CopySrcOptions into their
194// equivalent HTTP header representation
195func (opts CopySrcOptions) Marshal(header http.Header) {
196 // Set the source header
197 header.Set("x-amz-copy-source", s3utils.EncodePath(opts.Bucket+"/"+opts.Object))
198 if opts.VersionID != "" {
199 header.Set("x-amz-copy-source", s3utils.EncodePath(opts.Bucket+"/"+opts.Object)+"?versionId="+opts.VersionID)
200 }
201
202 if opts.MatchETag != "" {
203 header.Set("x-amz-copy-source-if-match", opts.MatchETag)
204 }
205 if opts.NoMatchETag != "" {
206 header.Set("x-amz-copy-source-if-none-match", opts.NoMatchETag)
207 }
208
209 if !opts.MatchModifiedSince.IsZero() {
210 header.Set("x-amz-copy-source-if-modified-since", opts.MatchModifiedSince.Format(http.TimeFormat))
211 }
212 if !opts.MatchUnmodifiedSince.IsZero() {
213 header.Set("x-amz-copy-source-if-unmodified-since", opts.MatchUnmodifiedSince.Format(http.TimeFormat))
214 }
215
216 if opts.Encryption != nil {
217 encrypt.SSECopy(opts.Encryption).Marshal(header)
218 }
219}
220
221func (opts CopySrcOptions) validate() (err error) {
222 // 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