MCPcopy
hub / github.com/minio/minio-go / SetCondition

Method SetCondition

post-policy.go:137–155  ·  view source on GitHub ↗

SetCondition - Sets condition for credentials, date and algorithm

(matchType, condition, value string)

Source from the content-addressed store, hash-verified

135
136// SetCondition - Sets condition for credentials, date and algorithm
137func (p *PostPolicy) SetCondition(matchType, condition, value string) error {
138 if strings.TrimSpace(value) == "" {
139 return errInvalidArgument("No value specified for condition")
140 }
141
142 policyCond := policyCondition{
143 matchType: matchType,
144 condition: "$" + condition,
145 value: value,
146 }
147 if condition == "X-Amz-Credential" || condition == "X-Amz-Date" || condition == "X-Amz-Algorithm" {
148 if err := p.addNewPolicy(policyCond); err != nil {
149 return err
150 }
151 p.formData[condition] = value
152 return nil
153 }
154 return errInvalidArgument("Invalid condition in policy")
155}
156
157// SetTagging - Sets tagging for the object for this policy based upload.
158func (p *PostPolicy) SetTagging(tagging string) error {

Callers 1

Calls 2

addNewPolicyMethod · 0.95
errInvalidArgumentFunction · 0.85

Tested by 1