Documentation
¶
Overview ¶
Package s3 is a minimal S3 client for the telemetry archive: put, get, delete and list objects in one bucket, path-style, signed with AWS Signature Version 4 over the real payload hash (never UNSIGNED-PAYLOAD). It talks to the in-cluster MinIO; nothing here is MinIO-specific.
A handful of verbs didn't justify a client library and its dependency tree (DA, N19 A2): the signer is checked against AWS's published examples (s3_test.go) and every verb against a real MinIO (integration test).
Index ¶
- Variables
- type Client
- func (c *Client) CreateBucket(ctx context.Context) error
- func (c *Client) Delete(ctx context.Context, key string) error
- func (c *Client) Get(ctx context.Context, key string) (io.ReadCloser, error)
- func (c *Client) List(ctx context.Context, prefix string, fn func(Object) error) error
- func (c *Client) Put(ctx context.Context, key string, body []byte, contentType string) error
- type Object
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("s3: no such key")
ErrNotFound is a GET of a key that doesn't exist.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// Endpoint is the service URL, e.g. http://minio.minio.svc:9000.
Endpoint string
Region string // e.g. us-east-1
Bucket string
AccessKey string
SecretKey string
// HTTP defaults to a client with a 2-minute timeout.
HTTP *http.Client
// Now is the signing clock (tests pin it).
Now func() time.Time
// ListPageSize is ListObjectsV2's max-keys (0: the server's 1000). Tests
// set it small to exercise continuation.
ListPageSize int
}
Client is one bucket on one endpoint.
func (*Client) CreateBucket ¶
CreateBucket creates the client's bucket. For tests and local development: in a cluster the buckets are created by the MinIO bootstrap Job, and the app's credentials can't create them.
func (*Client) Get ¶
Get returns the object's body; the caller closes it. A missing key is ErrNotFound.