minio

package module
v6.0.57 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: Apache-2.0 Imports: 45 Imported by: 231

README

MinIO Go Client SDK for Amazon S3 Compatible Cloud Storage Slack Sourcegraph Apache V2 License

The MinIO Go Client SDK provides simple APIs to access any Amazon S3 compatible object storage.

This quickstart guide will show you how to install the MinIO client SDK, connect to MinIO, and provide a walkthrough for a simple file uploader. For a complete list of APIs and examples, please take a look at the Go Client API Reference.

This document assumes that you have a working Go development environment.

Download from Github

GO111MODULE=on go get github.com/minio/minio-go/v6

Initialize MinIO Client

MinIO client requires the following four parameters specified to connect to an Amazon S3 compatible object storage.

Parameter Description
endpoint URL to object storage service.
accessKeyID Access key is the user ID that uniquely identifies your account.
secretAccessKey Secret key is the password to your account.
secure Set this value to 'true' to enable secure (HTTPS) access.
package main

import (
	"github.com/minio/minio-go/v6"
	"log"
)

func main() {
	endpoint := "play.min.io"
	accessKeyID := "Q3AM3UQ867SPQQA43P2F"
	secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
	useSSL := true

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	log.Printf("%#v\n", minioClient) // minioClient is now setup
}

Quick Start Example - File Uploader

This example program connects to an object storage server, creates a bucket and uploads a file to the bucket.

We will use the MinIO server running at https://play.min.io in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.

FileUploader.go
package main

import (
	"github.com/minio/minio-go/v6"
	"log"
)

func main() {
	endpoint := "play.min.io"
	accessKeyID := "Q3AM3UQ867SPQQA43P2F"
	secretAccessKey := "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG"
	useSSL := true

	// Initialize minio client object.
	minioClient, err := minio.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	// Make a new bucket called mymusic.
	bucketName := "mymusic"
	location := "us-east-1"

	err = minioClient.MakeBucket(bucketName, location)
	if err != nil {
		// Check to see if we already own this bucket (which happens if you run this twice)
		exists, errBucketExists := minioClient.BucketExists(bucketName)
		if errBucketExists == nil && exists {
			log.Printf("We already own %s\n", bucketName)
		} else {
			log.Fatalln(err)
		}
	} else {
		log.Printf("Successfully created %s\n", bucketName)
	}

	// Upload the zip file
	objectName := "golden-oldies.zip"
	filePath := "/tmp/golden-oldies.zip"
	contentType := "application/zip"

	// Upload the zip file with FPutObject
	n, err := minioClient.FPutObject(bucketName, objectName, filePath, minio.PutObjectOptions{ContentType:contentType})
	if err != nil {
		log.Fatalln(err)
	}

	log.Printf("Successfully uploaded %s of size %d\n", objectName, n)
}
Run FileUploader
go run file-uploader.go
2016/08/13 17:03:28 Successfully created mymusic
2016/08/13 17:03:40 Successfully uploaded golden-oldies.zip of size 16253413

mc ls play/mymusic/
[2016-05-27 16:02:16 PDT]  17MiB golden-oldies.zip

API Reference

The full API Reference is available here.

API Reference : Bucket Operations
API Reference : Bucket policy Operations
API Reference : Bucket notification Operations
API Reference : File Object Operations
API Reference : Object Operations
API Reference : Presigned Operations
API Reference : Client custom settings

Full Examples

Full Examples : Bucket Operations
Full Examples : Bucket policy Operations
Full Examples : Bucket lifecycle Operations
Full Examples : Bucket encryption Operations
Full Examples : Bucket notification Operations
Full Examples : File Object Operations
Full Examples : Object Operations
Full Examples : Encrypted Object Operations
Full Examples : Presigned Operations

Explore Further

Contribute

Contributors Guide

Build Status Build status

License

This SDK is distributed under the Apache License, Version 2.0, see LICENSE and NOTICE for more information.

Documentation

Index

Constants

View Source
const (
	CSVFileHeaderInfoNone   CSVFileHeaderInfo = "NONE"
	CSVFileHeaderInfoIgnore                   = "IGNORE"
	CSVFileHeaderInfoUse                      = "USE"
)

Constants for file header info.

View Source
const (
	SelectCompressionNONE SelectCompressionType = "NONE"
	SelectCompressionGZIP                       = "GZIP"
	SelectCompressionBZIP                       = "BZIP2"
)

Constants for compression types under select API.

View Source
const (
	SelectObjectTypeCSV     SelectObjectType = "CSV"
	SelectObjectTypeJSON                     = "JSON"
	SelectObjectTypeParquet                  = "Parquet"
)

Constants for input data types.

View Source
const (
	ObjectCreatedAll                     NotificationEventType = "s3:ObjectCreated:*"
	ObjectCreatedPut                                           = "s3:ObjectCreated:Put"
	ObjectCreatedPost                                          = "s3:ObjectCreated:Post"
	ObjectCreatedCopy                                          = "s3:ObjectCreated:Copy"
	ObjectCreatedCompleteMultipartUpload                       = "s3:ObjectCreated:CompleteMultipartUpload"
	ObjectAccessedGet                                          = "s3:ObjectAccessed:Get"
	ObjectAccessedHead                                         = "s3:ObjectAccessed:Head"
	ObjectAccessedAll                                          = "s3:ObjectAccessed:*"
	ObjectRemovedAll                                           = "s3:ObjectRemoved:*"
	ObjectRemovedDelete                                        = "s3:ObjectRemoved:Delete"
	ObjectRemovedDeleteMarkerCreated                           = "s3:ObjectRemoved:DeleteMarkerCreated"
	ObjectReducedRedundancyLostObject                          = "s3:ReducedRedundancyLostObject"
)

The role of all event types are described in :

http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations
View Source
const DefaultRetryCap = time.Second * 30

DefaultRetryCap - Each retry attempt never waits no longer than this maximum time duration.

View Source
const DefaultRetryUnit = time.Second

DefaultRetryUnit - default unit multiplicative per retry. defaults to 1 second.

View Source
const MaxJitter = 1.0

MaxJitter will randomize over the full exponential backoff time

View Source
const NoJitter = 0.0

NoJitter disables the use of jitter for randomizing the exponential backoff time

Variables

