or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

bucket-access-control.mdbucket-features.mdbucket-operations.mdclient-config.mdindex.mdlist-operations.mdmultipart-upload.mdobject-operations.mdpaginators-waiters.mdpresigned-urls.mdtypes.md
tile.json

list-operations.mddocs/

AWS SDK for Go v2 - S3 List Operations

This document provides comprehensive API reference for AWS S3 list operations in the AWS SDK for Go v2.

Table of Contents

  1. ListObjectsV2 (Recommended)
  2. ListObjects (Legacy v1)
  3. ListObjectVersions
  4. ListMultipartUploads

ListObjectsV2

Description

Returns some or all (up to 1,000) of the objects in a bucket with each request. This is the recommended version of the list objects operation.

Key Features:

  • Returns up to 1,000 objects per request
  • Supports pagination via continuation tokens
  • General purpose buckets return objects in lexicographical order
  • Directory buckets do not return objects in lexicographical order
  • Supports prefix filtering and delimiter-based grouping

Permissions:

  • General purpose buckets: Requires s3:ListBucket permission
  • Directory buckets: Use session-based authorization with s3express:CreateSession

Client Method Signature { .api }

func (c *Client) ListObjectsV2(
    ctx context.Context,
    params *ListObjectsV2Input,
    optFns ...func(*Options),
) (*ListObjectsV2Output, error)

Input Type: ListObjectsV2Input { .api }

type ListObjectsV2Input struct {
    // Bucket is the name of the bucket to list objects from.
    // For directory buckets, use virtual-hosted-style requests.
    // This member is required.
    Bucket *string

    // ContinuationToken indicates to Amazon S3 that the list is being continued
    // on this bucket with a token. You can use this for pagination of list results.
    ContinuationToken *string

    // Delimiter is a character that you use to group keys.
    // For directory buckets, only "/" is supported.
    Delimiter *string

    // EncodingType specifies the encoding type used by Amazon S3 to encode
    // the object keys in the response.
    EncodingType types.EncodingType

    // ExpectedBucketOwner is the account ID of the expected bucket owner.
    // If provided and does not match actual owner, request fails with 403.
    ExpectedBucketOwner *string

    // FetchOwner when set to true returns the owner field with each key.
    // Default is false.
    FetchOwner *bool

    // MaxKeys sets the maximum number of keys returned in the response.
    // Default is up to 1,000 keys. Response might contain fewer but never more.
    MaxKeys *int32

    // OptionalObjectAttributes specifies optional fields to return in response.
    // Not supported for directory buckets.
    OptionalObjectAttributes []types.OptionalObjectAttributes

    // Prefix limits the response to keys that begin with the specified prefix.
    // For directory buckets, only prefixes ending in "/" are supported.
    Prefix *string

    // RequestPayer confirms requester knows they will be charged for the request.
    // Not supported for directory buckets.
    RequestPayer types.RequestPayer

    // StartAfter is where you want Amazon S3 to start listing from.
    // Amazon S3 starts listing after this specified key.
    // Not supported for directory buckets.
    StartAfter *string
}

Output Type: ListObjectsV2Output { .api }

type ListObjectsV2Output struct {
    // CommonPrefixes groups keys that share the same prefix up to delimiter.
    // When counting total returns, this group is considered as one item.
    CommonPrefixes []types.CommonPrefix

    // Contents contains metadata about each object returned.
    Contents []types.Object

    // ContinuationToken if sent with request, it is included in response.
    ContinuationToken *string

    // Delimiter causes keys with same string between prefix and first
    // occurrence of delimiter to be rolled up into CommonPrefixes.
    Delimiter *string

    // EncodingType is the encoding type used by Amazon S3 to encode object keys.
    EncodingType types.EncodingType

    // IsTruncated is false if all results were returned, true if more keys available.
    IsTruncated *bool

    // KeyCount is the number of keys returned with this request.
    // Always less than or equal to MaxKeys.
    KeyCount *int32

    // MaxKeys is the maximum number of keys returned in the response.
    MaxKeys *int32

    // Name is the bucket name.
    Name *string

    // NextContinuationToken is sent when IsTruncated is true.
    // Use this for the next list request to continue pagination.
    NextContinuationToken *string

    // Prefix contains keys that begin with the indicated prefix.
    Prefix *string

    // RequestCharged indicates requester was successfully charged for request.
    // Not supported for directory buckets.
    RequestCharged types.RequestCharged

    // StartAfter if sent with request, it is included in response.
    // Not supported for directory buckets.
    StartAfter *string

    // ResultMetadata contains metadata pertaining to the operation's result.
    ResultMetadata middleware.Metadata
}

