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

Method addNewPolicy

post-policy.go:402–411  ·  view source on GitHub ↗

addNewPolicy - internal helper to validate adding new policies. Can use starts-with with an empty value ("") to allow any content within a form field.

(policyCond policyCondition)

Source from the content-addressed store, hash-verified

400// addNewPolicy - internal helper to validate adding new policies.
401// Can use starts-with with an empty value ("") to allow any content within a form field.
402func (p *PostPolicy) addNewPolicy(policyCond policyCondition) error {
403 if policyCond.matchType == "" || policyCond.condition == "" {
404 return errInvalidArgument("Policy fields are empty.")
405 }
406 if policyCond.matchType != "starts-with" && policyCond.value == "" {
407 return errInvalidArgument("Policy value is empty.")
408 }
409 p.conditions = append(p.conditions, policyCond)
410 return nil
411}
412
413// String function for printing policy in json formatted string.
414func (p PostPolicy) String() string {

Callers 15

SetKeyMethod · 0.95
SetKeyStartsWithMethod · 0.95
SetBucketMethod · 0.95
SetConditionMethod · 0.95
SetTaggingMethod · 0.95
SetContentTypeMethod · 0.95
SetContentDispositionMethod · 0.95
SetContentEncodingMethod · 0.95
SetUserMetadataMethod · 0.95

Calls 1

errInvalidArgumentFunction · 0.85

Tested by

no test coverage detected