s3

package
Version: v1.14.29 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package s3 provides the client and types for making API requests to Amazon Simple Storage Service.

See https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01 for more information on this service.

See s3 package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/s3/

Using the Client

To contact Amazon Simple Storage Service with the SDK use the New function to create a new service client. With that client you can make API requests to the service. These clients are safe to use concurrently.

See the SDK's documentation for more information on how to use the SDK. https://docs.aws.amazon.com/sdk-for-go/api/

See aws.Config documentation for more information on configuring SDK clients. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the Amazon Simple Storage Service client S3 for more information on creating client for this service. https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#New

Upload Managers

The s3manager package's Uploader provides concurrent upload of content to S3 by taking advantage of S3's Multipart APIs. The Uploader also supports both io.Reader for streaming uploads, and will also take advantage of io.ReadSeeker for optimizations if the Body satisfies that type. Once the Uploader instance is created you can call Upload concurrently from multiple goroutines safely.

// The session the S3 Uploader will use
sess := session.Must(session.NewSession())

// Create an uploader with the session and default options
uploader := s3manager.NewUploader(sess)

f, err  := os.Open(filename)
if err != nil {
    return fmt.Errorf("failed to open file %q, %v", filename, err)
}

// Upload the file to S3.
result, err := uploader.Upload(&s3manager.UploadInput{
    Bucket: aws.String(myBucket),
    Key:    aws.String(myString),
    Body:   f,
})
if err != nil {
    return fmt.Errorf("failed to upload file, %v", err)
}
fmt.Printf("file uploaded to, %s\n", aws.StringValue(result.Location))

See the s3manager package's Uploader type documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Uploader

Download Manager

The s3manager package's Downloader provides concurrently downloading of Objects from S3. The Downloader will write S3 Object content with an io.WriterAt. Once the Downloader instance is created you can call Download concurrently from multiple goroutines safely.

// The session the S3 Downloader will use
sess := session.Must(session.NewSession())

// Create a downloader with the session and default options
downloader := s3manager.NewDownloader(sess)

// Create a file to write the S3 Object contents to.
f, err := os.Create(filename)
if err != nil {
    return fmt.Errorf("failed to create file %q, %v", filename, err)
}

// Write the contents of S3 Object to the file
n, err := downloader.Download(f, &s3.GetObjectInput{
    Bucket: aws.String(myBucket),
    Key:    aws.String(myString),
})
if err != nil {
    return fmt.Errorf("failed to download file, %v", err)
}
fmt.Printf("file downloaded, %d bytes\n", n)

See the s3manager package's Downloader type documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader

Get Bucket Region

GetBucketRegion will attempt to get the region for a bucket using a region hint to determine which AWS partition to perform the query on. Use this utility to determine the region a bucket is in.

sess := session.Must(session.NewSession())

bucket := "my-bucket"
region, err := s3manager.GetBucketRegion(ctx, sess, bucket, "us-west-2")
if err != nil {
    if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" {
         fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket)
    }
    return err
}
fmt.Printf("Bucket %s is in %s region\n", bucket, region)

See the s3manager package's GetBucketRegion function documentation for more information https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion

S3 Crypto Client

The s3crypto package provides the tools to upload and download encrypted content from S3. The Encryption and Decryption clients can be used concurrently once the client is created.

sess := session.Must(session.NewSession())

// Create the decryption client.
svc := s3crypto.NewDecryptionClient(sess)

// The object will be downloaded from S3 and decrypted locally. By metadata
// about the object's encryption will instruct the decryption client how
// decrypt the content of the object. By default KMS is used for keys.
result, err := svc.GetObject(&s3.GetObjectInput {
    Bucket: aws.String(myBucket),
    Key: aws.String(myKey),
})

See the s3crypto package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3crypto/

Index

Examples

Constants

