s3

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: MIT Imports: 60 Imported by: 0

README

S3

Parity grade: A · SDK aws-sdk-go-v2/service/s3@v1.106.5 · last audited 2026-08-15 ((uncommitted at time of writing)) · protocol REST-XML

Coverage

Metric Value
Operations audited 20 (19 ok, 1 other)
Feature families 8 (8 ok)
Known gaps 10
Deferred items 0
Resource leaks clean
Known gaps
  • GetBucketMetadataConfiguration/GetBucketMetadataTableConfiguration return the wrong response shape entirely for any real typed client -- see the ops row above (gopherstack-6flj, 2026-08-15). Fixing this for real requires modeling S3 Tables table-bucket provisioning (ARN/namespace/status), which this backend has no concept of anywhere; CreateBucketMetadataConfiguration/CreateBucketMetadataTableConfiguration would also need the same new state. Left flagged rather than fabricated.
  • Object Annotations (gopherstack-zi7k, 2026-08-14): implemented -- PutObjectAnnotation/GetObjectAnnotation/DeleteObjectAnnotation/ListObjectAnnotations store real per-object-version state (StoredObjectVersion.Annotations, additive/omitempty, survives Snapshot/Restore) and UpdateBucketMetadataAnnotationTableConfiguration persists its config XML the same way its metadataInventoryTable/metadataJournalTable siblings do. Routes verified from the pinned serializer, not by pattern: PUT/GET/DELETE /{Key+}?annotation, and GET is shared byte-for-byte between GetObjectAnnotation and ListObjectAnnotations (both httpbinding.SplitURI to the same path+query) -- disambiguated on the presence of the annotationName query param, which only GetObjectAnnotation's HttpBindings function binds. Bucket-level route key metadataAnnotationTable was independently re-verified (matches the bd issue's note). Deliberately NOT enforced: the documented 1-byte-to-1-MiB payload size window (no error code for it appears in any of these ops' own deserializeOpError switches, so inventing one would violate the same rule that caught the invented metadataTableConfiguration/exception bugs this same sweep found elsewhere) and DeleteObjectAnnotation/PutObjectAnnotation's ObjectIfMatch conditional header (also absent from every relevant switch in this pinned SDK version). DeleteObjectAnnotation deliberately does NOT return NoSuchAnnotation for a missing name -- its error switch declares only NoSuchBucket/NoSuchKey, matching real S3's idempotent-delete semantics. The annotation-name reserved-prefix rule ('cannot start with aws or s3') is enforced from DeleteObjectAnnotation's doc comment in the pinned source, not a serializer/deserializer fact -- flagged here as the one validation rule in this pass that rests on prose rather than wire code. UpdateBucketMetadataAnnotationTableConfiguration's own error switch declares no typed error cases at all (every failure decodes as smithy.GenericAPIError) -- confirmed by reading it directly, not assumed. No dedicated Get op exists for the bucket-level annotation-table config in the pinned SDK, so (like its inventory/journal siblings) persistence there is provable by store/restore but not independently readable over the wire.
  • CreateSession (S3 Express One Zone) is a disguised stub beyond its own doc comment's disclosure: buckets.go's CreateSession returns a hardcoded fake SessionToken/AccessKeyId/SecretAccessKey for ANY bucket (it doesn't check IsDirectoryBucket, doesn't validate the bucket is actually a directory bucket the way real S3 requires), completely ignores the request's SessionMode (ReadOnly/ReadWrite), and the returned session token has no effect anywhere else in this package -- it isn't wired into sigv4 validation or any subsequent request's authorization, so a caller that authenticates via the returned session credentials would not actually get S3-Express-scoped access semantics. Consistent with the broader disclosed gap that this emulator does not model directory buckets/S3-Express as a distinct bucket type at all; a real fix is a full S3 Express feature addition, not scoped for this pass. (gopherstack-3dqa)
  • RenameObject is applied uniformly to any bucket (general-purpose or directory), but real S3 restricts RenameObject to directory buckets only (api_op_RenameObject.go's Bucket doc: 'The bucket name of the directory bucket containing the object... Path-style requests are not supported'). This emulator has no directory-bucket-vs-general-purpose distinction anywhere (see CreateSession gap above), so RenameObject working on any bucket is a permissive superset rather than a wire-shape bug reachable by a real client hitting a real endpoint shape. Also: RenameObjectInput's DestinationIfMatch/DestinationIfNoneMatch/DestinationIfModifiedSince/DestinationIfUnmodifiedSince conditional-header preconditions are declared on the real input but not read/enforced by handleRenameObject (object_ops_copy.go) -- a caller relying on If-None-Match:* to prevent clobbering an existing destination gets a silent unconditional overwrite instead of a 412. Not fixed this pass (scoped feature, not a one-line diff); flagged honestly rather than silently left. (gopherstack-3dqa)
  • SelectObjectContent ScanRange (partial-object byte-range selection) is not implemented — requests with a ScanRange element are accepted but the range is ignored and the full object is scanned. Real semantics require record-boundary-aware slicing (a record is included if its first byte falls in [Start,End]) that's entangled with evaluateCSVQuery/evaluateJSONQuery's own record-splitting logic — implementing it correctly is a real feature addition, not a diff-and-fix, so it's left as an honest gap rather than a rushed subtly-wrong implementation.
  • List*Configurations (analytics/inventory/metrics/intelligent-tiering) do not implement ContinuationToken-based pagination — IsTruncated is always false and all stored configs for a bucket are returned in one response. Real S3 caps at 100 entries per page; this only matters for buckets with >100 configs of one type, an edge case unlikely to be exercised by any realistic test.
  • object_lambda: CreateAccessPointForObjectLambda and the whole Object Lambda access point resource (policy, configuration, ARN) genuinely belong to and ARE already fully implemented in services/s3control (object_lambda.go + handler_object_lambda.go + handler_object_lambda_test.go — verified: CreateAccessPointForObjectLambda, Get/Delete/List, Get/Put/DeleteAccessPointPolicyForObjectLambda, policy-status, and configuration are all real backend-state ops, not stubs). services/s3's own object_lambda.go (SetObjectLambdaConfig + WriteGetObjectResponse) is legitimately s3 DATA-PLANE surface — confirmed WriteGetObjectResponse is an aws-sdk-go-v2/service/s3 operation, not service/s3control — so it is NOT mis-scoped. What IS a real, disclosed limitation: GetObject only recognizes a Lambda wired in via the Go-only SetObjectLambdaConfig test hook, not via genuine access-point-ARN routing (calling GetObject with Bucket=). Wiring that would require access-point-ARN parsing on every object route PLUS a live cross-service lookup into s3control's backend — and regular (non-Lambda) S3 Access Points have zero ARN-as-bucket routing support anywhere in this service either (grepped: no accesspoint/AccessPointARN handling exists in services/s3), so Object Lambda access points would be building ARN routing on a foundation that doesn't exist yet. This is a real, larger cross-service feature, not a diff-and-fix; left honestly open with the evidence above rather than attempted as a rushed partial wiring.
  • SelectObjectContent's SQL engine internals (select_sql_parser.go/select_sql_tokenizer.go/select_sql_expr.go) were not re-diffed against the S3 Select SQL dialect spec this pass — only the request-handling wrapper (SSE-C headers) was fixed. The engine's existing extensive test coverage (select_test.go, select_advanced_test.go) was re-run and passes; no correctness re-audit of parser/expression-evaluator edge cases was performed.
  • ListBuckets does not implement the bucket-region/prefix/continuation-token/max-buckets request parameters (filtering or pagination) — ListBucketsInput is always passed empty to the backend, and every bucket the account owns is always returned in one response. A deliberate, disclosed gap: real S3 also gates whether BucketRegion appears in the response on the request being 'paginated' (see the ListBuckets ops note above), which only matters once pagination exists. Adding real filtering/pagination here is a separate feature, not part of the BucketRegion display fix.
  • ListDirectoryBuckets is structurally unreachable from any real, unmodified aws-sdk-go-v2 client pointed at gopherstack's single local endpoint (gopherstack-0bq8, 2026-08-14). Confirmed against s3@v1.106.5: ListDirectoryBucketsInput.bindEndpointParams sets UseS3ExpressControlEndpoint, and real AWS distinguishes ListDirectoryBuckets from ListBuckets purely by literal hostname (s3express-control..amazonaws.com vs s3..amazonaws.com) — the request itself carries no query param, path segment, or header that differs (HttpBindings only sets continuation-token/max-directory-buckets, same shape family as ListBuckets' own params; the addIsExpressUserAgent middleware that tags S3-Express traffic keys off a Bucket field this op doesn't have). The router's isListDirectoryBucketsRequest checks a ?list-type=directory query key no real client ever sends — dead code, confirmed by cross-referencing every query-setting line in the op's own HttpBindings function — so every real ListDirectoryBuckets() call silently falls through to listBuckets (200 success, wrong bucket set: general-purpose buckets instead of directory buckets). Not fixed: there is no real discriminator available to key on when serving both operations from one endpoint (same structural class as the cloudfront KeyValueStore data-plane ops, which structurally can never reach that service's Handler either). Left as documented dead code rather than deleted or silently 'fixed' with another fabricated key, since it's the only way any test (including buckets_test.go's existing TestListDirectoryBuckets) can reach the op at all.

More

Documentation

Index

Constants

View Source
const (
	ChecksumCRC32  = "CRC32"
	ChecksumCRC32C = "CRC32C"
	ChecksumSHA1   = "SHA1"
	ChecksumSHA256 = "SHA256"
)
View Source
const ChecksumCRC64NVME = "CRC64NVME"

ChecksumCRC64NVME is the algorithm name for CRC64/NVME checksums.

View Source
const NullVersion = "null"

NullVersion is the version ID used when versioning is not enabled.

Variables

View Source
var (
	ErrBucketAlreadyExists     = awserr.New("BucketAlreadyExists", awserr.ErrAlreadyExists)
	ErrBucketAlreadyOwnedByYou = awserr.New("BucketAlreadyOwnedByYou", awserr.ErrAlreadyExists)
	ErrNoSuchBucket            = awserr.New("NoSuchBucket", awserr.ErrNotFound)
	ErrNoSuchKey               = awserr.New("NoSuchKey", awserr.ErrNotFound)
	ErrInvalidBucketName       = errors.New("InvalidBucketName")
	ErrBucketNotEmpty          = errors.New(
		"BucketNotEmpty: The bucket you tried to delete is not empty",
	)
	ErrPermanentRedirect = errors.New("PermanentRedirect")
	// ErrPreconditionFailed is returned when an If-Match / If-None-Match
	// condition on a write op (PutObject / DeleteObject) fails.
	ErrPreconditionFailed = errors.New("PreconditionFailed")
	ErrNotImplemented     = errors.New("NotImplemented")
	ErrMethodNotAllowed   = errors.New("MethodNotAllowed")
	ErrInvalidArgument    = errors.New(errInvalidArgument)
	ErrNoSuchUpload       = awserr.New("NoSuchUpload", awserr.ErrNotFound)
	ErrInvalidPart        = errors.New("InvalidPart")
	ErrInvalidPartOrder   = errors.New("InvalidPartOrder")
	ErrEmptyParts         = errors.New("InvalidRequest")
	ErrNoCompressor       = errors.New("data is compressed but no compressor available")
	ErrNoBucketPolicy     = errors.New("NoSuchBucketPolicy")
	ErrNoCORSConfig       = errors.New("NoSuchCORSConfiguration")
	ErrNoLifecycleConfig  = errors.New("NoSuchLifecycleConfiguration")
	ErrNoObjectLockConfig = errors.New("ObjectLockConfigurationNotFoundError")
	// ErrObjectLockNotEnabled is InvalidBucketState: PutObjectLockConfiguration
	// on a bucket not created with x-amz-bucket-object-lock-enabled: true.
	ErrObjectLockNotEnabled       = errors.New("InvalidBucketState")
	ErrNoWebsiteConfig            = errors.New("NoSuchWebsiteConfiguration")
	ErrNoEncryptionConfig         = errors.New("ServerSideEncryptionConfigurationNotFoundError")
	ErrObjectLocked               = errors.New(errAccessDenied)
	ErrInvalidObjectState         = errors.New("InvalidObjectState")
	ErrNoSuchObjectLockConfig     = awserr.New("NoSuchObjectLockConfiguration", awserr.ErrNotFound)
	ErrNoPublicAccessBlock        = errors.New("NoSuchPublicAccessBlockConfiguration")
	ErrNoOwnershipControls        = errors.New("OwnershipControlsNotFoundError")
	ErrNoReplicationConfig        = errors.New("ReplicationConfigurationNotFoundError")
	ErrNoAnalyticsConfig          = errors.New(errNoSuchConfig)
	ErrNoInventoryConfig          = errors.New(errNoSuchConfig)
	ErrNoMetricsConfig            = errors.New(errNoSuchConfig)
	ErrNoIntelligentTieringConfig = errors.New(errNoSuchConfig)
	ErrNoMetadataConfig           = errors.New(errNoSuchConfig)
	ErrNoMetadataTableConfig      = errors.New(errNoSuchConfig)
	ErrNoSuchTagSet               = errors.New("NoSuchTagSet")
	ErrBadChecksum                = errors.New("BadDigest")
	ErrDeleteMarker               = errors.New("DeleteMarker")
	ErrLatestDeleteMarker         = errors.New("LatestDeleteMarker")
	ErrTooManyTags                = errors.New("BadRequest")
	ErrInvalidTag                 = errors.New("InvalidTag")
	ErrCopySelfNoChange           = errors.New("CopySelfNoChange")
	ErrEntityTooSmall             = errors.New("EntityTooSmall")
	ErrAccessDenied               = errors.New(errAccessDenied)
	ErrKeyTooLongError            = errors.New("KeyTooLongError")
	ErrSSECRequired               = errors.New("InvalidRequest")
	// ErrMalformedXML is returned when an XML request body cannot be decoded.
	// The error table maps it to HTTP 400 with code "MalformedXML".
	ErrMalformedXML = errors.New(errMalformedXML)
	// ErrMalformedPolicy is returned when a PutBucketPolicy body is not valid
	// JSON. The error table maps it to HTTP 400 with code "MalformedPolicy",
	// matching real S3.
	ErrMalformedPolicy = errors.New("MalformedPolicy")

	// ErrAnnotationLimitExceeded and the Object Annotations errors below it
	// carry codes verified against s3@v1.106.5 deserializers.go's per-op error
	// switches: PutObjectAnnotation declares AnnotationLimitExceeded,
	// AnnotationNameTooLong, InvalidAnnotationName, InvalidRequest, NoSuchBucket,
	// NoSuchKey, UnsupportedMediaType; GetObjectAnnotation declares NoSuchAnnotation,
	// NoSuchBucket, NoSuchKey; ListObjectAnnotations declares InvalidPrefix,
	// NoSuchBucket, NoSuchKey. DeleteObjectAnnotation's switch declares only
	// NoSuchBucket/NoSuchKey -- deliberately no ErrNoSuchAnnotation there, see
	// DeleteObjectAnnotation in annotations.go.
	ErrAnnotationLimitExceeded        = errors.New("AnnotationLimitExceeded")
	ErrAnnotationNameTooLong          = errors.New("AnnotationNameTooLong")
	ErrInvalidAnnotationName          = errors.New("InvalidAnnotationName")
	ErrNoSuchAnnotation               = awserr.New("NoSuchAnnotation", awserr.ErrNotFound)
	ErrAnnotationUnsupportedMediaType = errors.New("UnsupportedMediaType")
	ErrInvalidAnnotationPrefix        = errors.New("InvalidPrefix")
	// ErrAnnotationSSECNotSupported reuses the "InvalidRequest" code (declared
	// on PutObjectAnnotation's switch) for the documented restriction "Objects
	// encrypted with SSE-C cannot have annotations" (s3@v1.106.5
	// api_op_PutObjectAnnotation.go doc comment).
	ErrAnnotationSSECNotSupported = errors.New("InvalidRequest")
)
View Source
var ErrRenameTargetSameAsSource = errors.New("target key must differ from source")

