Documentation ¶
Index ¶
- Constants
- Variables
- func IsErr(err error, code ErrCode) bool
- func RetryLongTermOperations[T any](ctx context.Context, f func() (T, error)) (T, error)
- func RetryOnCodes[T any](ctx context.Context, codes []ErrCode, f func() (T, error)) (T, error)
- func S3TagsToRaw(tags []*s3.Tag) map[string]string
- func TagsToRaw(tags []Tag) map[string]string
- func TagsToS3(tags []Tag) []*s3.Tag
- func TransitionHash(v interface{}) int
- type Bucket
- type BucketACL
- type CORSRule
- type Client
- func (c *Client) CreateBucket(ctx context.Context, bucket string, acl BucketACL) error
- func (c *Client) CreateObject(ctx context.Context, data CreationData) (bool, error)
- func (c *Client) DeleteBucket(ctx context.Context, bucket string, force bool) error
- func (c *Client) DeleteObject(ctx context.Context, bucket, key string) error
- func (c *Client) GetBucket(ctx context.Context, bucket, endpoint, acl string) (*Bucket, error)
- func (c *Client) GetObject(ctx context.Context, bucket, key string) (*Object, error)
- func (c *Client) S3() *s3.S3
- func (c *Client) UpdateBucketACL(ctx context.Context, bucket string, acl BucketACL) error
- func (c *Client) UpdateBucketCORS(ctx context.Context, bucket string, rules []CORSRule) error
- func (c *Client) UpdateBucketGrants(ctx context.Context, bucket string, grants []Grant) error
- func (c *Client) UpdateBucketLifecycle(ctx context.Context, bucket string, rules []LifecycleRule) error
- func (c *Client) UpdateBucketLogging(ctx context.Context, bucket string, loggingStatus LoggingStatus) error
- func (c *Client) UpdateBucketObjectLock(ctx context.Context, bucket string, lock ObjectLock) error
- func (c *Client) UpdateBucketPolicy(ctx context.Context, bucket, policy string) error
- func (c *Client) UpdateBucketServerSideEncryption(ctx context.Context, bucket string, rules []ServerSideEncryptionRule) error
- func (c *Client) UpdateBucketTags(ctx context.Context, bucket string, tags []Tag) error
- func (c *Client) UpdateBucketVersioning(ctx context.Context, bucket string, status VersioningStatus) error
- func (c *Client) UpdateBucketWebsite(ctx context.Context, bucket string, website *Website) error
- func (c *Client) UpdateObjectACL(ctx context.Context, bucket, key, acl string) error
- func (c *Client) UpdateObjectLegalHold(ctx context.Context, bucket, key, status string) error
- func (c *Client) UpdateObjectRetention(ctx context.Context, bucket, key string, retention *ObjectRetention) error
- func (c *Client) UpdateObjectTags(ctx context.Context, bucket, key string, tags []Tag) error
- type CreationData
- type ErrCode
- type Grant
- type Grantee
- type LifecycleAbortIncompleteMultipartUpload
- type LifecycleExpiration
- type LifecycleNoncurrentVersionExpiration
- type LifecycleNoncurrentVersionTransition
- type LifecycleRule
- type LifecycleRuleAndOperator
- type LifecycleRuleFilter
- type LifecycleTransition
- type LoggingStatus
- type Object
- type ObjectLock
- type ObjectLockRule
- type ObjectRetention
- type RedirectAllRequestsTo
- type ServerSideEncryptionRule
- type Source
- type SourceType
- type Tag
- type VersioningStatus
- type Website
- type WebsiteInfo
Constants ¶
View Source
const ( StorageClassStandard = s3.StorageClassStandardIa StorageClassCold = "COLD" StorageClassIce = "ICE" )
View Source
const ( TypeCanonicalUser = s3.TypeCanonicalUser TypeGroup = s3.TypeGroup )
View Source
const ( PermissionFullControl = s3.PermissionFullControl PermissionRead = s3.PermissionRead PermissionWrite = s3.PermissionWrite )
View Source
const (
ObjectLockEnabled = s3.ObjectLockEnabledEnabled
)
View Source
const (
ServerSideEncryptionAwsKms = s3.ServerSideEncryptionAwsKms
)
Variables ¶
View Source
var ( ObjectLockEnabledValues = s3.ObjectLockEnabled_Values() ObjectLockRetentionModeValues = s3.ObjectLockRetentionMode_Values() ObjectLockLegalHoldStatusValues = s3.ObjectLockLegalHoldStatus_Values() )
View Source
var ErrBucketNotFound = errors.New("bucket not found")
View Source
var ErrObjectNotFound = errors.New("object not found")
Functions ¶
func IsErr ¶
IsErr returns true if the error matches all these conditions:
- err is of type awserr.Error
- Error.Code() matches code
func RetryLongTermOperations ¶
RetryLongTermOperations retries on some AWS codes because some previous operations are asynchronous and need to wait for the result.
func RetryOnCodes ¶
func TransitionHash ¶
func TransitionHash(v interface{}) int
Types ¶
type Bucket ¶
type Bucket struct { DomainName string Policy string CORSRules []map[string]interface{} Website *WebsiteInfo Grants []interface{} Versioning []map[string]interface{} ObjectLock []map[string]interface{} Logging []map[string]interface{} Lifecycle []map[string]interface{} Encryption []map[string]interface{} Tags []Tag }
type BucketACL ¶
type BucketACL string
const ( BucketACLOwnerFullControl BucketACL = "bucket-owner-full-control" BucketACLPublicRead BucketACL = s3.BucketCannedACLPublicRead BucketACLPublicReadWrite BucketACL = s3.BucketCannedACLPublicReadWrite BucketACLAuthRead BucketACL = s3.BucketCannedACLAuthenticatedRead BucketACLPrivate BucketACL = s3.BucketCannedACLPrivate )
type CORSRule ¶
type CORSRule struct { MaxAgeSeconds int AllowedHeaders []*string AllowedMethods []*string AllowedOrigins []*string ExposeHeaders []*string }
func NewCORSRules ¶
func NewCORSRules(raw []interface{}) []CORSRule
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CreateBucket ¶
func (*Client) CreateObject ¶
CreateObject creates a new object in the bucket with the given key and source. It returns true if the object was created, false if it was not created (but no error occurred),
func (*Client) DeleteBucket ¶
func (*Client) DeleteObject ¶
func (*Client) S3 ¶
S3 use only for test for backward compatibility with old code do not use it in new code
func (*Client) UpdateBucketACL ¶
func (*Client) UpdateBucketCORS ¶
func (*Client) UpdateBucketGrants ¶
func (*Client) UpdateBucketLifecycle ¶
func (*Client) UpdateBucketLogging ¶
func (*Client) UpdateBucketObjectLock ¶
func (*Client) UpdateBucketPolicy ¶
func (*Client) UpdateBucketServerSideEncryption ¶
func (*Client) UpdateBucketTags ¶
func (*Client) UpdateBucketVersioning ¶
func (*Client) UpdateBucketWebsite ¶
func (*Client) UpdateObjectACL ¶
func (*Client) UpdateObjectLegalHold ¶
func (*Client) UpdateObjectRetention ¶
type CreationData ¶
type ErrCode ¶
type ErrCode string
const ( NoSuchBucket ErrCode = s3.ErrCodeNoSuchBucket AccessDenied ErrCode = "AccessDenied" BadRequest ErrCode = "BadRequest" Forbidden ErrCode = "Forbidden" MalformedPolicy ErrCode = "MalformedPolicy" BucketNotEmpty ErrCode = "BucketNotEmpty" NoSuchBucketPolicy ErrCode = "NoSuchBucketPolicy" NoSuchCORSConfiguration ErrCode = "NoSuchCORSConfiguration" NotImplemented ErrCode = "NotImplemented" NoSuchWebsiteConfiguration ErrCode = "NoSuchWebsiteConfiguration" ObjectLockConfigurationNotFoundError ErrCode = "ObjectLockConfigurationNotFoundError" NoSuchLifecycleConfiguration ErrCode = "NoSuchLifecycleConfiguration" ServerSideEncryptionConfigurationNotFoundError ErrCode = "ServerSideEncryptionConfigurationNotFoundError" NoSuchEncryptionConfiguration ErrCode = "NoSuchEncryptionConfiguration" )
type LifecycleAbortIncompleteMultipartUpload ¶
type LifecycleAbortIncompleteMultipartUpload struct {
DaysAfterInitiation *int64
}
type LifecycleExpiration ¶
type LifecycleNoncurrentVersionExpiration ¶
type LifecycleNoncurrentVersionExpiration struct {
NoncurrentDays *int64
}
type LifecycleRule ¶
type LifecycleRule struct { ID *string Status *string Filter *LifecycleRuleFilter Expiration *LifecycleExpiration AbortIncompleteMultipartUpload *LifecycleAbortIncompleteMultipartUpload NoncurrentVersionExpiration *LifecycleNoncurrentVersionExpiration Transitions []LifecycleTransition NoncurrentVersionTransitions []LifecycleNoncurrentVersionTransition }
func NewLifecycleRules ¶
func NewLifecycleRules(raw []interface{}, d *schema.ResourceData) ([]LifecycleRule, error)
type LifecycleRuleFilter ¶
type LifecycleRuleFilter struct { Prefix *string ObjectSizeGreaterThan *int64 ObjectSizeLessThan *int64 Tag *Tag And *LifecycleRuleAndOperator }
type LifecycleTransition ¶
type LoggingStatus ¶
func NewLoggingStatus ¶
func NewLoggingStatus(raw []interface{}) LoggingStatus
type ObjectLock ¶
type ObjectLock struct { Enabled bool Rule *ObjectLockRule }
func NewObjectLock ¶
func NewObjectLock(raw []interface{}) ObjectLock
type ObjectLockRule ¶
type ObjectRetention ¶
type RedirectAllRequestsTo ¶
type ServerSideEncryptionRule ¶
func NewServerSideEncryptionRules ¶
func NewServerSideEncryptionRules(raw []interface{}) []ServerSideEncryptionRule
type Source ¶
type Source struct { Type SourceType Value string }
type SourceType ¶
type SourceType string
const ( SourceTypeFile SourceType = "file" SourceTypeContent SourceType = "content" SourceTypeContentBase64 SourceType = "content_base64" )
type VersioningStatus ¶
type VersioningStatus string
const ( VersioningEnabled VersioningStatus = "Enabled" VersioningDisabled VersioningStatus = "Suspended" )
func NewVersioningStatus ¶
func NewVersioningStatus(raw []interface{}) VersioningStatus
type Website ¶
type Website struct { IndexDocument string ErrorDocument string RedirectAllRequestsTo *RedirectAllRequestsTo RoutingRules []*s3.RoutingRule }
func NewWebsite ¶
type WebsiteInfo ¶
Click to show internal directories.
Click to hide internal directories.