View Source
const (
	// BucketAccelerateStatusEnabled is a BucketAccelerateStatus enum value
	BucketAccelerateStatusEnabled = "Enabled"

	// BucketAccelerateStatusSuspended is a BucketAccelerateStatus enum value
	BucketAccelerateStatusSuspended = "Suspended"
)
View Source
const (
	// BucketCannedACLPrivate is a BucketCannedACL enum value
	BucketCannedACLPrivate = "private"

	// BucketCannedACLPublicRead is a BucketCannedACL enum value
	BucketCannedACLPublicRead = "public-read"

	// BucketCannedACLPublicReadWrite is a BucketCannedACL enum value
	BucketCannedACLPublicReadWrite = "public-read-write"

	// BucketCannedACLAuthenticatedRead is a BucketCannedACL enum value
	BucketCannedACLAuthenticatedRead = "authenticated-read"
)
View Source
const (
	// BucketLocationConstraintEu is a BucketLocationConstraint enum value
	BucketLocationConstraintEu = "EU"

	// BucketLocationConstraintEuWest1 is a BucketLocationConstraint enum value
	BucketLocationConstraintEuWest1 = "eu-west-1"

	// BucketLocationConstraintUsWest1 is a BucketLocationConstraint enum value
	BucketLocationConstraintUsWest1 = "us-west-1"

	// BucketLocationConstraintUsWest2 is a BucketLocationConstraint enum value
	BucketLocationConstraintUsWest2 = "us-west-2"

	// BucketLocationConstraintApSouth1 is a BucketLocationConstraint enum value
	BucketLocationConstraintApSouth1 = "ap-south-1"

	// BucketLocationConstraintApSoutheast1 is a BucketLocationConstraint enum value
	BucketLocationConstraintApSoutheast1 = "ap-southeast-1"

	// BucketLocationConstraintApSoutheast2 is a BucketLocationConstraint enum value
	BucketLocationConstraintApSoutheast2 = "ap-southeast-2"

	// BucketLocationConstraintApNortheast1 is a BucketLocationConstraint enum value
	BucketLocationConstraintApNortheast1 = "ap-northeast-1"

	// BucketLocationConstraintSaEast1 is a BucketLocationConstraint enum value
	BucketLocationConstraintSaEast1 = "sa-east-1"

	// BucketLocationConstraintCnNorth1 is a BucketLocationConstraint enum value
	BucketLocationConstraintCnNorth1 = "cn-north-1"

	// BucketLocationConstraintEuCentral1 is a BucketLocationConstraint enum value
	BucketLocationConstraintEuCentral1 = "eu-central-1"
)
View Source
const (
	// BucketLogsPermissionFullControl is a BucketLogsPermission enum value
	BucketLogsPermissionFullControl = "FULL_CONTROL"

	// BucketLogsPermissionRead is a BucketLogsPermission enum value
	BucketLogsPermissionRead = "READ"

	// BucketLogsPermissionWrite is a BucketLogsPermission enum value
	BucketLogsPermissionWrite = "WRITE"
)
View Source
const (
	// BucketVersioningStatusEnabled is a BucketVersioningStatus enum value
	BucketVersioningStatusEnabled = "Enabled"

	// BucketVersioningStatusSuspended is a BucketVersioningStatus enum value
	BucketVersioningStatusSuspended = "Suspended"
)
View Source
const (
	// CompressionTypeNone is a CompressionType enum value
	CompressionTypeNone = "NONE"

	// CompressionTypeGzip is a CompressionType enum value
	CompressionTypeGzip = "GZIP"

	// CompressionTypeBzip2 is a CompressionType enum value
	CompressionTypeBzip2 = "BZIP2"
)
View Source
const (
	// EventS3ReducedRedundancyLostObject is a Event enum value
	EventS3ReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject"

	// EventS3ObjectCreated is a Event enum value
	EventS3ObjectCreated = "s3:ObjectCreated:*"

	// EventS3ObjectCreatedPut is a Event enum value
	EventS3ObjectCreatedPut = "s3:ObjectCreated:Put"

	// EventS3ObjectCreatedPost is a Event enum value
	EventS3ObjectCreatedPost = "s3:ObjectCreated:Post"

	// EventS3ObjectCreatedCopy is a Event enum value
	EventS3ObjectCreatedCopy = "s3:ObjectCreated:Copy"

	// EventS3ObjectCreatedCompleteMultipartUpload is a Event enum value
	EventS3ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload"

	// EventS3ObjectRemoved is a Event enum value
	EventS3ObjectRemoved = "s3:ObjectRemoved:*"

	// EventS3ObjectRemovedDelete is a Event enum value
	EventS3ObjectRemovedDelete = "s3:ObjectRemoved:Delete"

	// EventS3ObjectRemovedDeleteMarkerCreated is a Event enum value
	EventS3ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated"
)

Bucket event for which to send notifications.

