s3

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DuplicateRuleIDError               = "error: PUT bucket lifecycle failed because the ruleId %s is duplicate."
	NoRequestBodyLifecycle             = "error: No request body specified for creating lifecycle configuration"
	NoRequestBodySSE                   = "error: No request body specified for creating SSE configuration"
	MoreThanOneExpirationAction        = "error: More than one expiration action is not permitted in one rule"
	DaysInStorageClassBeforeExpiration = "error: minimum days for an object in the current storage class should be less than Expiration Days"
	DaysInStorageClassBeforeTransition = "error: minimum days for an object in the current storage class is less before transition action"
	NoRuleIDForLifecycleDelete         = "error: No rule ID specified to delete from lifecycle configuration"
	WrongRuleIDForLifecycleDelete      = "error: The rule ID which is specified for delete does not exist"
	InvalidTier                        = "error: Invalid tier"
	InvalidExpireDays                  = "error: Days for Expiring object must not be less than %d"
	InvalidTransistionDays             = "error: days for transitioning object to tier_%d must not be less than %d"
	TooMuchLCRuls                      = "error: number of rules should not more than %d"
	InvalidRuleId                      = "error: Invalid rule ID"
)
View Source
const (
	AWSErrCodeInvalidArgument = "InvalidArgument"
)
View Source
const IdLimiteLen int = 255

Variables

View Source
var ChunkSize int = 2048
View Source
var ClassAndTier map[string]int32

Map from storage calss to tier

View Source
var ClassAndTier1 map[string]int32

Map from storage calss to tier

View Source
var CommonS3ResponseHeaders = []string{"Content-Length", "Content-Type", "Connection", "Date", "ETag", "Server",
	"x-amz-delete-marker", "x-amz-id-2", "x-amz-request-id", "x-amz-version-id"}

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

View Source
var ValidSuccessActionStatus = []string{"200", "201", "204"}

handle post object according to 'https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html'

Functions

func CheckValidBucketName added in v0.6.3

func CheckValidBucketName(bucketName string) (err error)

CheckValidBucketName - checks if we have a valid input bucket name.

func CreateListObjectsResponse added in v0.6.3

func CreateListObjectsResponse(bucketName string, request *s3.ListObjectsRequest,
	listRsp *s3.ListObjectsResponse) (response datatype.ListObjectsResponse)

this function refers to GenerateListObjectsResponse in api-response.go from Minio Cloud Storage.

func EncodeResponse added in v0.6.3

func EncodeResponse(response interface{}) []byte

Encodes the response headers into XML format.

func GenerateCompleteMultipartUploadResponse added in v0.6.3

func GenerateCompleteMultipartUploadResponse(bucket, key, location, etag string) CompleteMultipartUploadResponse

GenerateCompleteMultipartUploadResponse

func GenerateCopyObjectPartResponse added in v0.8.0

func GenerateCopyObjectPartResponse(etag string, lastModified int64) CopyObjectPartResponse

func GenerateCopyObjectResponse added in v0.6.3

func GenerateCopyObjectResponse(etag string, lastModified time.Time) CopyObjectResponse

GenerateCopyObjectResponse

func GenerateInitiateMultipartUploadResponse added in v0.6.3

func GenerateInitiateMultipartUploadResponse(bucket, key, uploadID string) InitiateMultipartUploadResponse

GenerateInitiateMultipartUploadResponse

func GetFinalError added in v0.6.3

func GetFinalError(err error, errorCode int32) error

func GetLocation added in v0.6.3

func GetLocation(r *http.Request) string

getLocation get URL location.

func HandleS3Error added in v0.6.3

func HandleS3Error(response *restful.Response, request *restful.Request, err error, errCode int32) error

func HasHeader

func HasHeader(request *restful.Request, name string) bool

func IsQuery

func IsQuery(request *restful.Request, name string) bool

func ReadBody

func ReadBody(r *restful.Request) []byte

func RegisterRouter

func RegisterRouter(ws *restful.WebService)

RegisterRouter - route request to appropriate method

func SetObjectHeaders added in v0.6.3

func SetObjectHeaders(response *restful.Response, object *pb.Object, expTime int64, ruleId string,
	contentRange *HttpRange)

Write object header, expTime and ruleId only used for HeadObject

func UrlEncodeAsAwsS3 added in v0.12.0

func UrlEncodeAsAwsS3(s string) string

func WriteApiErrorResponse added in v0.6.3

func WriteApiErrorResponse(response *restful.Response, request *restful.Request, status int, awsErrCode, message string)

func WriteErrorResponse added in v0.6.3

func WriteErrorResponse(response *restful.Response, request *restful.Request, err error)

writeErrorResponse write error headers w http.ResponseWriter, r *http.Request

func WriteErrorResponseHeaders added in v0.6.3

func WriteErrorResponseHeaders(response *restful.Response, err error)

func WriteErrorResponseNoHeader added in v0.6.3

func WriteErrorResponseNoHeader(response *restful.Response, request *restful.Request, err error, resource string)

func WriteErrorResponseWithResource added in v0.6.3

func WriteErrorResponseWithResource(response *restful.Response, request *restful.Request, err error, resource string)

func WriteSuccessNoContent added in v0.6.3

func WriteSuccessNoContent(response *restful.Response)

writeSuccessNoContent write success headers with http status 204

func WriteSuccessResponse added in v0.6.3

func WriteSuccessResponse(response *restful.Response, data []byte)

WriteSuccessResponse write success headers and response if any.

Types

type APIService

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

func NewAPIService

func NewAPIService(c client.Client) *APIService

func (*APIService) AbortMultipartUpload

