Documentation
¶
Index ¶
Constants ¶
const ( LibraryName = "minio-go" LibraryVersion = "0.2.2" )
Global constants
Variables ¶
This section is empty.
Functions ¶
Types ¶
type API ¶
type API interface {
// Bucket Read/Write/Stat operations
BucketAPI
// Object Read/Write/Stat operations
ObjectAPI
// Presigned API
PresignedAPI
}
API - Cloud Storage API interface
type BucketAPI ¶
type BucketAPI interface {
MakeBucket(bucket string, cannedACL BucketACL) error
BucketExists(bucket string) error
RemoveBucket(bucket string) error
SetBucketACL(bucket string, cannedACL BucketACL) error
GetBucketACL(bucket string) (BucketACL, error)
ListBuckets() <-chan BucketStatCh
ListObjects(bucket, prefix string, recursive bool) <-chan ObjectStatCh
// Drop all incomplete uploads
DropAllIncompleteUploads(bucket string) <-chan error
}
BucketAPI - bucket specific Read/Write/Stat interface
type BucketStat ¶
type BucketStat struct {
// The name of the bucket.
Name string
// Date the bucket was created.
CreationDate time.Time
}
BucketStat container for bucket metadata
type BucketStatCh ¶
type BucketStatCh struct {
Stat BucketStat
Err error
}
BucketStatCh - bucket metadata over read channel
type Config ¶
type Config struct {
// Standard options
AccessKeyID string
SecretAccessKey string
Endpoint string
// Advanced options
// Specify this to get server response in non XML style if server supports it
AcceptType string
// Optional field. If empty, region is determined automatically.
Region string
// Expert options
//
// Set this to override default transport “http.DefaultTransport“
//
// This transport is usually needed for debugging OR to add your own
// custom TLS certificates on the client transport, for custom CA's and
// certs which are not part of standard certificate authority
//
// For example :-
//
// tr := &http.Transport{
// TLSClientConfig: &tls.Config{RootCAs: pool},
// DisableCompression: true,
// }
//
Transport http.RoundTripper
// contains filtered or unexported fields
}
Config - main configuration struct used by all to set endpoint, credentials, and other options for requests.
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 is the type error returned by some API operations.
func ToErrorResponse ¶
func ToErrorResponse(err error) *ErrorResponse
ToErrorResponse returns parsed ErrorResponse struct, if input is nil or not ErrorResponse return value is nil this fuction is useful when some one wants to dig deeper into the error structures over the network.
for example:
import s3 "github.com/minio/minio-go"
...
...
..., err := s3.GetObject(...)
if err != nil {
resp := s3.ToErrorResponse(err)
fmt.Println(resp.ToXML())
}
...
...
func (ErrorResponse) ToJSON ¶
func (e ErrorResponse) ToJSON() string
ToJSON send raw json marshalled as string
func (ErrorResponse) ToXML ¶
func (e ErrorResponse) ToXML() string
ToXML send raw xml marshalled as string
type ObjectAPI ¶
type ObjectAPI interface {
GetObject(bucket, object string) (io.ReadCloser, ObjectStat, error)
GetPartialObject(bucket, object string, offset, length int64) (io.ReadCloser, ObjectStat, error)
PutObject(bucket, object, contentType string, size int64, data io.Reader) error
StatObject(bucket, object string) (ObjectStat, error)
RemoveObject(bucket, object string) error
// Drop all incomplete uploads for a given object
DropIncompleteUpload(bucket, object string) <-chan error
}
ObjectAPI - object specific Read/Write/Stat interface
type ObjectStat ¶
type ObjectStat struct {
ETag string
Key string
LastModified time.Time
Size int64
ContentType string
Owner struct {
DisplayName string
ID string
}
// The class of storage used to store the object.
StorageClass string
}
ObjectStat container for object metadata
type ObjectStatCh ¶
type ObjectStatCh struct {
Stat ObjectStat
Err error
}
ObjectStatCh - object metadata over read channel