ErrRenameTargetSameAsSource is returned when RenameObject is called with a target key equal to (or empty relative to) the source key.

View Source
var ErrRestoreDaysNegative = errors.New("restore Days must be non-negative")

ErrRestoreDaysNegative is returned when RestoreObject is called with a negative Days value.

Functions

func CalculateCRC64NVME

func CalculateCRC64NVME(data []byte) string

CalculateCRC64NVME computes the base64-encoded CRC64/NVME checksum of data.

func CalculateChecksum

func CalculateChecksum(data []byte, algorithm string) string

func IsValidBucketName

func IsValidBucketName(name string) bool

IsValidBucketName validates an S3 bucket name based on AWS rules. Rules summary: - 3 to 63 characters long. - Only lowercase letters, numbers, dots (.), and hyphens (-). - Begins and ends with a letter or number. - No adjacent dots. - Not formatted as an IP address.

func IsValidObjectKey

func IsValidObjectKey(key string) bool

IsValidObjectKey validates an S3 object key based on AWS rules. Rules summary: - Up to 1024 bytes in UTF-8.

func NewCRC64NVME

func NewCRC64NVME() hash.Hash

NewCRC64NVME returns a new CRC64/NVME hash.

func WriteError

func WriteError(ctx context.Context, w http.ResponseWriter, r *http.Request, err error)

WriteError translates a typed Go error to an S3 ErrorResponse XML payload.

Types

type AccessControlList

type AccessControlList struct {
	Grants []Grant `xml:"Grant"`
}

AccessControlList contains the list of grants.

type AccessControlPolicy

type AccessControlPolicy struct {
	XMLName xml.Name          `xml:"AccessControlPolicy"`
	Xmlns   string            `xml:"xmlns,attr"`
	Owner   Owner             `xml:"Owner"`
	ACL     AccessControlList `xml:"AccessControlList"`
}

AccessControlPolicy is the XML response for GetBucketAcl.

type BucketLoggingStatus

type BucketLoggingStatus struct {
	LoggingEnabled *LoggingEnabled `xml:"LoggingEnabled,omitempty"`
	XMLName        xml.Name        `xml:"BucketLoggingStatus"`
	Xmlns          string          `xml:"xmlns,attr,omitempty"`
}

BucketLoggingStatus is the full XML body for PutBucketLogging / GetBucketLogging.

type BucketXML

type BucketXML struct {
	Name         string `xml:"Name"`
	CreationDate string `xml:"CreationDate"`
	// BucketRegion is the literal region the bucket lives in (see
	// InMemoryBackend.ListBuckets in buckets.go for why it's always populated
	// here, and why -- unlike GetBucketLocation's LocationConstraint -- it is
	// never blanked out for us-east-1).
	BucketRegion string `xml:"BucketRegion"`
}

type CORSConfiguration

type CORSConfiguration struct {
	XMLName xml.Name   `xml:"CORSConfiguration"`
	Rules   []CORSRule `xml:"CORSRule"`
}

CORSConfiguration is the XML structure for a bucket's CORS configuration.

type CORSRule

type CORSRule struct {
	AllowedOrigins []string `xml:"AllowedOrigin"`
	AllowedMethods []string `xml:"AllowedMethod"`
	AllowedHeaders []string `xml:"AllowedHeader"`
	ExposeHeaders  []string `xml:"ExposeHeader"`
	MaxAgeSeconds  int      `xml:"MaxAgeSeconds,omitempty"`
}

CORSRule represents a single CORS rule within a CORSConfiguration.

type CommonPrefixXML

type CommonPrefixXML struct {
	Prefix string `xml:"Prefix"`
}

CommonPrefixXML represents a common prefix entry in a listing response.

type CompleteMultipartUpload

type CompleteMultipartUpload struct {
	XMLName xml.Name           `xml:"CompleteMultipartUpload"`
	Parts   []CompletedPartXML `xml:"Part"`
}

type CompleteMultipartUploadResult

