Documentation ¶
Index ¶
- Constants
- Variables
- type BucketInfo
- type BucketLookupType
- type BucketVersioningConfiguration
- type CSVFileHeaderInfo
- type CSVInputOptions
- func (c CSVInputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (c *CSVInputOptions) SetComments(val string)
- func (c *CSVInputOptions) SetFieldDelimiter(val string)
- func (c *CSVInputOptions) SetFileHeaderInfo(val CSVFileHeaderInfo)
- func (c *CSVInputOptions) SetQuoteCharacter(val string)
- func (c *CSVInputOptions) SetQuoteEscapeCharacter(val string)
- func (c *CSVInputOptions) SetRecordDelimiter(val string)
- type CSVOutputOptions
- func (c CSVOutputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
- func (c *CSVOutputOptions) SetFieldDelimiter(val string)
- func (c *CSVOutputOptions) SetQuoteCharacter(val string)
- func (c *CSVOutputOptions) SetQuoteEscapeCharacter(val string)
- func (c *CSVOutputOptions) SetQuoteFields(val CSVQuoteFields)
- func (c *CSVOutputOptions) SetRecordDelimiter(val string)
- type CSVQuoteFields
- type Client
- func (c Client) BucketExists(ctx context.Context, bucketName string) (bool, error)
- func (c Client) ComposeObject(ctx context.Context, dst CopyDestOptions, srcs ...CopySrcOptions) (UploadInfo, error)
- func (c Client) CopyObject(ctx context.Context, dst CopyDestOptions, src CopySrcOptions) (UploadInfo, error)
- func (c Client) EnableVersioning(ctx context.Context, bucketName string) error
- func (c *Client) EndpointURL() *url.URL
- func (c Client) FGetObject(ctx context.Context, bucketName, objectName, filePath string, ...) error
- func (c Client) FPutObject(ctx context.Context, bucketName, objectName, filePath string, ...) (info UploadInfo, err error)
- func (c Client) GetBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error)
- func (c Client) GetBucketLifecycle(ctx context.Context, bucketName string) (*lifecycle.Configuration, error)
- func (c Client) GetBucketLocation(ctx context.Context, bucketName string) (string, error)
- func (c Client) GetBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error)
- func (c Client) GetBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *RetentionMode, validity *uint, unit *ValidityUnit, err error)
- func (c Client) GetBucketPolicy(ctx context.Context, bucketName string) (string, error)
- func (c Client) GetBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error)
- func (c Client) GetBucketTagging(ctx context.Context, bucketName string) (*tags.Tags, error)
- func (c Client) GetBucketVersioning(ctx context.Context, bucketName string) (BucketVersioningConfiguration, error)
- func (c Client) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error)
- func (c Client) GetObjectACL(ctx context.Context, bucketName, objectName string) (*ObjectInfo, error)
- func (c Client) GetObjectLegalHold(ctx context.Context, bucketName, objectName string, ...) (status *LegalHoldStatus, err error)
- func (c Client) GetObjectLockConfig(ctx context.Context, bucketName string) (objectLock string, mode *RetentionMode, validity *uint, unit *ValidityUnit, ...)
- func (c Client) GetObjectRetention(ctx context.Context, bucketName, objectName, versionID string) (mode *RetentionMode, retainUntilDate *time.Time, err error)
- func (c Client) GetObjectTagging(ctx context.Context, bucketName, objectName string, ...) (*tags.Tags, error)
- func (c Client) ListBuckets(ctx context.Context) ([]BucketInfo, error)
- func (c Client) ListIncompleteUploads(ctx context.Context, bucketName, objectPrefix string, recursive bool) <-chan ObjectMultipartInfo
- func (c Client) ListObjects(ctx context.Context, bucketName string, opts ListObjectsOptions) <-chan ObjectInfo
- func (c Client) ListenBucketNotification(ctx context.Context, bucketName, prefix, suffix string, events []string) <-chan notification.Info
- func (c Client) ListenNotification(ctx context.Context, prefix, suffix string, events []string) <-chan notification.Info
- func (c Client) MakeBucket(ctx context.Context, bucketName string, opts MakeBucketOptions) (err error)
- func (c Client) Presign(ctx context.Context, method string, bucketName string, objectName string, ...) (u *url.URL, err error)
- func (c Client) PresignedGetObject(ctx context.Context, bucketName string, objectName string, ...) (u *url.URL, err error)
- func (c Client) PresignedHeadObject(ctx context.Context, bucketName string, objectName string, ...) (u *url.URL, err error)
- func (c Client) PresignedPostPolicy(ctx context.Context, p *PostPolicy) (u *url.URL, formData map[string]string, err error)
- func (c Client) PresignedPutObject(ctx context.Context, bucketName string, objectName string, ...) (u *url.URL, err error)
- func (c Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, ...) (info UploadInfo, err error)
- func (c Client) PutObjectLegalHold(ctx context.Context, bucketName, objectName string, ...) error
- func (c Client) PutObjectRetention(ctx context.Context, bucketName, objectName string, ...) error
- func (c Client) PutObjectTagging(ctx context.Context, bucketName, objectName string, otags *tags.Tags, ...) error
- func (c Client) RemoveAllBucketNotification(ctx context.Context, bucketName string) error
- func (c Client) RemoveBucket(ctx context.Context, bucketName string) error
- func (c Client) RemoveBucketEncryption(ctx context.Context, bucketName string) error
- func (c Client) RemoveBucketReplication(ctx context.Context, bucketName string) error
- func (c Client) RemoveBucketTagging(ctx context.Context, bucketName string) error
- func (c Client) RemoveIncompleteUpload(ctx context.Context, bucketName, objectName string) error
- func (c Client) RemoveObject(ctx context.Context, bucketName, objectName string, opts RemoveObjectOptions) error
- func (c Client) RemoveObjectTagging(ctx context.Context, bucketName, objectName string, ...) error
- func (c Client) RemoveObjects(ctx context.Context, bucketName string, objectsCh <-chan ObjectInfo, ...) <-chan RemoveObjectError
- func (c Client) SelectObjectContent(ctx context.Context, bucketName, objectName string, opts SelectObjectOptions) (*SelectResults, error)
- func (c *Client) SetAppInfo(appName string, appVersion string)
- func (c Client) SetBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error
- func (c Client) SetBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error
- func (c Client) SetBucketNotification(ctx context.Context, bucketName string, config notification.Configuration) error
- func (c Client) SetBucketObjectLockConfig(ctx context.Context, bucketName string, mode *RetentionMode, validity *uint, ...) error
- func (c Client) SetBucketPolicy(ctx context.Context, bucketName, policy string) error
- func (c Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error
- func (c Client) SetBucketTagging(ctx context.Context, bucketName string, tags *tags.Tags) error
- func (c Client) SetBucketVersioning(ctx context.Context, bucketName string, config BucketVersioningConfiguration) error
- func (c Client) SetObjectLockConfig(ctx context.Context, bucketName string, mode *RetentionMode, validity *uint, ...) error
- func (c *Client) SetS3TransferAccelerate(accelerateEndpoint string)
- func (c Client) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)
- func (c Client) SuspendVersioning(ctx context.Context, bucketName string) error
- func (c *Client) TraceErrorsOnlyOff()
- func (c *Client) TraceErrorsOnlyOn(outputStream io.Writer)
- func (c *Client) TraceOff()
- func (c *Client) TraceOn(outputStream io.Writer)
- type CommonPrefix
- type CompletePart
- type CopyDestOptions
- type CopySrcOptions
- type Core
- func (c Core) AbortMultipartUpload(ctx context.Context, bucket, object, uploadID string) error
- func (c Core) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, parts []CompletePart) (string, error)
- func (c Core) CopyObject(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, ...) (ObjectInfo, error)
- func (c Core) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, ...) (p CompletePart, err error)
- func (c Core) GetBucketPolicy(ctx context.Context, bucket string) (string, error)
- func (c Core) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error)
- func (c Core) ListMultipartUploads(ctx context.Context, ...) (result ListMultipartUploadsResult, err error)
- func (c Core) ListObjectParts(ctx context.Context, bucket, object, uploadID string, partNumberMarker int, ...) (result ListObjectPartsResult, err error)
- func (c Core) ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) (result ListBucketResult, err error)
- func (c Core) ListObjectsV2(bucketName, objectPrefix, continuationToken string, fetchOwner bool, ...) (ListBucketV2Result, error)
- func (c Core) NewMultipartUpload(ctx context.Context, bucket, object string, opts PutObjectOptions) (uploadID string, err error)
- func (c Core) PutBucketPolicy(ctx context.Context, bucket, bucketPolicy string) error
- func (c Core) PutObject(ctx context.Context, bucket, object string, data io.Reader, size int64, ...) (UploadInfo, error)
- func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int, ...) (ObjectPart, error)
- func (c Core) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)
- type ErrorResponse
- type GetObjectLegalHoldOptions
- type GetObjectOptions
- func (o GetObjectOptions) Header() http.Header
- func (o *GetObjectOptions) Set(key, value string)
- func (o *GetObjectOptions) SetMatchETag(etag string) error
- func (o *GetObjectOptions) SetMatchETagExcept(etag string) error
- func (o *GetObjectOptions) SetModified(modTime time.Time) error
- func (o *GetObjectOptions) SetRange(start, end int64) error
- func (o *GetObjectOptions) SetUnmodified(modTime time.Time) error
- type GetObjectTaggingOptions
- type JSONInputOptions
- type JSONOutputOptions
- type JSONType
- type LegalHoldStatus
- type ListBucketResult
- type ListBucketV2Result
- type ListMultipartUploadsResult
- type ListObjectPartsResult
- type ListObjectsOptions
- type ListVersionsResult
- type MakeBucketOptions
- type Object
- type ObjectInfo
- type ObjectMultipartInfo
- type ObjectPart
- type Options
- type Owner
- type ParquetInputOptions
- type PostPolicy
- func (p *PostPolicy) SetBucket(bucketName string) error
- func (p *PostPolicy) SetCondition(matchType, condition, value string) error
- func (p *PostPolicy) SetContentLengthRange(min, max int64) error
- func (p *PostPolicy) SetContentType(contentType string) error
- func (p *PostPolicy) SetExpires(t time.Time) error
- func (p *PostPolicy) SetKey(key string) error
- func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error
- func (p *PostPolicy) SetSuccessActionRedirect(redirect string) error
- func (p *PostPolicy) SetSuccessStatusAction(status string) error
- func (p *PostPolicy) SetUserData(key string, value string) error
- func (p *PostPolicy) SetUserMetadata(key string, value string) error
- func (p PostPolicy) String() string
- type ProgressMessage
- type PutObjectLegalHoldOptions
- type PutObjectOptions
- type PutObjectRetentionOptions
- type PutObjectTaggingOptions
- type QueryExpressionType
- type RemoveObjectError
- type RemoveObjectOptions
- type RemoveObjectTaggingOptions
- type RemoveObjectsOptions
- type ReplicationStatus
- type Retention
- type RetentionMode
- type SelectCompressionType
- type SelectObjectInputSerialization
- type SelectObjectOptions
- type SelectObjectOutputSerialization
- type SelectObjectType
- type SelectResults
- type StatObjectOptions
- type StatsMessage
- type StringMap
- type UploadInfo
- type ValidityUnit
- type Version
Constants ¶
const ( CSVFileHeaderInfoNone CSVFileHeaderInfo = "NONE" CSVFileHeaderInfoIgnore = "IGNORE" CSVFileHeaderInfoUse = "USE" )
Constants for file header info.
const ( SelectCompressionNONE SelectCompressionType = "NONE" SelectCompressionGZIP = "GZIP" SelectCompressionBZIP = "BZIP2" )
Constants for compression types under select API.
const ( SelectObjectTypeCSV SelectObjectType = "CSV" SelectObjectTypeJSON = "JSON" SelectObjectTypeParquet = "Parquet" )
Constants for input data types.
const DefaultRetryCap = time.Second * 30
DefaultRetryCap - Each retry attempt never waits no longer than this maximum time duration.
const DefaultRetryUnit = time.Second
DefaultRetryUnit - default unit multiplicative per retry. defaults to 1 second.
const MaxJitter = 1.0
MaxJitter will randomize over the full exponential backoff time
const NoJitter = 0.0
NoJitter disables the use of jitter for randomizing the exponential backoff time
Variables ¶
var DefaultTransport = func(secure bool) (*http.Transport, error) { tr := &http.Transport{ Proxy: http.ProxyFromEnvironment, DialContext: (&net.Dialer{ Timeout: 30 * time.Second, KeepAlive: 30 * time.Second, }).DialContext, MaxIdleConns: 256, MaxIdleConnsPerHost: 16, ResponseHeaderTimeout: time.Minute, IdleConnTimeout: time.Minute, TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 10 * time.Second, DisableCompression: true, } if secure { tr.TLSClientConfig = &tls.Config{ MinVersion: tls.VersionTLS12, } if f := os.Getenv("SSL_CERT_FILE"); f != "" { rootCAs := mustGetSystemCertPool() data, err := ioutil.ReadFile(f) if err == nil { rootCAs.AppendCertsFromPEM(data) } tr.TLSClientConfig.RootCAs = rootCAs } } return tr, nil }
DefaultTransport - this default transport is similar to http.DefaultTransport but with additional param DisableCompression is set to true to avoid decompressing content with 'gzip' encoding.
var MaxRetry = 10
MaxRetry is the maximum number of retries before stopping.
Functions ¶
This section is empty.
Types ¶
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 BucketLookupType ¶
type BucketLookupType int
BucketLookupType is type of url lookup supported by server.
const ( BucketLookupAuto BucketLookupType = iota BucketLookupDNS BucketLookupPath )
Different types of url lookup supported by the server.Initialized to BucketLookupAuto
type BucketVersioningConfiguration ¶
type BucketVersioningConfiguration struct { XMLName xml.Name `xml:"VersioningConfiguration"` Status string `xml:"Status"` MFADelete string `xml:"MfaDelete,omitempty"` }
BucketVersioningConfiguration is the versioning configuration structure
type CSVFileHeaderInfo ¶
type CSVFileHeaderInfo string
CSVFileHeaderInfo - is the parameter for whether to utilize headers.
type CSVInputOptions ¶
type CSVInputOptions struct { FileHeaderInfo CSVFileHeaderInfo RecordDelimiter string FieldDelimiter string QuoteCharacter string QuoteEscapeCharacter string Comments string // contains filtered or unexported fields }
CSVInputOptions csv input specific options
func (CSVInputOptions) MarshalXML ¶
func (c CSVInputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML - produces the xml representation of the CSV input options struct
func (*CSVInputOptions) SetComments ¶
func (c *CSVInputOptions) SetComments(val string)
SetComments sets the comments character in the CSV input options
func (*CSVInputOptions) SetFieldDelimiter ¶
func (c *CSVInputOptions) SetFieldDelimiter(val string)
SetFieldDelimiter sets the field delimiter in the CSV input options
func (*CSVInputOptions) SetFileHeaderInfo ¶
func (c *CSVInputOptions) SetFileHeaderInfo(val CSVFileHeaderInfo)
SetFileHeaderInfo sets the file header info in the CSV input options
func (*CSVInputOptions) SetQuoteCharacter ¶
func (c *CSVInputOptions) SetQuoteCharacter(val string)
SetQuoteCharacter sets the quote character in the CSV input options
func (*CSVInputOptions) SetQuoteEscapeCharacter ¶
func (c *CSVInputOptions) SetQuoteEscapeCharacter(val string)
SetQuoteEscapeCharacter sets the quote escape character in the CSV input options
func (*CSVInputOptions) SetRecordDelimiter ¶
func (c *CSVInputOptions) SetRecordDelimiter(val string)
SetRecordDelimiter sets the record delimiter in the CSV input options
type CSVOutputOptions ¶
type CSVOutputOptions struct { QuoteFields CSVQuoteFields RecordDelimiter string FieldDelimiter string QuoteCharacter string QuoteEscapeCharacter string // contains filtered or unexported fields }
CSVOutputOptions csv output specific options
func (CSVOutputOptions) MarshalXML ¶
func (c CSVOutputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML - produces the xml representation of the CSVOutputOptions struct
func (*CSVOutputOptions) SetFieldDelimiter ¶
func (c *CSVOutputOptions) SetFieldDelimiter(val string)
SetFieldDelimiter sets the field delimiter character in the CSV output options
func (*CSVOutputOptions) SetQuoteCharacter ¶
func (c *CSVOutputOptions) SetQuoteCharacter(val string)
SetQuoteCharacter sets the quote character in the CSV output options
func (*CSVOutputOptions) SetQuoteEscapeCharacter ¶
func (c *CSVOutputOptions) SetQuoteEscapeCharacter(val string)
SetQuoteEscapeCharacter sets the quote escape character in the CSV output options
func (*CSVOutputOptions) SetQuoteFields ¶
func (c *CSVOutputOptions) SetQuoteFields(val CSVQuoteFields)
SetQuoteFields sets the quote field parameter in the CSV output options
func (*CSVOutputOptions) SetRecordDelimiter ¶
func (c *CSVOutputOptions) SetRecordDelimiter(val string)
SetRecordDelimiter sets the record delimiter character in the CSV output options
type CSVQuoteFields ¶
type CSVQuoteFields string
CSVQuoteFields - is the parameter for how CSV fields are quoted.
const ( CSVQuoteFieldsAlways CSVQuoteFields = "Always" CSVQuoteFieldsAsNeeded = "AsNeeded" )
Constants for csv quote styles.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements Amazon S3 compatible methods.
func (Client) BucketExists ¶
BucketExists verifies if bucket exists and you have permission to access it. Allows for a Context to control cancellations and timeouts.
func (Client) ComposeObject ¶
func (c Client) ComposeObject(ctx context.Context, dst CopyDestOptions, srcs ...CopySrcOptions) (UploadInfo, error)
ComposeObject - creates an object using server-side copying of existing objects. It takes a list of source objects (with optional offsets) and concatenates them into a new object using only server-side copying operations. Optionally takes progress reader hook for applications to look at current progress.
func (Client) CopyObject ¶
func (c Client) CopyObject(ctx context.Context, dst CopyDestOptions, src CopySrcOptions) (UploadInfo, error)
CopyObject - copy a source object into a new object
func (Client) EnableVersioning ¶
EnableVersioning - enable object versioning in given bucket.
func (*Client) EndpointURL ¶
EndpointURL returns the URL of the S3 endpoint.
func (Client) FGetObject ¶
func (c Client) FGetObject(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error
FGetObject - download contents of an object to a local file. The options can be used to specify the GET request further.
func (Client) FPutObject ¶
func (c Client) FPutObject(ctx context.Context, bucketName, objectName, filePath string, opts PutObjectOptions) (info UploadInfo, err error)
FPutObject - Create an object in a bucket, with contents from file at filePath. Allows request cancellation.
func (Client) GetBucketEncryption ¶
func (c Client) GetBucketEncryption(ctx context.Context, bucketName string) (*sse.Configuration, error)
GetBucketEncryption gets the default encryption configuration on an existing bucket with a context to control cancellations and timeouts.
func (Client) GetBucketLifecycle ¶
func (c Client) GetBucketLifecycle(ctx context.Context, bucketName string) (*lifecycle.Configuration, error)
GetBucketLifecycle fetch bucket lifecycle configuration
func (Client) GetBucketLocation ¶
GetBucketLocation - get location for the bucket name from location cache, if not fetch freshly by making a new request.
func (Client) GetBucketNotification ¶
func (c Client) GetBucketNotification(ctx context.Context, bucketName string) (bucketNotification notification.Configuration, err error)
GetBucketNotification returns current bucket notification configuration
func (Client) GetBucketObjectLockConfig ¶
func (c Client) GetBucketObjectLockConfig(ctx context.Context, bucketName string) (mode *RetentionMode, validity *uint, unit *ValidityUnit, err error)
GetBucketObjectLockConfig gets object lock configuration of given bucket.
func (Client) GetBucketPolicy ¶
GetBucketPolicy returns the current policy
func (Client) GetBucketReplication ¶
func (c Client) GetBucketReplication(ctx context.Context, bucketName string) (cfg replication.Config, err error)
GetBucketReplication fetches bucket replication configuration.If config is not found, returns empty config with nil error.
func (Client) GetBucketTagging ¶
GetBucketTagging fetch tagging configuration for a bucket with a context to control cancellations and timeouts.
func (Client) GetBucketVersioning ¶
func (c Client) GetBucketVersioning(ctx context.Context, bucketName string) (BucketVersioningConfiguration, error)
GetBucketVersioning gets the versioning configuration on an existing bucket with a context to control cancellations and timeouts.
func (Client) GetObject ¶
func (c Client) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error)
GetObject wrapper function that accepts a request context
func (Client) GetObjectACL ¶
func (c Client) GetObjectACL(ctx context.Context, bucketName, objectName string) (*ObjectInfo, error)
GetObjectACL get object ACLs
func (Client) GetObjectLegalHold ¶
func (c Client) GetObjectLegalHold(ctx context.Context, bucketName, objectName string, opts GetObjectLegalHoldOptions) (status *LegalHoldStatus, err error)
GetObjectLegalHold gets legal-hold status of given object.
func (Client) GetObjectLockConfig ¶
func (c Client) GetObjectLockConfig(ctx context.Context, bucketName string) (objectLock string, mode *RetentionMode, validity *uint, unit *ValidityUnit, err error)
GetObjectLockConfig gets object lock configuration of given bucket.
func (Client) GetObjectRetention ¶
func (c Client) GetObjectRetention(ctx context.Context, bucketName, objectName, versionID string) (mode *RetentionMode, retainUntilDate *time.Time, err error)
GetObjectRetention gets retention of given object.
func (Client) GetObjectTagging ¶
func (c Client) GetObjectTagging(ctx context.Context, bucketName, objectName string, opts GetObjectTaggingOptions) (*tags.Tags, error)
GetObjectTagging fetches object tag(s) with options to target a specific object version in a versioned bucket.
func (Client) ListBuckets ¶
func (c Client) ListBuckets(ctx context.Context) ([]BucketInfo, error)
ListBuckets list all buckets owned by this authenticated user.
This call requires explicit authentication, no anonymous requests are allowed for listing buckets.
api := client.New(....) for message := range api.ListBuckets(context.Background()) { fmt.Println(message) }
func (Client) ListIncompleteUploads ¶
func (c Client) ListIncompleteUploads(ctx context.Context, bucketName, objectPrefix string, recursive bool) <-chan ObjectMultipartInfo
ListIncompleteUploads - List incompletely uploaded multipart objects.
ListIncompleteUploads lists all incompleted objects matching the objectPrefix from the specified bucket. If recursion is enabled it would list all subdirectories and all its contents.
Your input parameters are just bucketName, objectPrefix, recursive. If you enable recursive as 'true' this function will return back all the multipart objects in a given bucket name.
api := client.New(....) // Recurively list all objects in 'mytestbucket' recursive := true for message := range api.ListIncompleteUploads(context.Background(), "mytestbucket", "starthere", recursive) { fmt.Println(message) }
func (Client) ListObjects ¶
func (c Client) ListObjects(ctx context.Context, bucketName string, opts ListObjectsOptions) <-chan ObjectInfo
ListObjects returns objects list after evaluating the passed options.
api := client.New(....) for object := range api.ListObjects(ctx, "mytestbucket", minio.ListObjectsOptions{Prefix: "starthere", Recursive:true}) { fmt.Println(object) }
func (Client) ListenBucketNotification ¶
func (c Client) ListenBucketNotification(ctx context.Context, bucketName, prefix, suffix string, events []string) <-chan notification.Info
ListenBucketNotification listen for bucket events, this is a MinIO specific API
func (Client) ListenNotification ¶
func (c Client) ListenNotification(ctx context.Context, prefix, suffix string, events []string) <-chan notification.Info
ListenNotification listen for all events, this is a MinIO specific API
func (Client) MakeBucket ¶
func (c Client) MakeBucket(ctx context.Context, bucketName string, opts MakeBucketOptions) (err error)
MakeBucket creates a new bucket with bucketName with a context to control cancellations and timeouts.
Location is an optional argument, by default all buckets are created in US Standard Region.
For Amazon S3 for more supported regions - http://docs.aws.amazon.com/general/latest/gr/rande.html For Google Cloud Storage for more supported regions - https://cloud.google.com/storage/docs/bucket-locations
func (Client) Presign ¶
func (c Client) Presign(ctx context.Context, method string, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error)
Presign - returns a presigned URL for any http method of your choice along with custom request params. URL can have a maximum expiry of upto 7days or a minimum of 1sec.
func (Client) PresignedGetObject ¶
func (c Client) PresignedGetObject(ctx context.Context, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error)
PresignedGetObject - Returns a presigned URL to access an object data without credentials. URL can have a maximum expiry of upto 7days or a minimum of 1sec. Additionally you can override a set of response headers using the query parameters.
func (Client) PresignedHeadObject ¶
func (c Client) PresignedHeadObject(ctx context.Context, bucketName string, objectName string, expires time.Duration, reqParams url.Values) (u *url.URL, err error)
PresignedHeadObject - Returns a presigned URL to access object metadata without credentials. URL can have a maximum expiry of upto 7days or a minimum of 1sec. Additionally you can override a set of response headers using the query parameters.
func (Client) PresignedPostPolicy ¶
func (c Client) PresignedPostPolicy(ctx context.Context, p *PostPolicy) (u *url.URL, formData map[string]string, err error)
PresignedPostPolicy - Returns POST urlString, form data to upload an object.
func (Client) PresignedPutObject ¶
func (c Client) PresignedPutObject(ctx context.Context, bucketName string, objectName string, expires time.Duration) (u *url.URL, err error)
PresignedPutObject - Returns a presigned URL to upload an object without credentials. URL can have a maximum expiry of upto 7days or a minimum of 1sec.
func (Client) PutObject ¶
func (c Client) PutObject(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64, opts PutObjectOptions) (info UploadInfo, err error)
PutObject creates an object in a bucket.
You must have WRITE permissions on a bucket to create an object.
- For size smaller than 128MiB PutObject automatically does a single atomic Put operation.
- For size larger than 128MiB PutObject automatically does a multipart Put operation.
- For size input as -1 PutObject does a multipart Put operation until input stream reaches EOF. Maximum object size that can be uploaded through this operation will be 5TiB.
func (Client) PutObjectLegalHold ¶
func (c Client) PutObjectLegalHold(ctx context.Context, bucketName, objectName string, opts PutObjectLegalHoldOptions) error
PutObjectLegalHold : sets object legal hold for a given object and versionID.
func (Client) PutObjectRetention ¶
func (c Client) PutObjectRetention(ctx context.Context, bucketName, objectName string, opts PutObjectRetentionOptions) error
PutObjectRetention sets object retention for a given object and versionID.
func (Client) PutObjectTagging ¶
func (c Client) PutObjectTagging(ctx context.Context, bucketName, objectName string, otags *tags.Tags, opts PutObjectTaggingOptions) error
PutObjectTagging replaces or creates object tag(s) and can target a specific object version in a versioned bucket.
func (Client) RemoveAllBucketNotification ¶
RemoveAllBucketNotification - Remove bucket notification clears all previously specified config
func (Client) RemoveBucket ¶
RemoveBucket deletes the bucket name.
All objects (including all object versions and delete markers). in the bucket must be deleted before successfully attempting this request.
func (Client) RemoveBucketEncryption ¶
RemoveBucketEncryption removes the default encryption configuration on a bucket with a context to control cancellations and timeouts.
func (Client) RemoveBucketReplication ¶
RemoveBucketReplication removes a replication config on an existing bucket.
func (Client) RemoveBucketTagging ¶
RemoveBucketTagging removes tagging configuration for a bucket with a context to control cancellations and timeouts.
func (Client) RemoveIncompleteUpload ¶
RemoveIncompleteUpload aborts an partially uploaded object.
func (Client) RemoveObject ¶
func (c Client) RemoveObject(ctx context.Context, bucketName, objectName string, opts RemoveObjectOptions) error
RemoveObject removes an object from a bucket.
func (Client) RemoveObjectTagging ¶
func (c Client) RemoveObjectTagging(ctx context.Context, bucketName, objectName string, opts RemoveObjectTaggingOptions) error
RemoveObjectTagging removes object tag(s) with options to control a specific object version in a versioned bucket
func (Client) RemoveObjects ¶
func (c Client) RemoveObjects(ctx context.Context, bucketName string, objectsCh <-chan ObjectInfo, opts RemoveObjectsOptions) <-chan RemoveObjectError
RemoveObjects removes multiple objects from a bucket while it is possible to specify objects versions which are received from objectsCh. Remove failures are sent back via error channel.
func (Client) SelectObjectContent ¶
func (c Client) SelectObjectContent(ctx context.Context, bucketName, objectName string, opts SelectObjectOptions) (*SelectResults, error)
SelectObjectContent is a implementation of http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectSELECTContent.html AWS S3 API.
func (*Client) SetAppInfo ¶
SetAppInfo - add application details to user agent.
func (Client) SetBucketEncryption ¶
func (c Client) SetBucketEncryption(ctx context.Context, bucketName string, config *sse.Configuration) error
SetBucketEncryption sets the default encryption configuration on an existing bucket.
func (Client) SetBucketLifecycle ¶
func (c Client) SetBucketLifecycle(ctx context.Context, bucketName string, config *lifecycle.Configuration) error
SetBucketLifecycle set the lifecycle on an existing bucket.
func (Client) SetBucketNotification ¶
func (c Client) SetBucketNotification(ctx context.Context, bucketName string, config notification.Configuration) error
SetBucketNotification saves a new bucket notification with a context to control cancellations and timeouts.
func (Client) SetBucketObjectLockConfig ¶
func (c Client) SetBucketObjectLockConfig(ctx context.Context, bucketName string, mode *RetentionMode, validity *uint, unit *ValidityUnit) error
SetBucketObjectLockConfig sets object lock configuration in given bucket. mode, validity and unit are either all set or all nil.
func (Client) SetBucketPolicy ¶
SetBucketPolicy sets the access permissions on an existing bucket.
func (Client) SetBucketReplication ¶
func (c Client) SetBucketReplication(ctx context.Context, bucketName string, cfg replication.Config) error
SetBucketReplication sets a replication config on an existing bucket.
func (Client) SetBucketTagging ¶
SetBucketTagging sets tagging configuration for a bucket with a context to control cancellations and timeouts.
func (Client) SetBucketVersioning ¶
func (c Client) SetBucketVersioning(ctx context.Context, bucketName string, config BucketVersioningConfiguration) error
SetBucketVersioning sets a bucket versioning configuration
func (Client) SetObjectLockConfig ¶
func (c Client) SetObjectLockConfig(ctx context.Context, bucketName string, mode *RetentionMode, validity *uint, unit *ValidityUnit) error
SetObjectLockConfig sets object lock configuration in given bucket. mode, validity and unit are either all set or all nil.
func (*Client) SetS3TransferAccelerate ¶
SetS3TransferAccelerate - turns s3 accelerated endpoint on or off for all your requests. This feature is only specific to S3 for all other endpoints this function does nothing. To read further details on s3 transfer acceleration please vist - http://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html
func (Client) StatObject ¶
func (c Client) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)
StatObject verifies if object exists and you have permission to access.
func (Client) SuspendVersioning ¶
SuspendVersioning - suspend object versioning in given bucket.
func (*Client) TraceErrorsOnlyOff ¶
func (c *Client) TraceErrorsOnlyOff()
TraceErrorsOnlyOff - Turns off the errors only tracing and everything will be traced after this call. If all tracing needs to be turned off, call TraceOff().
func (*Client) TraceErrorsOnlyOn ¶
TraceErrorsOnlyOn - same as TraceOn, but only errors will be traced.
type CommonPrefix ¶
type CommonPrefix struct {
Prefix string
}
CommonPrefix container for prefix response.
type CompletePart ¶
type CompletePart struct { XMLName xml.Name `xml:"http://s3.amazonaws.com/doc/2006-03-01/ Part" json:"-"` // Part number identifies the part. PartNumber int ETag string }
CompletePart sub container lists individual part numbers and their md5sum, part of completeMultipartUpload.
type CopyDestOptions ¶
type CopyDestOptions struct { Bucket string // points to destination bucket Object string // points to destination object // `Encryption` is the key info for server-side-encryption with customer // provided key. If it is nil, no encryption is performed. Encryption encrypt.ServerSide // `userMeta` is the user-metadata key-value pairs to be set on the // destination. The keys are automatically prefixed with `x-amz-meta-` // if needed. If nil is passed, and if only a single source (of any // size) is provided in the ComposeObject call, then metadata from the // source is copied to the destination. // if no user-metadata is provided, it is copied from source // (when there is only once source object in the compose // request) UserMetadata map[string]string // UserMetadata is only set to destination if ReplaceMetadata is true // other value is UserMetadata is ignored and we preserve src.UserMetadata // NOTE: if you set this value to true and now metadata is present // in UserMetadata your destination object will not have any metadata // set. ReplaceMetadata bool // `userTags` is the user defined object tags to be set on destination. // This will be set only if the `replaceTags` field is set to true. // Otherwise this field is ignored UserTags map[string]string ReplaceTags bool // Specifies whether you want to apply a Legal Hold to the copied object. LegalHold LegalHoldStatus // Object Retention related fields Mode RetentionMode RetainUntilDate time.Time Size int64 // Needs to be specified if progress bar is specified. // Progress of the entire copy operation will be sent here. Progress io.Reader }
CopyDestOptions represents options specified by user for CopyObject/ComposeObject APIs
func (CopyDestOptions) Marshal ¶
func (opts CopyDestOptions) Marshal(header http.Header)
Marshal converts all the CopyDestOptions into their equivalent HTTP header representation
type CopySrcOptions ¶
type CopySrcOptions struct {
Bucket, Object string
VersionID string
MatchETag string
NoMatchETag string
MatchModifiedSince time.Time
MatchUnmodifiedSince time.Time
MatchRange bool
Start, End int64
Encryption encrypt.ServerSide
}
CopySrcOptions represents a source object to be copied, using server-side copying APIs.
func (CopySrcOptions) Marshal ¶
func (opts CopySrcOptions) Marshal(header http.Header)
Marshal converts all the CopySrcOptions into their equivalent HTTP header representation
type Core ¶
type Core struct {
*Client
}
Core - Inherits Client and adds new methods to expose the low level S3 APIs.
func NewCore ¶
NewCore - Returns new initialized a Core client, this CoreClient should be only used under special conditions such as need to access lower primitives and being able to use them to write your own wrappers.
func (Core) AbortMultipartUpload ¶
AbortMultipartUpload - Abort an incomplete upload.
func (Core) CompleteMultipartUpload ¶
func (c Core) CompleteMultipartUpload(ctx context.Context, bucket, object, uploadID string, parts []CompletePart) (string, error)
CompleteMultipartUpload - Concatenate uploaded parts and commit to an object.
func (Core) CopyObject ¶
func (c Core) CopyObject(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, metadata map[string]string) (ObjectInfo, error)
CopyObject - copies an object from source object to destination object on server side.
func (Core) CopyObjectPart ¶
func (c Core) CopyObjectPart(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string, partID int, startOffset, length int64, metadata map[string]string) (p CompletePart, err error)
CopyObjectPart - creates a part in a multipart upload by copying (a part of) an existing object.
func (Core) GetBucketPolicy ¶
GetBucketPolicy - fetches bucket access policy for a given bucket.
func (Core) GetObject ¶
func (c Core) GetObject(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error)
GetObject is a lower level API implemented to support reading partial objects and also downloading objects with special conditions matching etag, modtime etc.
func (Core) ListMultipartUploads ¶
func (c Core) ListMultipartUploads(ctx context.Context, bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartUploadsResult, err error)
ListMultipartUploads - List incomplete uploads.
func (Core) ListObjectParts ¶
func (c Core) ListObjectParts(ctx context.Context, bucket, object, uploadID string, partNumberMarker int, maxParts int) (result ListObjectPartsResult, err error)
ListObjectParts - List uploaded parts of an incomplete upload.x
func (Core) ListObjects ¶
func (c Core) ListObjects(bucket, prefix, marker, delimiter string, maxKeys int) (result ListBucketResult, err error)
ListObjects - List all the objects at a prefix, optionally with marker and delimiter you can further filter the results.
func (Core) ListObjectsV2 ¶
func (c Core) ListObjectsV2(bucketName, objectPrefix, continuationToken string, fetchOwner bool, delimiter string, maxkeys int) (ListBucketV2Result, error)
ListObjectsV2 - Lists all the objects at a prefix, similar to ListObjects() but uses continuationToken instead of marker to support iteration over the results.
func (Core) NewMultipartUpload ¶
func (c Core) NewMultipartUpload(ctx context.Context, bucket, object string, opts PutObjectOptions) (uploadID string, err error)
NewMultipartUpload - Initiates new multipart upload and returns the new uploadID.
func (Core) PutBucketPolicy ¶
PutBucketPolicy - applies a new bucket access policy for a given bucket.
func (Core) PutObject ¶
func (c Core) PutObject(ctx context.Context, bucket, object string, data io.Reader, size int64, md5Base64, sha256Hex string, opts PutObjectOptions) (UploadInfo, error)
PutObject - Upload object. Uploads using single PUT call.
func (Core) PutObjectPart ¶
func (c Core) PutObjectPart(ctx context.Context, bucket, object, uploadID string, partID int, data io.Reader, size int64, md5Base64, sha256Hex string, sse encrypt.ServerSide) (ObjectPart, error)
PutObjectPart - Upload an object part.
func (Core) StatObject ¶
func (c Core) StatObject(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)
StatObject is a lower level API implemented to support special conditions matching etag, modtime on a request.
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 // Captures the server string returned in response header. Server string // Underlying HTTP status code for the returned error StatusCode int `xml:"-" json:"-"` }
ErrorResponse - Is the typed error returned by all API operations. ErrorResponse struct should be comparable since it is compared inside golang http API (https://github.com/golang/go/issues/29768)
func ToErrorResponse ¶
func ToErrorResponse(err error) ErrorResponse
ToErrorResponse - Returns parsed ErrorResponse struct from body and http headers.
For example:
import s3 "github.com/findmyname666/minio-go/v7" ... ... reader, stat, err := s3.GetObject(...) if err != nil { resp := s3.ToErrorResponse(err) } ...
type GetObjectLegalHoldOptions ¶
type GetObjectLegalHoldOptions struct {
VersionID string
}
GetObjectLegalHoldOptions represents options specified by user for GetObjectLegalHold call
type GetObjectOptions ¶
type GetObjectOptions struct { ServerSideEncryption encrypt.ServerSide VersionID string // contains filtered or unexported fields }
GetObjectOptions are used to specify additional headers or options during GET requests.
func (GetObjectOptions) Header ¶
func (o GetObjectOptions) Header() http.Header
Header returns the http.Header representation of the GET options.
func (*GetObjectOptions) Set ¶
func (o *GetObjectOptions) Set(key, value string)
Set adds a key value pair to the options. The key-value pair will be part of the HTTP GET request headers.
func (*GetObjectOptions) SetMatchETag ¶
func (o *GetObjectOptions) SetMatchETag(etag string) error
SetMatchETag - set match etag.
func (*GetObjectOptions) SetMatchETagExcept ¶
func (o *GetObjectOptions) SetMatchETagExcept(etag string) error
SetMatchETagExcept - set match etag except.
func (*GetObjectOptions) SetModified ¶
func (o *GetObjectOptions) SetModified(modTime time.Time) error
SetModified - set modified time since.
func (*GetObjectOptions) SetRange ¶
func (o *GetObjectOptions) SetRange(start, end int64) error
SetRange - set the start and end offset of the object to be read. See https://tools.ietf.org/html/rfc7233#section-3.1 for reference.
func (*GetObjectOptions) SetUnmodified ¶
func (o *GetObjectOptions) SetUnmodified(modTime time.Time) error
SetUnmodified - set unmodified time since.
type GetObjectTaggingOptions ¶
type GetObjectTaggingOptions struct {
VersionID string
}
GetObjectTaggingOptions holds the object version ID to fetch the tagging key/value pairs
type JSONInputOptions ¶
type JSONInputOptions struct { Type JSONType // contains filtered or unexported fields }
JSONInputOptions json input specific options
func (JSONInputOptions) MarshalXML ¶
func (j JSONInputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML - produces the xml representation of the JSONInputOptions struct
func (*JSONInputOptions) SetType ¶
func (j *JSONInputOptions) SetType(typ JSONType)
SetType sets the JSON type in the JSON input options
type JSONOutputOptions ¶
type JSONOutputOptions struct { RecordDelimiter string // contains filtered or unexported fields }
JSONOutputOptions - json output specific options
func (JSONOutputOptions) MarshalXML ¶
func (j JSONOutputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error
MarshalXML - produces the xml representation of the JSONOutputOptions struct
func (*JSONOutputOptions) SetRecordDelimiter ¶
func (j *JSONOutputOptions) SetRecordDelimiter(val string)
SetRecordDelimiter sets the record delimiter in the JSON output options
type JSONType ¶
type JSONType string
JSONType determines json input serialization type.
const ( JSONDocumentType JSONType = "DOCUMENT" JSONLinesType = "LINES" )
Constants for JSONTypes.
type LegalHoldStatus ¶
type LegalHoldStatus string
LegalHoldStatus - object legal hold status.
const ( // LegalHoldEnabled indicates legal hold is enabled LegalHoldEnabled LegalHoldStatus = "ON" // LegalHoldDisabled indicates legal hold is disabled LegalHoldDisabled LegalHoldStatus = "OFF" )
func (LegalHoldStatus) IsValid ¶
func (r LegalHoldStatus) IsValid() bool
IsValid - check whether this legal hold status is valid or not.
func (LegalHoldStatus) String ¶
func (r LegalHoldStatus) String() string
type ListBucketResult ¶
type ListBucketResult struct { // A response can contain CommonPrefixes only if you have // specified a delimiter. CommonPrefixes []CommonPrefix // Metadata about each object returned. Contents []ObjectInfo 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 int64 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. // Object storage 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 }
ListBucketResult container for listObjects response.
type ListBucketV2Result ¶
type ListBucketV2Result struct { // A response can contain CommonPrefixes only if you have // specified a delimiter. CommonPrefixes []CommonPrefix // Metadata about each object returned. Contents []ObjectInfo 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 MaxKeys int64 Name string // Hold the token that will be sent in the next request to fetch the next group of keys NextContinuationToken string ContinuationToken string Prefix string // FetchOwner and StartAfter are currently not used FetchOwner string StartAfter string }
ListBucketV2Result container for listObjects response version 2.
type ListMultipartUploadsResult ¶
type ListMultipartUploadsResult struct { Bucket string KeyMarker string UploadIDMarker string `xml:"UploadIdMarker"` NextKeyMarker string NextUploadIDMarker string `xml:"NextUploadIdMarker"` EncodingType string MaxUploads int64 IsTruncated bool Uploads []ObjectMultipartInfo `xml:"Upload"` Prefix string Delimiter string // A response can contain CommonPrefixes only if you specify a delimiter. CommonPrefixes []CommonPrefix }
ListMultipartUploadsResult container for ListMultipartUploads response
type ListObjectPartsResult ¶
type ListObjectPartsResult struct { Bucket string Key string UploadID string `xml:"UploadId"` Initiator initiator Owner owner StorageClass string PartNumberMarker int NextPartNumberMarker int MaxParts int // Indicates whether the returned list of parts is truncated. IsTruncated bool ObjectParts []ObjectPart `xml:"Part"` EncodingType string }
ListObjectPartsResult container for ListObjectParts response.
type ListObjectsOptions ¶
type ListObjectsOptions struct { // Include objects versions in the listing WithVersions bool // Include objects metadata in the listing WithMetadata bool // Only list objects with the prefix Prefix string // Ignore '/' delimiter Recursive bool // The maximum number of objects requested per // batch, advanced use-case not useful for most // applications MaxKeys int // Use the deprecated list objects V1 API UseV1 bool }
ListObjectsOptions holds all options of a list object request
type ListVersionsResult ¶
type ListVersionsResult struct { Versions []Version CommonPrefixes []CommonPrefix Name string Prefix string Delimiter string MaxKeys int64 EncodingType string IsTruncated bool KeyMarker string VersionIDMarker string NextKeyMarker string NextVersionIDMarker string }
ListVersionsResult is an element in the list object versions response
func (*ListVersionsResult) UnmarshalXML ¶
func (l *ListVersionsResult) UnmarshalXML(d *xml.Decoder, start xml.StartElement) (err error)
UnmarshalXML is a custom unmarshal code for the response of ListObjectVersions, the custom code will unmarshal <Version> and <DeleteMarker> tags and save them in Versions field to preserve the lexical order of the listing.
type MakeBucketOptions ¶
type MakeBucketOptions struct { // Bucket location Region string // Enable object locking ObjectLocking bool }
MakeBucketOptions holds all options to tweak bucket creation
type Object ¶
type Object struct {
// contains filtered or unexported fields
}
Object represents an open object. It implements Reader, ReaderAt, Seeker, Closer for a HTTP stream.
func (*Object) Close ¶
Close - The behavior of Close after the first call returns error for subsequent Close() calls.
func (*Object) Read ¶
Read reads up to len(b) bytes into b. It returns the number of bytes read (0 <= n <= len(b)) and any error encountered. Returns io.EOF upon end of file.
func (*Object) ReadAt ¶
ReadAt reads len(b) bytes from the File starting at byte offset off. It returns the number of bytes read and the error, if any. ReadAt always returns a non-nil error when n < len(b). At end of file, that error is io.EOF.
func (*Object) Seek ¶
Seek sets the offset for the next Read or Write to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset and an error, if any.
Seeking to a negative offset is an error. Seeking to any positive offset is legal, subsequent io operations succeed until the underlying object is not closed.
func (*Object) Stat ¶
func (o *Object) Stat() (ObjectInfo, error)
Stat returns the ObjectInfo structure describing Object.
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. Expires time.Time `json:"expires"` // The date and time at which the object is no longer able to be cached. // Collection of additional metadata on the object. // eg: x-amz-meta-*, content-encoding etc. Metadata http.Header `json:"metadata" xml:"-"` // x-amz-meta-* headers stripped "x-amz-meta-" prefix containing the first value. UserMetadata StringMap `json:"userMetadata"` // x-amz-tagging values in their k/v values. UserTags map[string]string `json:"userTags"` // x-amz-tagging-count value UserTagCount int // Owner name. Owner Owner // ACL grant. Grant []struct { Grantee struct { ID string `xml:"ID"` DisplayName string `xml:"DisplayName"` URI string `xml:"URI"` } `xml:"Grantee"` Permission string `xml:"Permission"` } `xml:"Grant"` // The class of storage used to store the object. StorageClass string `json:"storageClass"` // Versioning related information IsLatest bool IsDeleteMarker bool VersionID string `xml:"VersionId"` // x-amz-replication-status value is either in one of the following states // - COMPLETE // - PENDING // - FAILED // - REPLICA (on the destination) ReplicationStatus string `xml:"ReplicationStatus"` // Lifecycle expiry-date and ruleID associated with the expiry // not to be confused with `Expires` HTTP header. Expiration time.Time ExpirationRuleID string // Error Err error `json:"-"` }
ObjectInfo container for object metadata.
func ToObjectInfo ¶
ToObjectInfo converts http header values into ObjectInfo type, extracts metadata and fills in all the necessary fields in ObjectInfo.
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 multipart object metadata.
type ObjectPart ¶
type ObjectPart struct { // Part number identifies the part. PartNumber int // Date and time the part was uploaded. LastModified time.Time // Entity tag returned when the part was uploaded, usually md5sum // of the part. ETag string // Size of the uploaded part data. Size int64 }
ObjectPart container for particular part of an object.
type Options ¶
type Options struct { Creds *credentials.Credentials Secure bool Transport http.RoundTripper Region string BucketLookup BucketLookupType // Custom hash routines. Leave nil to use standard. CustomMD5 func() md5simd.Hasher CustomSHA256 func() md5simd.Hasher }
Options for New method
type ParquetInputOptions ¶
type ParquetInputOptions struct{}
ParquetInputOptions parquet input specific options
type PostPolicy ¶
type PostPolicy struct {
// contains filtered or unexported fields
}
PostPolicy - Provides strict static type conversion and validation for Amazon S3's POST policy JSON string.
func (*PostPolicy) SetBucket ¶
func (p *PostPolicy) SetBucket(bucketName string) error
SetBucket - Sets bucket at which objects will be uploaded to.
func (*PostPolicy) SetCondition ¶
func (p *PostPolicy) SetCondition(matchType, condition, value string) error
SetCondition - Sets condition for credentials, date and algorithm
func (*PostPolicy) SetContentLengthRange ¶
func (p *PostPolicy) SetContentLengthRange(min, max int64) error
SetContentLengthRange - Set new min and max content length condition for all incoming uploads.
func (*PostPolicy) SetContentType ¶
func (p *PostPolicy) SetContentType(contentType string) error
SetContentType - Sets content-type of the object for this policy based upload.
func (*PostPolicy) SetExpires ¶
func (p *PostPolicy) SetExpires(t time.Time) error
SetExpires - Sets expiration time for the new policy.
func (*PostPolicy) SetKey ¶
func (p *PostPolicy) SetKey(key string) error
SetKey - Sets an object name for the policy based upload.
func (*PostPolicy) SetKeyStartsWith ¶
func (p *PostPolicy) SetKeyStartsWith(keyStartsWith string) error
SetKeyStartsWith - Sets an object name that an policy based upload can start with.
func (*PostPolicy) SetSuccessActionRedirect ¶
func (p *PostPolicy) SetSuccessActionRedirect(redirect string) error
SetSuccessActionRedirect - Sets the redirect success url of the object for this policy based upload.
func (*PostPolicy) SetSuccessStatusAction ¶
func (p *PostPolicy) SetSuccessStatusAction(status string) error
SetSuccessStatusAction - Sets the status success code of the object for this policy based upload.
func (*PostPolicy) SetUserData ¶
func (p *PostPolicy) SetUserData(key string, value string) error
SetUserData - Set user data as a key/value couple. Can be retrieved through a HEAD request or an event.
func (*PostPolicy) SetUserMetadata ¶
func (p *PostPolicy) SetUserMetadata(key string, value string) error
SetUserMetadata - Set user metadata as a key/value couple. Can be retrieved through a HEAD request or an event.
func (PostPolicy) String ¶
func (p PostPolicy) String() string
String function for printing policy in json formatted string.
type ProgressMessage ¶
type ProgressMessage struct { XMLName xml.Name `xml:"Progress" json:"-"` StatsMessage }
ProgressMessage is a struct for progress xml message.
type PutObjectLegalHoldOptions ¶
type PutObjectLegalHoldOptions struct { VersionID string Status *LegalHoldStatus }
PutObjectLegalHoldOptions represents options specified by user for PutObjectLegalHold call
type PutObjectOptions ¶
type PutObjectOptions struct { UserMetadata map[string]string UserTags map[string]string Progress io.Reader ContentType string ContentEncoding string ContentDisposition string ContentLanguage string CacheControl string Mode RetentionMode RetainUntilDate time.Time ServerSideEncryption encrypt.ServerSide NumThreads uint StorageClass string WebsiteRedirectLocation string PartSize uint64 LegalHold LegalHoldStatus SendContentMd5 bool DisableMultipart bool ReplicationVersionID string ReplicationStatus ReplicationStatus ReplicationMTime time.Time }
PutObjectOptions represents options specified by user for PutObject call
func (PutObjectOptions) Header ¶
func (opts PutObjectOptions) Header() (header http.Header)
Header - constructs the headers from metadata entered by user in PutObjectOptions struct
type PutObjectRetentionOptions ¶
type PutObjectRetentionOptions struct { GovernanceBypass bool Mode *RetentionMode RetainUntilDate *time.Time VersionID string }
PutObjectRetentionOptions represents options specified by user for PutObject call
type PutObjectTaggingOptions ¶
type PutObjectTaggingOptions struct {
VersionID string
}
PutObjectTaggingOptions holds an object version id to update tag(s) of a specific object version
type QueryExpressionType ¶
type QueryExpressionType string
QueryExpressionType - is of what syntax the expression is, this should only be SQL
const (
QueryExpressionTypeSQL QueryExpressionType = "SQL"
)
Constants for expression type.
type RemoveObjectError ¶
RemoveObjectError - container of Multi Delete S3 API error
type RemoveObjectOptions ¶
RemoveObjectOptions represents options specified by user for RemoveObject call
type RemoveObjectTaggingOptions ¶
type RemoveObjectTaggingOptions struct {
VersionID string
}
RemoveObjectTaggingOptions holds the version id of the object to remove
type RemoveObjectsOptions ¶
type RemoveObjectsOptions struct {
GovernanceBypass bool
}
RemoveObjectsOptions represents options specified by user for RemoveObjects call
type ReplicationStatus ¶
type ReplicationStatus string
ReplicationStatus represents replication status of object
const ( // ReplicationStatusPending indicates replication is pending ReplicationStatusPending ReplicationStatus = "PENDING" // ReplicationStatusComplete indicates replication completed ok ReplicationStatusComplete ReplicationStatus = "COMPLETE" // ReplicationStatusFailed indicates replication failed ReplicationStatusFailed ReplicationStatus = "FAILED" // ReplicationStatusReplica indicates object is a replica of a source ReplicationStatusReplica ReplicationStatus = "REPLICA" )
func (ReplicationStatus) Empty ¶
func (r ReplicationStatus) Empty() bool
Empty returns true if no replication status set.
type Retention ¶
type Retention struct { Mode RetentionMode Validity time.Duration }
Retention - bucket level retention configuration.
type RetentionMode ¶
type RetentionMode string
RetentionMode - object retention mode.
const ( // Governance - governance mode. Governance RetentionMode = "GOVERNANCE" // Compliance - compliance mode. Compliance RetentionMode = "COMPLIANCE" )
func (RetentionMode) IsValid ¶
func (r RetentionMode) IsValid() bool
IsValid - check whether this retention mode is valid or not.
func (RetentionMode) String ¶
func (r RetentionMode) String() string
type SelectCompressionType ¶
type SelectCompressionType string
SelectCompressionType - is the parameter for what type of compression is present
type SelectObjectInputSerialization ¶
type SelectObjectInputSerialization struct { CompressionType SelectCompressionType Parquet *ParquetInputOptions `xml:"Parquet,omitempty"` CSV *CSVInputOptions `xml:"CSV,omitempty"` JSON *JSONInputOptions `xml:"JSON,omitempty"` }
SelectObjectInputSerialization - input serialization parameters
type SelectObjectOptions ¶
type SelectObjectOptions struct { XMLName xml.Name `xml:"SelectObjectContentRequest" json:"-"` ServerSideEncryption encrypt.ServerSide `xml:"-"` Expression string ExpressionType QueryExpressionType InputSerialization SelectObjectInputSerialization OutputSerialization SelectObjectOutputSerialization RequestProgress struct { Enabled bool } }
SelectObjectOptions - represents the input select body
func (SelectObjectOptions) Header ¶
func (o SelectObjectOptions) Header() http.Header
Header returns the http.Header representation of the SelectObject options.
type SelectObjectOutputSerialization ¶
type SelectObjectOutputSerialization struct { CSV *CSVOutputOptions `xml:"CSV,omitempty"` JSON *JSONOutputOptions `xml:"JSON,omitempty"` }
SelectObjectOutputSerialization - output serialization parameters.
type SelectObjectType ¶
type SelectObjectType string
SelectObjectType - is the parameter which defines what type of object the operation is being performed on.
type SelectResults ¶
type SelectResults struct {
// contains filtered or unexported fields
}
SelectResults is used for the streaming responses from the server.
func NewSelectResults ¶
func NewSelectResults(resp *http.Response, bucketName string) (*SelectResults, error)
NewSelectResults creates a Select Result parser that parses the response and returns a Reader that will return parsed and assembled select output.
func (*SelectResults) Close ¶
func (s *SelectResults) Close() error
Close - closes the underlying response body and the stream reader.
func (*SelectResults) Progress ¶
func (s *SelectResults) Progress() *ProgressMessage
Progress - information about the progress of a request.
func (*SelectResults) Read ¶
func (s *SelectResults) Read(b []byte) (n int, err error)
Read - is a reader compatible implementation for SelectObjectContent records.
func (*SelectResults) Stats ¶
func (s *SelectResults) Stats() *StatsMessage
Stats - information about a request's stats when processing is complete.
type StatObjectOptions ¶
type StatObjectOptions = GetObjectOptions
StatObjectOptions are used to specify additional headers or options during GET info/stat requests.
type StatsMessage ¶
type StatsMessage struct { XMLName xml.Name `xml:"Stats" json:"-"` BytesScanned int64 BytesProcessed int64 BytesReturned int64 }
StatsMessage is a struct for stat xml message.
type StringMap ¶
StringMap represents map with custom UnmarshalXML
func (*StringMap) UnmarshalXML ¶
UnmarshalXML unmarshals the XML into a map of string to strings, creating a key in the map for each tag and setting it's value to the tags contents.
The fact this function is on the pointer of Map is important, so that if m is nil it can be initialized, which is often the case if m is nested in another xml structural. This is also why the first thing done on the first line is initialize it.
type UploadInfo ¶
type UploadInfo struct { Bucket string Key string ETag string Size int64 LastModified time.Time Location string VersionID string // Lifecycle expiry-date and ruleID associated with the expiry // not to be confused with `Expires` HTTP header. Expiration time.Time ExpirationRuleID string }
UploadInfo contains information about the newly uploaded or copied object.
type ValidityUnit ¶
type ValidityUnit string
ValidityUnit - retention validity unit.
const ( // Days - denotes no. of days. Days ValidityUnit = "DAYS" // Years - denotes no. of years. Years ValidityUnit = "YEARS" )
func (ValidityUnit) String ¶
func (unit ValidityUnit) String() string
Source Files ¶
- api-bucket-encryption.go
- api-bucket-lifecycle.go
- api-bucket-notification.go
- api-bucket-policy.go
- api-bucket-replication.go
- api-bucket-tagging.go
- api-bucket-versioning.go
- api-compose-object.go
- api-datatypes.go
- api-error-response.go
- api-get-object-acl.go
- api-get-object-file.go
- api-get-object.go
- api-get-options.go
- api-list.go
- api-object-legal-hold.go
- api-object-lock.go
- api-object-retention.go
- api-object-tagging.go
- api-presigned.go
- api-put-bucket.go
- api-put-object-common.go
- api-put-object-copy.go
- api-put-object-file-context.go
- api-put-object-multipart.go
- api-put-object-streaming.go
- api-put-object.go
- api-remove.go
- api-s3-datatypes.go
- api-select.go
- api-stat.go
- api.go
- bucket-cache.go
- constants.go
- core.go
- hook-reader.go
- post-policy.go
- retry-continous.go
- retry.go
- s3-endpoints.go
- s3-error.go
- transport.go
- utils.go
Directories ¶
Path | Synopsis |
---|---|
pkg
|
|
credentials
Package credentials provides credential retrieval and management for S3 compatible object storage.
|
Package credentials provides credential retrieval and management for S3 compatible object storage. |
lifecycle
Package lifecycle contains all the lifecycle related data types and marshallers.
|
Package lifecycle contains all the lifecycle related data types and marshallers. |