Marshal converts all the CopySrcOptions into their equivalent HTTP header representation
(header http.Header)
| 211 | // Marshal converts all the CopySrcOptions into their |
| 212 | // equivalent HTTP header representation |
| 213 | func (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 | |
| 239 | func (opts CopySrcOptions) validate() (err error) { |
| 240 | // Input validation. |
nothing calls this directly
no test coverage detected