Paginator: ListObjectsV2Paginator { .api }

The ListObjectsV2Paginator provides automatic pagination for listing objects.

Paginator Types

// ListObjectsV2PaginatorOptions configures the paginator
type ListObjectsV2PaginatorOptions struct {
    // Limit sets the maximum number of keys returned per page.
    // Default is up to 1,000 keys.
    Limit int32

    // StopOnDuplicateToken stops pagination if service returns
    // a token matching the most recent token provided.
    StopOnDuplicateToken bool
}

// ListObjectsV2Paginator is a paginator for ListObjectsV2
type ListObjectsV2Paginator struct {
    // contains filtered or unexported fields
}

Constructor

func NewListObjectsV2Paginator(
    client ListObjectsV2APIClient,
    params *ListObjectsV2Input,
    optFns ...func(*ListObjectsV2PaginatorOptions),
) *ListObjectsV2Paginator

Methods

// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListObjectsV2Paginator) HasMorePages() bool

// NextPage retrieves the next ListObjectsV2 page
func (p *ListObjectsV2Paginator) NextPage(
    ctx context.Context,
    optFns ...func(*Options),
) (*ListObjectsV2Output, error)

Paginator Usage Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/s3"
    "github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
    cfg, err := config.LoadDefaultConfig(context.TODO())
    if err != nil {
        log.Fatal(err)
    }

    client := s3.NewFromConfig(cfg)

    // Create paginator
    paginator := s3.NewListObjectsV2Paginator(client, &s3.ListObjectsV2Input{
        Bucket: aws.String("my-bucket"),
        Prefix: aws.String("photos/"),
        MaxKeys: aws.Int32(100),
    })

    // Iterate through pages
    var objectCount int
    for paginator.HasMorePages() {
        page, err := paginator.NextPage(context.TODO())
        if err != nil {
            log.Fatal(err)
        }

        for _, obj := range page.Contents {
            fmt.Printf("Key: %s, Size: %d, LastModified: %v\n",
                aws.ToString(obj.Key),
                aws.ToInt64(obj.Size),
                obj.LastModified,
            )
            objectCount++
        }
    }

    fmt.Printf("Total objects listed: %d\n", objectCount)
}

ListObjects

Description

Returns some or all (up to 1,000) of the objects in a bucket. This is the legacy v1 API.

Important: This operation is not supported for directory buckets. Amazon recommends using ListObjectsV2 for all new applications.

Key Features:

  • Returns up to 1,000 objects per request
  • Uses marker-based pagination (older than continuation token approach)
  • Supported for general purpose buckets only
  • Maintained for backward compatibility

Client Method Signature { .api }

func (c *Client) ListObjects(
    ctx context.Context,
    params *ListObjectsInput,
    optFns ...func(*Options),
) (*ListObjectsOutput, error)

Input Type: ListObjectsInput { .api }

type ListObjectsInput struct {
    // Bucket is the name of the bucket containing the objects.
    // This member is required.
    Bucket *string

    // Delimiter is a character that you use to group keys.
    // CommonPrefixes is filtered out if not lexicographically greater than Marker.
    Delimiter *string

    // EncodingType specifies the encoding type used by Amazon S3 to encode
    // object keys in the response.
    EncodingType types.EncodingType

    // ExpectedBucketOwner is the account ID of the expected bucket owner.
    ExpectedBucketOwner *string

    // Marker is where you want Amazon S3 to start listing from.
    // Amazon S3 starts listing after this specified key.
    Marker *string

    // MaxKeys sets the maximum number of keys returned in response.
    // Default is up to 1,000 keys.
    MaxKeys *int32

    // OptionalObjectAttributes specifies optional fields to return in response.
    OptionalObjectAttributes []types.OptionalObjectAttributes

    // Prefix limits the response to keys that begin with the specified prefix.
    Prefix *string

    // RequestPayer confirms requester knows they will be charged for request.
    RequestPayer types.RequestPayer
}

