cmd

package
v0.0.0-...-3f004ba Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2016 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketPolicyNone      BucketPolicy = "none"
	BucketPolicyReadOnly               = "readonly"
	BucketPolicyReadWrite              = "readwrite"
	BucketPolicyWriteOnly              = "writeonly"
)

Different types of Policies currently supported for buckets.

Variables

View Source
var MaxRetry = 5

MaxRetry is the maximum number of retries before stopping.

View Source
var TCPretry = []string{"i/o timeout", "net/http: TLS handshake timeout", "connection reset by peer", "read: operation timed out"}

TCPretry holds all the errors that can and should be retried.

Functions

func ErrInvalidArgument

func ErrInvalidArgument(message string) error

ErrInvalidArgument - Invalid argument response.

func GetPolicies

func GetPolicies(statements []Statement, bucketName string) map[string]BucketPolicy

GetPolicies returns a map of policies rules of given bucket name, prefix in given statements.

func Main

func Main()

Main - Set up and run the app.

Types

type APItest

type APItest struct {
	Test     func(ServerConfig, int) bool
	Extended bool // Extended tests will only be invoked at the users request.
	Critical bool // Tests marked critical must pass before more tests can be run.
}

APItest - Define all mainXXX tests to be of this form.

type BucketAccessPolicy

type BucketAccessPolicy struct {
	Version    string      // date in YYYY-MM-DD format
	Statements []Statement `json:"Statement"`
}

BucketAccessPolicy - minio policy collection

type BucketInfo

type BucketInfo struct {
	// The name of the bucket.
	Name string `json:"name"`
	// Date the bucket was created.
	CreationDate time.Time `json:"creationDate"`
}

BucketInfo container for bucket metadata.

type BucketPolicy

type BucketPolicy string

BucketPolicy - Bucket level policy.

func GetPolicy

func GetPolicy(statements []Statement, bucketName string, prefix string) BucketPolicy

GetPolicy - Returns policy of given bucket name, prefix in given statements.

func (BucketPolicy) IsValidBucketPolicy

func (p BucketPolicy) IsValidBucketPolicy() bool

IsValidBucketPolicy - Is provided policy value supported.

type ConditionKeyMap

type ConditionKeyMap map[string]StringSet

ConditionKeyMap - map of policy condition key and value.

func CopyConditionKeyMap

func CopyConditionKeyMap(condKeyMap ConditionKeyMap) ConditionKeyMap

CopyConditionKeyMap - returns new copy of given ConditionKeyMap.

func (ConditionKeyMap) Add

func (ckm ConditionKeyMap) Add(key string, value StringSet)

Add - adds key and value. The value is appended If key already exists.

func (ConditionKeyMap) Remove

func (ckm ConditionKeyMap) Remove(key string, value StringSet)

Remove - removes value of given key. If key has empty after removal, the key is also removed.

func (ConditionKeyMap) RemoveKey

func (ckm ConditionKeyMap) RemoveKey(key string)

RemoveKey - removes key and its value.

type ConditionMap

type ConditionMap map[string]ConditionKeyMap

ConditionMap - map of condition and conditional values.

func (ConditionMap) Add

func (cond ConditionMap) Add(condKey string, condKeyMap ConditionKeyMap)

Add - adds condition key and condition value. The value is appended if key already exists.

func (ConditionMap) Remove

func (cond ConditionMap) Remove(condKey string)

Remove - removes condition key and its value.

type ErrorResponse

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

	// Region where the bucket is located. This header is returned
	// only in HEAD bucket and ListObjects response.
	Region string
}

ErrorResponse - Is the typed error returned by all API operations.

func ToErrorResponse

func ToErrorResponse(err error) ErrorResponse

ToErrorResponse - Returns parsed ErrorResponse struct from body and http headers.

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error - Returns HTTP error string

type ObjectInfo

type ObjectInfo struct {
	// An ETag is optionally set to md5sum of an object.  In case of multipart objects,
	// ETag is of the form MD5SUM-N where MD5SUM is md5sum of all individual md5sums of
	// each parts concatenated into one string.
	ETag string `json:"etag"`

	Key          string    `json:"name"`         // Name of the object
	LastModified time.Time `json:"lastModified"` // Date and time the object was last modified.
	Size         int64     `json:"size"`         // Size in bytes of the object.
	ContentType  string    `json:"contentType"`  // A standard MIME type describing the format of the object data.

	// Owner name.
	Owner struct {
		DisplayName string `json:"name"`
		ID          string `json:"id"`
	} `json:"owner"`

	// The class of storage used to store the object.
	StorageClass string `json:"storageClass"`

	// Error
	Err error `json:"-"`

	Body     []byte // Data held by the object.
	UploadID string // To be set only for multipart uploaded objects.
}

ObjectInfo container for object metadata.

type ObjectInfos

type ObjectInfos []ObjectInfo