View Source
var DefaultTransport = func(secure bool) (http.RoundTripper, 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.

View Source
var ErrInvalidObjectPrefix = ErrInvalidObjectName

ErrInvalidObjectPrefix - Invalid object prefix response is similar to object name response.

View Source
var ErrNoNotificationConfigMatch = errors.New("no notification configuration matched")

ErrNoNotificationConfigMatch is returned when a notification configuration (sqs,sns,lambda) is not found when trying to delete

View Source
var MaxRetry = 10

MaxRetry is the maximum number of retries before stopping.

Functions

func EqualFilterRuleList added in v6.0.53

func EqualFilterRuleList(a, b []FilterRule) bool

EqualFilterRuleList tells whether a and b contain the same filters

func EqualNotificationEventTypeList added in v6.0.53

func EqualNotificationEventTypeList(a, b []NotificationEventType) bool

EqualNotificationEventTypeList tells whether a and b contain the same events

func ErrAPINotSupported

func ErrAPINotSupported(message string) error

ErrAPINotSupported - API not supported response The specified API call is not supported

func ErrEntityTooLarge

func ErrEntityTooLarge(totalSize, maxObjectSize int64, bucketName, objectName string) error

ErrEntityTooLarge - Input size is larger than supported maximum.

func ErrEntityTooSmall

func ErrEntityTooSmall(totalSize int64, bucketName, objectName string) error

ErrEntityTooSmall - Input size is smaller than supported minimum.

func ErrInvalidArgument

func ErrInvalidArgument(message string) error

ErrInvalidArgument - Invalid argument response.

func ErrInvalidBucketName

func ErrInvalidBucketName(message string) error

ErrInvalidBucketName - Invalid bucket name response.

func ErrInvalidObjectName

func ErrInvalidObjectName(message string) error

ErrInvalidObjectName - Invalid object name response.

func ErrNoSuchBucketPolicy

func ErrNoSuchBucketPolicy(message string) error

ErrNoSuchBucketPolicy - No Such Bucket Policy response The specified bucket does not have a bucket policy.

func ErrTransferAccelerationBucket

func ErrTransferAccelerationBucket(bucketName string) error

ErrTransferAccelerationBucket - bucket name is invalid to be used with transfer acceleration.

func ErrUnexpectedEOF

func ErrUnexpectedEOF(totalRead, totalSize int64, bucketName, objectName string) error

ErrUnexpectedEOF - Unexpected end of file reached.

Types

type ApplyServerSideEncryptionByDefault added in v6.0.47

type ApplyServerSideEncryptionByDefault struct {
	KmsMasterKeyID string `xml:"KMSMasterKeyID,omitempty"`
	SSEAlgorithm   string `xml:"SSEAlgorithm"`
}

ApplyServerSideEncryptionByDefault defines default encryption configuration, KMS or SSE. To activate KMS, SSEAlgoritm needs to be set to "aws:kms" Minio currently does not support Kms.

type Arn

type Arn struct {
	Partition string
	Service   string
	Region    string
	AccountID string
	Resource  string
}

Arn - holds ARN information that will be sent to the web service, ARN desciption can be found in http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html

func NewArn

func NewArn(partition, service, region, accountID, resource string) Arn

NewArn creates new ARN based on the given partition, service, region, account id and resource

func (Arn) String

func (arn Arn) String() string

String returns the string format of the ARN

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 BucketNotification

type BucketNotification struct {
	XMLName       xml.Name       `xml:"NotificationConfiguration"`
	LambdaConfigs []LambdaConfig `xml:"CloudFunctionConfiguration"`
	TopicConfigs  []TopicConfig  `xml:"TopicConfiguration"`
	QueueConfigs  []QueueConfig  `xml:"QueueConfiguration"`
}

BucketNotification - the struct that represents the whole XML to be sent to the web service

func (*BucketNotification) AddLambda

func (b *BucketNotification) AddLambda(lambdaConfig NotificationConfig) bool

AddLambda adds a given lambda config to the general bucket notification config

func (*BucketNotification) AddQueue

func (b *BucketNotification) AddQueue(queueConfig NotificationConfig) bool

AddQueue adds a given queue config to the general bucket notification config

func (*BucketNotification) AddTopic

func (b *BucketNotification) AddTopic(topicConfig NotificationConfig) bool

AddTopic adds a given topic config to the general bucket notification config

func (*BucketNotification) RemoveLambdaByArn

func (b *BucketNotification) RemoveLambdaByArn(arn Arn)

RemoveLambdaByArn removes all lambda configurations that match the exact specified ARN

func (*BucketNotification) RemoveLambdaByArnEventsPrefixSuffix added in v6.0.53

func (b *BucketNotification) RemoveLambdaByArnEventsPrefixSuffix(arn Arn, events []NotificationEventType, prefix, suffix string) error

RemoveLambdaByArnEventsPrefixSuffix removes a topic configuration that match the exact specified ARN, events, prefix and suffix

func (*BucketNotification) RemoveQueueByArn

func (b *BucketNotification) RemoveQueueByArn(arn Arn)

RemoveQueueByArn removes all queue configurations that match the exact specified ARN

func (*BucketNotification) RemoveQueueByArnEventsPrefixSuffix added in v6.0.53

func (b *BucketNotification) RemoveQueueByArnEventsPrefixSuffix(arn Arn, events []NotificationEventType, prefix, suffix string) error

RemoveQueueByArnEventsPrefixSuffix removes a queue configuration that match the exact specified ARN, events, prefix and suffix

func (*BucketNotification) RemoveTopicByArn

func (b *BucketNotification) RemoveTopicByArn(arn Arn)

RemoveTopicByArn removes all topic configurations that match the exact specified ARN

func (*BucketNotification) RemoveTopicByArnEventsPrefixSuffix added in v6.0.53

func (b *BucketNotification) RemoveTopicByArnEventsPrefixSuffix(arn Arn, events []NotificationEventType, prefix, suffix string) error

RemoveTopicByArnEventsPrefixSuffix removes a topic configuration that match the exact specified ARN, events, prefix and suffix

type BucketVersioningConfiguration added in v6.0.53

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 added in v6.0.54

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 added in v6.0.54

func (c *CSVInputOptions) SetComments(val string)

SetComments sets the comments character in the CSV input options

func (*CSVInputOptions) SetFieldDelimiter added in v6.0.54

func (c *CSVInputOptions) SetFieldDelimiter(val string)

SetFieldDelimiter sets the field delimiter in the CSV input options

func (*CSVInputOptions) SetFileHeaderInfo added in v6.0.54

func (c *CSVInputOptions) SetFileHeaderInfo(val CSVFileHeaderInfo)

SetFileHeaderInfo sets the file header info in the CSV input options

func (*CSVInputOptions) SetQuoteCharacter added in v6.0.54

func (c *CSVInputOptions) SetQuoteCharacter(val string)

SetQuoteCharacter sets the quote character in the CSV input options

func (*CSVInputOptions) SetQuoteEscapeCharacter added in v6.0.54

func (c *CSVInputOptions) SetQuoteEscapeCharacter(val string)

SetQuoteEscapeCharacter sets the quote escape character in the CSV input options

func (*CSVInputOptions) SetRecordDelimiter added in v6.0.54

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 added in v6.0.54

func (c CSVOutputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - produces the xml representation of the CSVOutputOptions struct

func (*CSVOutputOptions) SetFieldDelimiter added in v6.0.54

func (c *CSVOutputOptions) SetFieldDelimiter(val string)

SetFieldDelimiter sets the field delimiter character in the CSV output options

func (*CSVOutputOptions) SetQuoteCharacter added in v6.0.54

func (c *CSVOutputOptions) SetQuoteCharacter(val string)

SetQuoteCharacter sets the quote character in the CSV output options

func (*CSVOutputOptions) SetQuoteEscapeCharacter added in v6.0.54

func (c *CSVOutputOptions) SetQuoteEscapeCharacter(val string)

SetQuoteEscapeCharacter sets the quote escape character in the CSV output options

func (*CSVOutputOptions) SetQuoteFields added in v6.0.54

func (c *CSVOutputOptions) SetQuoteFields(val CSVQuoteFields)

SetQuoteFields sets the quote field parameter in the CSV output options

func (*CSVOutputOptions) SetRecordDelimiter added in v6.0.54

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 New

func New(endpoint, accessKeyID, secretAccessKey string, secure bool) (*Client, error)

New - instantiate minio client, adds automatic verification of signature.

func NewV2

func NewV2(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*Client, error)

NewV2 - instantiate minio client with Amazon S3 signature version '2' compatibility.

func NewV4

func NewV4(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*Client, error)

NewV4 - instantiate minio client with Amazon S3 signature version '4' compatibility.

func NewWithCredentials

func NewWithCredentials(endpoint string, creds *credentials.Credentials, secure bool, region string) (*Client, error)

NewWithCredentials - instantiate minio client with credentials provider for retrieving credentials from various credentials provider such as IAM, File, Env etc.

func NewWithOptions

func NewWithOptions(endpoint string, opts *Options) (*Client, error)

NewWithOptions - instantiate minio client with options

func NewWithRegion

func NewWithRegion(endpoint, accessKeyID, secretAccessKey string, secure bool, region string) (*Client, error)

NewWithRegion - instantiate minio client, with region configured. Unlike New(), NewWithRegion avoids bucket-location lookup operations and it is slightly faster. Use this function when if your application deals with single region.

func (Client) BucketExists

func (c Client) BucketExists(bucketName string) (bool, error)

BucketExists verify if bucket exists and you have permission to access it.

func (Client) BucketExistsWithContext added in v6.0.44

func (c Client) BucketExistsWithContext(ctx context.Context, bucketName string) (bool, error)

BucketExistsWithContext verify 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(dst DestinationInfo, srcs []SourceInfo) 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.

func (Client) ComposeObjectWithProgress

func (c Client) ComposeObjectWithProgress(dst DestinationInfo, srcs []SourceInfo, progress io.Reader) error

ComposeObjectWithProgress - 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(dst DestinationInfo, src SourceInfo) error

CopyObject - copy a source object into a new object

func (Client) CopyObjectWithProgress

func (c Client) CopyObjectWithProgress(dst DestinationInfo, src SourceInfo, progress io.Reader) error

CopyObjectWithProgress - copy a source object into a new object, optionally takes progress bar input to notify current progress.

func (Client) DeleteBucketEncryption added in v6.0.47

func (c Client) DeleteBucketEncryption(bucketName string) error

DeleteBucketEncryption removes the default encryption configuration on a bucket.

func (Client) DeleteBucketEncryptionWithContext added in v6.0.47

func (c Client) DeleteBucketEncryptionWithContext(ctx context.Context, bucketName string) error

DeleteBucketEncryptionWithContext removes the default encryption configuration on a bucket with a context to control cancellations and timeouts.

func (Client) DeleteBucketTagging added in v6.0.56

func (c Client) DeleteBucketTagging(bucketName string) error

DeleteBucketTagging removes tagging configuration for a bucket.

func (Client) DeleteBucketTaggingWithContext added in v6.0.56

func (c Client) DeleteBucketTaggingWithContext(ctx context.Context, bucketName string) error

DeleteBucketTaggingWithContext removes tagging configuration for a bucket with a context to control cancellations and timeouts.

func (Client) DisableVersioning added in v6.0.41

func (c Client) DisableVersioning(bucketName string) error

DisableVersioning - Disable object versioning in given bucket.

func (Client) DisableVersioningWithContext added in v6.0.44

func (c Client) DisableVersioningWithContext(ctx context.Context, bucketName string) error

DisableVersioningWithContext - Disable object versioning in given bucket with a context to control cancellations and timeouts.

func (Client) EnableVersioning added in v6.0.41

func (c Client) EnableVersioning(bucketName string) error

EnableVersioning - Enable object versioning in given bucket.

func (Client) EnableVersioningWithContext added in v6.0.44

func (c Client) EnableVersioningWithContext(ctx context.Context, bucketName string) error

EnableVersioningWithContext - Enable object versioning in given bucket with a context to control cancellations and timeouts.

func (*Client) EndpointURL added in v6.0.33

func (c *Client) EndpointURL() *url.URL

EndpointURL returns the URL of the S3 endpoint.

func (Client) FGetObject

func (c Client) FGetObject(bucketName, objectName, filePath string, opts GetObjectOptions) error

FGetObject - download contents of an object to a local file.

func (Client) FGetObjectWithContext

func (c Client) FGetObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts GetObjectOptions) error

FGetObjectWithContext - 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(bucketName, objectName, filePath string, opts PutObjectOptions) (n int64, err error)

FPutObject - Create an object in a bucket, with contents from file at filePath

func (Client) FPutObjectWithContext

func (c Client) FPutObjectWithContext(ctx context.Context, bucketName, objectName, filePath string, opts PutObjectOptions) (n int64, err error)

FPutObjectWithContext - Create an object in a bucket, with contents from file at filePath. Allows request cancellation.

func (Client) GetBucketEncryption added in v6.0.47

func (c Client) GetBucketEncryption(bucketName string) (ServerSideEncryptionConfiguration, error)

GetBucketEncryption - get default encryption configuration for a bucket.

func (Client) GetBucketEncryptionWithContext added in v6.0.47

func (c Client) GetBucketEncryptionWithContext(ctx context.Context, bucketName string) (ServerSideEncryptionConfiguration, error)

GetBucketEncryptionWithContext gets the default encryption configuration on an existing bucket with a context to control cancellations and timeouts.

func (Client) GetBucketLifecycle

func (c Client) GetBucketLifecycle(bucketName string) (string, error)

GetBucketLifecycle - get bucket lifecycle.

func (Client) GetBucketLocation

func (c Client) GetBucketLocation(bucketName string) (string, error)

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(bucketName string) (bucketNotification BucketNotification, err error)

GetBucketNotification - get bucket notification at a given path.

func (Client) GetBucketObjectLockConfig added in v6.0.41

func (c Client) GetBucketObjectLockConfig(bucketName string) (mode *RetentionMode, validity *uint, unit *ValidityUnit, err error)

GetBucketObjectLockConfig gets object lock configuration of given bucket.

func (Client) GetBucketPolicy

func (c Client) GetBucketPolicy(bucketName string) (string, error)

GetBucketPolicy - get bucket policy at a given path.

func (Client) GetBucketTagging added in v6.0.56

func (c Client) GetBucketTagging(bucketName string) (*tags.Tags, error)

GetBucketTagging gets tagging configuration for a bucket.

func (Client) GetBucketTaggingWithContext added in v6.0.56

func (c Client) GetBucketTaggingWithContext(ctx context.Context, bucketName string) (*tags.Tags, error)

GetBucketTaggingWithContext gets tagging configuration for a bucket with a context to control cancellations and timeouts.

func (Client) GetBucketVersioning added in v6.0.53

func (c Client) GetBucketVersioning(bucketName string) (BucketVersioningConfiguration, error)

GetBucketVersioning - get versioning configuration for a bucket.

func (Client) GetBucketVersioningWithContext added in v6.0.53

func (c Client) GetBucketVersioningWithContext(ctx context.Context, bucketName string) (BucketVersioningConfiguration, error)

GetBucketVersioningWithContext gets the versioning configuration on an existing bucket with a context to control cancellations and timeouts.

func (Client) GetObject

func (c Client) GetObject(bucketName, objectName string, opts GetObjectOptions) (*Object, error)

GetObject - returns an seekable, readable object.

func (Client) GetObjectACL

func (c Client) GetObjectACL(bucketName, objectName string) (*ObjectInfo, error)

GetObjectACL get object ACLs

func (Client) GetObjectACLWithContext added in v6.0.44

func (c Client) GetObjectACLWithContext(ctx context.Context, bucketName, objectName string) (*ObjectInfo, error)

GetObjectACLWithContext get object ACLs

func (Client) GetObjectLegalHold added in v6.0.49

func (c Client) GetObjectLegalHold(bucketName, objectName string, opts GetObjectLegalHoldOptions) (status *LegalHoldStatus, err error)

GetObjectLegalHold gets legal-hold status of given object.

func (Client) GetObjectLockConfig added in v6.0.50

func (c Client) GetObjectLockConfig(bucketName string) (objectLock string, mode *RetentionMode, validity *uint, unit *ValidityUnit, err error)

GetObjectLockConfig gets object lock configuration of given bucket.

func (Client) GetObjectRetention added in v6.0.42

func (c Client) GetObjectRetention(bucketName, objectName, versionID string) (mode *RetentionMode, retainUntilDate *time.Time, err error)

GetObjectRetention gets retention of given object.

func (Client) GetObjectTagging added in v6.0.45

func (c Client) GetObjectTagging(bucketName, objectName string) (string, error)

GetObjectTagging fetches object tag(s)

func (Client) GetObjectTaggingWithContext added in v6.0.45

func (c Client) GetObjectTaggingWithContext(ctx context.Context, bucketName, objectName string) (string, error)

GetObjectTaggingWithContext fetches object tag(s) with a context to control cancellations and timeouts.

func (Client) GetObjectWithContext

func (c Client) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (*Object, error)

GetObjectWithContext - returns an seekable, readable object. The options can be used to specify the GET request further.

func (Client) ListBuckets

func (c Client) ListBuckets() ([]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() {
    fmt.Println(message)
}

func (Client) ListBucketsWithContext added in v6.0.44

func (c Client) ListBucketsWithContext(ctx context.Context) ([]BucketInfo, error)

ListBucketsWithContext list all buckets owned by this authenticated user, accepts a context for facilitate cancellation.

This call requires explicit authentication, no anonymous requests are allowed for listing buckets.

api := client.New(....)
for message := range api.ListBucketsWithContext(context.Background()) {
    fmt.Println(message)
}

func (Client) ListIncompleteUploads

func (c Client) ListIncompleteUploads(bucketName, objectPrefix string, recursive bool, doneCh <-chan struct{}) <-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 and a done channel to pro-actively close the internal go routine. If you enable recursive as 'true' this function will return back all the multipart objects in a given bucket name.

api := client.New(....)
// Create a done channel.
doneCh := make(chan struct{})
defer close(doneCh)
// Recurively list all objects in 'mytestbucket'
recursive := true
for message := range api.ListIncompleteUploads("mytestbucket", "starthere", recursive) {
    fmt.Println(message)
}

func (Client) ListObjects

func (c Client) ListObjects(bucketName, objectPrefix string, recursive bool, doneCh <-chan struct{}) <-chan ObjectInfo

ListObjects - (List Objects) - List some objects or all recursively.

ListObjects lists all 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 and a done channel for pro-actively closing the internal go routine. If you enable recursive as 'true' this function will return back all the objects in a given bucket name and object prefix.

api := client.New(....)
// Create a done channel.
doneCh := make(chan struct{})
defer close(doneCh)
// Recurively list all objects in 'mytestbucket'
recursive := true
for message := range api.ListObjects("mytestbucket", "starthere", recursive, doneCh) {
    fmt.Println(message)
}

func (Client) ListObjectsV2

func (c Client) ListObjectsV2(bucketName, objectPrefix string, recursive bool, doneCh <-chan struct{}) <-chan ObjectInfo

ListObjectsV2 lists all 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 and a done channel for pro-actively closing the internal go routine. If you enable recursive as 'true' this function will return back all the objects in a given bucket name and object prefix.

api := client.New(....)
// Create a done channel.
doneCh := make(chan struct{})
defer close(doneCh)
// Recursively list all objects in 'mytestbucket'
recursive := true
for message := range api.ListObjectsV2("mytestbucket", "starthere", recursive, doneCh) {
    fmt.Println(message)
}

func (Client) ListObjectsV2WithMetadata added in v6.0.43

func (c Client) ListObjectsV2WithMetadata(bucketName, objectPrefix string, recursive bool,
	doneCh <-chan struct{}) <-chan ObjectInfo

ListObjectsV2WithMetadata lists all objects matching the objectPrefix from the specified bucket. If recursion is enabled it would list all subdirectories and all its contents. This call adds UserMetadata information as well for each object.

This is a MinIO extension, this will not work against other S3 compatible object storage vendors.

Your input parameters are just bucketName, objectPrefix, recursive and a done channel for pro-actively closing the internal go routine. If you enable recursive as 'true' this function will return back all the objects in a given bucket name and object prefix.

api := client.New(....)
// Create a done channel.
doneCh := make(chan struct{})
defer close(doneCh)
// Recursively list all objects in 'mytestbucket'
recursive := true
// Add metadata
metadata := true
for message := range api.ListObjectsV2WithMetadata("mytestbucket", "starthere", recursive, doneCh) {
    fmt.Println(message)
}

func (Client) ListenBucketNotification

func (c Client) ListenBucketNotification(bucketName, prefix, suffix string, events []string, doneCh <-chan struct{}) <-chan NotificationInfo

ListenBucketNotification - listen on bucket notifications.

func (Client) MakeBucket

func (c Client) MakeBucket(bucketName string, location string) (err error)

MakeBucket creates a new bucket with bucketName.

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) MakeBucketWithContext added in v6.0.44

func (c Client) MakeBucketWithContext(ctx context.Context, bucketName string, location string) (err error)

MakeBucketWithContext 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) MakeBucketWithObjectLock added in v6.0.41

