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