policy

package
v0.0.0-...-5c6c1e7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPostPolicy

func CheckPostPolicy(formValues http.Header, postPolicyForm PostPolicyForm) error

CheckPostPolicy - apply policy conditions and validate input values. (http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html)

Types

type PostPolicy

type PostPolicy struct {
	// contains filtered or unexported fields
}

PostPolicy - Provides strict static type conversion and validation for Amazon S3's POST policy JSON string.

func NewPostPolicy

func NewPostPolicy() *PostPolicy

NewPostPolicy - Instantiate new post policy.

func (*PostPolicy) SetBucket

func (p *PostPolicy) SetBucket(bucketName string) error

SetBucket - Sets bucket at which objects will be uploaded to.

func (*PostPolicy) SetCondition

func (p *PostPolicy) SetCondition(matchType, condition, value string) error

SetCondition - Sets condition for credentials, date and algorithm

func (*PostPolicy) SetContentLengthRange

func (p *PostPolicy) SetContentLengthRange(min, max int64) error

SetContentLengthRange - Set new min and max content length condition for all incoming uploads.

func (*PostPolicy) SetContentType

func (p *PostPolicy) SetContentType(contentType string) error

SetContentType - Sets content-type of the object for this policy based upload.

func (*PostPolicy) SetExpires

func (p *PostPolicy) SetExpires(t time.Time) error

SetExpires - Sets expiration time for the new policy.

func (*PostPolicy) SetKey

func (p *PostPolicy) SetKey(key string) error

SetKey - Sets an object name for the policy based upload.

func (*PostPolicy) SetKeyStartsWith

func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error

SetKeyStartsWith - Sets an object name that an policy based upload can start with.

func (*PostPolicy) SetSuccessActionRedirect

func (p *PostPolicy) SetSuccessActionRedirect(redirect string) error

SetSuccessActionRedirect - Sets the redirect success url of the object for this policy based upload.

func (*PostPolicy) SetSuccessStatusAction

func (p *PostPolicy) SetSuccessStatusAction(status string) error

SetSuccessStatusAction - Sets the status success code of the object for this policy based upload.

func (*PostPolicy) SetUserData

func (p *PostPolicy) SetUserData(key string, value string) error

SetUserData - Set user data as a key/value couple. Can be retrieved through a HEAD request or an event.

func (*PostPolicy) SetUserMetadata

func (p *PostPolicy) SetUserMetadata(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 (PostPolicy) String

func (p PostPolicy) String() string

String function for printing policy in json formatted string.

type PostPolicyForm

type PostPolicyForm struct {
	Expiration time.Time // Expiration date and time of the POST policy.
	Conditions struct {
		Policies []struct {
			Operator string
			Key      string
			Value    string
		}
		ContentLengthRange contentLengthRange
	}
}

PostPolicyForm provides strict static type conversion and validation for Amazon S3's POST policy JSON string.

func ParsePostPolicyForm

func ParsePostPolicyForm(policy string) (ppf PostPolicyForm, e error)

ParsePostPolicyForm - Parse JSON policy string into typed PostPolicyForm structure.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL