common

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: Apache-2.0 Imports: 9 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaxPaginationLimit      = 1000
	DefaultPaginationLimit  = MaxPaginationLimit
	DefaultPaginationOffset = 0
	MaxObjectSize           = 5 * 1024 * 1024 * 1024 // 5GB
	SortDirectionAsc        = "asc"
	SortDirectionDesc       = "desc"
	DefaultAdminTenantId    = "94b280022d0c4401bcf3b0ea85870519"
)
View Source
const (
	KLimit        = "limit"
	KOffset       = "offset"
	KSort         = "sort"
	KLastModified = "lastmodified"
	KObjKey       = "objkey"
	KStorageTier  = "tier"
	KPrefix       = "prefix"
	KMarker       = "marker"
	KDelimiter    = "delimiter"
	KVerMarker    = "verMarker"
)
View Source
const (
	CTX_KEY_TENANT_ID   = "Tenantid"
	CTX_KEY_USER_ID     = "Userid"
	CTX_KEY_IS_ADMIN    = "Isadmin"
	CTX_VAL_TRUE        = "true"
	CTX_REPRE_TENANT    = "Representedtenantid"
	CTX_KEY_OBJECT_KEY  = "ObjectKey"
	CTX_KEY_BUCKET_NAME = "BucketName"
	CTX_KEY_SIZE        = "ObjectSize"
	CTX_KEY_LOCATION    = "Location"
)
View Source
const (
	REQUEST_PATH_BUCKET_NAME         = "bucketName"
	REQUEST_PATH_OBJECT_KEY          = "objectKey"
	REQUEST_PATH_BACKEND_ID          = "backendId"
	REQUEST_HEADER_CONTENT_LENGTH    = "Content-Length"
	REQUEST_HEADER_BACKEND           = "x-amz-meta-backend"
	REQUEST_HEADER_STORAGE_CLASS     = "x-amz-storage-class"
	REQUEST_HEADER_COPY_SOURCE       = "X-Amz-Copy-Source"
	REQUEST_HEADER_COPY_SOURCE_RANGE = "X-Amz-Copy-Source-Range"
	REQUEST_HEADER_ACL               = "X-Amz-Acl"
	REQUEST_HEADER_CONTENT_MD5       = "Content-Md5"
	REQUEST_HEADER_CONTENT_TYPE      = "Content-Type"
	REQUEST_HEADER_SSE_KEY           = "x-amz-server-side-encryption"
	REQUEST_HEADER_SSE_VALUE_AES256  = "AES256"
	REQUEST_HEADER_ARCHIVE           = "X-Amz-Storage-Class"
)
View Source
const (
	REQUEST_FORM_KEY    = "Key"
	REQUEST_FORM_BUCKET = "Bucket"
)

Variables

This section is empty.

Functions

func GetAdminContext added in v1.3.2

func GetAdminContext() context.Context

func GetFilter

func GetFilter(request *restful.Request, filterOpts []string) (map[string]string, error)

func GetFilterPathParams added in v1.0.0

func GetFilterPathParams(request *restful.Request, filterOpts []string) (map[string]string, error)

func GetOwner added in v0.12.0

func GetOwner(request *restful.Request) (ownerId string)

func GetPaginationParam

func GetPaginationParam(request *restful.Request) (int32, int32, error)

func GetSortParam

func GetSortParam(request *restful.Request) (sortKeys []string, sortDirs []string, err error)

An example of sort key parameter will be like this: sort=key1:asc,key2:desc

func InitCtxWithAuthInfo added in v0.6.3

func InitCtxWithAuthInfo(request *restful.Request) context.Context

func InitCtxWithAuthInfoNonAdmin added in v1.3.2

func InitCtxWithAuthInfoNonAdmin(request *restful.Request) context.Context

TODO: Can be optimized with above function InitCtxWithAuthInfo()

func InitCtxWithVal added in v0.6.3

func InitCtxWithVal(request *restful.Request, md map[string]string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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