ocs

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2020 License: Apache-2.0, MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AccessKeyID is a constant for the key in a backup secret that holds the OCS S3 access key id.
	AccessKeyID = "accessKeyID"
	// SecretAccessKey is a constant for the key in a backup secret that holds the OCS S3 secret access key.
	SecretAccessKey = "secretAccessKey"
	// Endpoint is a constant for the key in a backup secret that holds an OCS S3 endpoint.
	Endpoint = "endpoint"
	// DisableSSL is a constant for the key in a backup secret that specifies whether SSL should be disabled or not.
	DisableSSL = "disableSSL"
	// InsecureSkipVerify is a constant for the key in a backup secret that specifies whether the client verifies the server's certificate chain and host name.
	InsecureSkipVerify = "insecureSkipVerify"
	// Region is a constant for the key in a backup secret that points to a region.
	Region = "region"
)
View Source
const (
	// ErrCodeNoSuchBucket for service response error code "BucketNotEmpty". The bucket you tried to delete is not empty.
	ErrCodeBucketNotEmpty = "BucketNotEmpty"
)
View Source
const Type = "OCS"

Type is the type of resources managed by the S3 controllers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	S3 *s3.S3
}

func NewClient

func NewClient(accessKey, secret, endpoint, region string, disableSSL, insecureSkipVerify bool) (*Client, error)

func NewClientFromSecretRef

func NewClientFromSecretRef(ctx context.Context, client client.Client, secretRef corev1.SecretReference, region string) (*Client, error)

NewClientFromSecretRef creates a new s3 Client for the given s3 credentials from given k8s <secretRef> and the OCS <region>.

func (*Client) CreateBucketIfNotExists

func (c *Client) CreateBucketIfNotExists(ctx context.Context, bucket, region string) error

CreateBucketIfNotExists creates the s3 bucket with name <bucket> in <region>.

func (*Client) DeleteBucketIfExists

func (c *Client) DeleteBucketIfExists(ctx context.Context, bucket string) error

DeleteBucketIfExists deletes the s3 bucket with name <bucket>. If it does not exist, no error is returned.

func (*Client) DeleteObjectsWithPrefix

func (c *Client) DeleteObjectsWithPrefix(ctx context.Context, bucket, prefix string) error

DeleteObjectsWithPrefix deletes the s3 objects with the specific <prefix> from <bucket>. If it does not exist, no error is returned.

type Credentials

type Credentials struct {
	AccessKeyID        string
	SecretAccessKey    string
	Endpoint           string
	DisableSSL         bool
	InsecureSkipVerify bool
}

Credentials stores AWS credentials.

func GetCredentialsFromSecretRef

func GetCredentialsFromSecretRef(ctx context.Context, client client.Client, secretRef corev1.SecretReference) (*Credentials, error)

GetCredentialsFromSecretRef reads the secret given by the the secret reference and returns the read Credentials object.

func ReadCredentialsSecret

func ReadCredentialsSecret(secret *corev1.Secret) (*Credentials, error)

ReadCredentialsSecret reads a secret containing credentials.

Jump to

Keyboard shortcuts

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