type CompleteMultipartUploadResult struct {
	XMLName  xml.Name `xml:"CompleteMultipartUploadResult"`
	Location string   `xml:"Location"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	ETag     string   `xml:"ETag"`
}

type CompletedPartXML

type CompletedPartXML struct {
	ETag       string `xml:"ETag"`
	PartNumber int    `xml:"PartNumber"`
}

type Compressor

type Compressor interface {
	Compress(data []byte) ([]byte, error)
	Decompress(data []byte) ([]byte, error)
}

type ConfigProvider

type ConfigProvider interface {
	GetS3Settings() Settings
	GetS3Endpoint() string
}

ConfigProvider is a private interface to extract S3 configuration from the abstract AppContext Config.

type CopyObjectResult

type CopyObjectResult struct {
	XMLName           xml.Name `xml:"CopyObjectResult"`
	ETag              string   `xml:"ETag"`
	LastModified      string   `xml:"LastModified"`
	ChecksumCRC32     string   `xml:"ChecksumCRC32,omitempty"`
	ChecksumCRC32C    string   `xml:"ChecksumCRC32C,omitempty"`
	ChecksumCRC64NVME string   `xml:"ChecksumCRC64NVME,omitempty"`
	ChecksumSHA1      string   `xml:"ChecksumSHA1,omitempty"`
	ChecksumSHA256    string   `xml:"ChecksumSHA256,omitempty"`
}

type DashboardHandlers

type DashboardHandlers struct {
	HandleS3 func(http.ResponseWriter, *http.Request, string)
}

DashboardHandlers defines the functions needed for S3 dashboard routes.

type DashboardProvider

type DashboardProvider struct {
	// Handlers will be set by the dashboard handler during initialization
	Handlers DashboardHandlers
}

DashboardProvider implements the service.DashboardProvider interface to enable S3 dashboard discovery and route registration. It wraps a reference to dashboard handler functions.

func NewDashboardProvider

func NewDashboardProvider() *DashboardProvider

NewDashboardProvider creates a new S3 dashboard provider. The handlers must be set by the dashboard initialization code before any routes are registered.

func (*DashboardProvider) DashboardName

func (p *DashboardProvider) DashboardName() string

DashboardName returns the user-facing name for the S3 dashboard tab.

func (*DashboardProvider) DashboardRoutePrefix

func (p *DashboardProvider) DashboardRoutePrefix() string

DashboardRoutePrefix returns the URL path prefix for S3 dashboard routes.

func (*DashboardProvider) RegisterDashboardRoutes

func (p *DashboardProvider) RegisterDashboardRoutes(
	group *echo.Group,
	_ any,
	_ string,
)

RegisterDashboardRoutes registers all S3 dashboard routes under the given Echo group. The group is mounted at /dashboard/s3 by the dashboard handler.

type DefaultRetention

type DefaultRetention struct {
	Mode  string `xml:"Mode"`
	Days  int    `xml:"Days,omitempty"`
	Years int    `xml:"Years,omitempty"`
}

DefaultRetention specifies the default retention settings for objects placed in the bucket.

type DeleteErrorXML

type DeleteErrorXML struct {
	VersionID *string `xml:"VersionId,omitempty"`
	Key       string  `xml:"Key"`
	Code      string  `xml:"Code"`
	Message   string  `xml:"Message"`
}

type DeleteMarkerReplication

type DeleteMarkerReplication struct {
	Status string `xml:"Status"`
}

DeleteMarkerReplication controls whether delete markers are replicated.

type DeleteMarkerXML

type DeleteMarkerXML struct {
	Owner        *Owner `xml:"Owner"`
	Key          string `xml:"Key"`
	VersionID    string `xml:"VersionId"`
	LastModified string `xml:"LastModified"`
	IsLatest     bool   `xml:"IsLatest"`
}

type DeleteObject

type DeleteObject struct {
	VersionID *string `xml:"VersionId,omitempty"`
	Key       string  `xml:"Key"`
}

type DeleteRequest

type DeleteRequest struct {
	XMLName xml.Name       `xml:"Delete"`
	Objects []DeleteObject `xml:"Object"`
	Quiet   bool           `xml:"Quiet"`
}

type DeleteResult

type DeleteResult struct {
	XMLName xml.Name         `xml:"DeleteResult"`
	Deleted []DeletedXML     `xml:"Deleted"`
	Errors  []DeleteErrorXML `xml:"Error"`
}

type DeletedXML

type DeletedXML struct {
	VersionID             *string `xml:"VersionId,omitempty"`
	DeleteMarkerVersionID *string `xml:"DeleteMarkerVersionId,omitempty"`
	Key                   string  `xml:"Key"`
	DeleteMarker          bool    `xml:"DeleteMarker,omitempty"`
}

type ErrorResponse

type ErrorResponse struct {
	XMLName   xml.Name `xml:"Error"`
	Code      string   `xml:"Code"`
	Message   string   `xml:"Message"`
	Resource  string   `xml:"Resource"`
	RequestID string   `xml:"RequestId"`
}

type EventBridgePublisher

type EventBridgePublisher interface {
	PublishS3Event(ctx context.Context, source, detailType, detail string)
}

EventBridgePublisher publishes an S3 event to the default EventBridge event bus.

type Grant

type Grant struct {
	Grantee    Grantee `xml:"Grantee"`
	Permission string  `xml:"Permission"`
}

Grant is a single permission grant.

type Grantee

type Grantee struct {
	XmlnsXsi    string `xml:"xmlns:xsi,attr"`
	XsiType     string `xml:"xsi:type,attr"`
	ID          string `xml:"ID,omitempty"`
	DisplayName string `xml:"DisplayName,omitempty"`
	URI         string `xml:"URI,omitempty"`
}

Grantee identifies who is being granted permissions. A CanonicalUser grantee carries ID/DisplayName; a Group grantee (AllUsers / AuthenticatedUsers / LogDelivery) carries URI instead.

type GzipCompressor

type GzipCompressor struct{}

func (*GzipCompressor) Compress

func (c *GzipCompressor) Compress(data []byte) ([]byte, error)

func (*GzipCompressor) Decompress

func (c *GzipCompressor) Decompress(data []byte) ([]byte, error)

type InMemoryBackend

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

func NewInMemoryBackend

func NewInMemoryBackend(compressor Compressor) *InMemoryBackend

func (*InMemoryBackend) AbortMultipartUpload

func (*InMemoryBackend) BucketRegion

func (b *InMemoryBackend) BucketRegion(name string) string

BucketRegion returns the region a bucket is stored in, or "" if the bucket does not exist or is pending async deletion. Safe for concurrent use.

func (*InMemoryBackend) BucketsByRegion

func (b *InMemoryBackend) BucketsByRegion(region string) []types.Bucket

BucketsByRegion returns a snapshot of all Bucket SDK objects in the given region. Returns all buckets (cross-region) if region is empty.

func (*InMemoryBackend) CompleteMultipartUpload

func (*InMemoryBackend) CreateBucket

func (b *InMemoryBackend) CreateBucket(
	ctx context.Context,
	input *s3.CreateBucketInput,
) (*s3.CreateBucketOutput, error)

func (*InMemoryBackend) CreateBucketMetadataConfiguration

func (b *InMemoryBackend) CreateBucketMetadataConfiguration(
	_ context.Context,
	bucketName, configXML string,
) error

CreateBucketMetadataConfiguration stores the metadata configuration for a bucket.

func (*InMemoryBackend) CreateBucketMetadataTableConfiguration

func (b *InMemoryBackend) CreateBucketMetadataTableConfiguration(
	_ context.Context,
	bucketName, configXML string,
) error

CreateBucketMetadataTableConfiguration stores the metadata table configuration for a bucket.

func (*InMemoryBackend) CreateMultipartUpload

func (b *InMemoryBackend) CreateMultipartUpload(
	ctx context.Context,
	input *s3.CreateMultipartUploadInput,
) (*s3.CreateMultipartUploadOutput, error)

func (*InMemoryBackend) CreateSession

func (b *InMemoryBackend) CreateSession(_ context.Context, bucketName string) (string, error)

CreateSession returns a stub session response for a bucket (S3 Express One Zone). It is a stub in more ways than the response body suggests: SessionMode (the X-Amz-Create-Session-Mode header) is never read, IsDirectoryBucket is never checked -- this emulator has no directory-bucket-vs-general-purpose distinction at all -- and the returned SessionToken has no downstream effect; nothing validates it on subsequent requests, so it authorizes nothing.

func (*InMemoryBackend) DeleteBucket

func (b *InMemoryBackend) DeleteBucket(
	_ context.Context,
	input *s3.DeleteBucketInput,
) (*s3.DeleteBucketOutput, error)

func (*InMemoryBackend) DeleteBucketAnalyticsConfiguration

func (b *InMemoryBackend) DeleteBucketAnalyticsConfiguration(
	_ context.Context,
	bucketName, id string,
) error

DeleteBucketAnalyticsConfiguration removes an analytics configuration from a bucket by ID.

func (*InMemoryBackend) DeleteBucketCORS

func (b *InMemoryBackend) DeleteBucketCORS(_ context.Context, bucketName string) error

DeleteBucketCORS clears the bucket CORS configuration.

func (*InMemoryBackend) DeleteBucketEncryption

func (b *InMemoryBackend) DeleteBucketEncryption(_ context.Context, bucketName string) error

DeleteBucketEncryption clears the server-side encryption configuration for a bucket.

func (*InMemoryBackend) DeleteBucketIntelligentTieringConfiguration

func (b *InMemoryBackend) DeleteBucketIntelligentTieringConfiguration(
	_ context.Context,
	bucketName, id string,
) error

DeleteBucketIntelligentTieringConfiguration removes an Intelligent-Tiering configuration from a bucket by ID.

func (*InMemoryBackend) DeleteBucketInventoryConfiguration

func (b *InMemoryBackend) DeleteBucketInventoryConfiguration(
	_ context.Context,
	bucketName, id string,
) error

DeleteBucketInventoryConfiguration removes an inventory configuration from a bucket by ID.

func (*InMemoryBackend) DeleteBucketLifecycle

func (b *InMemoryBackend) DeleteBucketLifecycle(ctx context.Context, bucketName string) error

DeleteBucketLifecycle clears the lifecycle configuration for a bucket. This is the legacy alias for DeleteBucketLifecycleConfiguration.

func (*InMemoryBackend) DeleteBucketLifecycleConfiguration

func (b *InMemoryBackend) DeleteBucketLifecycleConfiguration(
	_ context.Context,
	bucketName string,
) error

DeleteBucketLifecycleConfiguration clears the lifecycle configuration for a bucket.

func (*InMemoryBackend) DeleteBucketMetadataConfiguration

func (b *InMemoryBackend) DeleteBucketMetadataConfiguration(
	_ context.Context,
	bucketName string,
) error

DeleteBucketMetadataConfiguration clears the metadata configuration for a bucket.

func (*InMemoryBackend) DeleteBucketMetadataTableConfiguration

func (b *InMemoryBackend) DeleteBucketMetadataTableConfiguration(
	_ context.Context,
	bucketName string,
) error

DeleteBucketMetadataTableConfiguration clears the metadata table configuration for a bucket.

func (*InMemoryBackend) DeleteBucketMetricsConfiguration

func (b *InMemoryBackend) DeleteBucketMetricsConfiguration(
	_ context.Context,
	bucketName, id string,
) error

DeleteBucketMetricsConfiguration removes a metrics configuration from a bucket by ID.

func (*InMemoryBackend) DeleteBucketOwnershipControls

func (b *InMemoryBackend) DeleteBucketOwnershipControls(
	_ context.Context,
	bucketName string,
) error

DeleteBucketOwnershipControls removes the ownership controls configuration for a bucket.

func (*InMemoryBackend) DeleteBucketPolicy

func (b *InMemoryBackend) DeleteBucketPolicy(_ context.Context, bucketName string) error

DeleteBucketPolicy clears the bucket policy document.

func (*InMemoryBackend) DeleteBucketReplication

func (b *InMemoryBackend) DeleteBucketReplication(_ context.Context, bucketName string) error

DeleteBucketReplication removes the replication configuration for a bucket.

func (*InMemoryBackend) DeleteBucketTagging

func (b *InMemoryBackend) DeleteBucketTagging(_ context.Context, bucketName string) error

DeleteBucketTagging removes the tag set from a bucket.

func (*InMemoryBackend) DeleteBucketWebsite

func (b *InMemoryBackend) DeleteBucketWebsite(_ context.Context, bucketName string) error

DeleteBucketWebsite clears the static website configuration for a bucket.

func (*InMemoryBackend) DeleteObject

func (b *InMemoryBackend) DeleteObject(
	ctx context.Context,
	input *s3.DeleteObjectInput,
) (*s3.DeleteObjectOutput, error)

func (*InMemoryBackend) DeleteObjectAnnotation added in v1.3.1

DeleteObjectAnnotation removes a named annotation from an object version. Deleting a name that doesn't exist is not an error: DeleteObjectAnnotation's error switch (s3@v1.106.5 deserializers.go) declares only NoSuchBucket and NoSuchKey -- no NoSuchAnnotation -- matching real S3's idempotent-delete semantics for DeleteObject itself.

func (*InMemoryBackend) DeleteObjectTagging

func (*InMemoryBackend) DeleteObjects

func (b *InMemoryBackend) DeleteObjects(
	_ context.Context,
	input *s3.DeleteObjectsInput,
) (*s3.DeleteObjectsOutput, error)

func (*InMemoryBackend) DeletePublicAccessBlock

func (b *InMemoryBackend) DeletePublicAccessBlock(_ context.Context, bucketName string) error

DeletePublicAccessBlock removes the public access block configuration for a bucket.

func (*InMemoryBackend) DrainReplicationGoroutines

func (b *InMemoryBackend) DrainReplicationGoroutines()

DrainReplicationGoroutines blocks until all in-flight replication goroutines complete. Use in tests to establish a happens-before boundary between operations that spawn replication goroutines and subsequent state assertions.

func (*InMemoryBackend) GetBucketACL

func (b *InMemoryBackend) GetBucketACL(_ context.Context, bucketName string) (string, error)

GetBucketACL returns the canned ACL for a bucket.

func (*InMemoryBackend) GetBucketAbac

func (b *InMemoryBackend) GetBucketAbac(_ context.Context, bucketName string) (string, error)

GetBucketAbac returns the stored ABAC configuration XML for a bucket. Returns an empty string (not an error) when no config has been set, matching the AWS behaviour of returning an empty AbacConfiguration element.

func (*InMemoryBackend) GetBucketAccelerateConfiguration

func (b *InMemoryBackend) GetBucketAccelerateConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketAccelerateConfiguration returns the bucket's accelerate status. When unset the AWS default of "Suspended" is returned.

func (*InMemoryBackend) GetBucketAnalyticsConfiguration

func (b *InMemoryBackend) GetBucketAnalyticsConfiguration(
	_ context.Context,
	bucketName, id string,
) (string, error)

GetBucketAnalyticsConfiguration returns an analytics configuration for a bucket by ID.

func (*InMemoryBackend) GetBucketCORS

func (b *InMemoryBackend) GetBucketCORS(_ context.Context, bucketName string) (string, error)

GetBucketCORS returns the bucket CORS configuration.

func (*InMemoryBackend) GetBucketEncryption

func (b *InMemoryBackend) GetBucketEncryption(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketEncryption returns the server-side encryption configuration for a bucket.

func (*InMemoryBackend) GetBucketIntelligentTieringConfiguration

func (b *InMemoryBackend) GetBucketIntelligentTieringConfiguration(
	_ context.Context,
	bucketName, id string,
) (string, error)

GetBucketIntelligentTieringConfiguration returns an Intelligent-Tiering configuration for a bucket by ID.

func (*InMemoryBackend) GetBucketInventoryConfiguration

func (b *InMemoryBackend) GetBucketInventoryConfiguration(
	_ context.Context,
	bucketName, id string,
) (string, error)

GetBucketInventoryConfiguration returns an inventory configuration for a bucket by ID.

func (*InMemoryBackend) GetBucketLifecycleConfiguration

func (b *InMemoryBackend) GetBucketLifecycleConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketLifecycleConfiguration returns the lifecycle configuration for a bucket.

func (*InMemoryBackend) GetBucketLogging

func (b *InMemoryBackend) GetBucketLogging(_ context.Context, bucketName string) (string, error)

GetBucketLogging returns the logging configuration for a bucket. Returns "" (empty string) when no logging is configured; the handler synthesizes the AWS-compatible empty XML response.

func (*InMemoryBackend) GetBucketMetadata

func (b *InMemoryBackend) GetBucketMetadata(
	_ context.Context,
	bucketName string,
) (string, string, []types.Tag, error)

func (*InMemoryBackend) GetBucketMetadataConfiguration

func (b *InMemoryBackend) GetBucketMetadataConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketMetadataConfiguration returns the metadata configuration for a bucket.

func (*InMemoryBackend) GetBucketMetadataTableConfiguration

func (b *InMemoryBackend) GetBucketMetadataTableConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketMetadataTableConfiguration returns the metadata table configuration for a bucket.

func (*InMemoryBackend) GetBucketMetricsConfiguration

func (b *InMemoryBackend) GetBucketMetricsConfiguration(
	_ context.Context,
	bucketName, id string,
) (string, error)

GetBucketMetricsConfiguration returns a metrics configuration for a bucket by ID.

func (*InMemoryBackend) GetBucketNotificationConfiguration

func (b *InMemoryBackend) GetBucketNotificationConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketNotificationConfiguration returns the notification configuration for a bucket.

func (*InMemoryBackend) GetBucketOwnershipControls

func (b *InMemoryBackend) GetBucketOwnershipControls(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketOwnershipControls returns the ownership controls configuration for a bucket.

func (*InMemoryBackend) GetBucketPolicy

func (b *InMemoryBackend) GetBucketPolicy(_ context.Context, bucketName string) (string, error)

GetBucketPolicy returns the bucket policy document.

func (*InMemoryBackend) GetBucketReplication

func (b *InMemoryBackend) GetBucketReplication(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketReplication returns the replication configuration for a bucket.

func (*InMemoryBackend) GetBucketRequestPayment

func (b *InMemoryBackend) GetBucketRequestPayment(
	_ context.Context,
	bucketName string,
) (string, error)

GetBucketRequestPayment returns the request-payment payer; defaults to "BucketOwner".

func (*InMemoryBackend) GetBucketTagging

func (b *InMemoryBackend) GetBucketTagging(
	_ context.Context,
	bucketName string,
) ([]types.Tag, error)

GetBucketTagging returns the tag set for a bucket.

func (*InMemoryBackend) GetBucketVersioning

func (*InMemoryBackend) GetBucketWebsite

func (b *InMemoryBackend) GetBucketWebsite(_ context.Context, bucketName string) (string, error)

GetBucketWebsite returns the static website configuration for a bucket.

func (*InMemoryBackend) GetObject

func (b *InMemoryBackend) GetObject(
	ctx context.Context,
	input *s3.GetObjectInput,
) (*s3.GetObjectOutput, error)

func (*InMemoryBackend) GetObjectACL

func (b *InMemoryBackend) GetObjectACL(
	_ context.Context,
	bucketName, key, versionID string,
) (string, error)

GetObjectACL returns the persisted ACL XML for the targeted version, or "" when no explicit ACL has been set (caller should synthesise the default owner-FULL_CONTROL grant in that case).

func (*InMemoryBackend) GetObjectAnnotation added in v1.3.1

GetObjectAnnotation retrieves a single named annotation from an object version.

func (*InMemoryBackend) GetObjectAttributes

func (b *InMemoryBackend) GetObjectAttributes(
	_ context.Context,
	bucketName, key, versionID string,
	maxParts, partNumberMarker int32,
) (*ObjectAttributes, error)

GetObjectAttributes returns selected attributes for the latest version of an object. versionID may be empty to select the latest version.

func (*InMemoryBackend) GetObjectLegalHold

func (b *InMemoryBackend) GetObjectLegalHold(
	_ context.Context,
	bucketName, key string,
	versionID *string,
) (string, error)

GetObjectLegalHold returns the legal hold status for a specific object version.

func (*InMemoryBackend) GetObjectLockConfiguration

func (b *InMemoryBackend) GetObjectLockConfiguration(
	_ context.Context,
	bucketName string,
) (string, error)

GetObjectLockConfiguration retrieves the object lock configuration for a bucket.

func (*InMemoryBackend) GetObjectRetention

func (b *InMemoryBackend) GetObjectRetention(
	_ context.Context,
	bucketName, key string,
	versionID *string,
) (string, time.Time, error)

GetObjectRetention returns the retention mode and retain-until-date for a specific object version.

func (*InMemoryBackend) GetObjectTagging

func (b *InMemoryBackend) GetObjectTagging(
	_ context.Context,
	input *s3.GetObjectTaggingInput,
) (*s3.GetObjectTaggingOutput, error)

func (*InMemoryBackend) GetPublicAccessBlock

func (b *InMemoryBackend) GetPublicAccessBlock(
	_ context.Context,
	bucketName string,
) (string, error)

GetPublicAccessBlock returns the public access block configuration for a bucket.

func (*InMemoryBackend) HeadBucket

func (b *InMemoryBackend) HeadBucket(
	_ context.Context,
	input *s3.HeadBucketInput,
) (*s3.HeadBucketOutput, error)

func (*InMemoryBackend) HeadObject

func (b *InMemoryBackend) HeadObject(
	ctx context.Context,
	input *s3.HeadObjectInput,
) (*s3.HeadObjectOutput, error)

func (*InMemoryBackend) ListBucketAnalyticsConfigurations

func (b *InMemoryBackend) ListBucketAnalyticsConfigurations(
	_ context.Context,
	bucketName string,
) ([]string, error)

ListBucketAnalyticsConfigurations returns all analytics configurations for a bucket.

func (*InMemoryBackend) ListBucketIntelligentTieringConfigurations

func (b *InMemoryBackend) ListBucketIntelligentTieringConfigurations(
	_ context.Context,
	bucketName string,
) ([]string, error)

ListBucketIntelligentTieringConfigurations returns all Intelligent-Tiering configurations for a bucket.

func (*InMemoryBackend) ListBucketInventoryConfigurations

func (b *InMemoryBackend) ListBucketInventoryConfigurations(
	_ context.Context,
	bucketName string,
) ([]string, error)

ListBucketInventoryConfigurations returns all inventory configurations for a bucket.

func (*InMemoryBackend) ListBucketMetricsConfigurations

func (b *InMemoryBackend) ListBucketMetricsConfigurations(
	_ context.Context,
	bucketName string,
) ([]string, error)

ListBucketMetricsConfigurations returns all metrics configurations for a bucket.

func (*InMemoryBackend) ListBuckets

func (*InMemoryBackend) ListDirectoryBuckets

func (b *InMemoryBackend) ListDirectoryBuckets(_ context.Context) ([]types.Bucket, error)

ListDirectoryBuckets returns all S3 Express directory buckets (name suffix --x-s3) owned by the account, excluding general-purpose buckets. Matches AWS behaviour where ListBuckets and ListDirectoryBuckets partition the two bucket types into separate lists.

func (*InMemoryBackend) ListMultipartUploads

ListMultipartUploads returns in-progress multipart uploads for a bucket.

func (*InMemoryBackend) ListObjectAnnotations added in v1.3.1

ListObjectAnnotations lists the annotations attached to an object version, optionally filtered by name prefix and paginated via ContinuationToken.

func (*InMemoryBackend) ListObjectVersions

func (*InMemoryBackend) ListObjects

func (b *InMemoryBackend) ListObjects(
	_ context.Context,
	input *s3.ListObjectsInput,
) (*s3.ListObjectsOutput, error)

func (*InMemoryBackend) ListObjectsV2

func (b *InMemoryBackend) ListObjectsV2(
	ctx context.Context,
	input *s3.ListObjectsV2Input,
) (*s3.ListObjectsV2Output, error)

func (*InMemoryBackend) ListParts

func (b *InMemoryBackend) ListParts(
	_ context.Context,
	input *s3.ListPartsInput,
) (*s3.ListPartsOutput, error)

func (*InMemoryBackend) MergeBucketTags added in v1.3.1

func (b *InMemoryBackend) MergeBucketTags(bucketName string, newTags map[string]string) error

MergeBucketTags adds/overwrites tags in a bucket's existing tag set. Unlike PutBucketTagging (which replaces the whole set, matching real S3's PutBucketTagging semantics), this merges -- the semantics Resource Groups Tagging API's TagResources needs.

func (*InMemoryBackend) Purge

func (b *InMemoryBackend) Purge(ctx context.Context, cutoff time.Time)

Purge removes all buckets created before the given cutoff time.

func (*InMemoryBackend) PutBucketACL

func (b *InMemoryBackend) PutBucketACL(_ context.Context, bucketName, acl string) error

PutBucketACL stores the canned ACL for a bucket.

func (*InMemoryBackend) PutBucketAbac

func (b *InMemoryBackend) PutBucketAbac(_ context.Context, bucketName, configXML string) error

PutBucketAbac stores the ABAC configuration XML for an S3 Tables bucket.

func (*InMemoryBackend) PutBucketAccelerateConfiguration

func (b *InMemoryBackend) PutBucketAccelerateConfiguration(
	_ context.Context,
	bucketName, status string,
) error

PutBucketAccelerateConfiguration stores the accelerate status ("Enabled"/"Suspended") for a bucket.

func (*InMemoryBackend) PutBucketAnalyticsConfiguration

func (b *InMemoryBackend) PutBucketAnalyticsConfiguration(
	_ context.Context,
	bucketName, id, configXML string,
) error

PutBucketAnalyticsConfiguration stores an analytics configuration for a bucket by ID.

func (*InMemoryBackend) PutBucketCORS

func (b *InMemoryBackend) PutBucketCORS(_ context.Context, bucketName, corsXML string) error

PutBucketCORS stores the bucket CORS configuration.

func (*InMemoryBackend) PutBucketEncryption

func (b *InMemoryBackend) PutBucketEncryption(
	_ context.Context,
	bucketName, encryptionXML string,
) error

PutBucketEncryption stores the server-side encryption configuration for a bucket.

func (*InMemoryBackend) PutBucketIntelligentTieringConfiguration

func (b *InMemoryBackend) PutBucketIntelligentTieringConfiguration(
	_ context.Context,
	bucketName, id, configXML string,
) error

PutBucketIntelligentTieringConfiguration stores an Intelligent-Tiering configuration for a bucket by ID.

func (*InMemoryBackend) PutBucketInventoryConfiguration

func (b *InMemoryBackend) PutBucketInventoryConfiguration(
	_ context.Context,
	bucketName, id, configXML string,
) error

PutBucketInventoryConfiguration stores an inventory configuration for a bucket by ID.

func (*InMemoryBackend) PutBucketLifecycleConfiguration

func (b *InMemoryBackend) PutBucketLifecycleConfiguration(
	_ context.Context,
	bucketName, lifecycleXML string,
) error

PutBucketLifecycleConfiguration stores the lifecycle configuration for a bucket.

func (*InMemoryBackend) PutBucketLogging

func (b *InMemoryBackend) PutBucketLogging(_ context.Context, bucketName, loggingXML string) error

PutBucketLogging stores the logging configuration for a bucket.

func (*InMemoryBackend) PutBucketMetricsConfiguration

func (b *InMemoryBackend) PutBucketMetricsConfiguration(
	_ context.Context,
	bucketName, id, configXML string,
) error

PutBucketMetricsConfiguration stores a metrics configuration for a bucket by ID.

func (*InMemoryBackend) PutBucketNotificationConfiguration

func (b *InMemoryBackend) PutBucketNotificationConfiguration(
	_ context.Context,
	bucketName, notifXML string,
) error

func (*InMemoryBackend) PutBucketOwnershipControls

func (b *InMemoryBackend) PutBucketOwnershipControls(
	_ context.Context,
	bucketName, configXML string,
) error

PutBucketOwnershipControls stores the ownership controls configuration for a bucket.

func (*InMemoryBackend) PutBucketPolicy

func (b *InMemoryBackend) PutBucketPolicy(_ context.Context, bucketName, policy string) error

PutBucketPolicy stores the bucket policy document.

func (*InMemoryBackend) PutBucketReplication

func (b *InMemoryBackend) PutBucketReplication(
	_ context.Context,
	bucketName, replicationXML string,
) error

PutBucketReplication stores the replication configuration for a bucket.

func (*InMemoryBackend) PutBucketRequestPayment

func (b *InMemoryBackend) PutBucketRequestPayment(
	_ context.Context,
	bucketName, payer string,
) error

PutBucketRequestPayment stores the request-payment payer ("BucketOwner" or "Requester").

func (*InMemoryBackend) PutBucketTagging

func (b *InMemoryBackend) PutBucketTagging(
	_ context.Context,
	bucketName string,
	tags []types.Tag,
) error

PutBucketTagging sets the tag set for a bucket.

func (*InMemoryBackend) PutBucketVersioning

func (*InMemoryBackend) PutBucketWebsite

func (b *InMemoryBackend) PutBucketWebsite(_ context.Context, bucketName, websiteXML string) error

PutBucketWebsite stores the static website configuration for a bucket.

func (*InMemoryBackend) PutObject

func (b *InMemoryBackend) PutObject(
	ctx context.Context,
	input *s3.PutObjectInput,
) (*s3.PutObjectOutput, error)

func (*InMemoryBackend) PutObjectACL

func (b *InMemoryBackend) PutObjectACL(
	_ context.Context,
	bucketName, key, versionID, acl string,
) error

PutObjectACL stores the ACL XML/canned-ACL header on the latest object version. versionID may be empty to target the latest version.

func (*InMemoryBackend) PutObjectAnnotation added in v1.3.1

func (b *InMemoryBackend) PutObjectAnnotation(
	ctx context.Context,
	input *s3.PutObjectAnnotationInput,
) (*s3.PutObjectAnnotationOutput, error)

PutObjectAnnotation attaches a named annotation to an object version.

func (*InMemoryBackend) PutObjectLegalHold

func (b *InMemoryBackend) PutObjectLegalHold(
	_ context.Context,
	bucketName, key string,
	versionID *string,
	status string,
) error

PutObjectLegalHold sets or clears the legal hold status for a specific object version.

func (*InMemoryBackend) PutObjectLockConfiguration

func (b *InMemoryBackend) PutObjectLockConfiguration(
	_ context.Context,
	bucketName, configXML string,
) error

PutObjectLockConfiguration stores the object lock configuration for a bucket.

func (*InMemoryBackend) PutObjectRetention

func (b *InMemoryBackend) PutObjectRetention(
	_ context.Context,
	bucketName, key string,
	versionID *string,
	mode string,
	retainUntil time.Time,
) error

PutObjectRetention sets the retention mode and retain-until-date for a specific object version.

func (*InMemoryBackend) PutObjectTagging

func (b *InMemoryBackend) PutObjectTagging(
	_ context.Context,
	input *s3.PutObjectTaggingInput,
) (*s3.PutObjectTaggingOutput, error)

func (*InMemoryBackend) PutPublicAccessBlock

func (b *InMemoryBackend) PutPublicAccessBlock(
	_ context.Context,
	bucketName, configXML string,
) error

PutPublicAccessBlock stores the public access block configuration for a bucket.

func (*InMemoryBackend) Regions

func (b *InMemoryBackend) Regions() []string

Regions returns all distinct regions that contain at least one active bucket.

func (*InMemoryBackend) RemoveBucketTags added in v1.3.1

func (b *InMemoryBackend) RemoveBucketTags(bucketName string, keys []string) error

RemoveBucketTags deletes specific tag keys from a bucket's tag set, for Resource Groups Tagging API's UntagResources.

func (*InMemoryBackend) RenameObject

func (b *InMemoryBackend) RenameObject(
	_ context.Context,
	bucketName, sourceKey, targetKey string,
) error

RenameObject performs an atomic copy+delete of the source key into a new key. The target key is taken from `targetKey` (relative to the same bucket).

func (*InMemoryBackend) Reset

func (b *InMemoryBackend) Reset()

Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.

func (*InMemoryBackend) Restore

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable.

func (*InMemoryBackend) RestoreObject

func (b *InMemoryBackend) RestoreObject(_ context.Context, bucketName, key string, days int) error

RestoreObject marks the latest object version as restored for the given duration. AWS returns 202 Accepted and asynchronously restores; we mark the restore as completed immediately and set an expiry, since this is an in-memory mock.

func (*InMemoryBackend) SetDefaultRegion

func (b *InMemoryBackend) SetDefaultRegion(region string)

SetDefaultRegion sets the default region for this backend.

func (*InMemoryBackend) SetServiceContext

func (b *InMemoryBackend) SetServiceContext(ctx context.Context)

SetServiceContext wires the long-lived service context used to parent background work (replication). Called from the handler's StartWorker. Cancels the previous default background context before switching to the service-provided one.

func (*InMemoryBackend) Shutdown

func (b *InMemoryBackend) Shutdown()

Shutdown cancels the backend's service context and waits for all in-flight replication goroutines to complete. Safe to call more than once.

func (*InMemoryBackend) Snapshot

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serialises the backend state to JSON. It implements persistence.Persistable.

func (*InMemoryBackend) TaggedResources added in v1.3.1

func (b *InMemoryBackend) TaggedResources() []TaggedEntry

TaggedResources returns every bucket's tag set keyed by its ARN. Real S3 object ARNs are excluded: GetResources's own ResourceTypeFilters documentation only ever gives "s3:bucket" as the S3 example (botocore 1.43.56, resourcegroupstaggingapi/2017-01-26/service-2.json.gz, GetResourcesInput.ResourceTypeFilters), and objects have no such type.

func (*InMemoryBackend) UpdateBucketMetadataAnnotationTableConfig added in v1.3.1

func (b *InMemoryBackend) UpdateBucketMetadataAnnotationTableConfig(
	_ context.Context,
	bucketName, configXML string,
) error

UpdateBucketMetadataAnnotationTableConfig stores the annotation table configuration XML for an S3 Metadata configuration (real key "metadataAnnotationTable" -- verified against s3@v1.106.5 serializers.go: awsRestxml_serializeOpUpdateBucketMetadataAnnotationTableConfiguration's httpbinding.SplitURI("/?metadataAnnotationTable")). There is no dedicated Get op for this sub-config in the pinned SDK; it is exposed to the caller, if at all, nested inside GetBucketMetadataConfiguration's body, matching how the sibling inventory/journal table configs already behave here.

func (*InMemoryBackend) UpdateBucketMetadataInventoryTableConfig

func (b *InMemoryBackend) UpdateBucketMetadataInventoryTableConfig(
	_ context.Context,
	bucketName, configXML string,
) error

UpdateBucketMetadataInventoryTableConfig stores the metadata inventory table configuration XML for an S3 Tables bucket.

func (*InMemoryBackend) UpdateBucketMetadataJournalTableConfig

func (b *InMemoryBackend) UpdateBucketMetadataJournalTableConfig(
	_ context.Context,
	bucketName, configXML string,
) error

UpdateBucketMetadataJournalTableConfig stores the metadata journal table configuration XML for an S3 Tables bucket.

func (*InMemoryBackend) UpdateObjectEncryption

func (b *InMemoryBackend) UpdateObjectEncryption(
	_ context.Context,
	bucketName, key, algorithm, kmsKeyID string,
) error

UpdateObjectEncryption updates the SSE algorithm (and optional KMS key id) of the latest version of the named object.

func (*InMemoryBackend) UploadPart

func (b *InMemoryBackend) UploadPart(
	ctx context.Context,
	input *s3.UploadPartInput,
) (*s3.UploadPartOutput, error)

func (*InMemoryBackend) WithCompressionMinBytes

func (b *InMemoryBackend) WithCompressionMinBytes(n int) *InMemoryBackend

WithCompressionMinBytes sets the minimum object size (in bytes) below which gzip compression is skipped. A value of 0 compresses all objects regardless of size (the original behaviour). Negative values are clamped to 0 to prevent misconfiguration (e.g., via env/flags) from silently changing semantics.

func (*InMemoryBackend) WithSkipMultipartSizeCheck

func (b *InMemoryBackend) WithSkipMultipartSizeCheck() *InMemoryBackend

WithSkipMultipartSizeCheck disables the 5 MiB minimum non-last-part size enforcement in CompleteMultipartUpload. Use only in tests.

type InitiateMultipartUploadResult

type InitiateMultipartUploadResult struct {
	XMLName  xml.Name `xml:"InitiateMultipartUploadResult"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	UploadID string   `xml:"UploadId"`
}

