factory

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MinioS3Client

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

func (*MinioS3Client) BucketExists

func (minioS3Client *MinioS3Client) BucketExists(name string) (bool, error)

////////////////// Bucket methods // //////////////////

func (*MinioS3Client) CreateBucket

func (minioS3Client *MinioS3Client) CreateBucket(name string) error

func (*MinioS3Client) CreateOrUpdatePolicy

func (minioS3Client *MinioS3Client) CreateOrUpdatePolicy(name string, content string) error

The AddCannedPolicy of the madmin client actually does both creation and update (so does the CLI, as both are wired to the same endpoint on Minio API server).

func (*MinioS3Client) CreatePath

func (minioS3Client *MinioS3Client) CreatePath(bucketname string, path string) error

func (*MinioS3Client) DeleteBucket

func (minioS3Client *MinioS3Client) DeleteBucket(name string) error

Will fail if bucket is not empty

func (*MinioS3Client) DeletePath

func (minioS3Client *MinioS3Client) DeletePath(bucketname string, path string) error

func (*MinioS3Client) DeletePolicy

func (minioS3Client *MinioS3Client) DeletePolicy(name string) error

func (*MinioS3Client) GetPolicyInfo

func (minioS3Client *MinioS3Client) GetPolicyInfo(name string) (*madmin.PolicyInfo, error)

No method exposed by the madmin client is truly satisfying to test the existence of a policy

  • InfoCannedPolicyV2 returns an error if the policy does not exist (as opposed to BucketExists, for instance, see https://github.com/minio/minio-go/blob/v7.0.52/api-stat.go#L43-L45)
  • ListCannedPolicyV2 is extremely slow to run when the minio instance holds a large number of policies ( ~10000 => ~50s execution time on a modest staging minio cluster)

For lack of a better solution, we use InfoCannedPolicyV2 and test the error code to identify the case of a missing policy (vs a technical, non-recoverable error in contacting the S3 server for instance) A consequence is that we do things a little differently compared to buckets - instead of just testing for existence, we get the whole policy info, and the controller uses it down the line.

func (*MinioS3Client) GetQuota

func (minioS3Client *MinioS3Client) GetQuota(name string) (int64, error)

///////////////// Quota methods // /////////////////

func (*MinioS3Client) PathExists

func (minioS3Client *MinioS3Client) PathExists(bucketname string, path string) (bool, error)

func (*MinioS3Client) SetQuota

func (minioS3Client *MinioS3Client) SetQuota(name string, quota int64) error

type MockedS3Client

type MockedS3Client struct{}

func (*MockedS3Client) BucketExists

func (mockedS3Provider *MockedS3Client) BucketExists(name string) (bool, error)

func (*MockedS3Client) CreateBucket

func (mockedS3Provider *MockedS3Client) CreateBucket(name string) error

func (*MockedS3Client) CreateOrUpdatePolicy

func (mockedS3Provider *MockedS3Client) CreateOrUpdatePolicy(name string, content string) error

func (*MockedS3Client) CreatePath

func (mockedS3Provider *MockedS3Client) CreatePath(bucketname string, path string) error

func (*MockedS3Client) DeleteBucket

func (mockedS3Provider *MockedS3Client) DeleteBucket(name string) error

func (*MockedS3Client) DeletePath

func (mockedS3Provider *MockedS3Client) DeletePath(bucketname string, path string) error

func (*MockedS3Client) DeletePolicy

func (mockedS3Provider *MockedS3Client) DeletePolicy(name string) error

func (*MockedS3Client) GetPolicyInfo

func (mockedS3Provider *MockedS3Client) GetPolicyInfo(name string) (*madmin.PolicyInfo, error)

func (*MockedS3Client) GetQuota

func (mockedS3Provider *MockedS3Client) GetQuota(name string) (int64, error)

func (*MockedS3Client) PathExists

func (mockedS3Provider *MockedS3Client) PathExists(bucketname string, path string) (bool, error)

func (*MockedS3Client) SetQuota

func (mockedS3Provider *MockedS3Client) SetQuota(name string, quota int64) error

type S3Client

type S3Client interface {
	BucketExists(name string) (bool, error)
	CreateBucket(name string) error
	DeleteBucket(name string) error
	CreatePath(bucketname string, path string) error
	PathExists(bucketname string, path string) (bool, error)
	DeletePath(bucketname string, path string) error
	GetQuota(name string) (int64, error)
	SetQuota(name string, quota int64) error
	// see comment in [minioS3Client.go] regarding the absence of a PolicyExists method
	// PolicyExists(name string) (bool, error)
	GetPolicyInfo(name string) (*madmin.PolicyInfo, error)
	CreateOrUpdatePolicy(name string, content string) error
	DeletePolicy(name string) error
}

func GetS3Client

func GetS3Client(s3Provider string, S3Config *S3Config) (S3Client, error)

type S3Config

type S3Config struct {
	S3Provider           string
	S3UrlEndpoint        string
	Region               string
	AccessKey            string
	SecretKey            string
	UseSsl               bool
	CaCertificatesBase64 []string
	CaBundlePath         string
}

Jump to

Keyboard shortcuts

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