s3xml

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package s3xml holds the XML request and response bodies of the S3 API and the helper to render them. The S3 API speaks XML, so any service implementing it needs these wire types; they carry no proxy logic.

Index

Constants

View Source
const Namespace = "http://s3.amazonaws.com/doc/2006-03-01/"

Namespace is the XML namespace of S3 API documents.

Variables

This section is empty.

Functions

func FormatTime

func FormatTime(t time.Time) string

FormatTime formats a time the way S3 does in XML responses.

func Write

func Write(w http.ResponseWriter, v any) error

Write renders v as an S3 XML response body with a 200 status.

Types

type AccessControlPolicy

type AccessControlPolicy struct {
	XMLName           xml.Name `xml:"AccessControlPolicy"`
	XMLNS             string   `xml:"xmlns,attr"`
	Owner             Owner    `xml:"Owner"`
	AccessControlList struct {
		Grants []Grant `xml:"Grant"`
	} `xml:"AccessControlList"`
}

AccessControlPolicy is the response of GetBucketAcl / GetObjectAcl.

type AttributesChecksum added in v0.0.5

type AttributesChecksum struct {
	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"`
	ChecksumType      string `xml:"ChecksumType,omitempty"`
}

AttributesChecksum is the Checksum member of GetObjectAttributesResult.

type BucketEntry

type BucketEntry struct {
	Name         string `xml:"Name"`
	CreationDate string `xml:"CreationDate"`
}

type CORSConfiguration

type CORSConfiguration struct {
	XMLName xml.Name      `xml:"CORSConfiguration"`
	XMLNS   string        `xml:"xmlns,attr"`
	Rules   []CORSRuleXML `xml:"CORSRule"`
}

CORSConfiguration is the response of GetBucketCors.

type CORSRuleXML

type CORSRuleXML struct {
	AllowedOrigin []string `xml:"AllowedOrigin"`
	AllowedMethod []string `xml:"AllowedMethod"`
	AllowedHeader []string `xml:"AllowedHeader,omitempty"`
	ExposeHeader  []string `xml:"ExposeHeader,omitempty"`
	MaxAgeSeconds int      `xml:"MaxAgeSeconds,omitempty"`
}

type CommonPrefix

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

type CompleteMultipartUploadRequest

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

CompleteMultipartUploadRequest is the request body of CompleteMultipartUpload.

type CompleteMultipartUploadResult

type CompleteMultipartUploadResult struct {
	XMLName           xml.Name `xml:"CompleteMultipartUploadResult"`
	XMLNS             string   `xml:"xmlns,attr"`
	Location          string   `xml:"Location"`
	Bucket            string   `xml:"Bucket"`
	Key               string   `xml:"Key"`
	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"`
	ChecksumType      string   `xml:"ChecksumType,omitempty"`
}

CompleteMultipartUploadResult is the response of CompleteMultipartUpload.

type CompletePart

type CompletePart struct {
	PartNumber        int32  `xml:"PartNumber"`
	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"`
}

type CopyObjectResult

type CopyObjectResult struct {
	XMLName      xml.Name `xml:"CopyObjectResult"`
	XMLNS        string   `xml:"xmlns,attr"`
	ETag         string   `xml:"ETag"`
	LastModified string   `xml:"LastModified,omitempty"`
}

CopyObjectResult is the response of CopyObject.

type CopyPartResult

type CopyPartResult struct {
	XMLName      xml.Name `xml:"CopyPartResult"`
	XMLNS        string   `xml:"xmlns,attr"`
	ETag         string   `xml:"ETag"`
	LastModified string   `xml:"LastModified,omitempty"`
}

CopyPartResult is the response of UploadPartCopy.

type DefaultRetention

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

type DeleteError

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

type DeleteMarkerEntry

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

type DeleteRequest

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

DeleteRequest is the request body of DeleteObjects (Multi-Object Delete).

type DeleteRequestObject

type DeleteRequestObject struct {
	Key       string `xml:"Key"`
	VersionID string `xml:"VersionId"`
	// Delete preconditions: the object is deleted only if these match.
	ETag             string `xml:"ETag"`
	LastModifiedTime string `xml:"LastModifiedTime"`
	Size             *int64 `xml:"Size"`
}

type DeleteResult

type DeleteResult struct {
	XMLName xml.Name        `xml:"DeleteResult"`
	XMLNS   string          `xml:"xmlns,attr"`
	Deleted []DeletedObject `xml:"Deleted"`
	Errors  []DeleteError   `xml:"Error"`
}

DeleteResult is the response of DeleteObjects.

type DeletedObject

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

type GetObjectAttributesResult added in v0.0.5