type InvalidRangeError

type InvalidRangeError struct {
	XMLName        xml.Name `xml:"Error"`
	Code           string   `xml:"Code"`
	Message        string   `xml:"Message"`
	Resource       string   `xml:"Resource"`
	RequestID      string   `xml:"RequestId"`
	RangeRequested string   `xml:"RangeRequested"`
	// ActualObjectSize is last so its 8-byte int sits after the pointer-bearing
	// string fields, keeping the GC pointer-scan region contiguous.
	ActualObjectSize int64 `xml:"ActualObjectSize"`
}

InvalidRangeError is the XML body S3 returns with a 416 response when a Range request is syntactically valid but cannot be satisfied (the first byte position is at or beyond the object size). It mirrors the real AWS payload, which carries the actual object size and the rejected range so clients can recover without an extra HeadObject round-trip.

type Janitor

type Janitor struct {
	Backend *InMemoryBackend

	Interval    time.Duration
	TaskTimeout time.Duration
	// contains filtered or unexported fields
}

Janitor is the S3 background worker that drains buckets queued for async deletion and records queue-depth metrics for the live dashboard.

func NewJanitor

func NewJanitor(backend *InMemoryBackend, settings Settings) *Janitor

NewJanitor creates a new S3 Janitor for the given backend. The janitor interval is taken from the provided settings; if zero, it falls back to defaultJanitorInterval.

