SetKey - Sets an object name for the policy based upload.
(key string)
| 85 | |
| 86 | // SetKey - Sets an object name for the policy based upload. |
| 87 | func (p *PostPolicy) SetKey(key string) error { |
| 88 | if strings.TrimSpace(key) == "" { |
| 89 | return errInvalidArgument("Object name is empty.") |
| 90 | } |
| 91 | policyCond := policyCondition{ |
| 92 | matchType: "eq", |
| 93 | condition: "$key", |
| 94 | value: key, |
| 95 | } |
| 96 | if err := p.addNewPolicy(policyCond); err != nil { |
| 97 | return err |
| 98 | } |
| 99 | p.formData["key"] = key |
| 100 | return nil |
| 101 | } |
| 102 | |
| 103 | // SetKeyStartsWith - Sets an object name that an policy based upload |
| 104 | // can start with. |