Documentation
¶
Overview ¶
Package s3 wraps an S3-compatible object store client (AWS S3, Cloudflare R2, MinIO, etc.) with the minimal surface needed by xatu output sinks: connect, PutObject. Higher-level sinks layer their own event-shape semantics on top.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps an S3-compatible object store client.
func New ¶
func New(log observability.ContextualLogger, cfg *Config) (*Client, error)
New builds a Client. The connection is established lazily on first use; callers should issue a HEAD against the bucket via HeadBucket if they want startup-time validation.
func (*Client) HeadBucket ¶
HeadBucket checks the configured bucket is reachable and the credentials work. Suitable to call from a sink's Start.
type Config ¶
type Config struct {
// Endpoint is the S3 endpoint host. For Cloudflare R2 use the
// account-scoped endpoint (e.g. "<account>.r2.cloudflarestorage.com").
// For AWS use the regional endpoint (e.g. "s3.us-east-1.amazonaws.com").
// Must NOT include a scheme — set Insecure to toggle HTTPS/HTTP.
Endpoint string `yaml:"endpoint"`
// Bucket is the destination bucket name. Must already exist.
Bucket string `yaml:"bucket"`
// Region is the bucket region. Required by AWS, ignored by R2/MinIO
// but harmless. Defaults to "auto" which works for R2.
Region string `yaml:"region" default:"auto"`
// AccessKeyID and SecretAccessKey authenticate the client. Required.
AccessKeyID string `yaml:"accessKeyId"`
SecretAccessKey string `yaml:"secretAccessKey"`
// Insecure disables HTTPS (plain HTTP). Defaults to false — i.e. SSL
// is used. Modeled as opt-in plain-HTTP rather than opt-in SSL because
// `bool` zero-value defaulting traps the opposite shape: an explicit
// `useSsl: false` would be indistinguishable from "unset" and get
// overridden back to true by the defaults loader.
Insecure bool `yaml:"insecure"`
}
Config configures an S3-compatible client. It is YAML-inlineable so higher-level sinks can embed it directly under their own `config:` block.
type PutOptions ¶
type PutOptions struct {
// ContentType is the MIME type (e.g. "text/plain").
ContentType string
// ContentEncoding is the Content-Encoding header (e.g. "gzip" when
// Body is already gzip-compressed).
ContentEncoding string
}
PutOptions describes per-object metadata applied at upload time. Body bytes are uploaded verbatim — callers that want compression or encoding must do it before calling PutObject and set the matching header fields here.