View Source
const (
	// ExpirationStatusEnabled is a ExpirationStatus enum value
	ExpirationStatusEnabled = "Enabled"

	// ExpirationStatusDisabled is a ExpirationStatus enum value
	ExpirationStatusDisabled = "Disabled"
)
View Source
const (
	// FileHeaderInfoUse is a FileHeaderInfo enum value
	FileHeaderInfoUse = "USE"

	// FileHeaderInfoIgnore is a FileHeaderInfo enum value
	FileHeaderInfoIgnore = "IGNORE"

	// FileHeaderInfoNone is a FileHeaderInfo enum value
	FileHeaderInfoNone = "NONE"
)
View Source
const (
	// FilterRuleNamePrefix is a FilterRuleName enum value
	FilterRuleNamePrefix = "prefix"

	// FilterRuleNameSuffix is a FilterRuleName enum value
	FilterRuleNameSuffix = "suffix"
)
View Source
const (
	// InventoryFormatCsv is a InventoryFormat enum value
	InventoryFormatCsv = "CSV"

	// InventoryFormatOrc is a InventoryFormat enum value
	InventoryFormatOrc = "ORC"
)
View Source
const (
	// InventoryFrequencyDaily is a InventoryFrequency enum value
	InventoryFrequencyDaily = "Daily"

	// InventoryFrequencyWeekly is a InventoryFrequency enum value
	InventoryFrequencyWeekly = "Weekly"
)
View Source
const (
	// InventoryIncludedObjectVersionsAll is a InventoryIncludedObjectVersions enum value
	InventoryIncludedObjectVersionsAll = "All"

	// InventoryIncludedObjectVersionsCurrent is a InventoryIncludedObjectVersions enum value
	InventoryIncludedObjectVersionsCurrent = "Current"
)
View Source
const (
	// InventoryOptionalFieldSize is a InventoryOptionalField enum value
	InventoryOptionalFieldSize = "Size"

	// InventoryOptionalFieldLastModifiedDate is a InventoryOptionalField enum value
	InventoryOptionalFieldLastModifiedDate = "LastModifiedDate"

	// InventoryOptionalFieldStorageClass is a InventoryOptionalField enum value
	InventoryOptionalFieldStorageClass = "StorageClass"

	// InventoryOptionalFieldEtag is a InventoryOptionalField enum value
	InventoryOptionalFieldEtag = "ETag"

	// InventoryOptionalFieldIsMultipartUploaded is a InventoryOptionalField enum value
	InventoryOptionalFieldIsMultipartUploaded = "IsMultipartUploaded"

	// InventoryOptionalFieldReplicationStatus is a InventoryOptionalField enum value
	InventoryOptionalFieldReplicationStatus = "ReplicationStatus"

	// InventoryOptionalFieldEncryptionStatus is a InventoryOptionalField enum value
	InventoryOptionalFieldEncryptionStatus = "EncryptionStatus"
)
View Source
const (
	// JSONTypeDocument is a JSONType enum value
	JSONTypeDocument = "DOCUMENT"

	// JSONTypeLines is a JSONType enum value
	JSONTypeLines = "LINES"
)
View Source
const (
	// MFADeleteEnabled is a MFADelete enum value
	MFADeleteEnabled = "Enabled"

	// MFADeleteDisabled is a MFADelete enum value
	MFADeleteDisabled = "Disabled"
)
View Source
const (
	// MFADeleteStatusEnabled is a MFADeleteStatus enum value
	MFADeleteStatusEnabled = "Enabled"

	// MFADeleteStatusDisabled is a MFADeleteStatus enum value
	MFADeleteStatusDisabled = "Disabled"
)
View Source
const (
	// MetadataDirectiveCopy is a MetadataDirective enum value
	MetadataDirectiveCopy = "COPY"

	// MetadataDirectiveReplace is a MetadataDirective enum value
	MetadataDirectiveReplace = "REPLACE"
)
View Source
const (
	// ObjectCannedACLPrivate is a ObjectCannedACL enum value
	ObjectCannedACLPrivate = "private"

	// ObjectCannedACLPublicRead is a ObjectCannedACL enum value
	ObjectCannedACLPublicRead = "public-read"

	// ObjectCannedACLPublicReadWrite is a ObjectCannedACL enum value
	ObjectCannedACLPublicReadWrite = "public-read-write"

	// ObjectCannedACLAuthenticatedRead is a ObjectCannedACL enum value
	ObjectCannedACLAuthenticatedRead = "authenticated-read"

	// ObjectCannedACLAwsExecRead is a ObjectCannedACL enum value
	ObjectCannedACLAwsExecRead = "aws-exec-read"

	// ObjectCannedACLBucketOwnerRead is a ObjectCannedACL enum value
	ObjectCannedACLBucketOwnerRead = "bucket-owner-read"

	// ObjectCannedACLBucketOwnerFullControl is a ObjectCannedACL enum value
	ObjectCannedACLBucketOwnerFullControl = "bucket-owner-full-control"
)
View Source
const (
	// ObjectStorageClassStandard is a ObjectStorageClass enum value
	ObjectStorageClassStandard = "STANDARD"

	// ObjectStorageClassReducedRedundancy is a ObjectStorageClass enum value
	ObjectStorageClassReducedRedundancy = "REDUCED_REDUNDANCY"

	// ObjectStorageClassGlacier is a ObjectStorageClass enum value
	ObjectStorageClassGlacier = "GLACIER"

	// ObjectStorageClassStandardIa is a ObjectStorageClass enum value
	ObjectStorageClassStandardIa = "STANDARD_IA"

	// ObjectStorageClassOnezoneIa is a ObjectStorageClass enum value
	ObjectStorageClassOnezoneIa = "ONEZONE_IA"
)
View Source
const (
	// PayerRequester is a Payer enum value
	PayerRequester = "Requester"

	// PayerBucketOwner is a Payer enum value
	PayerBucketOwner = "BucketOwner"
)
View Source
const (
	// PermissionFullControl is a Permission enum value
	PermissionFullControl = "FULL_CONTROL"

	// PermissionWrite is a Permission enum value
	PermissionWrite = "WRITE"

	// PermissionWriteAcp is a Permission enum value
	PermissionWriteAcp = "WRITE_ACP"

	// PermissionRead is a Permission enum value
	PermissionRead = "READ"

	// PermissionReadAcp is a Permission enum value
	PermissionReadAcp = "READ_ACP"
)
View Source
const (
	// ProtocolHttp is a Protocol enum value
	ProtocolHttp = "http"

	// ProtocolHttps is a Protocol enum value
	ProtocolHttps = "https"
)
View Source
const (
	// QuoteFieldsAlways is a QuoteFields enum value
	QuoteFieldsAlways = "ALWAYS"

	// QuoteFieldsAsneeded is a QuoteFields enum value
	QuoteFieldsAsneeded = "ASNEEDED"
)
View Source
const (
	// ReplicationRuleStatusEnabled is a ReplicationRuleStatus enum value
	ReplicationRuleStatusEnabled = "Enabled"

	// ReplicationRuleStatusDisabled is a ReplicationRuleStatus enum value
	ReplicationRuleStatusDisabled = "Disabled"
)
View Source
const (
	// ReplicationStatusComplete is a ReplicationStatus enum value
	ReplicationStatusComplete = "COMPLETE"

	// ReplicationStatusPending is a ReplicationStatus enum value
	ReplicationStatusPending = "PENDING"

	// ReplicationStatusFailed is a ReplicationStatus enum value
	ReplicationStatusFailed = "FAILED"

	// ReplicationStatusReplica is a ReplicationStatus enum value
	ReplicationStatusReplica = "REPLICA"
)
View Source
const (
	// ServerSideEncryptionAes256 is a ServerSideEncryption enum value
	ServerSideEncryptionAes256 = "AES256"

	// ServerSideEncryptionAwsKms is a ServerSideEncryption enum value
	ServerSideEncryptionAwsKms = "aws:kms"
)
View Source
const (
	// SseKmsEncryptedObjectsStatusEnabled is a SseKmsEncryptedObjectsStatus enum value
	SseKmsEncryptedObjectsStatusEnabled = "Enabled"

	// SseKmsEncryptedObjectsStatusDisabled is a SseKmsEncryptedObjectsStatus enum value
	SseKmsEncryptedObjectsStatusDisabled = "Disabled"
)
View Source
const (
	// StorageClassStandard is a StorageClass enum value
	StorageClassStandard = "STANDARD"

	// StorageClassReducedRedundancy is a StorageClass enum value
	StorageClassReducedRedundancy = "REDUCED_REDUNDANCY"

	// StorageClassStandardIa is a StorageClass enum value
	StorageClassStandardIa = "STANDARD_IA"

	// StorageClassOnezoneIa is a StorageClass enum value
	StorageClassOnezoneIa = "ONEZONE_IA"
)
View Source
const (
	// TaggingDirectiveCopy is a TaggingDirective enum value
	TaggingDirectiveCopy = "COPY"

	// TaggingDirectiveReplace is a TaggingDirective enum value
	TaggingDirectiveReplace = "REPLACE"
)
View Source
const (
	// TierStandard is a Tier enum value
	TierStandard = "Standard"

	// TierBulk is a Tier enum value
	TierBulk = "Bulk"

	// TierExpedited is a Tier enum value
	TierExpedited = "Expedited"
)
View Source
const (
	// TransitionStorageClassGlacier is a TransitionStorageClass enum value
	TransitionStorageClassGlacier = "GLACIER"

	// TransitionStorageClassStandardIa is a TransitionStorageClass enum value
	TransitionStorageClassStandardIa = "STANDARD_IA"

	// TransitionStorageClassOnezoneIa is a TransitionStorageClass enum value
	TransitionStorageClassOnezoneIa = "ONEZONE_IA"
)
View Source
const (
	// TypeCanonicalUser is a Type enum value
	TypeCanonicalUser = "CanonicalUser"

	// TypeAmazonCustomerByEmail is a Type enum value
	TypeAmazonCustomerByEmail = "AmazonCustomerByEmail"

	// TypeGroup is a Type enum value
	TypeGroup = "Group"
)
View Source
const (

	// ErrCodeBucketAlreadyExists for service response error code
	// "BucketAlreadyExists".
	//
	// The requested bucket name is not available. The bucket namespace is shared
	// by all users of the system. Please select a different name and try again.
	ErrCodeBucketAlreadyExists = "BucketAlreadyExists"

	// ErrCodeBucketAlreadyOwnedByYou for service response error code
	// "BucketAlreadyOwnedByYou".
	ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou"

	// ErrCodeNoSuchBucket for service response error code
	// "NoSuchBucket".
	//
	// The specified bucket does not exist.
	ErrCodeNoSuchBucket = "NoSuchBucket"

	// ErrCodeNoSuchKey for service response error code
	// "NoSuchKey".
	//
	// The specified key does not exist.
	ErrCodeNoSuchKey = "NoSuchKey"

	// ErrCodeNoSuchUpload for service response error code
	// "NoSuchUpload".
	//
	// The specified multipart upload does not exist.
	ErrCodeNoSuchUpload = "NoSuchUpload"

	// ErrCodeObjectAlreadyInActiveTierError for service response error code
	// "ObjectAlreadyInActiveTierError".
	//
	// This operation is not allowed against this storage tier
	ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError"

	// ErrCodeObjectNotInActiveTierError for service response error code
	// "ObjectNotInActiveTierError".
	//
	// The source object of the COPY operation is not in the active tier and is
	// only stored in Amazon Glacier.
	ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError"
)
View Source
const (
	ServiceName = "s3"        // Name of service.
	EndpointsID = ServiceName // ID to lookup a service endpoint with.
	ServiceID   = "S3"        // ServiceID is a unique identifer of a specific service.
)