func (*Janitor) GetExpirationHeader

func (j *Janitor) GetExpirationHeader(
	lcXML string,
	key string,
	tags []types.Tag,
	lastModified time.Time,
) string

GetExpirationHeader calculates the x-amz-expiration header for an object based on the bucket's lifecycle configuration.

func (*Janitor) Run

func (j *Janitor) Run(ctx context.Context)

Run runs the janitor loop until ctx is cancelled. Each tick, sweepAndDrain spawns one goroutine per pending bucket so that thousands of large buckets are drained in parallel rather than serially.

The worker primitive recovers panics from each sweep automatically.

func (*Janitor) SweepOnce

func (j *Janitor) SweepOnce(ctx context.Context)

SweepOnce runs a single sweep pass (lifecycle + multipart cleanup). Exposed for testing. Note: sweepAndDrain is intentionally excluded here because it spawns long-lived drain goroutines that must outlive any per-task timeout context.

type LambdaInvoker

type LambdaInvoker interface {
	InvokeFunction(
		ctx context.Context,
		name, invocationType string,
		payload []byte,
	) ([]byte, int, error)
}

LambdaInvoker invokes a Lambda function by name or ARN with a JSON payload.

type ListAllMyBucketsResult

type ListAllMyBucketsResult struct {
	XMLName xml.Name    `xml:"ListAllMyBucketsResult"`
	Owner   *Owner      `xml:"Owner"`
	Buckets []BucketXML `xml:"Buckets>Bucket"`
}

type ListBucketResult

type ListBucketResult struct {
	XMLName        xml.Name          `xml:"ListBucketResult"`
	Name           string            `xml:"Name"`
	Prefix         string            `xml:"Prefix"`
	Delimiter      string            `xml:"Delimiter,omitempty"`
	Marker         string            `xml:"Marker,omitempty"`
	NextMarker     string            `xml:"NextMarker,omitempty"`
	EncodingType   string            `xml:"EncodingType,omitempty"`
	Contents       []ObjectXML       `xml:"Contents"`
	CommonPrefixes []CommonPrefixXML `xml:"CommonPrefixes,omitempty"`
	MaxKeys        int               `xml:"MaxKeys"`
	IsTruncated    bool              `xml:"IsTruncated"`
}

type ListBucketV2Result

type ListBucketV2Result struct {
	XMLName               xml.Name          `xml:"ListBucketResult"`
	StartAfter            string            `xml:"StartAfter,omitempty"`
	Prefix                string            `xml:"Prefix"`
	Delimiter             string            `xml:"Delimiter,omitempty"`
	ContinuationToken     string            `xml:"ContinuationToken,omitempty"`
	NextContinuationToken string            `xml:"NextContinuationToken,omitempty"`
	Name                  string            `xml:"Name"`
	EncodingType          string            `xml:"EncodingType,omitempty"`
	Contents              []ObjectXML       `xml:"Contents"`
	CommonPrefixes        []CommonPrefixXML `xml:"CommonPrefixes,omitempty"`
	KeyCount              int               `xml:"KeyCount"`
	MaxKeys               int               `xml:"MaxKeys"`
	IsTruncated           bool              `xml:"IsTruncated"`
}

ListBucketV2Result is the XML response for ListObjectsV2.

type ListMultipartUploadsResult

type ListMultipartUploadsResult struct {
	XMLName            xml.Name          `xml:"ListMultipartUploadsResult"`
	Xmlns              string            `xml:"xmlns,attr,omitempty"`
	Bucket             string            `xml:"Bucket"`
	Delimiter          string            `xml:"Delimiter,omitempty"`
	Prefix             string            `xml:"Prefix"`
	KeyMarker          string            `xml:"KeyMarker,omitempty"`
	UploadIDMarker     string            `xml:"UploadIdMarker,omitempty"`
	NextKeyMarker      string            `xml:"NextKeyMarker,omitempty"`
	NextUploadIDMarker string            `xml:"NextUploadIdMarker,omitempty"`
	EncodingType       string            `xml:"EncodingType,omitempty"`
	Uploads            []MultipartUpload `xml:"Upload"`
	CommonPrefixes     []CommonPrefixXML `xml:"CommonPrefixes,omitempty"`
	MaxUploads         int               `xml:"MaxUploads"`
	IsTruncated        bool              `xml:"IsTruncated"`
}

type ListPartsResult

type ListPartsResult struct {
	XMLName              xml.Name  `xml:"ListPartsResult"`
	Xmlns                string    `xml:"xmlns,attr,omitempty"`
	Bucket               string    `xml:"Bucket"`
	Key                  string    `xml:"Key"`
	UploadID             string    `xml:"UploadId"`
	NextPartNumberMarker string    `xml:"NextPartNumberMarker,omitempty"`
	Parts                []PartXML `xml:"Part"`
	PartNumberMarker     int       `xml:"PartNumberMarker"`
	MaxParts             int       `xml:"MaxParts"`
	IsTruncated          bool      `xml:"IsTruncated"`
}

type ListVersionsResult

type ListVersionsResult struct {
	XMLName             xml.Name           `xml:"ListVersionsResult"`
	Name                string             `xml:"Name"`
	Prefix              string             `xml:"Prefix"`
	KeyMarker           string             `xml:"KeyMarker"`
	VersionIDMarker     string             `xml:"VersionIdMarker"`
	NextKeyMarker       string             `xml:"NextKeyMarker,omitempty"`
	NextVersionIDMarker string             `xml:"NextVersionIdMarker,omitempty"`
	Delimiter           string             `xml:"Delimiter,omitempty"`
	EncodingType        string             `xml:"EncodingType,omitempty"`
	CommonPrefixes      []CommonPrefixXML  `xml:"CommonPrefixes"`
	Versions            []ObjectVersionXML `xml:"Version"`
	DeleteMarkers       []DeleteMarkerXML  `xml:"DeleteMarker"`
	MaxKeys             int                `xml:"MaxKeys"`
	IsTruncated         bool               `xml:"IsTruncated"`
}

type LocationConstraintResponse

type LocationConstraintResponse struct {
	XMLName xml.Name `xml:"LocationConstraint"`
	Xmlns   string   `xml:"xmlns,attr"`
	Region  string   `xml:",chardata"`
}

LocationConstraintResponse is the XML response body for GetBucketLocation.

type LoggingEnabled

type LoggingEnabled struct {
	TargetBucket string `xml:"TargetBucket"`
	TargetPrefix string `xml:"TargetPrefix"`
}

LoggingEnabled holds the logging target configuration for a bucket.

type MultipartUpload

type MultipartUpload struct {
	Initiated    time.Time `xml:"Initiated"`
	Owner        *Owner    `xml:"Owner,omitempty"`
	Initiator    *Owner    `xml:"Initiator,omitempty"`
	Key          string    `xml:"Key"`
	UploadID     string    `xml:"UploadId"`
	StorageClass string    `xml:"StorageClass,omitempty"`
}

MultipartUpload describes a single in-progress multipart upload.

type NotificationDispatcher

type NotificationDispatcher interface {
	// DispatchObjectCreated sends an s3:ObjectCreated:Put notification for a PutObject operation.
	DispatchObjectCreated(
		ctx context.Context,
		bucket, key, etag string,
		size int64,
		notifXML string,
	)
	// DispatchObjectCopied sends an s3:ObjectCreated:Copy notification for a CopyObject operation.
	DispatchObjectCopied(ctx context.Context, bucket, key, etag string, size int64, notifXML string)
	// DispatchObjectCompleted sends an s3:ObjectCreated:CompleteMultipartUpload notification.
	DispatchObjectCompleted(
		ctx context.Context,
		bucket, key, etag string,
		size int64,
		notifXML string,
	)
	// DispatchObjectDeleted sends an s3:ObjectRemoved notification for the given object.
	DispatchObjectDeleted(ctx context.Context, bucket, key, notifXML string)
	// DispatchObjectRestorePost sends an s3:ObjectRestore:Post notification for a
	// RestoreObject request (object restore initiation).
	DispatchObjectRestorePost(ctx context.Context, bucket, key, notifXML string)
}

NotificationDispatcher delivers S3 event notifications to configured targets.

func NewNotificationDispatcher

func NewNotificationDispatcher(targets *NotificationTargets, region string) NotificationDispatcher

NewNotificationDispatcher creates a NotificationDispatcher that delivers events to the provided in-process targets (SQS, SNS, Lambda).

type NotificationTargets

type NotificationTargets struct {
	SQSSender            SQSSender
	SNSPublisher         SNSPublisher
	LambdaInvoker        LambdaInvoker
	EventBridgePublisher EventBridgePublisher
}

NotificationTargets holds concrete delivery clients for each supported target type.

type ObjectAttributes

type ObjectAttributes struct {
	LastModified time.Time
	Checksum     map[string]string
	Parts        *ObjectPartsAttributes
	ETag         string
	StorageClass string
	ObjectSize   int64
}

ObjectAttributes is the projection of object metadata returned by GetObjectAttributes.

type ObjectLegalHold

type ObjectLegalHold struct {
	XMLName xml.Name `xml:"LegalHold"`
	Xmlns   string   `xml:"xmlns,attr,omitempty"`
	Status  string   `xml:"Status"`
}

ObjectLegalHold is the XML body for PutObjectLegalHold / GetObjectLegalHold.

type ObjectLockConfiguration