type GetObjectAttributesResult struct {
	XMLName      xml.Name              `xml:"GetObjectAttributesResponse"`
	XMLNS        string                `xml:"xmlns,attr"`
	ETag         string                `xml:"ETag,omitempty"`
	Checksum     *AttributesChecksum   `xml:"Checksum,omitempty"`
	ObjectParts  *ObjectAttributeParts `xml:"ObjectParts,omitempty"`
	StorageClass string                `xml:"StorageClass,omitempty"`
	ObjectSize   *int64                `xml:"ObjectSize,omitempty"`
}

GetObjectAttributesResult is the response of GetObjectAttributes. Only the attributes the request asked for are present. Note this API returns the ETag without quotes, unlike every other S3 response.

type Grant

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

type Grantee

type Grantee struct {
	XMLNSXSI    string `xml:"xmlns:xsi,attr"`
	Type        string `xml:"xsi:type,attr"`
	ID          string `xml:"ID"`
	DisplayName string `xml:"DisplayName,omitempty"`
}

type InitiateMultipartUploadResult

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

InitiateMultipartUploadResult is the response of CreateMultipartUpload.

type ListAllMyBucketsResult

type ListAllMyBucketsResult struct {
	XMLName xml.Name `xml:"ListAllMyBucketsResult"`
	XMLNS   string   `xml:"xmlns,attr"`
	Owner   Owner    `xml:"Owner"`
	Buckets struct {
		Bucket []BucketEntry `xml:"Bucket"`
	} `xml:"Buckets"`
	// ContinuationToken is the token for the next page, present only when
	// the listing is truncated.
	ContinuationToken string `xml:"ContinuationToken,omitempty"`
}

ListAllMyBucketsResult is the response of ListBuckets.

type ListBucketResult

type ListBucketResult struct {
	XMLName    xml.Name `xml:"ListBucketResult"`
	XMLNS      string   `xml:"xmlns,attr"`
	Name       string   `xml:"Name"`
	Prefix     string   `xml:"Prefix"`
	StartAfter string   `xml:"StartAfter,omitempty"`
	// ContinuationToken echoes the request's token; a pointer so a
	// supplied-but-empty token is echoed as an empty element rather than
	// omitted.
	ContinuationToken     *string        `xml:"ContinuationToken,omitempty"`
	NextContinuationToken string         `xml:"NextContinuationToken,omitempty"`
	KeyCount              int32          `xml:"KeyCount"`
	MaxKeys               int32          `xml:"MaxKeys"`
	Delimiter             string         `xml:"Delimiter,omitempty"`
	EncodingType          string         `xml:"EncodingType,omitempty"`
	IsTruncated           bool           `xml:"IsTruncated"`
	Contents              []Object       `xml:"Contents"`
	CommonPrefixes        []CommonPrefix `xml:"CommonPrefixes"`
}

ListBucketResult is the response of ListObjectsV2.

type ListBucketResultV1

type ListBucketResultV1 struct {
	XMLName        xml.Name       `xml:"ListBucketResult"`
	XMLNS          string         `xml:"xmlns,attr"`
	Name           string         `xml:"Name"`
	Prefix         string         `xml:"Prefix"`
	Marker         string         `xml:"Marker"`
	NextMarker     string         `xml:"NextMarker,omitempty"`
	MaxKeys        int32          `xml:"MaxKeys"`
	Delimiter      string         `xml:"Delimiter,omitempty"`
	EncodingType   string         `xml:"EncodingType,omitempty"`
	IsTruncated    bool           `xml:"IsTruncated"`
	Contents       []Object       `xml:"Contents"`
	CommonPrefixes []CommonPrefix `xml:"CommonPrefixes"`
}

ListBucketResultV1 is the response of ListObjects (version 1).

type ListMultipartUploadsResult

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

ListMultipartUploadsResult is the response of ListMultipartUploads.

type ListPartsResult

type ListPartsResult struct {
	XMLName              xml.Name `xml:"ListPartsResult"`
	XMLNS                string   `xml:"xmlns,attr"`
	Bucket               string   `xml:"Bucket"`
	Key                  string   `xml:"Key"`
	UploadID             string   `xml:"UploadId"`
	PartNumberMarker     string   `xml:"PartNumberMarker,omitempty"`
	NextPartNumberMarker string   `xml:"NextPartNumberMarker,omitempty"`
	MaxParts             int32    `xml:"MaxParts"`
	IsTruncated          bool     `xml:"IsTruncated"`
	Parts                []Part   `xml:"Part"`
	Initiator            *Owner   `xml:"Initiator,omitempty"`
	Owner                *Owner   `xml:"Owner,omitempty"`
	StorageClass         string   `xml:"StorageClass,omitempty"`
}

ListPartsResult is the response of ListParts.

type ListVersionsResult

