Verify if input expires value is valid.
(expires time.Duration)
| 189 | |
| 190 | // Verify if input expires value is valid. |
| 191 | func isValidExpiry(expires time.Duration) error { |
| 192 | expireSeconds := int64(expires / time.Second) |
| 193 | if expireSeconds < 1 { |
| 194 | return errInvalidArgument("Expires cannot be lesser than 1 second.") |
| 195 | } |
| 196 | if expireSeconds > 604800 { |
| 197 | return errInvalidArgument("Expires cannot be greater than 7 days.") |
| 198 | } |
| 199 | return nil |
| 200 | } |
| 201 | |
| 202 | // Extract only necessary metadata header key/values by |
| 203 | // filtering them out with a list of custom header keys. |