client

package
v0.5.0-linux-arm64 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 24 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentDigest

func ContentDigest(content []byte) string

ContentDigest identifies the exact serialized bytes that a prepared write would dispatch.

func ObjectMetadataURL

func ObjectMetadataURL(region, endpoint, bucket, key string) (*url.URL, error)

ObjectMetadataURL uses the SDK's partition and path rules without provider I/O.

func ReadObjectMetadata

func ReadObjectMetadata(ctx context.Context, httpClient *http.Client, config Config, creds Credentials, request HeadObjectRequest) (bool, error)

ReadObjectMetadata uses the admitted HTTP client and static credentials only. No environment credential discovery, redirects, retries or bucket listing is authorized.

func WithRedirectsDisabled

func WithRedirectsDisabled(ctx context.Context) context.Context

WithRedirectsDisabled prevents a scoped operation from switching resources through an otherwise public, network-policy-compliant redirect.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client performs S3-compatible provider requests through the AWS SDK.

func New

func New(ctx context.Context, config Config, creds Credentials) (*Client, error)

New creates an S3 client from runtime configuration and write-only credentials.

func (*Client) Close

func (c *Client) Close() error

Close releases idle HTTP connections held by the S3 client.

func (*Client) GetObject

func (c *Client) GetObject(ctx context.Context, req GetObjectRequest) (*ObjectContent, error)

GetObject reads one S3 object body into memory within the supplied byte limit.

func (*Client) HeadObject

func (c *Client) HeadObject(ctx context.Context, req HeadObjectRequest) (bool, error)

HeadObject reports whether one S3 object exists without returning its body.

func (*Client) ListObjects

func (c *Client) ListObjects(ctx context.Context, req ListObjectsRequest) ([]Object, error)

ListObjects lists object metadata under a bucket/prefix for schema introspection.

func (*Client) MatchesObject

func (c *Client) MatchesObject(ctx context.Context, req MatchObjectRequest) (bool, error)

MatchesObject confirms the complete prepared bytes and configured metadata with bounded memory.

func (*Client) PutObject

func (c *Client) PutObject(ctx context.Context, req PutObjectRequest) (*PutObjectResult, error)

PutObject writes one S3 object body after optional overwrite protection.

func (*Client) PutObjectStream

func (c *Client) PutObjectStream(ctx context.Context, req StreamWriteRequest) (_ *StreamWriteResult, retErr error)

PutObjectStream uploads sequential bounded parts, publishing only after input verification. An error after completion starts requires independent readback; callers must never infer that an existing object can safely be overwritten.

func (*Client) ReadObjectTo

func (c *Client) ReadObjectTo(ctx context.Context, req GetObjectRequest, dst io.Writer) (*filestream.Metadata, error)

ReadObjectTo consumes one finite object with backpressure from the destination. The caller owns the writer and must discard partial output on any error.

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context, req TestConnectionRequest) error

TestConnection checks only the configured prefix when credentials are prefix-restricted.

func (*Client) ValidatePut

func (c *Client) ValidatePut(overwrite bool) error

ValidatePut checks the endpoint contract before a sink claims a provider effect.

type Config

type Config struct {
	Endpoint          string `json:"endpoint,omitempty"            validate:"omitempty,url"`
	Region            string `json:"region"                        validate:"required,min=1"`
	Bucket            string `json:"bucket"                        validate:"required,min=1"`
	Prefix            string `json:"prefix,omitempty"`
	ForcePathStyle    bool   `json:"force_path_style,omitempty"`
	TimeoutSeconds    int    `json:"timeout_seconds,omitempty"    validate:"omitempty,min=1,max=300"`
	AllowPrivateHosts bool   `json:"allow_private_hosts,omitempty"`
}

Config holds S3-compatible connector runtime configuration.

type Credentials

type Credentials struct {
	AccessKeyID     string `json:"access_key_id"               validate:"required,min=1"`
	SecretAccessKey string `json:"secret_access_key"           validate:"required,min=1"`
	SessionToken    string `json:"session_token,omitempty"`
}

Credentials holds write-only S3 access key credentials.

type GetObjectRequest

type GetObjectRequest struct {
	Bucket   string
	Key      string
	MaxBytes int64
}

GetObjectRequest identifies one S3 object read and its runtime byte guardrail.

type HeadObjectRequest

type HeadObjectRequest struct {
	Bucket string
	Key    string
}

HeadObjectRequest identifies one S3 object metadata lookup.

type ListObjectsRequest

type ListObjectsRequest struct {
	Bucket string
	Prefix string
}

ListObjectsRequest identifies a bucket and prefix to introspect.

type MatchObjectRequest

type MatchObjectRequest struct {
	Bucket, Key, SHA256, ContentType string
	SizeBytes                        int64
	Metadata                         map[string]string
}

MatchObjectRequest describes the prepared output, never a replacement write.

type Object

type Object struct {
	Key          string
	SizeBytes    int64
	ETag         string
	LastModified *time.Time
}

Object is S3 object metadata needed for Braidplane schema introspection.

type ObjectContent

type ObjectContent struct {
	Key         string
	Content     []byte
	ContentType string
	Metadata    map[string]string
}

ObjectContent is an in-memory S3 object body plus safe provider metadata.

type PutObjectRequest

type PutObjectRequest struct {
	Bucket      string
	Key         string
	Content     []byte
	ContentType string
	Metadata    map[string]string
	Overwrite   bool
}

PutObjectRequest describes one S3 object write after Braidplane binding.

type PutObjectResult

type PutObjectResult struct {
	WrittenBytes int
}

PutObjectResult reports the number of bytes accepted for an S3 write.

type StreamWriteRequest

type StreamWriteRequest struct {
	Bucket      string
	Key         string
	Body        io.Reader
	SizeBytes   int64
	MaxBytes    int64
	SHA256      string
	ContentType string
	Metadata    map[string]string
	Overwrite   bool
}

StreamWriteRequest requires the length and digest of retained, verified input.

type StreamWriteResult

type StreamWriteResult struct {
	WrittenBytes   int64
	SHA256         string
	OutcomeUnknown bool
}

StreamWriteResult distinguishes a complete acknowledgement from an uncertain one.

type TestConnectionRequest

type TestConnectionRequest struct {
	Prefix string
	Bucket string
}

TestConnectionRequest identifies the bucket checked by connection tests.

Jump to

Keyboard shortcuts

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