brand

package
v1.3.13 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Brands = []string{"AWS"}
View Source
var CommonS3ResponseHeaders = []string{"Content-Length", "Content-Type", "Connection", "Date", "ETag", "Server"}

Refer: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html

View Source
var StartsWithConds = map[string]bool{
	"$acl":                     true,
	"$bucket":                  false,
	"$cache-control":           true,
	"$content-type":            true,
	"$content-disposition":     true,
	"$content-encoding":        true,
	"$expires":                 true,
	"$key":                     true,
	"$success_action_redirect": true,
	"$redirect":                true,
	"$success_action_status":   false,
}

startWithConds - map which indicates if a given condition supports starts-with policy operator

Functions

func Initialize

func Initialize(brands []string)

Types

type Aws

type Aws struct {
	Name string
}

func (*Aws) BrandName

func (a *Aws) BrandName() string

func (*Aws) GetHeaderFieldKey

func (a *Aws) GetHeaderFieldKey(field HeaderFieldKey) string

get full name by unified name

func (*Aws) GetHeaderFieldValue

func (a *Aws) GetHeaderFieldValue(field HeaderFieldValue) string

type Brand

type Brand interface {
	BrandName() string
	GetHeaderFieldKey(field HeaderFieldKey) string
	GetHeaderFieldValue(field HeaderFieldValue) string
}

func DistinguishBrandName

func DistinguishBrandName(r *http.Request, postValues map[string]string) (brand Brand)

Verify if request header field is X-Amz or X-UOS if can not find, UOS by default

func GetContextBrand

func GetContextBrand(r *http.Request) Brand

type BrandKeyType

type BrandKeyType string
const BrandKey BrandKeyType = "Brand"

type GeneralBrand

type GeneralBrand struct {
	Name string
}

func (*GeneralBrand) BrandName

func (g *GeneralBrand) BrandName() string

func (*GeneralBrand) GetHeaderFieldKey

func (g *GeneralBrand) GetHeaderFieldKey(field HeaderFieldKey) string

get full name by unified name

func (*GeneralBrand) GetHeaderFieldValue

func (g *GeneralBrand) GetHeaderFieldValue(field HeaderFieldValue) string

type HeaderFieldKey

type HeaderFieldKey string
const (
	AccessKeyId                  HeaderFieldKey = "AccessKeyId"
	XGeneralName                 HeaderFieldKey = "-"
	XContentSha                  HeaderFieldKey = "-Content-Sha256"
	XCredential                  HeaderFieldKey = "-Credential"
	XAlgorithm                   HeaderFieldKey = "-Algorithm"
	XACL                         HeaderFieldKey = "-Acl"
	XDate                        HeaderFieldKey = "-Date"
	XMeta                        HeaderFieldKey = "-Meta-"
	XExpires                     HeaderFieldKey = "-Expires"
	XSignature                   HeaderFieldKey = "-Signature"
	XSignedHeaders               HeaderFieldKey = "-SignedHeaders"
	XSecurityToken               HeaderFieldKey = "-Security-Token"
	XStorageClass                HeaderFieldKey = "-Storage-Class"
	XServerSideEncryption        HeaderFieldKey = "-Server-Side-Encryption"                                // ServerSideEncryption is the general AWS SSE HTTP header key.
	XSSEKmsContext               HeaderFieldKey = "-Context"                                               // SSEKmsContext is the HTTP header key referencing the SSE-KMS encryption context.
	XSSECAlgorithm               HeaderFieldKey = "-Server-Side-Encryption-Customer-Algorithm"             // SSECAlgorithm is the HTTP header key referencing the SSE-C algorithm.
	XSSECKey                     HeaderFieldKey = "-Server-Side-Encryption-Customer-Key"                   // SSECKey is the HTTP header key referencing the SSE-C client-provided key..
	XSSECKeyMD5                  HeaderFieldKey = "-Server-Side-Encryption-Customer-Key-Md5"               // SSECKeyMD5 is the HTTP header key referencing the MD5 sum of the client-provided key.
	XSSECopyAlgorithm            HeaderFieldKey = "-Copy-Source-Server-Side-Encryption-Customer-Algorithm" // SSECopyAlgorithm is the HTTP header key referencing the SSE-C algorithm for SSE-C copy requests.
	XSSECopyKey                  HeaderFieldKey = "-Copy-Source-Server-Side-Encryption-Customer-Key"       // SSECopyKey is the HTTP header key referencing the SSE-C client-provided key for SSE-C copy requests.
	XSSECopyKeyMD5               HeaderFieldKey = "-Copy-Source-Server-Side-Encryption-Customer-Key-Md5"   // SSECopyKeyMD5 is the HTTP header key referencing the MD5 sum of the client key for SSE-C copy requests.
	SSEKmsID                     HeaderFieldKey = "-Kms-Key-Id"                                            // SSEKmsID is the HTTP header key referencing the SSE-KMS key ID.
	XRestore                     HeaderFieldKey = "-Restore"
	XForbidOverwrite             HeaderFieldKey = "-Forbid-Overwrite"
	XCopySource                  HeaderFieldKey = "-Copy-Source"
	XCopySourceRange             HeaderFieldKey = "-Copy-Source-Range"
	XCopySourceIfModifiedSince   HeaderFieldKey = "-Copy-Source-If-Modified-Since"
	XCopySourceIfUnmodifiedSince HeaderFieldKey = "-Copy-Source-If-Unmodified-Since"
	XCopySourceIfMatch           HeaderFieldKey = "-Copy-Source-If-Match"
	XCopySourceIfNoneMatch       HeaderFieldKey = "-Copy-Source-If-None-Match"
	XCopySourceVersionId         HeaderFieldKey = "-Copy-Source-Version-Id"
	XRenameSourceKey             HeaderFieldKey = "-Rename-Source-Key"
	XDecodedContentLength        HeaderFieldKey = "-Decoded-Content-Length"
	XMetadataDirective           HeaderFieldKey = "-Metadata-Directive"
	XVersionId                   HeaderFieldKey = "-Version-Id"
	XNextAppendPosition          HeaderFieldKey = "-Next-Append-Position"
	XDeleteMarker                HeaderFieldKey = "-Delete-Marker"
	XObjectType                  HeaderFieldKey = "-Object-Type"
	XID2                         HeaderFieldKey = "-Id-2"
	XRequestId                   HeaderFieldKey = "-Request-Id"
)

type HeaderFieldValue

type HeaderFieldValue string
const (
	SpecialName            HeaderFieldValue = ""
	SignV2Algorithm        HeaderFieldValue = ""
	SignV4Algorithm        HeaderFieldValue = "4-HMAC-SHA256"
	SignV4ChunkedAlgorithm HeaderFieldValue = "4-HMAC-SHA256-PAYLOAD"
	SignV4                 HeaderFieldValue = "4"
	SignRequest            HeaderFieldValue = "4_request" // need strings.ToLower
	Chunked                HeaderFieldValue = "-chunked"
	StreamingContentSHA256 HeaderFieldValue = "STREAMING"
	SSEAlgorithmKMS        HeaderFieldValue = ":kms" // SSEAlgorithmKMS is the value of 'X-***-Server-Side-Encryption' for SSE-KMS.
)

Jump to

Keyboard shortcuts

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