Service information constants

View Source
const (
	// AnalyticsS3ExportFileFormatCsv is a AnalyticsS3ExportFileFormat enum value
	AnalyticsS3ExportFileFormatCsv = "CSV"
)
View Source
const (
	// EncodingTypeUrl is a EncodingType enum value
	EncodingTypeUrl = "url"
)

Requests Amazon S3 to encode the object keys in the response and specifies the encoding method to use. An object key may contain any Unicode character; however, XML 1.0 parser cannot parse some characters, such as characters with an ASCII value from 0 to 10. For characters that are not supported in XML 1.0, you can add this parameter to request that Amazon S3 encode the keys in the response.

View Source
const (
	// ExpressionTypeSql is a ExpressionType enum value
	ExpressionTypeSql = "SQL"
)
View Source
const (
	// ObjectVersionStorageClassStandard is a ObjectVersionStorageClass enum value
	ObjectVersionStorageClassStandard = "STANDARD"
)
View Source
const (
	// OwnerOverrideDestination is a OwnerOverride enum value
	OwnerOverrideDestination = "Destination"
)
View Source
const (
	// RequestChargedRequester is a RequestCharged enum value
	RequestChargedRequester = "requester"
)

If present, indicates that the requester was successfully charged for the request.

View Source
const (
	// RequestPayerRequester is a RequestPayer enum value
	RequestPayerRequester = "requester"
)

