bucket

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package bucket bucket/bucket.go

Package bucket bucket/create.go

Package bucket bucket/delete.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/policy_lifecycle.go

Package bucket bucket/replication.go

Package bucket bucket/service.go

Package bucket bucket/utils.go

Package bucket bucket/versioning.go

Index

Constants

This section is empty.

Variables

View Source
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

func WithRegion

func WithRegion(region string) CreateOption

WithRegion set bucket region

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

	// 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

	// 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
}

Service Bucket interface

func NewService

func NewService(executor *core.Executor, locationCache *cache.LocationCache) Service

NewService Create a new Bucket Service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL