factory

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 13 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) AddPoliciesToUser added in v0.9.0

func (minioS3Client *MinioS3Client) AddPoliciesToUser(accessKey string, policies []string) error

func (*MinioS3Client) AddServiceAccountForUser added in v0.9.0

func (minioS3Client *MinioS3Client) AddServiceAccountForUser(name string, accessKey string, secretKey string) error

func (*MinioS3Client) BucketExists

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

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

func (*MinioS3Client) CheckUserCredentialsValid added in v0.9.0

func (minioS3Client *MinioS3Client) CheckUserCredentialsValid(name string, accessKey string, secretKey string) (bool, error)

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) CreateUser added in v0.9.0

func (minioS3Client *MinioS3Client) CreateUser(accessKey string, secretKey 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) DeleteUser added in v0.9.0

func (minioS3Client *MinioS3Client) DeleteUser(accessKey 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) GetUserPolicies added in v0.9.0

func (minioS3Client *MinioS3Client) GetUserPolicies(accessKey string) ([]string, error)

func (*MinioS3Client) PathExists

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

func (*MinioS3Client) PolicyExist added in v0.9.0

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

func (*MinioS3Client) RemovePoliciesFromUser added in v0.9.0

func (minioS3Client *MinioS3Client) RemovePoliciesFromUser(accessKey string, policies []string) error

func (*MinioS3Client) SetQuota

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

func (*MinioS3Client) UserExist added in v0.9.0

func (minioS3Client *MinioS3Client) UserExist(accessKey string) (bool, error)

type MockedS3Client

type MockedS3Client struct{}

func (*MockedS3Client) AddPoliciesToUser added in v0.9.0

func (mockedS3Provider *MockedS3Client) AddPoliciesToUser(username string, policies []string) error

func (*MockedS3Client) AddServiceAccountForUser added in v0.9.0

func (mockedS3Provider *MockedS3Client) AddServiceAccountForUser(name string, accessKey string, secretKey string) error

func (*MockedS3Client) BucketExists

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

func (*MockedS3Client) CheckUserCredentialsValid added in v0.9.0

func (mockedS3Provider *MockedS3Client) CheckUserCredentialsValid(name string, accessKey string, secretKey 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) CreateUser added in v0.9.0

func (mockedS3Provider *MockedS3Client) CreateUser(name string, password 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) DeleteUser added in v0.9.0

func (mockedS3Provider *MockedS3Client) DeleteUser(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) GetUserPolicies added in v0.9.0

func (mockedS3Provider *MockedS3Client) GetUserPolicies(name string) ([]string, error)

func (*MockedS3Client) PathExists

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

func (*MockedS3Client) PolicyExist added in v0.9.0

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

func (*MockedS3Client) RemovePoliciesFromUser added in v0.9.0

func (mockedS3Provider *MockedS3Client) RemovePoliciesFromUser(username string, policies []string) error

func (*MockedS3Client) SetQuota

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

func (*MockedS3Client) UserExist added in v0.9.0

func (mockedS3Provider *MockedS3Client) UserExist(name string) (bool, 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)
	PolicyExist(name string) (bool, error)
	DeletePolicy(name string) error
	GetPolicyInfo(name string) (*madmin.PolicyInfo, error)
	CreateOrUpdatePolicy(name string, content string) error
	UserExist(name string) (bool, error)
	CheckUserCredentialsValid(name string, accessKey string, secretKey string) (bool, error)
	AddServiceAccountForUser(name string, accessKey string, secretKey string) error
	CreateUser(accessKey string, secretKey string) error
	DeleteUser(accessKey string) error
	GetUserPolicies(name string) ([]string, error)
	AddPoliciesToUser(accessKey string, policies []string) error
	RemovePoliciesFromUser(accessKey string, policies []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