diff --git a/post-policy.go b/post-policy.go index 3f4881e82..6d42488e5 100644 --- a/post-policy.go +++ b/post-policy.go @@ -152,6 +152,23 @@ func (p *PostPolicy) SetCondition(matchType, condition, value string) error { return errInvalidArgument("Invalid condition in policy") } +// SetTagging - Sets tagging for the object for this policy based upload. +func (p *PostPolicy) SetTagging(tagging string) error { + if strings.TrimSpace(tagging) == "" || tagging == "" { + return errInvalidArgument("No tagging specified.") + } + policyCond := policyCondition{ + matchType: "eq", + condition: "$tagging", + value: tagging, + } + if err := p.addNewPolicy(policyCond); err != nil { + return err + } + p.formData["tagging"] = tagging + return nil +} + // SetContentType - Sets content-type of the object for this policy // based upload. func (p *PostPolicy) SetContentType(contentType string) error {