Confirms that the requester knows that she or he will be charged for the request. Bucket owners need not specify this parameter in their requests. Documentation on downloading objects from requester pays buckets can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html

View Source
const (
	// RestoreRequestTypeSelect is a RestoreRequestType enum value
	RestoreRequestTypeSelect = "SELECT"
)
View Source
const (
	// StorageClassAnalysisSchemaVersionV1 is a StorageClassAnalysisSchemaVersion enum value
	StorageClassAnalysisSchemaVersionV1 = "V_1"
)

Variables

View Source
var NormalizeBucketLocationHandler = request.NamedHandler{
	Name: "awssdk.s3.NormalizeBucketLocation",
	Fn: func(req *request.Request) {
		if req.Error != nil {
			return
		}

		out := req.Data.(*GetBucketLocationOutput)
		loc := NormalizeBucketLocation(aws.StringValue(out.LocationConstraint))
		out.LocationConstraint = aws.String(loc)
	},
}

NormalizeBucketLocationHandler is a request handler which will update the GetBucketLocation's result LocationConstraint value to always be a region ID.

Replaces empty string with "us-east-1", and "EU" with "eu-west-1".

See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html for more information on the values that can be returned.

req, result := svc.GetBucketLocationRequest(&s3.GetBucketLocationInput{
    Bucket: aws.String(bucket),
})
req.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler)
err := req.Send()

Functions

func NormalizeBucketLocation added in v1.8.15

func NormalizeBucketLocation(loc string) string

NormalizeBucketLocation is a utility function which will update the passed in value to always be a region ID. Generally this would be used with GetBucketLocation API operation.

Replaces empty string with "us-east-1", and "EU" with "eu-west-1".

See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html for more information on the values that can be returned.

func WithNormalizeBucketLocation added in v1.8.15

func WithNormalizeBucketLocation(r *request.Request)

WithNormalizeBucketLocation is a request option which will update the GetBucketLocation's result LocationConstraint value to always be a region ID.

Replaces empty string with "us-east-1", and "EU" with "eu-west-1".

See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html for more information on the values that can be returned.

result, err := svc.GetBucketLocationWithContext(ctx,
    &s3.GetBucketLocationInput{
        Bucket: aws.String(bucket),
    },
    s3.WithNormalizeBucketLocation,
)

Types

type AbortIncompleteMultipartUpload added in v1.1.12

type AbortIncompleteMultipartUpload struct {

	// Indicates the number of days that must pass since initiation for Lifecycle
	// to abort an Incomplete Multipart Upload.
	DaysAfterInitiation *int64 `type:"integer"`
	// contains filtered or unexported fields
}

