Documentation
¶
Index ¶
- Variables
- func IsNotFound(err error) bool
- type AccessKey
- type Bucket
- type Client
- func (c *Client[C]) Bucket() string
- func (*Client[C]) BuildConfig() (app.Materializer, error)
- func (c *Client[C]) Close(_ context.Context) error
- func (c *Client[C]) Delete(ctx context.Context, key string) error
- func (c *Client[C]) Deps() []any
- func (c *Client[C]) Get(ctx context.Context, key string) (io.ReadCloser, Head, error)
- func (c *Client[C]) Head(ctx context.Context, key string) (Head, error)
- func (c *Client[C]) Inject(args []any)
- func (c *Client[C]) Label() string
- func (c *Client[C]) PresignGet(ctx context.Context, key string, ttl time.Duration) (string, error)
- func (c *Client[C]) ProbeReady(ctx context.Context) error
- func (c *Client[C]) Put(ctx context.Context, key string, body io.Reader, opts PutOptions) error
- func (c *Client[C]) Ready(ctx context.Context) error
- type Config
- type CredentialsProvider
- type CredentialsStatic
- type CredentialsStaticConfig
- type Default
- type Head
- type PutOptions
- type Region
- type SecretKey
- type UsePathStyle
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("clients3: not found")
ErrNotFound is returned when the object (or bucket for Ready) does not exist.
Functions ¶
func IsNotFound ¶
IsNotFound reports whether err is or wraps ErrNotFound.
Types ¶
type Client ¶
type Client[C CredentialsProvider] struct { // contains filtered or unexported fields }
Client is an S3-compatible object client bound to one bucket and credentials type C. Catalog field: *Client[C] (Configurable); C is a concrete CredentialsProvider (e.g. *CredentialsStatic[Default]). SDI wires C via Deps/Inject (same pattern as srv-http.Server[T]).
func NewTestClient ¶
func NewTestClient[C CredentialsProvider](inner *s3.Client, bucket string) *Client[C]
NewTestClient constructs a Client around an existing SDK client (tests only).
func (*Client[C]) BuildConfig ¶
func (*Client[C]) BuildConfig() (app.Materializer, error)
BuildConfig returns the config spec for materialize.
func (*Client[C]) PresignGet ¶
PresignGet returns a time-limited GET URL for key.
func (*Client[C]) ProbeReady ¶
ProbeReady reports S3 traffic readiness via HeadBucket (ops duck typing).
type Config ¶
type Config[C CredentialsProvider] struct { Label common.Label Endpoint httpv1.URL Region Region Bucket Bucket UsePathStyle UsePathStyle }
Config is the client-s3 spec; ecfg fills before Build. Endpoint is protovalidated by ecfg as http.v1.URL (non-empty http/https). Credentials come from SDI via Client[C] → CredentialsProvider implementor C.
type CredentialsProvider ¶
type CredentialsProvider interface {
Retrieve(ctx context.Context) (aws.Credentials, error)
}
CredentialsProvider is the SDI port for S3 credentials (static, Vault, STS, …). Catalog: declare a concrete implementor (e.g. *CredentialsStatic[Default]) and bind Client[C] to that type.
type CredentialsStatic ¶
type CredentialsStatic[Tag any] struct { // contains filtered or unexported fields }
CredentialsStatic is long-lived access/secret credentials (MinIO / IAM user keys). Tag distinguishes multiple static sets in one process for SDI. One set: CredentialsStatic[Default]. Two sets: CredentialsStatic[assets], CredentialsStatic[backups], … Catalog: *CredentialsStatic[Tag]; wire Client[*CredentialsStatic[Tag]].
func (*CredentialsStatic[Tag]) BuildConfig ¶
func (*CredentialsStatic[Tag]) BuildConfig() (app.Materializer, error)
BuildConfig returns the config spec for materialize.
func (*CredentialsStatic[Tag]) Retrieve ¶
func (c *CredentialsStatic[Tag]) Retrieve(_ context.Context) (aws.Credentials, error)
Retrieve implements aws.CredentialsProvider / CredentialsProvider.
type CredentialsStaticConfig ¶
CredentialsStaticConfig is the ecfg spec for CredentialsStatic.
func (*CredentialsStaticConfig[Tag]) Build ¶
func (c *CredentialsStaticConfig[Tag]) Build() (any, error)
Build returns a CredentialsStatic resource.
type Default ¶
type Default struct{}
Default tags the single static credentials set in a process (most apps). Also used when several clients share one credentials resource.
type PutOptions ¶
PutOptions controls optional PutObject fields.
type UsePathStyle ¶
type UsePathStyle bool
UsePathStyle enables path-style addressing (required for typical MinIO setups).
func (UsePathStyle) Usage ¶
func (UsePathStyle) Usage() string
func (UsePathStyle) Validate ¶
func (UsePathStyle) Validate() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
example
|
|
|
app
command
|
|
|
shared-creds
command
Two S3 clients share one static credentials resource (same Tag / one env block).
|
Two S3 clients share one static credentials resource (same Tag / one env block). |
|
two-creds
command
Two S3 clients with two different static credential sets (distinct Tags).
|
Two S3 clients with two different static credential sets (distinct Tags). |