type ObjectLockConfiguration struct {
	Rule              *ObjectLockRule `xml:"Rule,omitempty"`
	XMLName           xml.Name        `xml:"ObjectLockConfiguration"`
	Xmlns             string          `xml:"xmlns,attr,omitempty"`
	ObjectLockEnabled string          `xml:"ObjectLockEnabled"`
}

ObjectLockConfiguration is the XML body for PutObjectLockConfiguration / GetObjectLockConfiguration.

type ObjectLockRule

type ObjectLockRule struct {
	DefaultRetention *DefaultRetention `xml:"DefaultRetention,omitempty"`
}

ObjectLockRule holds the default retention rule for a bucket.

type ObjectMetadata

type ObjectMetadata struct {
	Tags              *tags.Tags
	UserMetadata      map[string]string
	ContentType       string
	ChecksumAlgorithm string
	ChecksumValue     string
}

ObjectMetadata holds internal metadata for storage operations. (Keeping this compatibility type if needed, though mostly replaced by SDK types usage).

type ObjectPartsAttributes added in v1.3.1

type ObjectPartsAttributes struct {
	Parts                []StoredObjectPart
	TotalPartsCount      int32
	PartNumberMarker     int32
	NextPartNumberMarker int32
	MaxParts             int32
	IsTruncated          bool
}

ObjectPartsAttributes contains multipart upload parts breakdown for GetObjectAttributes.

type ObjectRetention

type ObjectRetention struct {
	XMLName         xml.Name `xml:"Retention"`
	Xmlns           string   `xml:"xmlns,attr,omitempty"`
	Mode            string   `xml:"Mode"`
	RetainUntilDate string   `xml:"RetainUntilDate"`
}

ObjectRetention is the XML body for PutObjectRetention / GetObjectRetention.

type ObjectVersionXML

type ObjectVersionXML struct {
	Owner             *Owner `xml:"Owner"`
	Key               string `xml:"Key"`
	VersionID         string `xml:"VersionId"`
	LastModified      string `xml:"LastModified"`
	ETag              string `xml:"ETag"`
	StorageClass      string `xml:"StorageClass"`
	ChecksumAlgorithm string `xml:"ChecksumAlgorithm,omitempty"`
	Size              int64  `xml:"Size"`
	IsLatest          bool   `xml:"IsLatest"`
}

type ObjectXML

type ObjectXML struct {
	Owner             *Owner `xml:"Owner"`
	Key               string `xml:"Key"`
	LastModified      string `xml:"LastModified"`
	ETag              string `xml:"ETag"`
	StorageClass      string `xml:"StorageClass"`
	ChecksumAlgorithm string `xml:"ChecksumAlgorithm,omitempty"`
	Size              int64  `xml:"Size"`
}

type Owner

type Owner struct {
	ID          string `xml:"ID"`
	DisplayName string `xml:"DisplayName"`
}

type OwnershipControls

type OwnershipControls struct {
	XMLName xml.Name                `xml:"OwnershipControls"`
	Xmlns   string                  `xml:"xmlns,attr,omitempty"`
	Rules   []OwnershipControlsRule `xml:"Rule"`
}

OwnershipControls is the XML body for PutBucketOwnershipControls / GetBucketOwnershipControls.

type OwnershipControlsRule

type OwnershipControlsRule struct {
	ObjectOwnership string `xml:"ObjectOwnership"`
}

OwnershipControlsRule represents a single ownership controls rule.

type PartXML

type PartXML struct {
	ETag              string `xml:"ETag"`
	ChecksumCRC32     string `xml:"ChecksumCRC32,omitempty"`
	ChecksumCRC32C    string `xml:"ChecksumCRC32C,omitempty"`
	ChecksumCRC64NVME string `xml:"ChecksumCRC64NVME,omitempty"`
	ChecksumSHA1      string `xml:"ChecksumSHA1,omitempty"`
	ChecksumSHA256    string `xml:"ChecksumSHA256,omitempty"`
	Size              int64  `xml:"Size"`
	PartNumber        int    `xml:"PartNumber"`
}

PartXML describes a single uploaded part in a multipart upload.

type Provider

type Provider struct{}

Provider implements service.Provider for the S3 service.

func (*Provider) Init

Init initializes the S3 service backend, compressor, janitor, and handler.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the logical name of the provider.

type PublicAccessBlockConfiguration

type PublicAccessBlockConfiguration struct {
	XMLName               xml.Name `xml:"PublicAccessBlockConfiguration"`
	Xmlns                 string   `xml:"xmlns,attr,omitempty"`
	BlockPublicAcls       bool     `xml:"BlockPublicAcls"`
	IgnorePublicAcls      bool     `xml:"IgnorePublicAcls"`
	BlockPublicPolicy     bool     `xml:"BlockPublicPolicy"`
	RestrictPublicBuckets bool     `xml:"RestrictPublicBuckets"`
}

PublicAccessBlockConfiguration is the XML body for PutPublicAccessBlock / GetPublicAccessBlock.

type ReplicationConfiguration

type ReplicationConfiguration struct {
	XMLName xml.Name          `xml:"ReplicationConfiguration"`
	Xmlns   string            `xml:"xmlns,attr,omitempty"`
	Role    string            `xml:"Role"`
	Rules   []ReplicationRule `xml:"Rule"`
}

ReplicationConfiguration is the XML body for PutBucketReplication / GetBucketReplication. The full structure is complex; we store and return the raw XML for fidelity.

type ReplicationDestination

type ReplicationDestination struct {
	Bucket       string `xml:"Bucket"`
	StorageClass string `xml:"StorageClass,omitempty"`
}

ReplicationDestination specifies the destination bucket for replication.

type ReplicationRule

type ReplicationRule struct {
	Filter                  *ReplicationRuleFilter  `xml:"Filter,omitempty"`
	Destination             ReplicationDestination  `xml:"Destination"`
	DeleteMarkerReplication DeleteMarkerReplication `xml:"DeleteMarkerReplication"`
	ID                      string                  `xml:"ID,omitempty"`
	// Prefix is the legacy (deprecated) top-level filter field. Modern
	// configurations use Filter>Prefix instead -- see matchesReplicationRule
	// in replication.go, which checks Filter first and falls back to this.
	Prefix string `xml:"Prefix,omitempty"`
	Status string `xml:"Status"`
}

ReplicationRule is a single replication rule within a ReplicationConfiguration.

type ReplicationRuleFilter added in v1.3.1

type ReplicationRuleFilter struct {
	Prefix *string `xml:"Prefix,omitempty"`
	Tag    *Tag    `xml:"Tag,omitempty"`
}