Output Type: ListObjectsOutput { .api }

type ListObjectsOutput struct {
    // CommonPrefixes groups keys with same prefix up to delimiter.
    CommonPrefixes []types.CommonPrefix

    // Contents contains metadata about each object returned.
    Contents []types.Object

    // Delimiter causes keys between prefix and delimiter to be rolled up.
    Delimiter *string

    // EncodingType is the encoding used for object keys in response.
    EncodingType types.EncodingType

    // IsTruncated indicates whether Amazon S3 returned all results.
    IsTruncated *bool

    // Marker is included in response if it was sent with request.
    Marker *string

    // MaxKeys is the maximum number of keys returned in response body.
    MaxKeys *int32

    // Name is the bucket name.
    Name *string

    // NextMarker when response is truncated, use this as marker in next request.
    // Only returned if delimiter parameter was specified.
    NextMarker *string

    // Prefix contains keys that begin with indicated prefix.
    Prefix *string

    // RequestCharged indicates requester was successfully charged.
    RequestCharged types.RequestCharged

    // ResultMetadata contains metadata pertaining to operation's result.
    ResultMetadata middleware.Metadata
}

Usage Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/s3"
    "github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
    cfg, err := config.LoadDefaultConfig(context.TODO())
    if err != nil {
        log.Fatal(err)
    }

    client := s3.NewFromConfig(cfg)

    // List objects with manual pagination
    var marker *string
    for {
        output, err := client.ListObjects(context.TODO(), &s3.ListObjectsInput{
            Bucket: aws.String("my-bucket"),
            Marker: marker,
            MaxKeys: aws.Int32(100),
        })
        if err != nil {
            log.Fatal(err)
        }

        for _, obj := range output.Contents {
            fmt.Printf("Key: %s\n", aws.ToString(obj.Key))
        }

        // Check if there are more results
        if !aws.ToBool(output.IsTruncated) {
            break
        }

        // Set marker for next iteration
        marker = output.NextMarker
        if marker == nil && len(output.Contents) > 0 {
            // Use last key as marker if NextMarker not provided
            marker = output.Contents[len(output.Contents)-1].Key
        }
    }
}

ListObjectVersions

Description

Returns metadata about all versions of the objects in a bucket. You can use request parameters as selection criteria to return metadata about a subset of all object versions.

Important: This operation is not supported for directory buckets.

Key Features:

  • Returns up to 1,000 object versions per request
  • Includes both object versions and delete markers
  • Requires versioning to be enabled on the bucket
  • Supports prefix filtering and delimiter-based grouping
  • Uses key-marker and version-id-marker for pagination

Permissions:

  • Requires s3:ListBucketVersions permission (note the different action name)
  • Must have READ access to the bucket

Client Method Signature { .api }

func (c *Client) ListObjectVersions(
    ctx context.Context,
    params *ListObjectVersionsInput,
    optFns ...func(*Options),
) (*ListObjectVersionsOutput, error)

Input Type: ListObjectVersionsInput { .api }

type ListObjectVersionsInput struct {
    // Bucket is the bucket name that contains the objects.
    // This member is required.
    Bucket *string

    // Delimiter is a character that you specify to group keys.
    // CommonPrefixes is filtered out if not lexicographically greater than KeyMarker.
    Delimiter *string

    // EncodingType specifies encoding used by Amazon S3 to encode object keys.
    EncodingType types.EncodingType

    // ExpectedBucketOwner is the account ID of the expected bucket owner.
    ExpectedBucketOwner *string

    // KeyMarker specifies the key to start with when listing objects in bucket.
    KeyMarker *string

    // MaxKeys sets the maximum number of keys returned in response.
    // Default is up to 1,000 keys. Response might contain fewer but never more.
    MaxKeys *int32

    // OptionalObjectAttributes specifies optional fields to return in response.
    OptionalObjectAttributes []types.OptionalObjectAttributes

    // Prefix selects only those keys that begin with the specified prefix.
    Prefix *string

    // RequestPayer confirms requester knows they will be charged for request.
    // Not supported for directory buckets.
    RequestPayer types.RequestPayer

    // VersionIdMarker specifies the object version you want to start listing from.
    VersionIdMarker *string
}

