s3client

package
v0.1.0-dev04 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type COSSession

type COSSession struct {
	// contains filtered or unexported fields
}

COSSession represents a COS (S3) session

func (*COSSession) CheckBucketAccess

func (s *COSSession) CheckBucketAccess(bucket string) error

func (*COSSession) CheckObjectPathExistence

func (s *COSSession) CheckObjectPathExistence(bucket string, objectpath string) (bool, error)

func (*COSSession) CreateBucket

func (s *COSSession) CreateBucket(bucket, kpRootKeyCrn string) (res string, err error)

func (*COSSession) DeleteBucket

func (s *COSSession) DeleteBucket(bucket string) error

func (*COSSession) SetBucketVersioning added in v0.1.1

func (s *COSSession) SetBucketVersioning(bucket string, enable bool) error

type COSSessionFactory

type COSSessionFactory struct{}

COSSessionFactory represents a COS (S3) session factory

func NewObjectStorageSessionFactory

func NewObjectStorageSessionFactory() *COSSessionFactory

func (*COSSessionFactory) NewObjectStorageSession

func (s *COSSessionFactory) NewObjectStorageSession(endpoint, locationConstraint string, creds *ObjectStorageCredentials, lgr *zap.Logger) ObjectStorageSession

NewObjectStorageSession method creates a new object store session

type FakeCOSSessionFactory

type FakeCOSSessionFactory struct {
	FailCheckBucketAccess bool
	FailCreateBucket      bool
	FailDeleteBucket      bool
	FailBucketVersioning  bool
}

ObjectStorageSessionFactory is a factory for mocked object storage sessions

func (*FakeCOSSessionFactory) NewObjectStorageSession

func (f *FakeCOSSessionFactory) NewObjectStorageSession(endpoint, region string, creds *ObjectStorageCredentials, lgr *zap.Logger) ObjectStorageSession

NewObjectStorageSession method creates a new fake object store session

type ObjectStorageCredentials

type ObjectStorageCredentials struct {
	//AuthType
	AuthType string
	// AccessKey is the account identifier in AWS authentication
	AccessKey string
	// SecretKey is the "password" in AWS authentication
	SecretKey string
	// APIKey is the "password" in IBM IAM authentication
	APIKey string
	// ServiceInstanceID is the account identifier in IBM IAM authentication
	ServiceInstanceID string
	// KpRootKeyCrn
	KpRootKeyCRN string
	//IAMEndpoint ...
	IAMEndpoint string
}

ObjectStorageCredentials holds credentials for accessing an object storage service

type ObjectStorageSession

type ObjectStorageSession interface {
	// CheckBucketAccess method check that a bucket can be accessed
	CheckBucketAccess(bucket string) error

	// CheckObjectPathExistence method checks that object-path exists inside bucket
	CheckObjectPathExistence(bucket, objectpath string) (bool, error)

	// CreateBucket methods creates a new bucket
	CreateBucket(bucket, kpRootKeyCrn string) (string, error)

	// DeleteBucket methods deletes a bucket (with all of its objects)
	DeleteBucket(bucket string) error

	SetBucketVersioning(bucket string, enable bool) error
}

ObjectStorageSession is an interface of an object store session

func NewS3Client

func NewS3Client(lgr *zap.Logger) (ObjectStorageSession, error)

type ObjectStorageSessionFactory

type ObjectStorageSessionFactory interface {
	// NewObjectStorageBackend method creates a new object store session
	NewObjectStorageSession(endpoint, locationConstraint string, creds *ObjectStorageCredentials, lgr *zap.Logger) ObjectStorageSession
}

ObjectStorageSessionFactory is an interface of an object store session factory

Jump to

Keyboard shortcuts

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