ReplicationRuleFilter identifies the subset of objects a replication rule applies to. Real S3 requires exactly one of Prefix/Tag/And to be set (see aws-sdk-go-v2/service/s3/types.ReplicationRuleFilter's doc comment); And-based composite (multi-tag/prefix+tag) filters are not evaluated by this emulator (see matchesReplicationRule) and are a documented gap.

type S3Handler

type S3Handler struct {
	Backend StorageBackend

	DefaultRegion string
	Endpoint      string
	// PresignSecret, when non-empty, opts the handler into cryptographic
	// verification of presigned-URL signatures (SigV4 query-auth). It is empty
	// by default so presigned URLs are accepted on structure/expiry alone,
	// preserving backwards-compatible behaviour.
	PresignSecret string
	// contains filtered or unexported fields
}

S3Handler implements the S3-compatible service for object storage operations.

func NewHandler

func NewHandler(backend StorageBackend) *S3Handler

NewHandler creates a new S3 Handler with the given backend.

func (*S3Handler) BucketsByRegion

func (h *S3Handler) BucketsByRegion(region string) []types.Bucket

BucketsByRegion returns buckets in the given region (all if empty). Returns an empty slice when not using the in-memory backend.

func (*S3Handler) ChaosOperations

func (h *S3Handler) ChaosOperations() []string

ChaosOperations returns all operations that can be fault-injected.

func (*S3Handler) ChaosRegions

func (h *S3Handler) ChaosRegions() []string

ChaosRegions returns all regions this S3 instance handles.

func (*S3Handler) ChaosServiceName

func (h *S3Handler) ChaosServiceName() string

ChaosServiceName returns the lowercase AWS service name for fault rule matching.

func (*S3Handler) ExtractOperation

func (h *S3Handler) ExtractOperation(c *echo.Context) string

ExtractOperation returns the current S3 operation from context.

func (*S3Handler) ExtractResource

func (h *S3Handler) ExtractResource(c *echo.Context) string

ExtractResource returns the bucket name for this request.

func (*S3Handler) GetSupportedOperations

func (h *S3Handler) GetSupportedOperations() []string

GetSupportedOperations returns a list of supported S3 operations.

func (*S3Handler) Handler

func (h *S3Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for S3 requests.

func (*S3Handler) MatchPriority

func (h *S3Handler) MatchPriority() int

MatchPriority returns the priority for the S3 matcher. Catch-all matchers have the lowest priority (0), ensuring other services match first.

func (*S3Handler) Name

func (h *S3Handler) Name() string

Name returns the service identifier.

func (*S3Handler) Purge

func (h *S3Handler) Purge(ctx context.Context, cutoff time.Time)

Purge removes resources created before the given cutoff time.

func (*S3Handler) Regions

func (h *S3Handler) Regions() []string

Regions returns all regions with buckets in the backend. Returns an empty slice when not using the in-memory backend.

func (*S3Handler) Reset

func (h *S3Handler) Reset()

Reset clears all in-memory state from the backend. It is used by the POST /_gopherstack/reset endpoint for CI pipelines and rapid local development.

func (*S3Handler) Restore

func (h *S3Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable by delegating to the backend.

func (*S3Handler) RouteMatcher

func (h *S3Handler) RouteMatcher() service.Matcher

RouteMatcher returns a matcher that accepts all S3 requests (catch-all). With priority-based routing, S3 is matched last due to low priority. Excludes API endpoints and dashboard routes which take precedence.

func (*S3Handler) ServeWebsite

func (h *S3Handler) ServeWebsite(c *echo.Context) error

ServeWebsite serves a static file from an S3 bucket configured for website hosting. It is invoked by the GET /_gopherstack/website/{bucket}/{key+} route registered in cli.go. The bucket must have a website configuration stored via PutBucketWebsite.

func (*S3Handler) SetNotificationDispatcher

func (h *S3Handler) SetNotificationDispatcher(d NotificationDispatcher)

SetNotificationDispatcher attaches a NotificationDispatcher that delivers S3 event notifications to SQS/SNS/Lambda targets on PutObject and DeleteObject.

func (*S3Handler) SetObjectLambdaConfig

func (h *S3Handler) SetObjectLambdaConfig(bucket, lambdaARN string)

SetObjectLambdaConfig registers a Lambda ARN to be invoked for GetObject requests on the given bucket. When set, GetObject triggers the Lambda and waits for WriteGetObjectResponse before streaming the (transformed) body back to the caller.

func (*S3Handler) Snapshot

func (h *S3Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable by delegating to the backend.

func (*S3Handler) StartWorker

func (h *S3Handler) StartWorker(ctx context.Context) error

StartWorker starts the background janitor if it is configured.

func (*S3Handler) WithJanitor

func (h *S3Handler) WithJanitor(settings Settings, taskTimeout ...time.Duration) *S3Handler

WithJanitor attaches a background janitor to the handler.

func (*S3Handler) WithPresignValidation

func (h *S3Handler) WithPresignValidation(secret string) *S3Handler

WithPresignValidation enables cryptographic SigV4 verification of presigned-URL signatures, checking each signature against the given secret. A blank secret defaults to "test" (the conventional dummy credential). When never called, presigned URLs are validated on structure and expiry only.

type SNSPublisher

type SNSPublisher interface {
	PublishToTopic(ctx context.Context, topicARN, message, subject string) error
}

SNSPublisher publishes a message to an SNS topic identified by ARN.

type SQSSender

type SQSSender interface {
	SendMessageToQueue(ctx context.Context, queueARN, messageBody string) error
}

SQSSender sends a message body to an SQS queue identified by ARN.

type ServerSideEncryptionByDefault

type ServerSideEncryptionByDefault struct {
	SSEAlgorithm   string `xml:"SSEAlgorithm"`
	KMSMasterKeyID string `xml:"KMSMasterKeyID,omitempty"`
}

ServerSideEncryptionByDefault holds the default encryption algorithm and optional KMS key.

type ServerSideEncryptionConfiguration

type ServerSideEncryptionConfiguration struct {
	XMLName xml.Name                   `xml:"ServerSideEncryptionConfiguration"`
	Xmlns   string                     `xml:"xmlns,attr,omitempty"`
	Rules   []ServerSideEncryptionRule `xml:"Rule"`
}

ServerSideEncryptionConfiguration is the XML body for PutBucketEncryption / GetBucketEncryption.

type ServerSideEncryptionRule

type ServerSideEncryptionRule struct {
	ApplyServerSideEncryptionByDefault ServerSideEncryptionByDefault `xml:"ApplyServerSideEncryptionByDefault"`
	BucketKeyEnabled                   bool                          `xml:"BucketKeyEnabled,omitempty"`
}

ServerSideEncryptionRule represents a single encryption rule.

type Settings

type Settings struct {
	DefaultRegion       string        `json:"default_region"        env:"S3_REGION"                default:"us-east-1" help:"Default region for S3."` //nolint:lll // Kong struct tag makes this line long
	JanitorInterval     time.Duration `json:"janitor_interval"      env:"S3_JANITOR_INTERVAL"      default:"500ms"     help:"Janitor tick interval."` //nolint:lll // Kong struct tag makes this line long
	CompressionMinBytes int           ``                                                                                                              //nolint:lll // config struct tags are intentionally verbose
	/* 219-byte string literal not displayed */
}

Settings holds service-level configuration for the S3 backend. Fields are picked up by the Kong CLI parser when this struct is embedded in the root CLI command.

func DefaultSettings

func DefaultSettings() Settings

DefaultSettings returns a Settings struct populated with the documented defaults. This is used when no ConfigProvider is available at init time.

type StorageBackend

type StorageBackend interface {
	CreateBucket(ctx context.Context, input *s3.CreateBucketInput) (*s3.CreateBucketOutput, error)
	DeleteBucket(ctx context.Context, input *s3.DeleteBucketInput) (*s3.DeleteBucketOutput, error)
	HeadBucket(ctx context.Context, input *s3.HeadBucketInput) (*s3.HeadBucketOutput, error)
	ListBuckets(ctx context.Context, input *s3.ListBucketsInput) (*s3.ListBucketsOutput, error)

	PutObject(ctx context.Context, input *s3.PutObjectInput) (*s3.PutObjectOutput, error)
	GetObject(ctx context.Context, input *s3.GetObjectInput) (*s3.GetObjectOutput, error)
	HeadObject(ctx context.Context, input *s3.HeadObjectInput) (*s3.HeadObjectOutput, error)
	DeleteObject(ctx context.Context, input *s3.DeleteObjectInput) (*s3.DeleteObjectOutput, error)
	DeleteObjects(
		ctx context.Context,
		input *s3.DeleteObjectsInput,
	) (*s3.DeleteObjectsOutput, error)
	ListObjects(ctx context.Context, input *s3.ListObjectsInput) (*s3.ListObjectsOutput, error)
	ListObjectsV2(
		ctx context.Context,
		input *s3.ListObjectsV2Input,
	) (*s3.ListObjectsV2Output, error)
	ListObjectVersions(
		ctx context.Context,
		input *s3.ListObjectVersionsInput,
	) (*s3.ListObjectVersionsOutput, error)

	// Versioning
	PutBucketVersioning(
		ctx context.Context,
		input *s3.PutBucketVersioningInput,
	) (*s3.PutBucketVersioningOutput, error)
	GetBucketVersioning(
		ctx context.Context,
		input *s3.GetBucketVersioningInput,
	) (*s3.GetBucketVersioningOutput, error)

	// Tagging
	PutObjectTagging(
		ctx context.Context,
		input *s3.PutObjectTaggingInput,
	) (*s3.PutObjectTaggingOutput, error)
	GetObjectTagging(
		ctx context.Context,
		input *s3.GetObjectTaggingInput,
	) (*s3.GetObjectTaggingOutput, error)
	DeleteObjectTagging(
		ctx context.Context,
		input *s3.DeleteObjectTaggingInput,
	) (*s3.DeleteObjectTaggingOutput, error)

	// Bucket Tagging
	PutBucketTagging(ctx context.Context, bucket string, tags []types.Tag) error
	GetBucketTagging(ctx context.Context, bucket string) ([]types.Tag, error)
	DeleteBucketTagging(ctx context.Context, bucket string) error

	// ACL
	PutBucketACL(ctx context.Context, bucket, acl string) error
	GetBucketACL(ctx context.Context, bucket string) (string, error)

	// Policy
	PutBucketPolicy(ctx context.Context, bucket, policy string) error
	GetBucketPolicy(ctx context.Context, bucket string) (string, error)
	DeleteBucketPolicy(ctx context.Context, bucket string) error

	// CORS
	PutBucketCORS(ctx context.Context, bucket, corsXML string) error
	GetBucketCORS(ctx context.Context, bucket string) (string, error)
	DeleteBucketCORS(ctx context.Context, bucket string) error

	// Lifecycle
	PutBucketLifecycleConfiguration(ctx context.Context, bucket, lifecycleXML string) error
	GetBucketLifecycleConfiguration(ctx context.Context, bucket string) (string, error)
	DeleteBucketLifecycleConfiguration(ctx context.Context, bucket string) error

	// Website
	PutBucketWebsite(ctx context.Context, bucket, websiteXML string) error
	GetBucketWebsite(ctx context.Context, bucket string) (string, error)
	DeleteBucketWebsite(ctx context.Context, bucket string) error

	// Encryption
	PutBucketEncryption(ctx context.Context, bucket, encryptionXML string) error
	GetBucketEncryption(ctx context.Context, bucket string) (string, error)
	DeleteBucketEncryption(ctx context.Context, bucket string) error

	// Public Access Block
	PutPublicAccessBlock(ctx context.Context, bucket, configXML string) error
	GetPublicAccessBlock(ctx context.Context, bucket string) (string, error)
	DeletePublicAccessBlock(ctx context.Context, bucket string) error

	// Ownership Controls
	PutBucketOwnershipControls(ctx context.Context, bucket, configXML string) error
	GetBucketOwnershipControls(ctx context.Context, bucket string) (string, error)
	DeleteBucketOwnershipControls(ctx context.Context, bucket string) error

	// Logging
	PutBucketLogging(ctx context.Context, bucket, loggingXML string) error
	GetBucketLogging(ctx context.Context, bucket string) (string, error)

	// Replication
	PutBucketReplication(ctx context.Context, bucket, replicationXML string) error
	GetBucketReplication(ctx context.Context, bucket string) (string, error)
	DeleteBucketReplication(ctx context.Context, bucket string) error

	// Notifications
	PutBucketNotificationConfiguration(ctx context.Context, bucket, notifXML string) error
	GetBucketNotificationConfiguration(ctx context.Context, bucket string) (string, error)

	// Object Lock
	PutObjectLockConfiguration(ctx context.Context, bucket, configXML string) error
	GetObjectLockConfiguration(ctx context.Context, bucket string) (string, error)
	PutObjectRetention(
		ctx context.Context,
		bucket, key string,
		versionID *string,
		mode string,
		retainUntil time.Time,
	) error
	GetObjectRetention(
		ctx context.Context,
		bucket, key string,
		versionID *string,
	) (mode string, retainUntil time.Time, err error)
	PutObjectLegalHold(
		ctx context.Context,
		bucket, key string,
		versionID *string,
		status string,
	) error
	GetObjectLegalHold(
		ctx context.Context,
		bucket, key string,
		versionID *string,
	) (status string, err error)

	// Multipart
	CreateMultipartUpload(
		ctx context.Context,
		input *s3.CreateMultipartUploadInput,
	) (*s3.CreateMultipartUploadOutput, error)
	UploadPart(ctx context.Context, input *s3.UploadPartInput) (*s3.UploadPartOutput, error)
	CompleteMultipartUpload(
		ctx context.Context,
		input *s3.CompleteMultipartUploadInput,
	) (*s3.CompleteMultipartUploadOutput, error)
	AbortMultipartUpload(
		ctx context.Context,
		input *s3.AbortMultipartUploadInput,
	) (*s3.AbortMultipartUploadOutput, error)
	ListMultipartUploads(
		ctx context.Context,
		input *s3.ListMultipartUploadsInput,
	) (*s3.ListMultipartUploadsOutput, error)
	ListParts(
		ctx context.Context,
		input *s3.ListPartsInput,
	) (*s3.ListPartsOutput, error)

	// Metadata helpers
	GetBucketMetadata(
		ctx context.Context,
		bucketName string,
	) (region string, lifecycleXML string, tags []types.Tag, err error)

	// Analytics (supports multiple configs per bucket via id)
	PutBucketAnalyticsConfiguration(ctx context.Context, bucket, id, configXML string) error
	GetBucketAnalyticsConfiguration(ctx context.Context, bucket, id string) (string, error)
	DeleteBucketAnalyticsConfiguration(ctx context.Context, bucket, id string) error
	ListBucketAnalyticsConfigurations(ctx context.Context, bucket string) ([]string, error)

	// Intelligent Tiering (supports multiple configs per bucket via id)
	PutBucketIntelligentTieringConfiguration(
		ctx context.Context,
		bucket, id, configXML string,
	) error
	GetBucketIntelligentTieringConfiguration(ctx context.Context, bucket, id string) (string, error)
	DeleteBucketIntelligentTieringConfiguration(ctx context.Context, bucket, id string) error
	ListBucketIntelligentTieringConfigurations(ctx context.Context, bucket string) ([]string, error)

	// Inventory (supports multiple configs per bucket via id)
	PutBucketInventoryConfiguration(ctx context.Context, bucket, id, configXML string) error
	GetBucketInventoryConfiguration(ctx context.Context, bucket, id string) (string, error)
	DeleteBucketInventoryConfiguration(ctx context.Context, bucket, id string) error
	ListBucketInventoryConfigurations(ctx context.Context, bucket string) ([]string, error)

	// Lifecycle (legacy alias)
	DeleteBucketLifecycle(ctx context.Context, bucket string) error

	// Metadata Configuration
	CreateBucketMetadataConfiguration(ctx context.Context, bucket, configXML string) error
	GetBucketMetadataConfiguration(ctx context.Context, bucket string) (string, error)
	DeleteBucketMetadataConfiguration(ctx context.Context, bucket string) error

	// Metadata Table Configuration
	CreateBucketMetadataTableConfiguration(ctx context.Context, bucket, configXML string) error
	GetBucketMetadataTableConfiguration(ctx context.Context, bucket string) (string, error)
	DeleteBucketMetadataTableConfiguration(ctx context.Context, bucket string) error

	// Metrics (supports multiple configs per bucket via id)
	PutBucketMetricsConfiguration(ctx context.Context, bucket, id, configXML string) error
	GetBucketMetricsConfiguration(ctx context.Context, bucket, id string) (string, error)
	DeleteBucketMetricsConfiguration(ctx context.Context, bucket, id string) error
	ListBucketMetricsConfigurations(ctx context.Context, bucket string) ([]string, error)

	// Session
	CreateSession(ctx context.Context, bucket string) (string, error)

	// Accelerate / RequestPayment configurations
	PutBucketAccelerateConfiguration(ctx context.Context, bucket, status string) error
	GetBucketAccelerateConfiguration(ctx context.Context, bucket string) (string, error)
	PutBucketRequestPayment(ctx context.Context, bucket, payer string) error
	GetBucketRequestPayment(ctx context.Context, bucket string) (string, error)

	// ABAC Configuration (S3 Tables / Express)
	PutBucketAbac(ctx context.Context, bucket, configXML string) error
	GetBucketAbac(ctx context.Context, bucket string) (string, error)

	// S3 Express directory buckets
	ListDirectoryBuckets(ctx context.Context) ([]types.Bucket, error)

	// Metadata Inventory / Journal Table Configurations (S3 Tables)
	UpdateBucketMetadataInventoryTableConfig(ctx context.Context, bucket, configXML string) error
	UpdateBucketMetadataJournalTableConfig(ctx context.Context, bucket, configXML string) error
	UpdateBucketMetadataAnnotationTableConfig(ctx context.Context, bucket, configXML string) error

	// Object Annotations
	PutObjectAnnotation(
		ctx context.Context,
		input *s3.PutObjectAnnotationInput,
	) (*s3.PutObjectAnnotationOutput, error)
	GetObjectAnnotation(
		ctx context.Context,
		input *s3.GetObjectAnnotationInput,
	) (*s3.GetObjectAnnotationOutput, error)
	DeleteObjectAnnotation(
		ctx context.Context,
		input *s3.DeleteObjectAnnotationInput,
	) (*s3.DeleteObjectAnnotationOutput, error)
	ListObjectAnnotations(
		ctx context.Context,
		input *s3.ListObjectAnnotationsInput,
	) (*s3.ListObjectAnnotationsOutput, error)

	// GetObjectAttributes / RestoreObject / RenameObject
	GetObjectAttributes(
		ctx context.Context,
		bucket, key, versionID string,
		maxParts, partNumberMarker int32,
	) (*ObjectAttributes, error)
	RestoreObject(ctx context.Context, bucket, key string, days int) error
	RenameObject(ctx context.Context, bucket, sourceKey, targetKey string) error

	// Object ACLs
	PutObjectACL(ctx context.Context, bucket, key, versionID, acl string) error
	GetObjectACL(ctx context.Context, bucket, key, versionID string) (string, error)

	// Per-object SSE updates
	UpdateObjectEncryption(ctx context.Context, bucket, key, algorithm, kmsKeyID string) error
}

type StorageClassTransition

type StorageClassTransition struct {
	TransitionedAt time.Time `json:"transitionedAt"`
	FromClass      string    `json:"fromClass"`
	ToClass        string    `json:"toClass"`
	RuleID         string    `json:"ruleID,omitempty"`
}

StorageClassTransition records a single storage class change applied by a lifecycle rule.

type StoredAnnotation added in v1.3.1

type StoredAnnotation struct {
	LastModified      time.Time               `json:"lastModified"`
	Name              string                  `json:"name"`
	ETag              string                  `json:"etag"`
	ChecksumAlgorithm types.ChecksumAlgorithm `json:"checksumAlgorithm,omitempty"`
	ChecksumCRC32     *string                 `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    *string                 `json:"checksumCRC32C,omitempty"`
	ChecksumSHA1      *string                 `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    *string                 `json:"checksumSHA256,omitempty"`
	ChecksumCRC64NVME *string                 `json:"checksumCRC64NVME,omitempty"`
	Payload           []byte                  `json:"payload"`
}

StoredAnnotation represents a single named annotation attached to an object version (PutObjectAnnotation / GetObjectAnnotation / ListObjectAnnotations).

type StoredBucket

type StoredBucket struct {
	CreationDate time.Time                `json:"creationDate"`
	Objects      map[string]*StoredObject `json:"objects,omitempty"`

	Region                        string                       `json:"region,omitempty"`
	WebsiteConfig                 string                       `json:"websiteConfig,omitempty"`
	PublicAccessBlockConfig       string                       `json:"publicAccessBlockConfig,omitempty"`
	LifecycleConfig               string                       `json:"lifecycleConfig,omitempty"`
	NotificationConfig            string                       `json:"notificationConfig,omitempty"`
	ObjectLockConfig              string                       `json:"objectLockConfig,omitempty"`
	Policy                        string                       `json:"policy,omitempty"`
	EncryptionConfig              string                       `json:"encryptionConfig,omitempty"`
	CORSConfig                    string                       `json:"corsConfig,omitempty"`
	OwnershipControlsConfig       string                       `json:"ownershipControlsConfig,omitempty"`
	LoggingConfig                 string                       `json:"loggingConfig,omitempty"`
	ReplicationConfig             string                       `json:"replicationConfig,omitempty"`
	AnalyticsConfigs              map[string]string            `json:"analyticsConfigs,omitempty"`
	IntelligentTieringConfigs     map[string]string            `json:"intelligentTieringConfigs,omitempty"`
	InventoryConfigs              map[string]string            `json:"inventoryConfigs,omitempty"`
	MetadataConfig                string                       `json:"metadataConfig,omitempty"`
	MetadataTableConfig           string                       `json:"metadataTableConfig,omitempty"`
	AbacConfig                    string                       `json:"abacConfig,omitempty"`
	MetadataInventoryTableConfig  string                       `json:"metadataInventoryTableConfig,omitempty"`
	MetadataJournalTableConfig    string                       `json:"metadataJournalTableConfig,omitempty"`
	MetadataAnnotationTableConfig string                       `json:"metadataAnnotationTableConfig,omitempty"`
	MetricsConfigs                map[string]string            `json:"metricsConfigs,omitempty"`
	Versioning                    types.BucketVersioningStatus `json:"versioning,omitempty"`
	// MFADelete is stored as a plain string, not a typed SDK enum, because the
	// real request and response shapes use two DIFFERENT Go types for the same
	// concept (VersioningConfiguration.MFADelete is types.MFADelete;
	// GetBucketVersioningOutput.MFADelete is types.MFADeleteStatus,
	// s3@v1.106.5 api_op_GetBucketVersioning.go/types/enums.go) -- both hold
	// the same "Enabled"/"Disabled" strings on the wire.
	MFADelete           string      `json:"mfaDelete,omitempty"`
	Name                string      `json:"name"`
	ACL                 string      `json:"acl,omitempty"`
	AccelerateStatus    string      `json:"accelerateStatus,omitempty"`
	RequestPaymentPayer string      `json:"requestPaymentPayer,omitempty"`
	Tags                []types.Tag `json:"tags,omitempty"`
	DeletePending       bool        `json:"deletePending,omitempty"`
	IsDirectoryBucket   bool        `json:"isDirectoryBucket,omitempty"`
	// ObjectLockEnabled records whether CreateBucket was called with
	// x-amz-bucket-object-lock-enabled: true. Real S3 requires this at bucket
	// creation before PutObjectLockConfiguration will accept a configuration
	// (gopherstack-pzth) -- it cannot be turned on for an existing bucket.
	ObjectLockEnabled bool `json:"objectLockEnabled,omitempty"`
	// contains filtered or unexported fields
}

StoredBucket represents an S3 bucket in memory.

Buckets are keyed by Name (globally unique -- CreateBucket enforces this across all regions, mirroring real S3's global bucket-namespace). Region never changes after creation (S3 has no "move bucket to another region" operation).

type StoredMultipartUpload

type StoredMultipartUpload struct {
	Initiated time.Time             `json:"initiated"`
	Parts     map[int32]*StoredPart `json:"parts,omitempty"`

	UploadID string `json:"uploadID"`
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	// Tagging holds the URL-encoded tag string from the X-Amz-Tagging header
	// supplied at CreateMultipartUpload time. It is applied to the resulting
	// object version when CompleteMultipartUpload succeeds.
	Tagging string `json:"tagging,omitempty"`
	// SSE captures the encryption headers from CreateMultipartUpload so the
	// completed object's assembled body can be sealed with the same envelope
	// (matching real S3 — SSE is fixed at session-init). Persisted so that an
	// in-flight upload that survives a snapshot/restore still completes with
	// the caller's chosen encryption rather than silently landing unencrypted.
	// (The SSE-C customer key inside sseInfo stays request-scoped — see
	// sseInfo.SSECKeyB64 — so SSE-C uploads still require the key on Complete.)
	SSE sseInfo `json:"sse"`
	// StorageClass is the x-amz-storage-class header from CreateMultipartUpload
	// (real S3 fixes storage class at session-init, same as SSE above). Applied
	// to the resulting object version on CompleteMultipartUpload and reported
	// back verbatim by ListMultipartUploads.
	StorageClass string `json:"storageClass,omitempty"`
	// contains filtered or unexported fields
}

StoredMultipartUpload represents an ongoing multipart upload session.

type StoredObject

type StoredObject struct {
	Versions map[string]*StoredObjectVersion `json:"versions,omitempty"`

	Key             string `json:"key"`
	LatestVersionID string `json:"latestVersionID"`
	// contains filtered or unexported fields
}

StoredObject represents an S3 object with its version history.

type StoredObjectPart added in v1.3.1

type StoredObjectPart struct {
	ChecksumCRC32     *string `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    *string `json:"checksumCRC32C,omitempty"`
	ChecksumCRC64NVME *string `json:"checksumCRC64NVME,omitempty"`
	ChecksumSHA1      *string `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    *string `json:"checksumSHA256,omitempty"`
	PartNumber        int32   `json:"partNumber"`
	Size              int64   `json:"size"`
}

StoredObjectPart represents metadata for an individual completed multipart upload part.

type StoredObjectVersion

type StoredObjectVersion struct {
	RetainUntil             time.Time                    `json:"retainUntil"`
	RestoreExpiry           time.Time                    `json:"restoreExpiry,omitzero"`
	LastModified            time.Time                    `json:"lastModified"`
	ChecksumSHA1            *string                      `json:"checksumSHA1,omitempty"`
	Metadata                map[string]string            `json:"metadata,omitempty"`
	Annotations             map[string]*StoredAnnotation `json:"annotations,omitempty"`
	ChecksumCRC64NVME       *string                      `json:"checksumCRC64NVME,omitempty"`
	ChecksumCRC32C          *string                      `json:"checksumCRC32C,omitempty"`
	ChecksumCRC32           *string                      `json:"checksumCRC32,omitempty"`
	ChecksumSHA256          *string                      `json:"checksumSHA256,omitempty"`
	SSEAlgorithm            string                       `json:"sseAlgorithm,omitempty"`
	VersionID               string                       `json:"versionID"`
	ChecksumAlgorithm       types.ChecksumAlgorithm      `json:"checksumAlgorithm,omitempty"`
	SSECKeyMD5              string                       `json:"sseCKeyMD5,omitempty"`
	SSECAlgorithm           string                       `json:"sseCAlgorithm,omitempty"`
	Key                     string                       `json:"key"`
	ETag                    string                       `json:"etag"`
	ContentType             string                       `json:"contentType"`
	ContentEncoding         string                       `json:"contentEncoding,omitempty"`
	ContentDisposition      string                       `json:"contentDisposition,omitempty"`
	RetentionMode           string                       `json:"retentionMode,omitempty"`
	StorageClass            string                       `json:"storageClass,omitempty"`
	ACL                     string                       `json:"acl,omitempty"`
	SSEKMSKeyID             string                       `json:"sseKMSKeyID,omitempty"`
	Parts                   []StoredObjectPart           `json:"parts,omitempty"`
	EncryptionNonce         []byte                       `json:"encryptionNonce,omitempty"`
	Data                    []byte                       `json:"data,omitempty"`
	StorageClassTransitions []StorageClassTransition     `json:"storageClassTransitions,omitempty"`
	EncryptionDEK           []byte                       `json:"encryptionDEK,omitempty"`
	Size                    int64                        `json:"size"`
	IsCompressed            bool                         `json:"isCompressed,omitempty"`
	IsLatest                bool                         `json:"isLatest"`
	Deleted                 bool                         `json:"deleted,omitempty"`
	LegalHold               bool                         `json:"legalHold,omitempty"`
	OngoingRestore          bool                         `json:"ongoingRestore,omitempty"`
}

StoredObjectVersion represents a specific version of an S3 object.

type StoredPart

type StoredPart struct {
	ETag              string  `json:"etag"`
	ChecksumCRC32     *string `json:"checksumCRC32,omitempty"`
	ChecksumCRC32C    *string `json:"checksumCRC32C,omitempty"`
	ChecksumCRC64NVME *string `json:"checksumCRC64NVME,omitempty"`
	ChecksumSHA1      *string `json:"checksumSHA1,omitempty"`
	ChecksumSHA256    *string `json:"checksumSHA256,omitempty"`
	Data              []byte  `json:"data,omitempty"`
	PartNumber        int32   `json:"partNumber"`
	Size              int64   `json:"size"`
}

StoredPart represents a single part of a multipart upload.

type Tag

type Tag struct {
	Key   string `xml:"Key"`
	Value string `xml:"Value"`
}

type TagSet

type TagSet struct {
	Tags []Tag `xml:"Tag"`
}

type TaggedEntry added in v1.3.1

type TaggedEntry struct {
	Tags map[string]string
	ARN  string
}

TaggedEntry pairs a bucket ARN with its tag set, for the Resource Groups Tagging API's GetResources (see cli.go's wireTaggingS3).

type Tagging

type Tagging struct {
	XMLName xml.Name `xml:"Tagging"`
	TagSet  TagSet   `xml:"TagSet"`
}

type UploadPartCopyResult

type UploadPartCopyResult struct {
	XMLName      xml.Name `xml:"CopyPartResult"`
	LastModified string   `xml:"LastModified"`
	ETag         string   `xml:"ETag"`
}

type VersioningConfiguration

type VersioningConfiguration struct {
	XMLName xml.Name `xml:"VersioningConfiguration"`
	Status  string   `xml:"Status,omitempty"` // "Enabled" or "Suspended"; omitted when versioning is not yet configured
	// MfaDelete ("MfaDelete" element name confirmed s3@v1.106.5 deserializers.go's
	// awsRestxml_deserializeOpDocumentGetBucketVersioningOutput, case
	// strings.EqualFold("MfaDelete", ...)) is only present once a bucket has ever
	// had MFA delete configured -- omitted, not "Disabled", beforehand.
	MfaDelete string `xml:"MfaDelete,omitempty"`
}

type WebsiteConfiguration

type WebsiteConfiguration struct {
	XMLName               xml.Name              `xml:"WebsiteConfiguration"`
	Xmlns                 string                `xml:"xmlns,attr,omitempty"`
	IndexDocument         *WebsiteIndexDocument `xml:"IndexDocument,omitempty"`
	ErrorDocument         *WebsiteErrorDocument `xml:"ErrorDocument,omitempty"`
	RedirectAllRequestsTo *WebsiteRedirectAll   `xml:"RedirectAllRequestsTo,omitempty"`
	RoutingRules          []WebsiteRoutingRule  `xml:"RoutingRules>RoutingRule,omitempty"`
}

WebsiteConfiguration is the XML body for PutBucketWebsite / GetBucketWebsite.

type WebsiteErrorDocument

type WebsiteErrorDocument struct {
	Key string `xml:"Key"`
}

WebsiteErrorDocument specifies the object to return on 4XX errors.

type WebsiteIndexDocument

type WebsiteIndexDocument struct {
	Suffix string `xml:"Suffix"`
}

WebsiteIndexDocument specifies the suffix of the object used as an index.

type WebsiteRedirectAll

type WebsiteRedirectAll struct {
	HostName string `xml:"HostName"`
	Protocol string `xml:"Protocol,omitempty"`
}

WebsiteRedirectAll configures a redirect for all requests to a given host.

type WebsiteRoutingRule

type WebsiteRoutingRule struct {
	Condition *WebsiteRoutingRuleCondition `xml:"Condition,omitempty"`
	Redirect  WebsiteRoutingRuleRedirect   `xml:"Redirect"`
}

WebsiteRoutingRule is a single conditional routing rule.

type WebsiteRoutingRuleCondition

type WebsiteRoutingRuleCondition struct {
	KeyPrefixEquals             string `xml:"KeyPrefixEquals,omitempty"`
	HTTPErrorCodeReturnedEquals string `xml:"HttpErrorCodeReturnedEquals,omitempty"`
}

WebsiteRoutingRuleCondition specifies the condition for a routing rule.

type WebsiteRoutingRuleRedirect

type WebsiteRoutingRuleRedirect struct {
	HostName             string `xml:"HostName,omitempty"`
	Protocol             string `xml:"Protocol,omitempty"`
	ReplaceKeyPrefixWith string `xml:"ReplaceKeyPrefixWith,omitempty"`
	ReplaceKeyWith       string `xml:"ReplaceKeyWith,omitempty"`
	HTTPRedirectCode     string `xml:"HttpRedirectCode,omitempty"`
}

WebsiteRoutingRuleRedirect specifies the redirect target for a routing rule.

Jump to

Keyboard shortcuts

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