Documentation
¶
Overview ¶
Package bucket bucket/acl.go
Package bucket bucket/bucket.go
Package bucket bucket/cors.go
Package bucket bucket/create.go
Package bucket bucket/delete.go
Package bucket provides bucket-level operations for the RustFS Go SDK.
It includes creation, deletion, configuration, and policy helpers for S3-compatible buckets.
Package bucket bucket/encryption.go
Package bucket bucket/errors.go
Package bucket bucket/exists.go
Package bucket bucket/list.go
Package bucket bucket/logging.go
Package bucket bucket/notification.go
Package bucket bucket/object_lock.go
Package bucket bucket/policy_lifecycle.go
Package bucket bucket/replication.go
Package bucket bucket/service.go
Package bucket bucket/tagging.go
Package bucket bucket/utils.go
Package bucket bucket/versioning.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidBucketName invalid bucket name ErrInvalidBucketName = errors.New("invalid bucket name") // ErrBucketNotFound not found bucket ErrBucketNotFound = errors.New("bucket not found") // ErrBucketAlreadyExists bucket already exists ErrBucketAlreadyExists = errors.New("bucket already exists") // ErrBucketNotEmpty bucket not empty ErrBucketNotEmpty = errors.New("bucket not empty") // ErrInvalidVersioningStatus invalid versioning status ErrInvalidVersioningStatus = errors.New("invalid versioning status, must be Enabled or Suspended") // ErrEmptyBucketConfig invalid empty bucket configuration payload ErrEmptyBucketConfig = errors.New("configuration payload cannot be empty") )
Functions ¶
This section is empty.
Types ¶
type CreateOption ¶
type CreateOption func(*CreateOptions)
CreateOption create bucket options function
func WithForceCreate ¶
func WithForceCreate(force bool) CreateOption
WithForceCreate set force create
func WithObjectLocking ¶
func WithObjectLocking(enabled bool) CreateOption
WithObjectLocking set object locking
type CreateOptions ¶
type CreateOptions struct {
// Region
Region string
// ObjectLocking enable object locking
ObjectLocking bool
// ForceCreate force create (overwrite if exists)
ForceCreate bool
}
CreateOptions create bucket options
type DeleteOption ¶
type DeleteOption func(*DeleteOptions)
DeleteOption delete bucket options function
func WithForceDelete ¶
func WithForceDelete(force bool) DeleteOption
WithForceDelete set force delete
type DeleteOptions ¶
type DeleteOptions struct {
// ForceDelete force delete (delete even if not empty)
ForceDelete bool
}
DeleteOptions delete bucket options
type Service ¶
type Service interface {
// Create bucket
Create(ctx context.Context, bucketName string, opts ...CreateOption) error
// Delete bucket
Delete(ctx context.Context, bucketName string, opts ...DeleteOption) error
// Exists check if bucket exists
Exists(ctx context.Context, bucketName string) (bool, error)
// List buckets
List(ctx context.Context) ([]types.BucketInfo, error)
// GetLocation get bucket location/region
GetLocation(ctx context.Context, bucketName string) (string, error)
// SetPolicy sets bucket policy JSON
SetPolicy(ctx context.Context, bucketName, policy string) error
// GetPolicy retrieves bucket policy JSON
GetPolicy(ctx context.Context, bucketName string) (string, error)
// DeletePolicy removes bucket policy
DeletePolicy(ctx context.Context, bucketName string) error
// SetLifecycle sets bucket lifecycle configuration (XML)
SetLifecycle(ctx context.Context, bucketName string, config []byte) error
// GetLifecycle retrieves bucket lifecycle configuration (XML)
GetLifecycle(ctx context.Context, bucketName string) ([]byte, error)
// DeleteLifecycle removes bucket lifecycle configuration
DeleteLifecycle(ctx context.Context, bucketName string) error
// SetVersioning sets bucket versioning configuration
SetVersioning(ctx context.Context, bucketName string, cfg types.VersioningConfig) error
// GetVersioning retrieves bucket versioning configuration
GetVersioning(ctx context.Context, bucketName string) (types.VersioningConfig, error)
// SetReplication sets bucket cross-region replication configuration
SetReplication(ctx context.Context, bucketName string, config []byte) error
// GetReplication retrieves bucket replication configuration
GetReplication(ctx context.Context, bucketName string) ([]byte, error)
// DeleteReplication removes bucket replication configuration
DeleteReplication(ctx context.Context, bucketName string) error
// GetReplicationMetrics retrieves replication metrics for a bucket
GetReplicationMetrics(ctx context.Context, bucketName string) (replication.Metrics, error)
// SetNotification sets bucket event notification configuration
SetNotification(ctx context.Context, bucketName string, config []byte) error
// GetNotification retrieves bucket event notification configuration
GetNotification(ctx context.Context, bucketName string) ([]byte, error)
// DeleteNotification removes bucket event notification configuration
DeleteNotification(ctx context.Context, bucketName string) error
// ListenNotification listens for bucket notification events.
ListenNotification(ctx context.Context, bucketName, prefix, suffix string, events []notification.EventType) <-chan notification.Info
// SetLogging sets bucket access logging configuration
SetLogging(ctx context.Context, bucketName string, config []byte) error
// GetLogging retrieves bucket access logging configuration
GetLogging(ctx context.Context, bucketName string) ([]byte, error)
// DeleteLogging removes bucket access logging configuration
DeleteLogging(ctx context.Context, bucketName string) error
// SetEncryption sets bucket default encryption configuration
SetEncryption(ctx context.Context, bucketName string, config sse.Configuration) error
// GetEncryption retrieves bucket default encryption configuration
GetEncryption(ctx context.Context, bucketName string) (sse.Configuration, error)
// DeleteEncryption removes bucket default encryption configuration
DeleteEncryption(ctx context.Context, bucketName string) error
// SetCORS sets bucket CORS configuration
SetCORS(ctx context.Context, bucketName string, config cors.Config) error
// GetCORS retrieves bucket CORS configuration
GetCORS(ctx context.Context, bucketName string) (cors.Config, error)
// DeleteCORS removes bucket CORS configuration
DeleteCORS(ctx context.Context, bucketName string) error
// SetTagging sets bucket tags
SetTagging(ctx context.Context, bucketName string, tags map[string]string) error
// GetTagging retrieves bucket tags
GetTagging(ctx context.Context, bucketName string) (map[string]string, error)
// DeleteTagging removes bucket tags
DeleteTagging(ctx context.Context, bucketName string) error
// SetACL sets bucket ACL
SetACL(ctx context.Context, bucketName string, policy acl.ACL) error
// GetACL retrieves bucket ACL
GetACL(ctx context.Context, bucketName string) (acl.ACL, error)
// SetObjectLockConfig sets bucket object lock configuration
SetObjectLockConfig(ctx context.Context, bucketName string, config objectlock.Config) error
// GetObjectLockConfig retrieves bucket object lock configuration
GetObjectLockConfig(ctx context.Context, bucketName string) (objectlock.Config, error)
}
Service Bucket interface
func NewService ¶
func NewService(executor *core.Executor, locationCache *cache.LocationCache) Service
NewService Create a new Bucket Service