Output Type: ListObjectVersionsOutput { .api }

type ListObjectVersionsOutput struct {
    // CommonPrefixes groups all keys rolled up into a common prefix.
    CommonPrefixes []types.CommonPrefix

    // DeleteMarkers contains objects that are delete markers.
    DeleteMarkers []types.DeleteMarkerEntry

    // Delimiter is the character used to group keys.
    Delimiter *string

    // EncodingType is the encoding type used by Amazon S3.
    EncodingType types.EncodingType

    // IsTruncated indicates whether Amazon S3 returned all results.
    // Make follow-up request using NextKeyMarker and NextVersionIdMarker.
    IsTruncated *bool

    // KeyMarker marks the last key returned in a truncated response.
    KeyMarker *string

    // MaxKeys specifies the maximum number of objects to return.
    MaxKeys *int32

    // Name is the bucket name.
    Name *string

    // NextKeyMarker specifies the first key not returned that satisfies criteria.
    // Use this for key-marker in subsequent request.
    NextKeyMarker *string

    // NextVersionIdMarker specifies first object version not returned.
    // Use this for version-id-marker in subsequent request.
    NextVersionIdMarker *string

    // Prefix selects objects that start with the value supplied.
    Prefix *string

    // RequestCharged indicates requester was successfully charged.
    // Not supported for directory buckets.
    RequestCharged types.RequestCharged

    // VersionIdMarker marks the last version of key returned in truncated response.
    VersionIdMarker *string

    // Versions contains version information for objects.
    Versions []types.ObjectVersion

    // ResultMetadata contains metadata pertaining to operation's result.
    ResultMetadata middleware.Metadata
}

Paginator: ListObjectVersionsPaginator { .api }

The ListObjectVersionsPaginator provides automatic pagination for listing object versions.

Paginator Types

// ListObjectVersionsPaginatorOptions configures the paginator
type ListObjectVersionsPaginatorOptions struct {
    // Limit is the maximum number of object versions to return.
    Limit int32

    // StopOnDuplicateToken stops pagination if service returns
    // a token matching the most recent token provided.
    StopOnDuplicateToken bool
}

// ListObjectVersionsPaginator is a paginator for ListObjectVersions
type ListObjectVersionsPaginator struct {
    // contains filtered or unexported fields
}

Constructor

func NewListObjectVersionsPaginator(
    client ListObjectVersionsAPIClient,
    params *ListObjectVersionsInput,
    optFns ...func(*ListObjectVersionsPaginatorOptions),
) *ListObjectVersionsPaginator

Methods

// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListObjectVersionsPaginator) HasMorePages() bool

// NextPage retrieves the next ListObjectVersions page
func (p *ListObjectVersionsPaginator) NextPage(
    ctx context.Context,
    optFns ...func(*Options),
) (*ListObjectVersionsOutput, error)

Paginator Usage Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/s3"
    "github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
    cfg, err := config.LoadDefaultConfig(context.TODO())
    if err != nil {
        log.Fatal(err)
    }

    client := s3.NewFromConfig(cfg)

    // Create paginator
    paginator := s3.NewListObjectVersionsPaginator(client, &s3.ListObjectVersionsInput{
        Bucket: aws.String("my-versioned-bucket"),
    })

    // Iterate through pages
    for paginator.HasMorePages() {
        page, err := paginator.NextPage(context.TODO())
        if err != nil {
            log.Fatal(err)
        }

        // Process object versions
        for _, version := range page.Versions {
            fmt.Printf("Key: %s, VersionId: %s, IsLatest: %v, Size: %d\n",
                aws.ToString(version.Key),
                aws.ToString(version.VersionId),
                aws.ToBool(version.IsLatest),
                aws.ToInt64(version.Size),
            )
        }

        // Process delete markers
        for _, marker := range page.DeleteMarkers {
            fmt.Printf("Delete Marker - Key: %s, VersionId: %s, IsLatest: %v\n",
                aws.ToString(marker.Key),
                aws.ToString(marker.VersionId),
                aws.ToBool(marker.IsLatest),
            )
        }
    }
}

