api

package
v0.0.0-...-f4bd7b1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	AccessDenied = iota
	BadDigest
	BucketAlreadyExists
	EntityTooSmall
	EntityTooLarge
	IncompleteBody
	InternalError
	InvalidAccessKeyID
	InvalidBucketName
	InvalidDigest
	InvalidRange
	InvalidRequest
	InvalidMaxKeys
	InvalidMaxUploads
	InvalidMaxParts
	InvalidPartNumberMarker
	MalformedXML
	MissingContentLength
	MissingRequestBodyError
	NoSuchBucket
	NoSuchKey
	NoSuchUpload
	NotImplemented
	RequestTimeTooSkewed
	SignatureDoesNotMatch
	TooManyBuckets
	MethodNotAllowed
	InvalidPart
	InvalidPartOrder
)

Error codes, non exhaustive list - http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html

View Source
const (
	NotAcceptable = iota + 29
)

Error codes, non exhaustive list - standard HTTP errors

Variables

This section is empty.

Functions

func CorsHandler

func CorsHandler(h http.Handler) http.Handler

func IgnoreResourcesHandler

func IgnoreResourcesHandler(h http.Handler) http.Handler

IgnoreResourcesHandler - Ignore resources handler is wrapper handler used for API request resource validation Since we do not support all the S3 queries, it is necessary for us to throw back a valid error message indicating such a feature is not implemented.

func InitSignatureV4

func InitSignatureV4(req *http.Request) (*donut.Signature, *probe.Error)

InitSignatureV4 initializing signature verification

func LoggingHandler

func LoggingHandler(h http.Handler) http.Handler

LoggingHandler logs requests

func StripAccessKeyID

func StripAccessKeyID(ah string) (string, error)

StripAccessKeyID - strip only access key id from auth header

func TimeValidityHandler

func TimeValidityHandler(h http.Handler) http.Handler

TimeValidityHandler to validate parsable time over http header

func ValidContentTypeHandler

func ValidContentTypeHandler(h http.Handler) http.Handler

ValidContentTypeHandler to validate Accept type

func ValidateAuthHeaderHandler

func ValidateAuthHeaderHandler(h http.Handler) http.Handler

ValidateAuthHeaderHandler - validate auth header handler is wrapper handler used for request validation with authorization header. Current authorization layer supports S3's standard HMAC based signature request.

Types

type ACLType

type ACLType int

ACLType - different acl types

type Bucket

type Bucket struct {
	Name         string
	CreationDate string
}

Bucket container for bucket metadata

type CommonPrefix

type CommonPrefix struct {
	Prefix string
}

CommonPrefix container for prefix response in ListObjectsResponse

type CompleteMultipartUploadResponse

type CompleteMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CompleteMultipartUploadResult" json:"-"`

	Location string
	Bucket   string
	Key      string
	ETag     string
}

CompleteMultipartUploadResponse container for completed multipart upload response

type Config

type Config struct {
	Address   string
	TLS       bool
	CertFile  string
	KeyFile   string
	RateLimit int
}

Config - http server config

type Error

type Error struct {
	Code           string
	Description    string
	HTTPStatusCode int
}

Error structure

type ErrorResponse

type ErrorResponse struct {
	XMLName   xml.Name `xml:"Error" json:"-"`
	Code      string
	Message   string
	Resource  string
	RequestID string `xml:"RequestId"`
	HostID    string `xml:"HostId"`
}

ErrorResponse - error response format

type InitiateMultipartUploadResponse

type InitiateMultipartUploadResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ InitiateMultipartUploadResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`
}

InitiateMultipartUploadResponse container for InitiateMultiPartUpload response, provides uploadID to start MultiPart upload

type Initiator

type Initiator Owner

Initiator inherit from Owner struct, fields are same

type ListBucketsResponse

type ListBucketsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListAllMyBucketsResult" json:"-"`
	// Container for one or more buckets.
	Buckets struct {
		Bucket []*Bucket
	} // Buckets are nested
	Owner Owner
}

ListBucketsResponse - format for list buckets response

type ListMultipartUploadsResponse

type ListMultipartUploadsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListMultipartUploadsResult" json:"-"`

	Bucket             string
	KeyMarker          string
	UploadIDMarker     string `xml:"UploadIdMarker"`
	NextKeyMarker      string
	NextUploadIDMarker string `xml:"NextUploadIdMarker"`
	EncodingType       string
	MaxUploads         int
	IsTruncated        bool
	Upload             []*Upload
	Prefix             string
	Delimiter          string
	CommonPrefixes     []*CommonPrefix
}

ListMultipartUploadsResponse - format for list multipart uploads response

type ListObjectsResponse

type ListObjectsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListBucketResult" json:"-"`

	CommonPrefixes []*CommonPrefix
	Contents       []*Object

	Delimiter string

	// Encoding type used to encode object keys in the response.
	EncodingType string

	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool
	Marker      string
	MaxKeys     int
	Name        string

	// When response is truncated (the IsTruncated element value in the response
	// is true), you can use the key name in this field as marker in the subsequent
	// request to get next set of objects. Server lists objects in alphabetical
	// order Note: This element is returned only if you have delimiter request parameter
	// specified. If response does not include the NextMaker and it is truncated,
	// you can use the value of the last Key in the response as the marker in the
	// subsequent request to get the next set of object keys.
	NextMarker string
	Prefix     string
}

ListObjectsResponse - format for list objects response

type ListPartsResponse

