Documentation
¶
Overview ¶
Package s3 implements s3 client.
Index ¶
- type Client
- func (c *Client) Bucket() string
- func (c *Client) DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
- func (c *Client) ErrNotFound(err error) bool
- func (c *Client) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
- func (c *Client) GetObjectEncrypt(ctx context.Context, kms KMS, params *s3.GetObjectInput, ...) (*s3.GetObjectOutput, error)
- func (c *Client) IsObjectExist(ctx context.Context, key string) (bool, error)
- func (c *Client) ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, ...) (*s3.ListObjectsV2Output, error)
- func (c *Client) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
- func (c *Client) PutObjectEncrypt(ctx context.Context, kms KMS, params *s3.PutObjectInput, ...) (*s3.PutObjectOutput, error)
- func (c *Client) Region() string
- type ClientOption
- type KMS
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client aws s3 client
func NewClient ¶
func NewClient(ctx context.Context, endpoint, key, secret string, opts ...ClientOption) (*Client, error)
NewClient new s3 client
if set kms engine by WithKMS, ListObject/GetObject will enable transparent encryption.
func (*Client) DeleteObject ¶
func (c *Client) DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, optFns ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)
DeleteObject delete s3 object
func (*Client) ErrNotFound ¶
ErrNotFound check error is not found
func (*Client) GetObject ¶
func (c *Client) GetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
GetObject get s3 object
func (*Client) GetObjectEncrypt ¶
func (c *Client) GetObjectEncrypt(ctx context.Context, kms KMS, params *s3.GetObjectInput, optFns ...func(*s3.Options)) (*s3.GetObjectOutput, error)
GetObjectEncrypt get s3 object
func (*Client) IsObjectExist ¶
IsObjectExist check object exist
func (*Client) ListObjectsV2 ¶
func (c *Client) ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, optFns ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)
ListObjectsV2 list object
func (*Client) PutObject ¶
func (c *Client) PutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
PutObject put s3 object
func (*Client) PutObjectEncrypt ¶
func (c *Client) PutObjectEncrypt(ctx context.Context, kms KMS, params *s3.PutObjectInput, optFns ...func(*s3.Options)) (*s3.PutObjectOutput, error)
PutObjectEncrypt put s3 object
type ClientOption ¶
type ClientOption func(*clientOption) error
ClientOption optional arguments for client
type KMS ¶
type KMS interface { // AddKek add new kek AddKek(ctx context.Context, kekID uint16, kek []byte) error // Kek get current used kek // Kek(ctx context.Context) (kekID uint16, kek []byte, err error) // Keks export all keks // Keks(ctx context.Context) (keks map[uint16][]byte, err error) // DeriveKeyByID derive key by specific kek id and dek id // DeriveKeyByID(ctx context.Context, // kekID uint16, // dekID []byte, // length int) (dek []byte, err error) // // DeriveKey derive random key by current kek // DeriveKey(ctx context.Context, length int) (kekID uint16, dekID, dek []byte, err error) // Encrypt encrypt data Encrypt(ctx context.Context, plaintext, additionalData []byte) (ed *gkms.EncryptedData, err error) // Decrypt decrypt data Decrypt(ctx context.Context, ed *gkms.EncryptedData, additionalData []byte) (plaintext []byte, err error) }
KMS KMS engine
Click to show internal directories.
Click to hide internal directories.