ListMultipartUploads

Description

Lists in-progress multipart uploads in a bucket. An in-progress multipart upload is one that has been initiated by CreateMultipartUpload but not yet completed or aborted.

Key Features:

  • Returns up to 1,000 multipart uploads per request
  • General purpose buckets sort by key name, then by upload initiation time
  • Directory buckets do not sort lexicographically
  • Directory buckets don't support upload-id-marker (use key-marker only)
  • Can filter by prefix and group by delimiter

Permissions:

  • General purpose buckets: Requires appropriate multipart upload permissions
  • Directory buckets: Use session-based authorization with s3express:CreateSession

Client Method Signature { .api }

func (c *Client) ListMultipartUploads(
    ctx context.Context,
    params *ListMultipartUploadsInput,
    optFns ...func(*Options),
) (*ListMultipartUploadsOutput, error)

Input Type: ListMultipartUploadsInput { .api }

type ListMultipartUploadsInput struct {
    // Bucket is the name of the bucket to which multipart upload was initiated.
    // For directory buckets, use virtual-hosted-style requests.
    // This member is required.
    Bucket *string

    // Delimiter is a character you use to group keys.
    // CommonPrefixes filtered out if not lexicographically greater than KeyMarker.
    // For directory buckets, only "/" is supported.
    Delimiter *string

    // EncodingType specifies encoding used by Amazon S3 to encode object keys.
    EncodingType types.EncodingType

    // ExpectedBucketOwner is the account ID of the expected bucket owner.
    ExpectedBucketOwner *string

    // KeyMarker specifies the multipart upload after which listing should begin.
    // For general purpose buckets, works with UploadIdMarker.
    // For directory buckets, this is obfuscated and UploadIdMarker is not supported.
    KeyMarker *string

    // MaxUploads sets maximum number of multipart uploads to return (1-1,000).
    // Default and maximum is 1,000.
    MaxUploads *int32

    // Prefix lists in-progress uploads only for keys beginning with specified prefix.
    // For directory buckets, only prefixes ending in "/" are supported.
    Prefix *string

    // RequestPayer confirms requester knows they will be charged.
    // Not supported for directory buckets.
    RequestPayer types.RequestPayer

    // UploadIdMarker together with KeyMarker, specifies upload after which to begin.
    // Ignored if KeyMarker not specified.
    // Not supported for directory buckets.
    UploadIdMarker *string
}

Output Type: ListMultipartUploadsOutput { .api }

type ListMultipartUploadsOutput struct {
    // Bucket is the name of bucket to which multipart upload was initiated.
    // Does not return access point ARN or alias if used.
    Bucket *string

    // CommonPrefixes contains distinct key prefixes grouped by delimiter.
    // For directory buckets, only prefixes ending in "/" are supported.
    CommonPrefixes []types.CommonPrefix

    // Delimiter is the delimiter you specified in request.
    // For directory buckets, only "/" is supported.
    Delimiter *string

    // EncodingType is the encoding type used by Amazon S3 to encode object keys.
    EncodingType types.EncodingType

    // IsTruncated indicates whether returned list is truncated.
    // True means more uploads exceed limit.
    IsTruncated *bool

    // KeyMarker is the key at or after which the listing began.
    KeyMarker *string

    // MaxUploads is maximum number of multipart uploads that could be included.
    MaxUploads *int32

    // NextKeyMarker when list is truncated, use this value for key-marker in next request.
    NextKeyMarker *string

    // NextUploadIdMarker when list truncated, use for upload-id-marker in next request.
    // Not supported for directory buckets.
    NextUploadIdMarker *string

    // Prefix when provided in request, this field contains the specified prefix.
    // For directory buckets, only prefixes ending in "/" are supported.
    Prefix *string

    // RequestCharged indicates requester was successfully charged.
    // Not supported for directory buckets.
    RequestCharged types.RequestCharged

    // UploadIdMarker together with KeyMarker, specifies upload listing began after.
    // Not supported for directory buckets.
    UploadIdMarker *string

    // Uploads contains zero or more multipart upload elements.
    Uploads []types.MultipartUpload

    // ResultMetadata contains metadata pertaining to operation's result.
    ResultMetadata middleware.Metadata
}

