Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ACLHeaders ¶ added in v1.8.3
type Bucket ¶
type Bucket interface {
// Check validates the bucket configuration and credentials.
Check() error
// List returns all buckets in the account.
List() ([]sdkstp.Bucket, error)
// Walk iterates over all buckets, calling f for each.
// Iteration stops when f returns false or all buckets are processed.
Walk(f WalkFunc) error
// Create creates a new bucket with the specified region constraint.
// If RegionConstraint is empty, uses the default region from configuration.
Create(RegionConstraint string) error
// CreateWithLock creates a new bucket with object locking enabled.
// Object locking cannot be disabled after bucket creation.
CreateWithLock(RegionConstraint string) error
// Delete removes the bucket. Bucket must be empty before deletion.
Delete() error
// SetVersioning enables or disables versioning for the bucket.
// When enabled, S3 keeps all versions of objects.
SetVersioning(state bool) error
// GetVersioning returns the current versioning status ("Enabled", "Suspended", or "").
GetVersioning() (string, error)
// LoadReplication retrieves the current replication configuration.
LoadReplication() (*sdkstp.ReplicationConfiguration, error)
// EnableReplication configures cross-region or same-region replication.
// Requires source and destination role ARNs and destination bucket name.
EnableReplication(srcRoleARN, dstRoleARN, dstBucketName string) error
// DeleteReplication removes the replication configuration from the bucket.
DeleteReplication() error
// PutWebsite configures the bucket for static website hosting.
// index: index document (e.g., "index.html")
// error: error document (e.g., "error.html")
PutWebsite(index, error string) error
// GetWebsite retrieves the website configuration for the bucket.
GetWebsite() (*sdksss.GetBucketWebsiteOutput, error)
// SetCORS configures Cross-Origin Resource Sharing rules for the bucket.
SetCORS(cors []sdkstp.CORSRule) error
// GetCORS retrieves the current CORS rules for the bucket.
GetCORS() ([]sdkstp.CORSRule, error)
// GetACL retrieves the Access Control List (ACL) for the bucket.
GetACL() (*sdkstp.AccessControlPolicy, error)
// SetACL sets the ACL using either a policy, canned ACL, or headers.
// Only one method should be provided (others can be nil/empty).
SetACL(ACP *sdkstp.AccessControlPolicy, cannedACL sdkstp.BucketCannedACL, header ACLHeaders) error
// SetACLPolicy sets the ACL using an Access Control Policy.
SetACLPolicy(ACP *sdkstp.AccessControlPolicy) error
// SetACLHeader sets the ACL using canned ACL and optional headers.
SetACLHeader(cannedACL sdkstp.BucketCannedACL, header ACLHeaders) error
// GetLifeCycle retrieves the lifecycle rules for the bucket.
GetLifeCycle() ([]sdkstp.LifecycleRule, error)
// SetLifeCycle configures lifecycle rules for automatic object management.
// Rules define when objects transition to different storage classes or expire.
SetLifeCycle(rules ...sdkstp.LifecycleRule) error
// GetLock retrieves the object lock configuration for the bucket.
GetLock() (*sdkstp.ObjectLockConfiguration, error)
// SetLock configures object locking to prevent object deletion or modification.
// token: optional version ID to enable lock on existing bucket
SetLock(cfg sdkstp.ObjectLockConfiguration, token string) error
}
Bucket provides operations for S3 bucket management including: - Lifecycle management (create, delete, list) - Versioning configuration - CORS configuration - Access control lists (ACL) - Replication configuration - Lifecycle rules - Website hosting - Object locking
Click to show internal directories.
Click to hide internal directories.