handler

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(log *zap.Logger, obj layer.Client) (api.Handler, error)

New creates new api.Handler using given logger and client.

Types

type Bucket

type Bucket struct {
	Name         string
	CreationDate string // time string of format "2006-01-02T15:04:05.000Z"
}

Bucket container for bucket metadata.

type CommonPrefix

type CommonPrefix struct {
	Prefix string
}

CommonPrefix container for prefix response in ListObjectsResponse.

type CopyObjectResponse

type CopyObjectResponse struct {
	XMLName      xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ CopyObjectResult" json:"-"`
	LastModified string   // time string of format "2006-01-02T15:04:05.000Z"
	ETag         string   // md5sum of the copied object.
}

CopyObjectResponse container returns ETag and LastModified of the successfully copied object.

type DeleteError

type DeleteError struct {
	Code    string
	Message string
	Key     string
}

DeleteError structure.

type DeleteMarkerEntry added in v0.16.0

type DeleteMarkerEntry struct {
	IsLatest     bool   `xml:"IsLatest"`
	Key          string `xml:"Key"`
	LastModified string `xml:"LastModified"`
	Owner        Owner  `xml:"Owner"`
	VersionID    string `xml:"VersionId"`
}

DeleteMarkerEntry container for deleted object's version in the response of ListBucketObjectVersionsHandler.

type DeleteObjectsRequest

type DeleteObjectsRequest struct {
	// Element to enable quiet mode for the request
	Quiet bool
	// List of objects to be deleted
	Objects []ObjectIdentifier `xml:"Object"`
}

DeleteObjectsRequest - xml carrying the object key names which needs to be deleted.

type DeleteObjectsResponse

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

	// Collection of all deleted objects
	DeletedObjects []ObjectIdentifier `xml:"Deleted,omitempty"`

	// Collection of errors deleting certain objects.
	Errors []DeleteError `xml:"Error,omitempty"`
}

DeleteObjectsResponse container for multiple object deletes.

type ListBucketsResponse

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

	Owner Owner

	// Container for one or more buckets.
	Buckets struct {
		Buckets []Bucket `xml:"Bucket"`
	} // Buckets are nested
}

ListBucketsResponse - format for list buckets response.

type ListMultipartUploadsResult

type ListMultipartUploadsResult struct {
	XMLName xml.Name `xml:"ListMultipartUploadsResult"`
	Text    string   `xml:",chardata"`
	Xmlns   string   `xml:"xmlns,attr"`
}

ListMultipartUploadsResult contains ListMultipartUploadsResult XML representation.

type ListObjectsResponse

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

	Name   string
	Prefix string
	Marker 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 `xml:"NextMarker,omitempty"`

	MaxKeys   int
	Delimiter string `xml:"Delimiter,omitempty"`
	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool

	Contents       []Object
	CommonPrefixes []CommonPrefix

	// Encoding type used to encode object keys in the response.
	EncodingType string `xml:"EncodingType,omitempty"`
}

ListObjectsResponse - format for list objects response.

type ListObjectsV2Response

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

	Name       string
	Prefix     string
	StartAfter string `xml:"StartAfter,omitempty"`
	// 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.
	ContinuationToken     string `xml:"ContinuationToken,omitempty"`
	NextContinuationToken string `xml:"NextContinuationToken,omitempty"`

	KeyCount  int
	MaxKeys   int
	Delimiter string `xml:"Delimiter,omitempty"`
	// A flag that indicates whether or not ListObjects returned all of the results
	// that satisfied the search criteria.
	IsTruncated bool

	Contents       []Object
	CommonPrefixes []CommonPrefix

	// Encoding type used to encode object keys in the response.
	EncodingType string `xml:"EncodingType,omitempty"`
}

ListObjectsV2Response - format for list objects response.

type ListObjectsVersionsResponse added in v0.16.0

type ListObjectsVersionsResponse struct {
	XMLName             xml.Name                `xml:"http://s3.amazonaws.com/doc/2006-03-01/ ListVersionsResult" json:"-"`
	EncodingType        string                  `xml:"EncodingType,omitempty"`
	Name                string                  `xml:"Name"`
	IsTruncated         bool                    `xml:"IsTruncated"`
	KeyMarker           string                  `xml:"KeyMarker"`
	NextKeyMarker       string                  `xml:"NextKeyMarker,omitempty"`
	NextVersionIDMarker string                  `xml:"NextVersionIdMarker,omitempty"`
	VersionIDMarker     string                  `xml:"VersionIdMarker"`
	DeleteMarker        []DeleteMarkerEntry     `xml:"DeleteMarker"`
	Version             []ObjectVersionResponse `xml:"Version"`
	CommonPrefixes      []CommonPrefix          `xml:"CommonPrefixes"`
}

ListObjectsVersionsResponse is a response of ListBucketObjectVersionsHandler.

type LocationResponse

type LocationResponse struct {
	XMLName  xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ LocationConstraint" json:"-"`
	Location string   `xml:",chardata"`
}

LocationResponse - format for location response.

type Object

type Object struct {
	Key          string
	LastModified string // time string of format "2006-01-02T15:04:05.000Z"
	ETag         string `xml:"ETag,omitempty"`
	Size         int64

	// Owner of the object.
	Owner Owner

	// The class of storage used to store the object.
	StorageClass string `xml:"StorageClass,omitempty"`
}

Object container for object metadata.

type ObjectIdentifier

type ObjectIdentifier struct {
	ObjectName string `xml:"Key"`
}

ObjectIdentifier carries key name for the object to delete.

type ObjectVersionResponse added in v0.16.0

type ObjectVersionResponse struct {
	ETag         string `xml:"ETag"`
	IsLatest     bool   `xml:"IsLatest"`
	Key          string `xml:"Key"`
	LastModified string `xml:"LastModified"`
	Owner        Owner  `xml:"Owner"`
	Size         int64  `xml:"Size"`
	StorageClass string `xml:"StorageClass,omitempty"` // is empty!!
	VersionID    string `xml:"VersionId"`
}

ObjectVersionResponse container for object version in the response of ListBucketObjectVersionsHandler.

type Owner

type Owner struct {
	ID          string
	DisplayName string
}

Owner - bucket owner/principal.

type Params

type Params struct {
	Log *zap.Logger
	Obj layer.Client
}

Params holds logger and client.

type StringMap

type StringMap map[string]string

StringMap is a map[string]string.

func (StringMap) MarshalXML

func (s StringMap) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - StringMap marshals into XML.

type VersioningConfiguration

type VersioningConfiguration struct {
	XMLName xml.Name `xml:"VersioningConfiguration"`
	Text    string   `xml:",chardata"`
	Xmlns   string   `xml:"xmlns,attr"`
}

VersioningConfiguration contains VersioningConfiguration XML representation.

Jump to

Keyboard shortcuts

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