Paginator: ListMultipartUploadsPaginator { .api }

The ListMultipartUploadsPaginator provides automatic pagination for listing multipart uploads.

Paginator Types

// ListMultipartUploadsPaginatorOptions configures the paginator
type ListMultipartUploadsPaginatorOptions struct {
    // Limit is the maximum number of multipart uploads to return.
    Limit int32

    // StopOnDuplicateToken stops pagination if service returns
    // a token matching the most recent token provided.
    StopOnDuplicateToken bool
}

// ListMultipartUploadsPaginator is a paginator for ListMultipartUploads
type ListMultipartUploadsPaginator struct {
    // contains filtered or unexported fields
}

Constructor

func NewListMultipartUploadsPaginator(
    client ListMultipartUploadsAPIClient,
    params *ListMultipartUploadsInput,
    optFns ...func(*ListMultipartUploadsPaginatorOptions),
) *ListMultipartUploadsPaginator

Methods

// HasMorePages returns a boolean indicating whether more pages are available
func (p *ListMultipartUploadsPaginator) HasMorePages() bool

// NextPage retrieves the next ListMultipartUploads page
func (p *ListMultipartUploadsPaginator) NextPage(
    ctx context.Context,
    optFns ...func(*Options),
) (*ListMultipartUploadsOutput, error)

Paginator Usage Example

package main

import (
    "context"
    "fmt"
    "log"

    "github.com/aws/aws-sdk-go-v2/config"
    "github.com/aws/aws-sdk-go-v2/service/s3"
    "github.com/aws/aws-sdk-go-v2/aws"
)

func main() {
    cfg, err := config.LoadDefaultConfig(context.TODO())
    if err != nil {
        log.Fatal(err)
    }

    client := s3.NewFromConfig(cfg)

    // Create paginator
    paginator := s3.NewListMultipartUploadsPaginator(client, &s3.ListMultipartUploadsInput{
        Bucket: aws.String("my-bucket"),
        Prefix: aws.String("uploads/"),
    })

    // Iterate through pages
    var totalUploads int
    for paginator.HasMorePages() {
        page, err := paginator.NextPage(context.TODO())
        if err != nil {
            log.Fatal(err)
        }

        for _, upload := range page.Uploads {
            fmt.Printf("Key: %s, UploadId: %s, Initiated: %v, StorageClass: %s\n",
                aws.ToString(upload.Key),
                aws.ToString(upload.UploadId),
                upload.Initiated,
                upload.StorageClass,
            )
            totalUploads++
        }
    }

    fmt.Printf("Total in-progress multipart uploads: %d\n", totalUploads)
}

Common Types

types.Object { .api }

Represents metadata for an object in S3.

type Object struct {
    // ChecksumAlgorithm is the algorithm used to create object checksum.
    ChecksumAlgorithm []ChecksumAlgorithm

    // ChecksumType is the type used to calculate object's checksum value.
    ChecksumType ChecksumType

    // ETag is a hash of the object (MD5 or otherwise depending on encryption).
    ETag *string

    // Key is the name you assign to an object for retrieval.
    Key *string

    // LastModified is creation date of the object.
    LastModified *time.Time

    // Owner is the owner of the object.
    // For directory buckets, bucket owner is returned as object owner.
    Owner *Owner

    // RestoreStatus specifies restoration status of archived objects.
    // Not supported for directory buckets.
    RestoreStatus *RestoreStatus

    // Size in bytes of the object.
    Size *int64

    // StorageClass is the class of storage used to store the object.
    StorageClass ObjectStorageClass
}

types.CommonPrefix { .api }

Represents a common prefix when using delimiters.

type CommonPrefix struct {
    // Prefix is the container for the specified common prefix.
    Prefix *string
}

types.ObjectVersion { .api }

Represents metadata for a specific version of an object.

