s3_constants

package
v0.0.0-...-2a169dd Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CannedAclPrivate                = "private"
	CannedAclPublicRead             = "public-read"
	CannedAclPublicReadWrite        = "public-read-write"
	CannedAclAuthenticatedRead      = "authenticated-read"
	CannedAclLogDeliveryWrite       = "log-delivery-write"
	CannedAclBucketOwnerRead        = "bucket-owner-read"
	CannedAclBucketOwnerFullControl = "bucket-owner-full-control"
	CannedAclAwsExecRead            = "aws-exec-read"
)
View Source
const (
	ExtAmzOwnerKey  = "Seaweed-X-Amz-Owner"
	ExtAmzAclKey    = "Seaweed-X-Amz-Acl"
	ExtOwnershipKey = "Seaweed-X-Amz-Ownership"
)
View Source
const (
	// S3 storage class
	AmzStorageClass = "x-amz-storage-class"

	// S3 user-defined metadata
	AmzUserMetaPrefix    = "X-Amz-Meta-"
	AmzUserMetaDirective = "X-Amz-Metadata-Directive"
	AmzUserMetaMtime     = "X-Amz-Meta-Mtime"

	// S3 object tagging
	AmzObjectTagging          = "X-Amz-Tagging"
	AmzObjectTaggingPrefix    = "X-Amz-Tagging-"
	AmzObjectTaggingDirective = "X-Amz-Tagging-Directive"
	AmzTagCount               = "x-amz-tagging-count"

	SeaweedFSIsDirectoryKey = "X-Seaweedfs-Is-Directory-Key"
	SeaweedFSPartNumber     = "X-Seaweedfs-Part-Number"
	SeaweedFSUploadId       = "X-Seaweedfs-Upload-Id"

	// S3 ACL headers
	AmzCannedAcl      = "X-Amz-Acl"
	AmzAclFullControl = "X-Amz-Grant-Full-Control"
	AmzAclRead        = "X-Amz-Grant-Read"
	AmzAclWrite       = "X-Amz-Grant-Write"
	AmzAclReadAcp     = "X-Amz-Grant-Read-Acp"
	AmzAclWriteAcp    = "X-Amz-Grant-Write-Acp"

	AmzMpPartsCount = "X-Amz-Mp-Parts-Count"
)

Standard S3 HTTP request constants

View Source
const (
	AmzIdentityId = "s3-identity-id"
	AmzAccountId  = "s3-account-id"
	AmzAuthType   = "s3-auth-type"
	AmzIsAdmin    = "s3-is-admin" // only set to http request header as a context
)

Non-Standard S3 HTTP request constants

View Source
const (
	AccountAnonymousId = "anonymous"
	AccountAdminId     = "admin"
)
View Source
const (
	ACTION_READ          = "Read"
	ACTION_READ_ACP      = "ReadAcp"
	ACTION_WRITE         = "Write"
	ACTION_WRITE_ACP     = "WriteAcp"
	ACTION_ADMIN         = "Admin"
	ACTION_TAGGING       = "Tagging"
	ACTION_LIST          = "List"
	ACTION_DELETE_BUCKET = "DeleteBucket"

	SeaweedStorageDestinationHeader = "x-seaweedfs-destination"
	MultipartUploadsFolder          = ".uploads"
	FolderMimeType                  = "httpd/unix-directory"
)

Variables

View Source
var (
	PublicRead = []*s3.Grant{
		{
			Grantee: &s3.Grantee{
				Type: &GrantTypeGroup,
				URI:  &GranteeGroupAllUsers,
			},
			Permission: &PermissionRead,
		},
	}

	PublicReadWrite = []*s3.Grant{
		{
			Grantee: &s3.Grantee{
				Type: &GrantTypeGroup,
				URI:  &GranteeGroupAllUsers,
			},
			Permission: &PermissionRead,
		},
		{
			Grantee: &s3.Grantee{
				Type: &GrantTypeGroup,
				URI:  &GranteeGroupAllUsers,
			},
			Permission: &PermissionWrite,
		},
	}

	AuthenticatedRead = []*s3.Grant{
		{
			Grantee: &s3.Grantee{
				Type: &GrantTypeGroup,
				URI:  &GranteeGroupAuthenticatedUsers,
			},
			Permission: &PermissionRead,
		},
	}

	LogDeliveryWrite = []*s3.Grant{
		{
			Grantee: &s3.Grantee{
				Type: &GrantTypeGroup,
				URI:  &GranteeGroupLogDelivery,
			},
			Permission: &PermissionWrite,
		},
	}
)
View Source
var (
	GranteeGroupAllUsers           = "http://acs.amazonaws.com/groups/global/AllUsers"
	GranteeGroupAuthenticatedUsers = "http://acs.amazonaws.com/groups/global/AuthenticatedUsers"
	GranteeGroupLogDelivery        = "http://acs.amazonaws.com/groups/s3/LogDelivery"
)

Amazon S3 predefined groups

View Source
var (
	GrantTypeCanonicalUser         = "CanonicalUser"
	GrantTypeAmazonCustomerByEmail = "AmazonCustomerByEmail"
	GrantTypeGroup                 = "Group"
)
View Source
var (
	OwnershipBucketOwnerPreferred = "BucketOwnerPreferred"
	OwnershipObjectWriter         = "ObjectWriter"
	OwnershipBucketOwnerEnforced  = "BucketOwnerEnforced"

	DefaultOwnershipForCreate = OwnershipObjectWriter
	DefaultOwnershipForExists = OwnershipBucketOwnerEnforced
)
View Source
var (
	PermissionFullControl = "FULL_CONTROL"
	PermissionRead        = "READ"
	PermissionWrite       = "WRITE"
	PermissionReadAcp     = "READ_ACP"
	PermissionWriteAcp    = "WRITE_ACP"
)
View Source
var (
	CircuitBreakerConfigDir  = "/etc/s3"
	CircuitBreakerConfigFile = "circuit_breaker.json"
	AllowedActions           = []string{ACTION_READ, ACTION_READ_ACP, ACTION_WRITE, ACTION_WRITE_ACP, ACTION_LIST, ACTION_TAGGING, ACTION_ADMIN, ACTION_DELETE_BUCKET}
	LimitTypeCount           = "Count"
	LimitTypeBytes           = "MB"
	Separator                = ":"
)
View Source
var PassThroughHeaders = map[string]string{
	"response-cache-control":       "Cache-Control",
	"response-content-disposition": "Content-Disposition",
	"response-content-encoding":    "Content-Encoding",
	"response-content-language":    "Content-Language",
	"response-content-type":        "Content-Type",
	"response-expires":             "Expires",
}

Functions

func Concat

func Concat(elements ...string) string

func GetBucketAndObject

func GetBucketAndObject(r *http.Request) (bucket, object string)

func ValidateGroup

func ValidateGroup(group string) bool

func ValidateOwnership

func ValidateOwnership(ownership string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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