ObjectInfos - A container for ObjectInfo structs to allow sorting.

func (ObjectInfos) Len

func (o ObjectInfos) Len() int

Return the len of a list of ObjectInfo.

func (ObjectInfos) Less

func (o ObjectInfos) Less(i, j int) bool

Allow comparisons of ObjectInfo types with their Keys.

func (ObjectInfos) Swap

func (o ObjectInfos) Swap(i, j int)

Allow swapping of ObjectInfo types.

type ObjectMultipartInfo

type ObjectMultipartInfo struct {
	// Date and time at which the multipart upload was initiated.
	Initiated time.Time `type:"timestamp" timestampFormat:"iso8601"`

	Initiator initiator
	Owner     owner

	// The type of storage to use for the object. Defaults to 'STANDARD'.
	StorageClass string

	// Key of the object for which the multipart upload was initiated.
	Key string

	// Size in bytes of the object.
	Size int64

	// Upload ID that identifies the multipart upload.
	UploadID string `xml:"UploadId"`

	// Error
	Err error
}

ObjectMultipartInfo - Container for a Multipart Objects information.

type Request

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

Request - a custom version of the http.Request that uses an io.Reader rather than an io.ReadCloser for the body to reduce the number of type conversions that must happen for retry to function properly.

type ServerConfig

type ServerConfig struct {
	Access   string
	Secret   string
	Endpoint string
	Region   string
	Client   *http.Client
}

ServerConfig - container for all the user passed server info and a reusable http.Client

type Statement

type Statement struct {
	Actions    StringSet    `json:"Action"`
	Conditions ConditionMap `json:"Condition,omitempty"`
	Effect     string
	Principal  User      `json:"Principal"`
	Resources  StringSet `json:"Resource"`
	Sid        string
}

Statement - minio policy statement

func SetPolicy

func SetPolicy(statements []Statement, policy BucketPolicy, bucketName string, prefix string) []Statement

SetPolicy - Returns new statements containing policy of given bucket name and prefix are appended.

type StringSet

type StringSet map[string]struct{}

StringSet - uses map as set of strings.

func CopyStringSet

func CopyStringSet(set StringSet) StringSet

CopyStringSet - returns copy of given set.

func CreateStringSet

func CreateStringSet(sl ...string) StringSet

CreateStringSet - creates new string set with given string values.

func NewStringSet

func NewStringSet() StringSet

NewStringSet - creates new string set.

func (StringSet) Add

func (set StringSet) Add(s string)

Add - adds string to the set.

func (StringSet) ApplyFunc

func (set StringSet) ApplyFunc(applyFn func(string) string) StringSet

ApplyFunc - returns new set containing each value processed by 'applyFn'. A 'applyFn' should accept element in a set as a argument and return a processed string. The function can do any logic to return a processed string.

func (StringSet) Contains

func (set StringSet) Contains(s string) bool

Contains - checks if string is in the set.

func (StringSet) Difference

func (set StringSet) Difference(sset StringSet) StringSet

Difference - returns the difference with given set as new set.

func (StringSet) Equals

func (set StringSet) Equals(sset StringSet) bool

Equals - checks whether given set is equal to current set or not.

func (StringSet) FuncMatch

func (set StringSet) FuncMatch(matchFn func(string, string) bool, matchString string) StringSet

FuncMatch - returns new set containing each value who passes match function. A 'matchFn' should accept element in a set as first argument and 'matchString' as second argument. The function can do any logic to compare both the arguments and should return true to accept element in a set to include in output set else the element is ignored.

func (StringSet) Intersection

func (set StringSet) Intersection(sset StringSet) StringSet

Intersection - returns the intersection with given set as new set.

func (StringSet) IsEmpty

func (set StringSet) IsEmpty() bool

IsEmpty - returns whether the set is empty or not.

func (StringSet) MarshalJSON

func (set StringSet) MarshalJSON() ([]byte, error)

MarshalJSON - converts to JSON data.

func (StringSet) Remove

func (set StringSet) Remove(s string)

Remove - removes string in the set. It does nothing if string does not exist in the set.

func (StringSet) String

func (set StringSet) String() string

String - returns printable string of the set.

func (StringSet) Union

func (set StringSet) Union(sset StringSet) StringSet

Union - returns the union with given set as new set.

func (*StringSet) UnmarshalJSON

func (set *StringSet) UnmarshalJSON(data []byte) error

UnmarshalJSON - parses JSON data and creates new set with it. If 'data' contains JSON string array, the set contains each string. If 'data' contains JSON string, the set contains the string as one element. If 'data' contains Other JSON types, JSON parse error is returned.

type User

type User struct {
	AWS           StringSet `json:"AWS,omitempty"`
	CanonicalUser StringSet `json:"CanonicalUser,omitempty"`
}

User - canonical users list.

Jump to

Keyboard shortcuts

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