Documentation ¶
Index ¶
- Constants
- Variables
- func BucketCannedACLToStrings() []string
- func GetCommonPrefixDeduplicator(stream bool) func([]types.CommonPrefix) []string
- func ObjectCannedACLToStrings() []string
- func ObjectHeadersFromS3(o *s3.GetObjectOutput) map[string]string
- type ACL
- type BucketObjectOwnership
- type CORSRule
- type Client
- func (c *Client) AddBucketCORSRule(ctx context.Context, bucket string, cors *CORSRule) error
- func (c *Client) AddObjectMetadata(ctx context.Context, bucket, key string, metadata map[string]string) error
- func (c *Client) AddObjectsMetadata(ctx context.Context, bucket, prefix string, metadata map[string]string, ...) error
- func (c *Client) BucketVersioningStatus(ctx context.Context, bucket string) (output.Outputter, error)
- func (c *Client) CopyObject(ctx context.Context, bucket, key string) (*s3.CopyObjectInput, error)
- func (c *Client) CreateNewBucket(ctx context.Context, name, acl string) error
- func (c Client) DeleteBucket(ctx context.Context, bucket string, recursive bool) error
- func (c *Client) DeleteBucketCORS(ctx context.Context, bucket string) error
- func (c *Client) DeleteObjectHeaders(ctx context.Context, bucket, key string, headers []string) error
- func (c *Client) DeleteObjectMetadata(ctx context.Context, bucket, key string, mdKeys []string) error
- func (c *Client) DeleteObjects(ctx context.Context, bucket, prefix string, recursive bool) ([]types.DeletedObject, error)
- func (c *Client) DeleteObjectsHeaders(ctx context.Context, bucket, prefix string, headers []string, recursive bool) error
- func (c *Client) DeleteObjectsMetadata(ctx context.Context, bucket, prefix string, mdKeys []string, recursive bool) error
- func (c *Client) DownloadFile(ctx context.Context, bucket string, object *types.Object, dst string) error
- func (c *Client) DownloadFiles(ctx context.Context, config *DownloadConfig) error
- func (c *Client) EnableBucketVersioning(ctx context.Context, bucket string) error
- func (c *Client) EstimatePartSize(f *os.File) (int64, error)
- func (c *Client) ForEachObject(ctx context.Context, bucket, prefix string, recursive bool, ...) error
- func (c *Client) GenPresignedURL(ctx context.Context, method, bucket, key string, expires time.Duration) (string, error)
- func (c Client) GetBucketObjectOwnership(ctx context.Context, bucket string) (BucketObjectOwnership, error)
- func (c Client) GetBucketObjectOwnershipInfo(ctx context.Context, bucket string) (output.Outputter, error)
- func (c *Client) GetBucketVersioning(ctx context.Context, bucket string) (types.BucketVersioningStatus, error)
- func (c *Client) ListObjects(ctx context.Context, list listFunc[object.ObjectInterface], ...) (*object.ListObjectsOutput, error)
- func (c *Client) ListObjectsFunc(bucket, prefix string, recursive, stream bool) listFunc[object.ObjectInterface]
- func (c *Client) ListObjectsVersions(ctx context.Context, list listFunc[object.ObjectVersionInterface], ...) (*object.ListObjectsOutput, error)
- func (c *Client) ListVersionedObjectsFunc(bucket, prefix string, recursive, stream bool) listFunc[object.ObjectVersionInterface]
- func (c *Client) NewUploader(client s3manager.UploadAPIClient, options ...func(*s3manager.Uploader)) Uploader
- func (c *Client) SetBucketACL(ctx context.Context, bucket string, acl *ACL) error
- func (c Client) SetBucketObjectOwnership(ctx context.Context, bucket string, ownership BucketObjectOwnership) error
- func (c *Client) SetObjectACL(ctx context.Context, bucket, key string, acl *ACL) error
- func (c *Client) SetObjectsACL(ctx context.Context, bucket, prefix string, acl *ACL, recursive bool) error
- func (c *Client) ShowBucket(ctx context.Context, bucket string) (output.Outputter, error)
- func (c *Client) ShowObject(ctx context.Context, bucket, key string) (*ShowObjectOutput, error)
- func (c *Client) SuspendBucketVersioning(ctx context.Context, bucket string) error
- func (c *Client) UpdateObjectHeaders(ctx context.Context, bucket, key string, headers map[string]*string) error
- func (c *Client) UpdateObjectsHeaders(ctx context.Context, bucket, prefix string, headers map[string]*string, ...) error
- func (c *Client) UploadFile(ctx context.Context, bucket, file, key, acl string) error
- func (c *Client) UploadFiles(ctx context.Context, sources []string, config *StorageUploadConfig) error
- type ClientOpt
- type DownloadConfig
- type ListBucketsItemOutput
- type ListBucketsOutput
- type ObjectListing
- type S3API
- type ShowBucketOutput
- type ShowObjectOutput
- type StorageUploadConfig
- type Uploader
Constants ¶
View Source
const ( ACLGranteeAllUsers = "http://acs.amazonaws.com/groups/global/AllUsers" ACLGranteeAuthenticatedUsers = "http://acs.amazonaws.com/groups/global/AuthenticatedUsers" SetACLCmdFlagRead = "read" SetACLCmdFlagWrite = "write" SetACLCmdFlagReadACP = "read-acp" SetACLCmdFlagWriteACP = "write-acp" SetACLCmdFlagFullControl = "full-control" )
View Source
const ( ObjectHeaderCacheControl = "Cache-Control" ObjectHeaderContentDisposition = "Content-Disposition" ObjectHeaderContentEncoding = "Content-Encoding" ObjectHeaderContentLanguage = "Content-Language" ObjectHeaderContentType = "Content-Type" ObjectHeaderExpires = "Expires" )
View Source
const (
BucketPrefix = "sos://"
)
View Source
const MetadataForbiddenCharset = `()<>@,;!:\\'&"/[]?_={} `
Variables ¶
View Source
var ( // CommonConfigOptFns represents the list of AWS SDK configuration options common // to all commands. In addition to those, some commands can/must set additional options // specific to their execution context. CommonConfigOptFns []func(*awsconfig.LoadOptions) error ClientNewUploaderDefaultFunc = s3manager.NewUploader )
Functions ¶
func BucketCannedACLToStrings ¶
func BucketCannedACLToStrings() []string
func GetCommonPrefixDeduplicator ¶ added in v1.71.0
func GetCommonPrefixDeduplicator(stream bool) func([]types.CommonPrefix) []string
func ObjectCannedACLToStrings ¶
func ObjectCannedACLToStrings() []string
func ObjectHeadersFromS3 ¶
func ObjectHeadersFromS3(o *s3.GetObjectOutput) map[string]string
ObjectHeadersFromS3 returns mutable object headers in a human-friendly key/value form.
Types ¶
type ACL ¶
type BucketObjectOwnership ¶
type BucketObjectOwnership string
const ( ObjectOwnershipObjectWriter BucketObjectOwnership = BucketObjectOwnership(types.ObjectOwnershipObjectWriter) ObjectOwnershipBucketOwnerPreferred BucketObjectOwnership = BucketObjectOwnership(types.ObjectOwnershipBucketOwnerPreferred) ObjectOwnershipBucketOwnerEnforced BucketObjectOwnership = "BucketOwnerEnforced" )
type CORSRule ¶
type CORSRule struct { AllowedOrigins []string `json:"allowed_origins,omitempty"` AllowedMethods []string `json:"allowed_methods,omitempty"` AllowedHeaders []string `json:"allowed_headers,omitempty"` }
func CORSRulesFromS3 ¶
func CORSRulesFromS3(v *s3.GetBucketCorsOutput) []CORSRule
CORSRulesFromS3 converts a list of S3 CORS rules to a list of CORSRule.
type Client ¶
type Client struct { S3Client S3API Zone string NewUploaderFunc func(client s3manager.UploadAPIClient, options ...func(*s3manager.Uploader)) Uploader }
func NewStorageClient ¶
func (*Client) AddBucketCORSRule ¶
func (*Client) AddObjectMetadata ¶
func (*Client) AddObjectsMetadata ¶
func (*Client) BucketVersioningStatus ¶ added in v1.70.0
func (*Client) CopyObject ¶
copyObject is a helper function to be used in commands involving object copying such as metadata/headers manipulation, retrieving information about the targeted object for a later copy.
func (*Client) CreateNewBucket ¶
func (Client) DeleteBucket ¶
func (*Client) DeleteBucketCORS ¶
func (*Client) DeleteObjectHeaders ¶
func (*Client) DeleteObjectMetadata ¶
func (*Client) DeleteObjects ¶
func (*Client) DeleteObjectsHeaders ¶
func (*Client) DeleteObjectsMetadata ¶
func (*Client) DownloadFile ¶
func (*Client) DownloadFiles ¶
func (c *Client) DownloadFiles(ctx context.Context, config *DownloadConfig) error
func (*Client) EnableBucketVersioning ¶ added in v1.70.0
func (*Client) ForEachObject ¶
func (c *Client) ForEachObject(ctx context.Context, bucket, prefix string, recursive bool, fn func(*s3types.Object) error) error
forEachObject is a convenience wrapper to execute a callback function on each object listed in the specified bucket/prefix. Upon callback function error, the whole processing ends.
func (*Client) GenPresignedURL ¶
func (Client) GetBucketObjectOwnership ¶
func (Client) GetBucketObjectOwnershipInfo ¶ added in v1.70.0
func (*Client) GetBucketVersioning ¶ added in v1.70.0
func (*Client) ListObjects ¶
func (c *Client) ListObjects(ctx context.Context, list listFunc[object.ObjectInterface], recursive, stream bool, filters []object.ObjectFilterFunc) (*object.ListObjectsOutput, error)
func (*Client) ListObjectsFunc ¶ added in v1.71.0
func (c *Client) ListObjectsFunc(bucket, prefix string, recursive, stream bool) listFunc[object.ObjectInterface]
func (*Client) ListObjectsVersions ¶ added in v1.71.0
func (c *Client) ListObjectsVersions(ctx context.Context, list listFunc[object.ObjectVersionInterface], recursive, stream bool, filters []object.ObjectFilterFunc, versionFilters []object.ObjectVersionFilterFunc) (*object.ListObjectsOutput, error)
func (*Client) ListVersionedObjectsFunc ¶ added in v1.71.0
func (c *Client) ListVersionedObjectsFunc(bucket, prefix string, recursive, stream bool) listFunc[object.ObjectVersionInterface]
func (*Client) NewUploader ¶ added in v1.70.0
func (*Client) SetBucketACL ¶
func (Client) SetBucketObjectOwnership ¶
func (*Client) SetObjectACL ¶
func (*Client) SetObjectsACL ¶
func (*Client) ShowBucket ¶
func (*Client) ShowObject ¶
func (*Client) SuspendBucketVersioning ¶ added in v1.70.0
func (*Client) UpdateObjectHeaders ¶
func (*Client) UpdateObjectsHeaders ¶
func (*Client) UploadFile ¶
func (*Client) UploadFiles ¶
type ClientOpt ¶
func ClientOptWithZone ¶
type DownloadConfig ¶
type ListBucketsItemOutput ¶
type ListBucketsOutput ¶
type ListBucketsOutput []ListBucketsItemOutput
func (*ListBucketsOutput) ToJSON ¶
func (o *ListBucketsOutput) ToJSON()
func (*ListBucketsOutput) ToTable ¶
func (o *ListBucketsOutput) ToTable()
func (*ListBucketsOutput) ToText ¶
func (o *ListBucketsOutput) ToText()
type ObjectListing ¶ added in v1.71.0
type ObjectListing[ObjectType object.ObjectInterface] struct { List []ObjectType CommonPrefixes []string }
type S3API ¶ added in v1.70.0
type S3API interface { s3manager.UploadAPIClient DeleteObjects(ctx context.Context, params *s3.DeleteObjectsInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error) GetObjectAcl(ctx context.Context, params *s3.GetObjectAclInput, optFns ...func(*s3.Options)) (*s3.GetObjectAclOutput, error) ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error) ListObjectVersions(ctx context.Context, params *s3.ListObjectVersionsInput, optFns ...func(*s3.Options)) (*s3.ListObjectVersionsOutput, error) CopyObject(ctx context.Context, params *s3.CopyObjectInput, optFns ...func(*s3.Options)) (*s3.CopyObjectOutput, error) DeleteBucketCors(ctx context.Context, params *s3.DeleteBucketCorsInput, optFns ...func(*s3.Options)) (*s3.DeleteBucketCorsOutput, error) GetBucketCors(ctx context.Context, params *s3.GetBucketCorsInput, optFns ...func(*s3.Options)) (*s3.GetBucketCorsOutput, error) PutBucketCors(ctx context.Context, params *s3.PutBucketCorsInput, optFns ...func(*s3.Options)) (*s3.PutBucketCorsOutput, error) PutBucketAcl(ctx context.Context, params *s3.PutBucketAclInput, optFns ...func(*s3.Options)) (*s3.PutBucketAclOutput, error) PutObjectAcl(ctx context.Context, params *s3.PutObjectAclInput, optFns ...func(*s3.Options)) (*s3.PutObjectAclOutput, error) CreateBucket(ctx context.Context, params *s3.CreateBucketInput, optFns ...func(*s3.Options)) (*s3.CreateBucketOutput, error) GetBucketAcl(ctx context.Context, params *s3.GetBucketAclInput, optFns ...func(*s3.Options)) (*s3.GetBucketAclOutput, error) GetBucketOwnershipControls(ctx context.Context, params *s3.GetBucketOwnershipControlsInput, optFns ...func(*s3.Options)) (*s3.GetBucketOwnershipControlsOutput, error) PutBucketOwnershipControls(ctx context.Context, params *s3.PutBucketOwnershipControlsInput, optFns ...func(*s3.Options)) (*s3.PutBucketOwnershipControlsOutput, error) GetBucketVersioning(ctx context.Context, params *s3.GetBucketVersioningInput, optFns ...func(*s3.Options)) (*s3.GetBucketVersioningOutput, error) PutBucketVersioning(ctx context.Context, params *s3.PutBucketVersioningInput, optFns ...func(*s3.Options)) (*s3.PutBucketVersioningOutput, error) ListMultipartUploads(ctx context.Context, params *s3.ListMultipartUploadsInput, optFns ...func(*s3.Options)) (*s3.ListMultipartUploadsOutput, error) AbortMultipartUpload(ctx context.Context, params *s3.AbortMultipartUploadInput, optFns ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error) DeleteBucket(ctx context.Context, params *s3.DeleteBucketInput, optFns ...func(*s3.Options)) (*s3.DeleteBucketOutput, error) }
type ShowBucketOutput ¶
type ShowBucketOutput struct { Name string `json:"name"` Zone string `json:"zone"` ACL ACL `json:"acl"` CORS []CORSRule `json:"cors"` ObjectOwnership BucketObjectOwnership `json:"objectOwnership"` }
func (*ShowBucketOutput) ToJSON ¶
func (o *ShowBucketOutput) ToJSON()
func (*ShowBucketOutput) ToTable ¶
func (o *ShowBucketOutput) ToTable()
func (*ShowBucketOutput) ToText ¶
func (o *ShowBucketOutput) ToText()
type ShowObjectOutput ¶
type ShowObjectOutput struct { Path string `json:"name"` Bucket string `json:"bucket"` LastModified string `json:"last_modified"` Size int64 `json:"size"` ACL ACL `json:"acl"` Metadata map[string]string `json:"metadata"` Headers map[string]string `json:"headers"` URL string `json:"url"` }
func (*ShowObjectOutput) ToJSON ¶
func (o *ShowObjectOutput) ToJSON()
func (*ShowObjectOutput) ToTable ¶
func (o *ShowObjectOutput) ToTable()
func (*ShowObjectOutput) ToText ¶
func (o *ShowObjectOutput) ToText()
type StorageUploadConfig ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.