Specifies the days since the initiation of an Incomplete Multipart Upload that Lifecycle will wait before permanently removing all parts of the upload.

func (AbortIncompleteMultipartUpload) GoString added in v1.1.12

GoString returns the string representation

func (*AbortIncompleteMultipartUpload) SetDaysAfterInitiation added in v1.5.0

SetDaysAfterInitiation sets the DaysAfterInitiation field's value.

func (AbortIncompleteMultipartUpload) String added in v1.1.12

String returns the string representation

type AbortMultipartUploadInput

type AbortMultipartUploadInput struct {

	// Bucket is a required field
	Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"`

	// Key is a required field
	Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"`

	// Confirms that the requester knows that she or he will be charged for the
	// request. Bucket owners need not specify this parameter in their requests.
	// Documentation on downloading objects from requester pays buckets can be found
	// at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html
	RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"`

	// UploadId is a required field
	UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"`
	// contains filtered or unexported fields
}

func (AbortMultipartUploadInput) GoString added in v0.6.5

func (s AbortMultipartUploadInput) GoString() string

GoString returns the string representation

func (*AbortMultipartUploadInput) SetBucket added in v1.5.0

SetBucket sets the Bucket field's value.

func (*AbortMultipartUploadInput) SetKey added in v1.5.0

SetKey sets the Key field's value.

func (*AbortMultipartUploadInput) SetRequestPayer added in v1.5.0

SetRequestPayer sets the RequestPayer field's value.

func (*AbortMultipartUploadInput) SetUploadId added in v1.5.0

SetUploadId sets the UploadId field's value.

func (AbortMultipartUploadInput) String added in v0.6.5

func (s AbortMultipartUploadInput) String() string

String returns the string representation

func (*AbortMultipartUploadInput) Validate added in v1.1.21