type ListVersionsResult struct {
	XMLName             xml.Name            `xml:"ListVersionsResult"`
	XMLNS               string              `xml:"xmlns,attr"`
	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"`
	MaxKeys             int32               `xml:"MaxKeys"`
	Delimiter           string              `xml:"Delimiter,omitempty"`
	EncodingType        string              `xml:"EncodingType,omitempty"`
	IsTruncated         bool                `xml:"IsTruncated"`
	Versions            []ObjectVersion     `xml:"Version"`
	DeleteMarkers       []DeleteMarkerEntry `xml:"DeleteMarker"`
	CommonPrefixes      []CommonPrefix      `xml:"CommonPrefixes"`
}

ListVersionsResult is the response of ListObjectVersions.

type LocationConstraint

type LocationConstraint struct {
	XMLName xml.Name `xml:"LocationConstraint"`
	XMLNS   string   `xml:"xmlns,attr"`
	Value   string   `xml:",chardata"`
}

LocationConstraint is the response of GetBucketLocation.

type Object

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

type ObjectAttributePart added in v0.0.5

type ObjectAttributePart struct {
	PartNumber        int32  `xml:"PartNumber"`
	Size              int64  `xml:"Size"`
	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"`
}

ObjectAttributePart is one part of ObjectAttributeParts.

type ObjectAttributeParts added in v0.0.5

type ObjectAttributeParts struct {
	IsTruncated          bool                  `xml:"IsTruncated"`
	MaxParts             *int32                `xml:"MaxParts,omitempty"`
	NextPartNumberMarker string                `xml:"NextPartNumberMarker,omitempty"`
	PartNumberMarker     string                `xml:"PartNumberMarker,omitempty"`
	PartsCount           *int32                `xml:"PartsCount,omitempty"`
	Parts                []ObjectAttributePart `xml:"Part"`
}

ObjectAttributeParts is the ObjectParts member of GetObjectAttributesResult.

type ObjectLockConfiguration

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

ObjectLockConfiguration is the request/response body of Put/GetObjectLockConfiguration.

type ObjectLockLegalHold

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

ObjectLockLegalHold is the request/response body of Put/GetObjectLegalHold.

type ObjectLockRetention

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

ObjectLockRetention is the request/response body of Put/GetObjectRetention.

type ObjectLockRule

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

type ObjectVersion

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

type Owner

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

type OwnershipControls added in v0.0.10

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

OwnershipControls is the request/response body of Put/GetBucketOwnershipControls.

type OwnershipControlsRule added in v0.0.10

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

type Part

type Part struct {
	PartNumber   int32  `xml:"PartNumber"`
	LastModified string `xml:"LastModified,omitempty"`
	ETag         string `xml:"ETag"`
	Size         int64  `xml:"Size"`
}

type PolicyStatus added in v0.0.10

type PolicyStatus struct {
	XMLName  xml.Name `xml:"PolicyStatus"`
	XMLNS    string   `xml:"xmlns,attr,omitempty"`
	IsPublic bool     `xml:"IsPublic"`
}

PolicyStatus is the response of GetBucketPolicyStatus.

type PostResponse added in v0.0.3

type PostResponse struct {
	XMLName  xml.Name `xml:"PostResponse"`
	XMLNS    string   `xml:"xmlns,attr,omitempty"`
	Location string   `xml:"Location"`
	Bucket   string   `xml:"Bucket"`
	Key      string   `xml:"Key"`
	ETag     string   `xml:"ETag"`
}

PostResponse is the body of a browser-based POST upload response when the form requests success_action_status 201.

type PublicAccessBlockConfiguration added in v0.0.10

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 request/response body of Put/GetPublicAccessBlock.

type ServerSideEncryptionByDefault added in v0.0.10

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

type ServerSideEncryptionConfiguration added in v0.0.10

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

ServerSideEncryptionConfiguration is the request/response body of Put/GetBucketEncryption.

type ServerSideEncryptionRule added in v0.0.10

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

type Tag

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

type TagSet

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

type Tagging

type Tagging struct {
	XMLName xml.Name `xml:"Tagging"`
	XMLNS   string   `xml:"xmlns,attr,omitempty"`
	TagSet  TagSet   `xml:"TagSet"`
}

Tagging is the request and response body of PutObjectTagging / GetObjectTagging.

type Upload

type Upload struct {
	Key          string `xml:"Key"`
	UploadID     string `xml:"UploadId"`
	Initiator    *Owner `xml:"Initiator,omitempty"`
	Owner        *Owner `xml:"Owner,omitempty"`
	StorageClass string `xml:"StorageClass,omitempty"`
	Initiated    string `xml:"Initiated,omitempty"`
}

type VersioningConfiguration

type VersioningConfiguration struct {
	XMLName xml.Name `xml:"VersioningConfiguration"`
	XMLNS   string   `xml:"xmlns,attr,omitempty"`
	Status  string   `xml:"Status,omitempty"`
}

VersioningConfiguration is the request and response body of PutBucketVersioning / GetBucketVersioning.

Jump to

Keyboard shortcuts

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