SetBucket - Sets bucket at which objects will be uploaded to.
(bucketName string)
| 118 | |
| 119 | // SetBucket - Sets bucket at which objects will be uploaded to. |
| 120 | func (p *PostPolicy) SetBucket(bucketName string) error { |
| 121 | if strings.TrimSpace(bucketName) == "" { |
| 122 | return errInvalidArgument("Bucket name is empty.") |
| 123 | } |
| 124 | policyCond := policyCondition{ |
| 125 | matchType: "eq", |
| 126 | condition: "$bucket", |
| 127 | value: bucketName, |
| 128 | } |
| 129 | if err := p.addNewPolicy(policyCond); err != nil { |
| 130 | return err |
| 131 | } |
| 132 | p.formData["bucket"] = bucketName |
| 133 | return nil |
| 134 | } |
| 135 | |
| 136 | // SetCondition - Sets condition for credentials, date and algorithm |
| 137 | func (p *PostPolicy) SetCondition(matchType, condition, value string) error { |