func (s *AbortMultipartUploadInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AbortMultipartUploadOutput

type AbortMultipartUploadOutput struct {

	// If present, indicates that the requester was successfully charged for the
	// request.
	RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"`
	// contains filtered or unexported fields
}

func (AbortMultipartUploadOutput) GoString added in v0.6.5

func (s AbortMultipartUploadOutput) GoString() string

GoString returns the string representation

func (*AbortMultipartUploadOutput) SetRequestCharged added in v1.5.0

SetRequestCharged sets the RequestCharged field's value.

func (AbortMultipartUploadOutput) String added in v0.6.5

String returns the string representation

type AccelerateConfiguration added in v1.1.19

type AccelerateConfiguration struct {

	// The accelerate configuration of the bucket.
	Status *string `type:"string" enum:"BucketAccelerateStatus"`
	// contains filtered or unexported fields
}

func (AccelerateConfiguration) GoString added in v1.1.19

func (s AccelerateConfiguration) GoString() string

GoString returns the string representation

func (*AccelerateConfiguration) SetStatus added in v1.5.0

SetStatus sets the Status field's value.

func (AccelerateConfiguration) String added in v1.1.19

func (s AccelerateConfiguration) String() string

String returns the string representation

type AccessControlPolicy

type AccessControlPolicy struct {

	// A list of grants.
	Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"`

	Owner *Owner `type:"structure"`
	// contains filtered or unexported fields
}

func (AccessControlPolicy) GoString added in v0.6.5

func (s AccessControlPolicy) GoString() string

GoString returns the string representation

func (*AccessControlPolicy) SetGrants added in v1.5.0

func (s *AccessControlPolicy) SetGrants(v []*Grant) *AccessControlPolicy

SetGrants sets the Grants field's value.

func (*AccessControlPolicy) SetOwner added in v1.5.0

SetOwner sets the Owner field's value.

func (AccessControlPolicy) String added in v0.6.5

func (s AccessControlPolicy) String() string

String returns the string representation

func (*AccessControlPolicy) Validate added in v1.1.21

func (s *AccessControlPolicy) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AccessControlTranslation added in v1.12.24

type AccessControlTranslation struct {

	// The override value for the owner of the replica object.
	//
	// Owner is a required field
	Owner *string `type:"string" required:"true" enum:"OwnerOverride"`
	// contains filtered or unexported fields
}

Container for information regarding the access control for replicas.

func (AccessControlTranslation) GoString added in v1.12.24

func (s AccessControlTranslation) GoString() string

GoString returns the string representation

func (*AccessControlTranslation) SetOwner added in v1.12.24

SetOwner sets the Owner field's value.

func (AccessControlTranslation) String added in v1.12.24

func (s AccessControlTranslation) String() string

String returns the string representation

func (*AccessControlTranslation) Validate added in v1.12.24

func (s *AccessControlTranslation) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyticsAndOperator added in v1.5.11

type AnalyticsAndOperator struct {

	// The prefix to use when evaluating an AND predicate.
	Prefix *string `type:"string"`

	// The list of tags to use when evaluating an AND predicate.
	Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"`
	// contains filtered or unexported fields
}

func (AnalyticsAndOperator) GoString added in v1.5.11

func (s AnalyticsAndOperator) GoString() string

GoString returns the string representation

func (*AnalyticsAndOperator) SetPrefix added in v1.5.11

SetPrefix sets the Prefix field's value.

func (*AnalyticsAndOperator) SetTags added in v1.5.11

func (s *AnalyticsAndOperator) SetTags(v []*Tag) *AnalyticsAndOperator

SetTags sets the Tags field's value.

func (AnalyticsAndOperator) String added in v1.5.11

func (s AnalyticsAndOperator) String() string

String returns the string representation

func (*AnalyticsAndOperator) Validate added in v1.5.11

func (s *AnalyticsAndOperator) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyticsConfiguration added in v1.5.11

type AnalyticsConfiguration struct {

	// The filter used to describe a set of objects for analyses. A filter must
	// have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator).
	// If no filter is provided, all objects will be considered in any analysis.
	Filter *AnalyticsFilter `type:"structure"`

	// The identifier used to represent an analytics configuration.
	//
	// Id is a required field
	Id *string `type:"string" required:"true"`

	// If present, it indicates that data related to access patterns will be collected
	// and made available to analyze the tradeoffs between different storage classes.
	//
	// StorageClassAnalysis is a required field
	StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"`
	// contains filtered or unexported fields
}

func (AnalyticsConfiguration) GoString added in v1.5.11

func (s AnalyticsConfiguration) GoString() string

GoString returns the string representation

func (*AnalyticsConfiguration) SetFilter added in v1.5.11

SetFilter sets the Filter field's value.

func (*AnalyticsConfiguration) SetId added in v1.5.11

SetId sets the Id field's value.

func (*AnalyticsConfiguration) SetStorageClassAnalysis added in v1.5.11

func (s *AnalyticsConfiguration) SetStorageClassAnalysis(v *StorageClassAnalysis) *AnalyticsConfiguration

SetStorageClassAnalysis sets the StorageClassAnalysis field's value.

func (AnalyticsConfiguration) String added in v1.5.11

func (s AnalyticsConfiguration) String() string

String returns the string representation

func (*AnalyticsConfiguration) Validate added in v1.5.11

func (s *AnalyticsConfiguration) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyticsExportDestination added in v1.5.11

type AnalyticsExportDestination struct {

	// A destination signifying output to an S3 bucket.
	//
	// S3BucketDestination is a required field
	S3BucketDestination *AnalyticsS3BucketDestination `type:"structure" required:"true"`
	// contains filtered or unexported fields
}

func (AnalyticsExportDestination) GoString added in v1.5.11

func (s AnalyticsExportDestination) GoString() string

GoString returns the string representation

func (*AnalyticsExportDestination) SetS3BucketDestination added in v1.5.11

SetS3BucketDestination sets the S3BucketDestination field's value.

func (AnalyticsExportDestination) String added in v1.5.11

String returns the string representation

func (*AnalyticsExportDestination) Validate added in v1.5.11

func (s *AnalyticsExportDestination) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyticsFilter added in v1.5.11

type AnalyticsFilter struct {

	// A conjunction (logical AND) of predicates, which is used in evaluating an
	// analytics filter. The operator must have at least two predicates.
	And *AnalyticsAndOperator `type:"structure"`

	// The prefix to use when evaluating an analytics filter.
	Prefix *string `type:"string"`

	// The tag to use when evaluating an analytics filter.
	Tag *Tag `type:"structure"`
	// contains filtered or unexported fields
}

func (AnalyticsFilter) GoString added in v1.5.11

func (s AnalyticsFilter) GoString() string

GoString returns the string representation

func (*AnalyticsFilter) SetAnd added in v1.5.11

SetAnd sets the And field's value.

func (*AnalyticsFilter) SetPrefix added in v1.5.11

func (s *AnalyticsFilter) SetPrefix(v string) *AnalyticsFilter

SetPrefix sets the Prefix field's value.

func (*AnalyticsFilter) SetTag added in v1.5.11

func (s *AnalyticsFilter) SetTag(v *Tag) *AnalyticsFilter

SetTag sets the Tag field's value.

func (AnalyticsFilter) String added in v1.5.11

func (s AnalyticsFilter) String() string

String returns the string representation

func (*AnalyticsFilter) Validate added in v1.5.11

func (s *AnalyticsFilter) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type AnalyticsS3BucketDestination added in v1.5.11

type AnalyticsS3BucketDestination struct {

	// The Amazon resource name (ARN) of the bucket to which data is exported.
	//
	// Bucket is a required field
	Bucket *string `type:"string" required:"true"`

	// The account ID that owns the destination bucket. If no account ID is provided,
	// the owner will not be validated prior to exporting data.
	BucketAccountId *string `type:"string"`

	// The file format used when exporting data to Amazon S3.
	//
	// Format is a required field
	Format *string `type:"string" required:"true" enum:"AnalyticsS3ExportFileFormat"`

	// The prefix to use when exporting data. The exported data begins with this
	// prefix.
	Prefix *string `type:"string"`
	// contains filtered or unexported fields
}

func (AnalyticsS3BucketDestination) GoString added in v1.5.11

func (s AnalyticsS3BucketDestination) GoString() string

GoString returns the string representation

func (*AnalyticsS3BucketDestination) SetBucket added in v1.5.11

SetBucket sets the Bucket field's value.

func (*AnalyticsS3BucketDestination) SetBucketAccountId added in v1.5.11

SetBucketAccountId sets the BucketAccountId field's value.

func (*AnalyticsS3BucketDestination) SetFormat added in v1.5.11

SetFormat sets the Format field's value.

func (*AnalyticsS3BucketDestination) SetPrefix added in v1.5.11

SetPrefix sets the Prefix field's value.

func (AnalyticsS3BucketDestination) String added in v1.5.11

String returns the string representation

func (*AnalyticsS3BucketDestination) Validate added in v1.5.11

func (s *AnalyticsS3BucketDestination) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type Bucket

type Bucket struct {

	// Date the bucket was created.
	CreationDate *time.Time `type:"timestamp" timestampFormat:"iso8601"`

	// The name of the bucket.
	Name *string `type:"string"`
	// contains filtered or unexported fields
}

func (Bucket) GoString added in v0.6.5

func (s Bucket) GoString() string

GoString returns the string representation

func (*Bucket) SetCreationDate added in v1.5.0

func (s *Bucket) SetCreationDate(v time.Time) *Bucket

SetCreationDate sets the CreationDate field's value.

func (*Bucket) SetName added in v1.5.0

func (s *Bucket) SetName(v string) *Bucket

SetName sets the Name field's value.

func (Bucket) String added in v0.6.5

func (s Bucket) String() string

String returns the string representation

type BucketLifecycleConfiguration added in v0.9.8

type BucketLifecycleConfiguration struct {

	// Rules is a required field
	Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"`
	// contains filtered or unexported fields
}

func (BucketLifecycleConfiguration) GoString added in v0.9.8

func (s BucketLifecycleConfiguration) GoString() string

GoString returns the string representation

func (*BucketLifecycleConfiguration) SetRules added in v1.5.0

SetRules sets the Rules field's value.

func (BucketLifecycleConfiguration) String added in v0.9.8

String returns the string representation

func (*BucketLifecycleConfiguration) Validate added in v1.1.21

func (s *BucketLifecycleConfiguration) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type BucketLoggingStatus

type BucketLoggingStatus struct {

	// Container for logging information. Presence of this element indicates that
	// logging is enabled. Parameters TargetBucket and TargetPrefix are required
	// in this case.
	LoggingEnabled *LoggingEnabled `type:"structure"`
	// contains filtered or unexported fields
}

func (BucketLoggingStatus) GoString added in v0.6.5

func (s BucketLoggingStatus) GoString() string

GoString returns the string representation

func (*BucketLoggingStatus) SetLoggingEnabled added in v1.5.0

func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggingStatus

SetLoggingEnabled sets the LoggingEnabled field's value.

func (BucketLoggingStatus) String added in v0.6.5

func (s BucketLoggingStatus) String() string

String returns the string representation

func (*BucketLoggingStatus) Validate added in v1.1.21

func (s *BucketLoggingStatus) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CORSConfiguration

type CORSConfiguration struct {

	// CORSRules is a required field
	CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"`
	// contains filtered or unexported fields
}

func (CORSConfiguration) GoString added in v0.6.5

func (s CORSConfiguration) GoString() string

GoString returns the string representation

func (*CORSConfiguration) SetCORSRules added in v1.5.0

func (s *CORSConfiguration) SetCORSRules(v []*CORSRule) *CORSConfiguration

SetCORSRules sets the CORSRules field's value.

func (CORSConfiguration) String added in v0.6.5

func (s CORSConfiguration) String() string

String returns the string representation

func (*CORSConfiguration) Validate added in v1.1.21

func (s *CORSConfiguration) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type CORSRule

type CORSRule struct {

	// Specifies which headers are allowed in a pre-flight OPTIONS request.
	AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"`

	// Identifies HTTP methods that the domain/origin specified in the rule is allowed
	// to execute.
	//
	// AllowedMethods is a required field
	AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"`

	// One or more origins you want customers to be able to access the bucket from.
	//
	// AllowedOrigins is a required field
	AllowedOrigins []*string `locationName:"AllowedOrigin" type:"list" flattened:"true" required:"true"`

	// One or more headers in the response that you want customers to be able to
	// access from their applications (for example, from a JavaScript XMLHttpRequest
	// object).
	ExposeHeaders []*string `locationName:"ExposeHeader" type:"list" flattened:"true"`

	// The time in seconds that your browser is to cache the preflight response
	// for the specified resource.
	MaxAgeSeconds *int64 `type:"integer"`
	// contains filtered or unexported fields
}

func (CORSRule) <