Skip to content

Commit

Permalink
Renamed to SetUserMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
hnb2 committed Oct 12, 2017
1 parent 400098e commit 552a5c5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -1348,8 +1348,8 @@ policy.SetContentType("image/png")
// Only allow content size in range 1KB to 1MB.
policy.SetContentLengthRange(1024, 1024*1024)

// Add a user specified metadata using the key "custom" and value "user"
policy.SetUserSpecifiedMetadata("custom", "user")
// Add a user metadata using the key "custom" and value "user"
policy.SetUserMetadata("custom", "user")

// Get the POST form key/value object:

Expand Down
6 changes: 3 additions & 3 deletions functional_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -2090,16 +2090,16 @@ func testPresignedPostPolicy() {
if err := policy.SetContentLengthRange(1024*1024, 1024); err == nil {
failureLog(function, args, startTime, "", "SetContentLengthRange did not fail for invalid conditions", err).Fatal()
}
if err := policy.SetUserSpecifiedMetadata("", ""); err == nil {
failureLog(function, args, startTime, "", "SetUserSpecifiedMetadata did not fail for invalid conditions", err).Fatal()
if err := policy.SetUserMetadata("", ""); err == nil {
failureLog(function, args, startTime, "", "SetUserMetadata did not fail for invalid conditions", err).Fatal()
}

policy.SetBucket(bucketName)
policy.SetKey(objectName)
policy.SetExpires(time.Now().UTC().AddDate(0, 0, 10)) // expires in 10 days
policy.SetContentType("image/png")
policy.SetContentLengthRange(1024, 1024*1024)
policy.SetUserSpecifiedMetadata(metadataKey, metadataValue)
policy.SetUserMetadata(metadataKey, metadataValue)
args["policy"] = policy

_, _, err = c.PresignedPostPolicy(policy)
Expand Down
6 changes: 3 additions & 3 deletions post-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ func (p *PostPolicy) SetSuccessStatusAction(status string) error {
return nil
}

// SetUserSpecifiedMetadata - Set user specified metadata as a key/value
// couple. Can be retrieved through a HEAD request or an event.
func (p *PostPolicy) SetUserSpecifiedMetadata(key string, value string) error {
// SetUserMetadata - Set user metadata as a key/value couple.
// Can be retrieved through a HEAD request or an event.
func (p *PostPolicy) SetUserMetadata(key string, value string) error {
if strings.TrimSpace(key) == "" || key == "" {
return ErrInvalidArgument("Key is empty")
}
Expand Down

0 comments on commit 552a5c5

Please sign in to comment.