type ObjectVersion struct {
    // ChecksumAlgorithm is the algorithm used to create object checksum.
    ChecksumAlgorithm []ChecksumAlgorithm

    // ChecksumType is the type used to calculate object's checksum value.
    ChecksumType ChecksumType

    // ETag is an MD5 hash of that version of the object.
    ETag *string

    // IsLatest specifies whether object is the latest version.
    IsLatest *bool

    // Key is the object key.
    Key *string

    // LastModified is date and time when object was last modified.
    LastModified *time.Time

    // Owner specifies the owner of the object.
    Owner *Owner

    // RestoreStatus specifies restoration status of archived objects.
    RestoreStatus *RestoreStatus

    // Size in bytes of the object.
    Size *int64

    // StorageClass is the class of storage used to store the object.
    StorageClass ObjectVersionStorageClass

    // VersionId is version ID of an object.
    VersionId *string
}

types.DeleteMarkerEntry { .api }

Represents a delete marker in a versioned bucket.

type DeleteMarkerEntry struct {
    // IsLatest specifies whether object is the latest version.
    IsLatest *bool

    // Key is the object key.
    Key *string

    // LastModified is date and time when object was last modified.
    LastModified *time.Time

    // Owner is the account that created the delete marker.
    Owner *Owner

    // VersionId is version ID of an object.
    VersionId *string
}

types.MultipartUpload { .api }

Represents metadata for an in-progress multipart upload.

type MultipartUpload struct {
    // ChecksumAlgorithm is the algorithm used to create checksum of object.
    ChecksumAlgorithm ChecksumAlgorithm

    // ChecksumType is the type used to calculate object's checksum value.
    ChecksumType ChecksumType

    // Initiated is date and time multipart upload was initiated.
    Initiated *time.Time

    // Initiator identifies who initiated the multipart upload.
    Initiator *Initiator

    // Key is the key of object for which multipart upload was initiated.
    Key *string

    // Owner specifies the owner of the object part of multipart upload.
    // For directory buckets, bucket owner returned for all objects.
    Owner *Owner

    // StorageClass is the class of storage used to store the object.
    StorageClass StorageClass

    // UploadId identifies the multipart upload.
    UploadId *string
}

types.Owner { .api }

Represents the owner of an S3 resource.

type Owner struct {
    // DisplayName is the display name of the owner.
    // Only supported in certain regions.
    // Not supported for directory buckets.
    DisplayName *string

    // ID is the canonical user ID of the owner.
    ID *string
}

types.Initiator { .api }

Represents the initiator of a multipart upload.

type Initiator struct {
    // DisplayName is the name of the principal.
    // Not supported for directory buckets.
    DisplayName *string

    // ID is the canonical user ID or IAM user ARN.
    // For directory buckets, provides AWS account ID or IAM user ARN.
    ID *string
}

Related Operations

  • CreateMultipartUpload - Initiates a multipart upload
  • UploadPart - Uploads a part in a multipart upload
  • CompleteMultipartUpload - Completes a multipart upload
  • AbortMultipartUpload - Aborts an in-progress multipart upload
  • ListParts - Lists parts of a specific multipart upload
  • GetObject - Retrieves an object from S3
  • PutObject - Uploads an object to S3
  • DeleteObject - Deletes an object from S3
  • DeleteObjects - Deletes multiple objects in a single request

Notes

  1. API Version: This documentation is based on AWS SDK for Go v2, service/s3 version 1.92.1
  2. Pagination Best Practice: Always use the paginator types (e.g., ListObjectsV2Paginator) rather than manual pagination for cleaner, more maintainable code
  3. Recommended API: Use ListObjectsV2 instead of the legacy ListObjects for all new applications
  4. Directory Buckets: Many features have different behavior or limitations for directory buckets - check the field documentation carefully
  5. Context Support: All operations accept a context.Context for cancellation and timeouts
  6. Error Handling: Always check for errors returned from API calls and pagination operations
  7. Versioning: ListObjectVersions requires bucket versioning to be enabled
  8. Permissions: Different operations require different IAM permissions - consult AWS documentation for specific requirements

Last Updated: 2025-12-30 SDK Version: 1.92.1 Service: Amazon S3