type ListPartsResponse struct {
	XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListPartsResult" json:"-"`

	Bucket   string
	Key      string
	UploadID string `xml:"UploadId"`

	Initiator Initiator
	Owner     Owner

	// The class of storage used to store the object.
	StorageClass string

	PartNumberMarker     int
	NextPartNumberMarker int
	MaxParts             int
	IsTruncated          bool

	// List of parts
	Part []*Part
}

ListPartsResponse - format for list parts response

type MiddlewareHandler

type MiddlewareHandler func(http.Handler) http.Handler

type Minio

type Minio struct {
	OP    chan Operation
	Donut donut.Interface
}

Minio container for API and also carries OP (operation) channel

func New

func New() Minio

New instantiate a new minio API

func (Minio) AbortMultipartUploadHandler

func (api Minio) AbortMultipartUploadHandler(w http.ResponseWriter, req *http.Request)

AbortMultipartUploadHandler - Abort multipart upload

func (Minio) CompleteMultipartUploadHandler

func (api Minio) CompleteMultipartUploadHandler(w http.ResponseWriter, req *http.Request)

CompleteMultipartUploadHandler - Complete multipart upload

func (Minio) DeleteBucketHandler

func (api Minio) DeleteBucketHandler(w http.ResponseWriter, req *http.Request)

DeleteBucketHandler - Delete bucket

func (Minio) DeleteObjectHandler

func (api Minio) DeleteObjectHandler(w http.ResponseWriter, req *http.Request)

DeleteObjectHandler - Delete object

func (Minio) GetObjectHandler

func (api Minio) GetObjectHandler(w http.ResponseWriter, req *http.Request)

GetObjectHandler - GET Object ---------- This implementation of the GET operation retrieves object. To use GET, you must have READ access to the object.

func (Minio) HeadBucketHandler

func (api Minio) HeadBucketHandler(w http.ResponseWriter, req *http.Request)

HeadBucketHandler - HEAD Bucket ---------- This operation is useful to determine if a bucket exists. The operation returns a 200 OK if the bucket exists and you have permission to access it. Otherwise, the operation might return responses such as 404 Not Found and 403 Forbidden.

func (Minio) HeadObjectHandler

func (api Minio) HeadObjectHandler(w http.ResponseWriter, req *http.Request)

HeadObjectHandler - HEAD Object ----------- The HEAD operation retrieves metadata from an object without returning the object itself.

func (Minio) ListBucketsHandler

func (api Minio) ListBucketsHandler(w http.ResponseWriter, req *http.Request)

ListBucketsHandler - GET Service ----------- This implementation of the GET operation returns a list of all buckets owned by the authenticated sender of the request.

func (Minio) ListMultipartUploadsHandler

func (api Minio) ListMultipartUploadsHandler(w http.ResponseWriter, req *http.Request)

ListMultipartUploadsHandler - GET Bucket (List Multipart uploads) ------------------------- This operation lists in-progress multipart uploads. An in-progress multipart upload is a multipart upload that has been initiated, using the Initiate Multipart Upload request, but has not yet been completed or aborted. This operation returns at most 1,000 multipart uploads in the response.

func (Minio) ListObjectPartsHandler

func (api Minio) ListObjectPartsHandler(w http.ResponseWriter, req *http.Request)

ListObjectPartsHandler - List object parts

func (Minio) ListObjectsHandler

func (api Minio) ListObjectsHandler(w http.ResponseWriter, req *http.Request)

ListObjectsHandler - GET Bucket (List Objects) ------------------------- This implementation of the GET operation returns some or all (up to 1000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket.

func (Minio) NewMultipartUploadHandler

func (api Minio) NewMultipartUploadHandler(w http.ResponseWriter, req *http.Request)

NewMultipartUploadHandler - New multipart upload

func (Minio) PutBucketACLHandler

func (api Minio) PutBucketACLHandler(w http.ResponseWriter, req *http.Request)

PutBucketACLHandler - PUT Bucket ACL ---------- This implementation of the PUT operation modifies the bucketACL for authenticated request

func (Minio) PutBucketHandler

func (api Minio) PutBucketHandler(w http.ResponseWriter, req *http.Request)

PutBucketHandler - PUT Bucket ---------- This implementation of the PUT operation creates a new bucket for authenticated request

func (Minio) PutObjectHandler

func (api Minio) PutObjectHandler(w http.ResponseWriter, req *http.Request)

PutObjectHandler - PUT Object ---------- This implementation of the PUT operation adds an object to a bucket.

func (Minio) PutObjectPartHandler

func (api Minio) PutObjectPartHandler(w http.ResponseWriter, req *http.Request)

PutObjectPartHandler - Upload part

type Object

type Object struct {
	ETag         string
	Key          string
	LastModified string
	Size         int64

	Owner Owner

	// The class of storage used to store the object.
	StorageClass string
}

Object container for object metadata

type Operation

type Operation struct {
	ProceedCh chan struct{}
}

Operation container for individual operations read by Ticket Master

type Owner

type Owner struct {
	ID          string
	DisplayName string
}

Owner - bucket owner/principal

type Part

type Part struct {
	PartNumber   int
	ETag         string
	LastModified string
	Size         int64
}

Part container for part metadata

type Upload

type Upload struct {
	Key          string
	UploadID     string `xml:"UploadId"`
	Initiator    Initiator
	Owner        Owner
	StorageClass string
	Initiated    string
}

Upload container for in progress multipart upload

Jump to

Keyboard shortcuts

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