func (c Client) MakeBucketWithObjectLock(bucketName string, location string) (err error)

MakeBucketWithObjectLock creates a object lock enabled new bucket with bucketName.

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) MakeBucketWithObjectLockWithContext added in v6.0.44

func (c Client) MakeBucketWithObjectLockWithContext(ctx context.Context, bucketName string, location string) (err error)

MakeBucketWithObjectLockWithContext creates a object lock enabled 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(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(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(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(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(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(bucketName, objectName string, reader io.Reader, objectSize int64,
	opts PutObjectOptions) (n int64, 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 added in v6.0.49

func (c Client) PutObjectLegalHold(bucketName, objectName string, opts PutObjectLegalHoldOptions) error

PutObjectLegalHold : sets object legal hold for a given object and versionID.

func (Client) PutObjectRetention added in v6.0.42

func (c Client) PutObjectRetention(bucketName, objectName string, opts PutObjectRetentionOptions) error

PutObjectRetention : sets object retention for a given object and versionID.

func (Client) PutObjectTagging added in v6.0.45

func (c Client) PutObjectTagging(bucketName, objectName string, objectTags map[string]string) error

PutObjectTagging replaces or creates object tag(s)

func (Client) PutObjectTaggingWithContext added in v6.0.45

func (c Client) PutObjectTaggingWithContext(ctx context.Context, bucketName, objectName string, objectTags map[string]string) error

PutObjectTaggingWithContext replaces or creates object tag(s) with a context to control cancellations and timeouts.

func (Client) PutObjectWithContext

func (c Client) PutObjectWithContext(ctx context.Context, bucketName, objectName string, reader io.Reader, objectSize int64,
	opts PutObjectOptions) (n int64, err error)

PutObjectWithContext - Identical to PutObject call, but accepts context to facilitate request cancellation.

func (Client) RemoveAllBucketNotification

func (c Client) RemoveAllBucketNotification(bucketName string) error

RemoveAllBucketNotification - Remove bucket notification clears all previously specified config

func (Client) RemoveBucket

func (c Client) RemoveBucket(bucketName string) error

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) RemoveIncompleteUpload

func (c Client) RemoveIncompleteUpload(bucketName, objectName string) error

RemoveIncompleteUpload aborts an partially uploaded object.

func (Client) RemoveObject

func (c Client) RemoveObject(bucketName, objectName string) error

RemoveObject remove an object from a bucket.

func (Client) RemoveObjectTagging added in v6.0.45

func (c Client) RemoveObjectTagging(bucketName, objectName string) error

RemoveObjectTagging deletes object tag(s)

func (Client) RemoveObjectTaggingWithContext added in v6.0.45

func (c Client) RemoveObjectTaggingWithContext(ctx context.Context, bucketName, objectName string) error

RemoveObjectTaggingWithContext removes object tag(s) with a context to control cancellations and timeouts.

func (Client) RemoveObjectWithOptions added in v6.0.42

func (c Client) RemoveObjectWithOptions(bucketName, objectName string, opts RemoveObjectOptions) error

RemoveObjectWithOptions removes an object from a bucket.

func (Client) RemoveObjects

func (c Client) RemoveObjects(bucketName string, objectsCh <-chan string) <-chan RemoveObjectError

RemoveObjects removes multiple objects from a bucket. The list of objects to remove are received from objectsCh. Remove failures are sent back via error channel.

func (Client) RemoveObjectsWithContext

func (c Client) RemoveObjectsWithContext(ctx context.Context, bucketName string, objectsCh <-chan string) <-chan RemoveObjectError

RemoveObjectsWithContext - Identical to RemoveObjects call, but accepts context to facilitate request cancellation.

func (Client) RemoveObjectsWithOptions added in v6.0.52

func (c Client) RemoveObjectsWithOptions(bucketName string, objectsCh <-chan string, opts RemoveObjectsOptions) <-chan RemoveObjectError

RemoveObjectsWithOptions removes multiple objects from a bucket. The list of objects to remove are received from objectsCh. Remove failures are sent back via error channel.

func (Client) RemoveObjectsWithOptionsContext added in v6.0.52

func (c Client) RemoveObjectsWithOptionsContext(ctx context.Context, bucketName string, objectsCh <-chan string, opts RemoveObjectsOptions) <-chan RemoveObjectError

RemoveObjectsWithOptionsContext - Identical to RemoveObjects call, but accepts context to facilitate request cancellation and options to bypass governance retention

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

func (c *Client) SetAppInfo(appName string, appVersion string)

SetAppInfo - add application details to user agent.

func (Client) SetBucketEncryption added in v6.0.47

func (c Client) SetBucketEncryption(bucketName string, configuration ServerSideEncryptionConfiguration) error

SetBucketEncryption sets the default encryption configuration on an existing bucket.

func (Client) SetBucketEncryptionWithContext added in v6.0.47

func (c Client) SetBucketEncryptionWithContext(ctx context.Context, bucketName string, configuration ServerSideEncryptionConfiguration) error

SetBucketEncryptionWithContext sets the default encryption configuration on an existing bucket with a context to control cancellations and timeouts.

func (Client) SetBucketLifecycle

func (c Client) SetBucketLifecycle(bucketName, lifecycle string) error

SetBucketLifecycle set the lifecycle on an existing bucket.

func (Client) SetBucketLifecycleWithContext added in v6.0.44

func (c Client) SetBucketLifecycleWithContext(ctx context.Context, bucketName, lifecycle string) error

SetBucketLifecycleWithContext set the lifecycle on an existing bucket with a context to control cancellations and timeouts.

func (Client) SetBucketNotification

func (c Client) SetBucketNotification(bucketName string, bucketNotification BucketNotification) error

SetBucketNotification saves a new bucket notification.

func (Client) SetBucketNotificationWithContext added in v6.0.44

func (c Client) SetBucketNotificationWithContext(ctx context.Context, bucketName string, bucketNotification BucketNotification) error

SetBucketNotificationWithContext saves a new bucket notification with a context to control cancellations and timeouts.

func (Client) SetBucketObjectLockConfig added in v6.0.41

func (c Client) SetBucketObjectLockConfig(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

func (c Client) SetBucketPolicy(bucketName, policy string) error

SetBucketPolicy set the access permissions on an existing bucket.

func (Client) SetBucketPolicyWithContext added in v6.0.44

func (c Client) SetBucketPolicyWithContext(ctx context.Context, bucketName, policy string) error

SetBucketPolicyWithContext set the access permissions on an existing bucket.

func (Client) SetBucketTagging added in v6.0.56

func (c Client) SetBucketTagging(bucketName string, tags *tags.Tags) error

SetBucketTagging sets tagging configuration for a bucket.

func (Client) SetBucketTaggingWithContext added in v6.0.56

func (c Client) SetBucketTaggingWithContext(ctx context.Context, bucketName string, tags *tags.Tags) error

SetBucketTaggingWithContext sets tagging configuration for a bucket with a context to control cancellations and timeouts.

func (*Client) SetCustomTransport

func (c *Client) SetCustomTransport(customHTTPTransport http.RoundTripper)

SetCustomTransport - set new custom transport.

func (Client) SetObjectLockConfig added in v6.0.50

func (c Client) SetObjectLockConfig(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

func (c *Client) SetS3TransferAccelerate(accelerateEndpoint string)

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(bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)

StatObject verifies if object exists and you have permission to access.

func (Client) StatObjectWithContext added in v6.0.44

func (c Client) StatObjectWithContext(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)

StatObjectWithContext verifies if object exists and you have permission to access with a context to control cancellations and timeouts.

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

func (c *Client) TraceErrorsOnlyOn(outputStream io.Writer)

TraceErrorsOnlyOn - same as TraceOn, but only errors will be traced.

func (*Client) TraceOff

func (c *Client) TraceOff()

TraceOff - disable HTTP tracing.

func (*Client) TraceOn

func (c *Client) TraceOn(outputStream io.Writer)

TraceOn - enable HTTP tracing.

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 Core

type Core struct {
	*Client
}

Core - Inherits Client and adds new methods to expose the low level S3 APIs.

func NewCore

func NewCore(endpoint string, accessKeyID, secretAccessKey string, secure bool) (*Core, error)

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

func (c Core) AbortMultipartUpload(bucket, object, uploadID string) error

AbortMultipartUpload - Abort an incomplete upload.

func (Core) AbortMultipartUploadWithContext added in v6.0.34

func (c Core) AbortMultipartUploadWithContext(ctx context.Context, bucket, object, uploadID string) error

AbortMultipartUploadWithContext - Abort an incomplete upload.

func (Core) CompleteMultipartUpload

func (c Core) CompleteMultipartUpload(bucket, object, uploadID string, parts []CompletePart) (string, error)

CompleteMultipartUpload - Concatenate uploaded parts and commit to an object.

func (Core) CompleteMultipartUploadWithContext added in v6.0.34

func (c Core) CompleteMultipartUploadWithContext(ctx context.Context, bucket, object, uploadID string, parts []CompletePart) (string, error)

CompleteMultipartUploadWithContext - Concatenate uploaded parts and commit to an object.

func (Core) CopyObject

func (c Core) CopyObject(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(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) CopyObjectPartWithContext added in v6.0.34

func (c Core) CopyObjectPartWithContext(ctx context.Context, srcBucket, srcObject, destBucket, destObject string, uploadID string,
	partID int, startOffset, length int64, metadata map[string]string) (p CompletePart, err error)

CopyObjectPartWithContext - creates a part in a multipart upload by copying (a part of) an existing object.

func (Core) CopyObjectWithContext added in v6.0.34

func (c Core) CopyObjectWithContext(ctx context.Context, sourceBucket, sourceObject, destBucket, destObject string, metadata map[string]string) (ObjectInfo, error)

CopyObjectWithContext - copies an object from source object to destination object on server side.

func (Core) GetBucketPolicy

func (c Core) GetBucketPolicy(bucket string) (string, error)

GetBucketPolicy - fetches bucket access policy for a given bucket.

func (Core) GetObject

func (c Core) GetObject(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) GetObjectWithContext added in v6.0.34

func (c Core) GetObjectWithContext(ctx context.Context, bucketName, objectName string, opts GetObjectOptions) (io.ReadCloser, ObjectInfo, http.Header, error)

GetObjectWithContext 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(bucket, prefix, keyMarker, uploadIDMarker, delimiter string, maxUploads int) (result ListMultipartUploadsResult, err error)

ListMultipartUploads - List incomplete uploads.

func (Core) ListObjectParts

func (c Core) ListObjectParts(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, startAfter string) (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(bucket, object string, opts PutObjectOptions) (uploadID string, err error)

NewMultipartUpload - Initiates new multipart upload and returns the new uploadID.

func (Core) PutBucketPolicy

func (c Core) PutBucketPolicy(bucket, bucketPolicy string) error

PutBucketPolicy - applies a new bucket access policy for a given bucket.

func (Core) PutBucketPolicyWithContext added in v6.0.44

func (c Core) PutBucketPolicyWithContext(ctx context.Context, bucket, bucketPolicy string) error

PutBucketPolicyWithContext - applies a new bucket access policy for a given bucket with a context to control cancellations and timeouts.

func (Core) PutObject

func (c Core) PutObject(bucket, object string, data io.Reader, size int64, md5Base64, sha256Hex string, opts PutObjectOptions) (ObjectInfo, error)

PutObject - Upload object. Uploads using single PUT call.

func (Core) PutObjectPart

func (c Core) PutObjectPart(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) PutObjectPartWithContext added in v6.0.34

func (c Core) PutObjectPartWithContext(ctx context.Context, bucket, object, uploadID string, partID int, data io.Reader, size int64, md5Base64, sha256Hex string, sse encrypt.ServerSide) (ObjectPart, error)

PutObjectPartWithContext - Upload an object part.

func (Core) PutObjectWithContext added in v6.0.34

func (c Core) PutObjectWithContext(ctx context.Context, bucket, object string, data io.Reader, size int64, md5Base64, sha256Hex string, opts PutObjectOptions) (ObjectInfo, error)

PutObjectWithContext - Upload object. Uploads using single PUT call.

func (Core) StatObject

func (c Core) StatObject(bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)

StatObject is a lower level API implemented to support special conditions matching etag, modtime on a request.

func (Core) StatObjectWithContext added in v6.0.34

func (c Core) StatObjectWithContext(ctx context.Context, bucketName, objectName string, opts StatObjectOptions) (ObjectInfo, error)

StatObjectWithContext is a lower level API implemented to support special conditions matching etag, modtime on a request.

type DestInfoOptions added in v6.0.45

type DestInfoOptions struct {
	// `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)
	UserMeta map[string]string

	// `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
}

DestInfoOptions represents options specified by user for NewDestinationInfo call

type DestinationInfo

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

DestinationInfo - type with information about the object to be created via server-side copy requests, using the Compose API.

func NewDestinationInfo

func NewDestinationInfo(bucket, object string, sse encrypt.ServerSide, userMeta map[string]string) (d DestinationInfo, err error)

NewDestinationInfo - creates a compose-object/copy-source destination info object.

`sse` is the key info for server-side-encryption with customer provided key. If it is nil, no encryption is performed.

`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.

func NewDestinationInfoWithOptions added in v6.0.45

func NewDestinationInfoWithOptions(bucket, object string, destOpts DestInfoOptions) (d DestinationInfo, err error)

NewDestinationInfoWithOptions - creates a compose-object/copy-source destination info object.

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/minio/minio-go/v6"
...
...
reader, stat, err := s3.GetObject(...)
if err != nil {
   resp := s3.ToErrorResponse(err)
}
...

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

Error - Returns S3 error string.

type Filter

type Filter struct {
	S3Key S3Key `xml:"S3Key,omitempty"`
}

Filter - a tag in the notification xml structure which carries suffix/prefix filters

type FilterRule

type FilterRule struct {
	Name  string `xml:"Name"`
	Value string `xml:"Value"`
}

FilterRule - child of S3Key, a tag in the notification xml which carries suffix/prefix filters

type GetObjectLegalHoldOptions added in v6.0.49

type GetObjectLegalHoldOptions struct {
	VersionID string
}

GetObjectLegalHoldOptions represents options specified by user for GetObjectLegalHold call

type GetObjectOptions

type GetObjectOptions struct {
	ServerSideEncryption encrypt.ServerSide
	// 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 JSONInputOptions

type JSONInputOptions struct {
	Type JSONType
	// contains filtered or unexported fields
}

JSONInputOptions json input specific options

func (JSONInputOptions) MarshalXML added in v6.0.54

func (j JSONInputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - produces the xml representation of the JSONInputOptions struct

func (*JSONInputOptions) SetType added in v6.0.54

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 added in v6.0.54

func (j JSONOutputOptions) MarshalXML(e *xml.Encoder, start xml.StartElement) error

MarshalXML - produces the xml representation of the JSONOutputOptions struct

func (*JSONOutputOptions) SetRecordDelimiter added in v6.0.54

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 LambdaConfig

type LambdaConfig struct {
	NotificationConfig
	Lambda string `xml:"CloudFunction"`
}

LambdaConfig carries one single cloudfunction notification configuration

type LegalHoldStatus added in v6.0.49

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 added in v6.0.49

func (r LegalHoldStatus) IsValid() bool

IsValid - check whether this legal hold status is valid or not.

func (LegalHoldStatus) String added in v6.0.49

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 NotificationConfig

type NotificationConfig struct {
	ID     string                  `xml:"Id,omitempty"`
	Arn    Arn                     `xml:"-"`
	Events []NotificationEventType `xml:"Event"`
	Filter *Filter                 `xml:"Filter,omitempty"`
}

NotificationConfig - represents one single notification configuration such as topic, queue or lambda configuration.

func NewNotificationConfig

func NewNotificationConfig(arn Arn) NotificationConfig

NewNotificationConfig creates one notification config and sets the given ARN

func (*NotificationConfig) AddEvents

func (t *NotificationConfig) AddEvents(events ...NotificationEventType)

AddEvents adds one event to the current notification config

func (*NotificationConfig) AddFilterPrefix

func (t *NotificationConfig) AddFilterPrefix(prefix string)

AddFilterPrefix sets the prefix configuration to the current notification config

func (*NotificationConfig) AddFilterSuffix

func (t *NotificationConfig) AddFilterSuffix(suffix string)

AddFilterSuffix sets the suffix configuration to the current notification config

func (*NotificationConfig) Equal added in v6.0.53

func (t *NotificationConfig) Equal(events []NotificationEventType, prefix, suffix string) bool

Equal returns whether this `NotificationConfig` is equal to another defined by the passed parameters

type NotificationEvent

type NotificationEvent struct {
	EventVersion      string            `json:"eventVersion"`
	EventSource       string            `json:"eventSource"`
	AwsRegion         string            `json:"awsRegion"`
	EventTime         string            `json:"eventTime"`
	EventName         string            `json:"eventName"`
	UserIdentity      identity          `json:"userIdentity"`
	RequestParameters map[string]string `json:"requestParameters"`
	ResponseElements  map[string]string `json:"responseElements"`
	S3                eventMeta         `json:"s3"`
	Source            sourceInfo        `json:"source"`
}

NotificationEvent represents an Amazon an S3 bucket notification event.

type NotificationEventType

type NotificationEventType string

NotificationEventType is a S3 notification event associated to the bucket notification configuration

type NotificationInfo

type NotificationInfo struct {
	Records []NotificationEvent
	Err     error
}

NotificationInfo - represents the collection of notification events, additionally also reports errors if any while listening on bucket notifications.

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

func (o *Object) Close() (err error)

Close - The behavior of Close after the first call returns error for subsequent Close() calls.

func (*Object) Read

func (o *Object) Read(b []byte) (n int, err error)

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

func (o *Object) ReadAt(b []byte, offset int64) (n int, err error)

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

func (o *Object) Seek(offset int64, whence int) (n int64, err error)

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"`

	// Owner name.
	Owner struct {
		DisplayName string `json:"name"`
		ID          string `json:"id"`
	} `json:"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"`

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

ObjectInfo container for object metadata.

func ToObjectInfo added in v6.0.51

func ToObjectInfo(bucketName string, objectName string, h http.Header) (ObjectInfo, error)

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
	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 NewPostPolicy

func NewPostPolicy() *PostPolicy

NewPostPolicy - Instantiate new post policy.

func (*PostPolicy) SetBucket

func (p *PostPolicy) SetBucket(bucketName string) error

SetBucket - Sets bucket at which objects will be uploaded to.

func (*PostPolicy) SetCondition added in v6.0.45

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) 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 added in v6.0.49

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
}

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 added in v6.0.42

type PutObjectRetentionOptions struct {
	GovernanceBypass bool
	Mode             *RetentionMode
	RetainUntilDate  *time.Time
	VersionID        string
}

PutObjectRetentionOptions represents options specified by user for PutObject call

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 QueueConfig

type QueueConfig struct {
	NotificationConfig
	Queue string `xml:"Queue"`
}

QueueConfig carries one single queue notification configuration

type RemoveObjectError

type RemoveObjectError struct {
	ObjectName string
	Err        error
}

RemoveObjectError - container of Multi Delete S3 API error

type RemoveObjectOptions added in v6.0.42

type RemoveObjectOptions struct {
	GovernanceBypass bool
	VersionID        string
}

RemoveObjectOptions represents options specified by user for RemoveObject call

type RemoveObjectsOptions added in v6.0.52

type RemoveObjectsOptions struct {
	GovernanceBypass bool
}

RemoveObjectsOptions represents options specified by user for RemoveObjects call

type Retention added in v6.0.41

type Retention struct {
	Mode     RetentionMode
	Validity time.Duration
}

Retention - bucket level retention configuration.

func (Retention) IsEmpty added in v6.0.41

func (r Retention) IsEmpty() bool

IsEmpty - returns whether retention is empty or not.

func (Retention) String added in v6.0.41

func (r Retention) String() string

type RetentionMode added in v6.0.41

type RetentionMode string

RetentionMode - object retention mode.

const (
	// Governance - governance mode.
	Governance RetentionMode = "GOVERNANCE"

	// Compliance - compliance mode.
	Compliance RetentionMode = "COMPLIANCE"
)

func (RetentionMode) IsValid added in v6.0.41

func (r RetentionMode) IsValid() bool

IsValid - check whether this retention mode is valid or not.

func (RetentionMode) String added in v6.0.41

func (r RetentionMode) String() string

type Rule added in v6.0.47

type Rule struct {
	Apply ApplyServerSideEncryptionByDefault `xml:"ApplyServerSideEncryptionByDefault"`
}

Rule layer encapsulates default encryption configuration

type S3Key

type S3Key struct {
	FilterRules []FilterRule `xml:"FilterRule,omitempty"`
}

S3Key - child of Filter, a tag in the notification xml which carries suffix/prefix filters

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 added in v6.0.38

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 ServerSideEncryptionConfiguration added in v6.0.47

type ServerSideEncryptionConfiguration struct {
	XMLName xml.Name `xml:"ServerSideEncryptionConfiguration"`
	Rules   []Rule   `xml:"Rule"`
}

ServerSideEncryptionConfiguration is the default encryption configuration structure

type SourceInfo

type SourceInfo struct {

	// Headers to send with the upload-part-copy request involving
	// this source object.
	Headers http.Header
	// contains filtered or unexported fields
}

SourceInfo - represents a source object to be copied, using server-side copying APIs.

func NewSourceInfo

func NewSourceInfo(bucket, object string, sse encrypt.ServerSide) SourceInfo

NewSourceInfo - create a compose-object/copy-object source info object.

`decryptSSEC` is the decryption key using server-side-encryption with customer provided key. It may be nil if the source is not encrypted.

func (*SourceInfo) SetMatchETagCond

func (s *SourceInfo) SetMatchETagCond(etag string) error

SetMatchETagCond - Set ETag match condition. The object is copied only if the etag of the source matches the value given here.

func (*SourceInfo) SetMatchETagExceptCond

func (s *SourceInfo) SetMatchETagExceptCond(etag string) error

SetMatchETagExceptCond - Set the ETag match exception condition. The object is copied only if the etag of the source is not the value given here.

func (*SourceInfo) SetModifiedSinceCond

func (s *SourceInfo) SetModifiedSinceCond(modTime time.Time) error

SetModifiedSinceCond - Set the modified since condition.

func (*SourceInfo) SetRange

func (s *SourceInfo) SetRange(start, end int64) error

SetRange - Set the start and end offset of the source object to be copied. If this method is not called, the whole source object is copied.

func (*SourceInfo) SetUnmodifiedSinceCond

func (s *SourceInfo) SetUnmodifiedSinceCond(modTime time.Time) error

SetUnmodifiedSinceCond - Set the unmodified since condition.

type StatObjectOptions

type StatObjectOptions struct {
	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 added in v6.0.43

type StringMap map[string]string

StringMap represents map with custom UnmarshalXML

func (*StringMap) UnmarshalXML added in v6.0.43

func (m *StringMap) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

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 TopicConfig

type TopicConfig struct {
	NotificationConfig
	Topic string `xml:"Topic"`
}

TopicConfig carries one single topic notification configuration

type ValidityUnit added in v6.0.41

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 added in v6.0.41

func (unit ValidityUnit) String() string

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.
set

Jump to

Keyboard shortcuts

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