Documentation
¶
Index ¶
- Constants
- Variables
- func ErrInvalidArgument(message string) error
- func GetPolicies(statements []Statement, bucketName string) map[string]BucketPolicy
- func Main()
- type APItest
- type BucketAccessPolicy
- type BucketInfo
- type BucketPolicy
- type ConditionKeyMap
- type ConditionMap
- type ErrorResponse
- type ObjectInfo
- type ObjectInfos
- type ObjectMultipartInfo
- type Request
- type ServerConfig
- type Statement
- type StringSet
- func (set StringSet) Add(s string)
- func (set StringSet) ApplyFunc(applyFn func(string) string) StringSet
- func (set StringSet) Contains(s string) bool
- func (set StringSet) Difference(sset StringSet) StringSet
- func (set StringSet) Equals(sset StringSet) bool
- func (set StringSet) FuncMatch(matchFn func(string, string) bool, matchString string) StringSet
- func (set StringSet) Intersection(sset StringSet) StringSet
- func (set StringSet) IsEmpty() bool
- func (set StringSet) MarshalJSON() ([]byte, error)
- func (set StringSet) Remove(s string)
- func (set StringSet) String() string
- func (set StringSet) Union(sset StringSet) StringSet
- func (set *StringSet) UnmarshalJSON(data []byte) error
- type User
Constants ¶
const ( BucketPolicyNone BucketPolicy = "none" BucketPolicyReadOnly = "readonly" BucketPolicyReadWrite = "readwrite" BucketPolicyWriteOnly = "writeonly" )
Different types of Policies currently supported for buckets.
Variables ¶
var MaxRetry = 5
MaxRetry is the maximum number of retries before stopping.
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 ¶
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.
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 ¶
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) Less ¶
func (o ObjectInfos) Less(i, j int) bool
Allow comparisons of ObjectInfo types with their Keys.
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
type StringSet ¶
type StringSet map[string]struct{}
StringSet - uses map as set of strings.
func CopyStringSet ¶
CopyStringSet - returns copy of given set.
func CreateStringSet ¶
CreateStringSet - creates new string set with given string values.
func (StringSet) ApplyFunc ¶
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) Difference ¶
Difference - returns the difference with given set as new set.
func (StringSet) FuncMatch ¶
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 ¶
Intersection - returns the intersection with given set as new set.
func (StringSet) MarshalJSON ¶
MarshalJSON - converts to JSON data.
func (StringSet) Remove ¶
Remove - removes string in the set. It does nothing if string does not exist in the set.
func (*StringSet) UnmarshalJSON ¶
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.
Source Files
¶
- abort-multipart-upload.go
- animation.go
- bucket-policy-condition.go
- bucket-policy.go
- clean-s3verify.go
- client-s3-trace.go
- complete-multipart-upload.go
- copy-object-if-match.go
- copy-object-if-modified-since.go
- copy-object-if-none-match.go
- copy-object-if-unmodified-since.go
- copy-object.go
- data-types.go
- error-response.go
- flags.go
- get-bucket-policy.go
- get-object-if-match.go
- get-object-if-modified-since.go
- get-object-if-none-match.go
- get-object-if-unmodified-since.go
- get-object-range.go
- get-object.go
- globals.go
- head-bucket.go
- head-object-if-match.go
- head-object-if-modified-since.go
- head-object-if-none-match.go
- head-object-if-unmodified-since.go
- head-object.go
- initiate-multipart-upload.go
- list-buckets.go
- list-multipart-uploads.go
- list-objects-v1.go
- list-objects-v2.go
- list-parts.go
- main.go
- post-object.go
- post-policy.go
- presigned-get-object.go
- presigned-put-object.go
- put-bucket-policy.go
- put-bucket.go
- put-object.go
- remove-bucket.go
- remove-object.go
- requests.go
- retry.go
- reuse-s3verify.go
- s3-datatypes.go
- s3-endpoints.go
- scan-bar.go
- server-config.go
- stringset.go
- tests.go
- upload-part.go
- utils.go