func (s *APIService) AbortMultipartUpload(request *restful.Request, response *restful.Response)

func (*APIService) BucketAclGet added in v0.6.3

func (s *APIService) BucketAclGet(request *restful.Request, response *restful.Response)

func (*APIService) BucketAclPut added in v0.6.3

func (s *APIService) BucketAclPut(request *restful.Request, response *restful.Response)

func (*APIService) BucketDelete

func (s *APIService) BucketDelete(request *restful.Request, response *restful.Response)

func (*APIService) BucketGet

func (s *APIService) BucketGet(request *restful.Request, response *restful.Response)

func (*APIService) BucketLifecycleDelete added in v0.5.3

func (s *APIService) BucketLifecycleDelete(request *restful.Request, response *restful.Response)

func (*APIService) BucketLifecycleGet added in v0.5.3

func (s *APIService) BucketLifecycleGet(request *restful.Request, response *restful.Response)

Function for GET Bucket Lifecycle API

func (*APIService) BucketLifecyclePut added in v0.5.3

func (s *APIService) BucketLifecyclePut(request *restful.Request, response *restful.Response)

func (*APIService) BucketPut

func (s *APIService) BucketPut(request *restful.Request, response *restful.Response)

func (*APIService) BucketSSEPut added in v0.6.3

func (s *APIService) BucketSSEPut(request *restful.Request, response *restful.Response)

func (*APIService) BucketVersioningPut added in v0.6.3

func (s *APIService) BucketVersioningPut(request *restful.Request, response *restful.Response)

func (*APIService) CompleteMultipartUpload

func (s *APIService) CompleteMultipartUpload(request *restful.Request, response *restful.Response)

func (*APIService) GetStorageClasses added in v0.5.2

func (s *APIService) GetStorageClasses(request *restful.Request, response *restful.Response)

func (*APIService) HeadBucket added in v0.7.0

func (s *APIService) HeadBucket(request *restful.Request, response *restful.Response)

func (*APIService) HeadObject added in v0.7.0

func (s *APIService) HeadObject(request *restful.Request, response *restful.Response)

func (*APIService) ListBucketUploadRecords added in v0.6.3

func (s *APIService) ListBucketUploadRecords(request *restful.Request, response *restful.Response)

func (*APIService) ListBuckets

func (s *APIService) ListBuckets(request *restful.Request, response *restful.Response)

func (*APIService) ListObjectParts added in v0.6.3

func (s *APIService) ListObjectParts(request *restful.Request, response *restful.Response)

func (*APIService) MultiPartUploadInit

func (s *APIService) MultiPartUploadInit(request *restful.Request, response *restful.Response)

func (*APIService) ObjectAclGet added in v0.6.3

func (s *APIService) ObjectAclGet(request *restful.Request, response *restful.Response)

func (*APIService) ObjectAclPut added in v0.6.3

func (s *APIService) ObjectAclPut(request *restful.Request, response *restful.Response)

func (*APIService) ObjectCopy added in v0.6.3

func (s *APIService) ObjectCopy(request *restful.Request, response *restful.Response)

ObjectCopy copy object from http header x-amz-copy-source

func (*APIService) ObjectDelete

func (s *APIService) ObjectDelete(request *restful.Request, response *restful.Response)

func (*APIService) ObjectGet

func (s *APIService) ObjectGet(request *restful.Request, response *restful.Response)

GetObjectHandler - GET Object

func (*APIService) ObjectPartCopy added in v0.8.0

func (s *APIService) ObjectPartCopy(request *restful.Request, response *restful.Response)

ObjectPartCopy copy object from http header x-amz-copy-source as a part for multipart

func (*APIService) ObjectPost added in v0.8.0

func (s *APIService) ObjectPost(request *restful.Request, response *restful.Response)

func (*APIService) ObjectPut

func (s *APIService) ObjectPut(request *restful.Request, response *restful.Response)

ObjectPut -

func (*APIService) RouteBucketDelete added in v0.5.3

func (s *APIService) RouteBucketDelete(request *restful.Request, response *restful.Response)

func (*APIService) RouteBucketGet added in v0.5.3

func (s *APIService) RouteBucketGet(request *restful.Request, response *restful.Response)

func (*APIService) RouteBucketHead added in v0.6.3

func (s *APIService) RouteBucketHead(request *restful.Request, response *restful.Response)

func (*APIService) RouteBucketPut

func (s *APIService) RouteBucketPut(request *restful.Request, response *restful.Response)

func (*APIService) RouteObjectDelete added in v0.3.4

func (s *APIService) RouteObjectDelete(request *restful.Request, response *restful.Response)

func (*APIService) RouteObjectGet added in v0.6.3

func (s *APIService) RouteObjectGet(request *restful.Request, response *restful.Response)

func (*APIService) RouteObjectHead added in v0.6.3

func (s *APIService) RouteObjectHead(request *restful.Request, response *restful.Response)

func (*APIService) RouteObjectPost added in v0.6.3

func (s *APIService) RouteObjectPost(request *restful.Request, response *restful.Response)

func (*APIService) RouteObjectPut

func (s *APIService) RouteObjectPut(request *restful.Request, response *restful.Response)

func (*APIService) UploadPart

func (s *APIService) UploadPart(request *restful.Request, response *restful.Response)

type ApiErrorResponse added in v0.6.3

type ApiErrorResponse struct {
	XMLName      xml.Name `xml:"Error" json:"-"`
	AwsErrorCode string   `xml:"Code"`
	Message      string
	Key          string
	BucketName   string
	Resource     string
	RequestId    string
	HostId       string
}

APIErrorResponse - error response format

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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