Learn R Programming

paws.storage (version 0.1.12)

s3_list_objects: Returns some or all (up to 1,000) of the objects in a bucket

Description

Returns some or all (up to 1,000) of the objects in a bucket. You can use the request parameters as selection criteria to return a subset of the objects in a bucket. A 200 OK response can contain valid or invalid XML. Be sure to design your application to parse the contents of the response and handle it appropriately.

This API has been revised. We recommend that you use the newer version, list_objects_v2, when developing applications. For backward compatibility, Amazon S3 continues to support list_objects.

The following operations are related to list_objects:

  • list_objects_v2

  • get_object

  • put_object

  • create_bucket

  • list_buckets

Usage

s3_list_objects(Bucket, Delimiter, EncodingType, Marker, MaxKeys,
  Prefix, RequestPayer, ExpectedBucketOwner)

Value

A list with the following syntax:

list(
  IsTruncated = TRUE|FALSE,
  Marker = "string",
  NextMarker = "string",
  Contents = list(
    list(
      Key = "string",
      LastModified = as.POSIXct(
        "2015-01-01"
      ),
      ETag = "string",
      Size = 123,
      StorageClass = "STANDARD"|"REDUCED_REDUNDANCY"|"GLACIER"|"STANDARD_IA"|"ONEZONE_IA"|"INTELLIGENT_TIERING"|"DEEP_ARCHIVE"|"OUTPOSTS",
      Owner = list(
        DisplayName = "string",
        ID = "string"
      )
    )
  ),
  Name = "string",
  Prefix = "string",
  Delimiter = "string",
  MaxKeys = 123,
  CommonPrefixes = list(
    list(
      Prefix = "string"
    )
  ),
  EncodingType = "url"
)

Arguments

Bucket

[required] The name of the bucket containing the objects.

When using this API with an access point, you must direct requests to the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. When using this operation with an access point through the AWS SDKs, you provide the access point ARN in place of the bucket name. For more information about access point ARNs, see Using Access Points in the Amazon Simple Storage Service Developer Guide.

When using this API with Amazon S3 on Outposts, you must direct requests to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When using this operation using S3 on Outposts through the AWS SDKs, you provide the Outposts bucket ARN in place of the bucket name. For more information about S3 on Outposts ARNs, see Using S3 on Outposts in the Amazon Simple Storage Service Developer Guide.

Delimiter

A delimiter is a character you use to group keys.

EncodingType

Marker

Specifies the key to start with when listing objects in a bucket.

MaxKeys

Sets the maximum number of keys returned in the response. By default the API returns up to 1,000 key names. The response might contain fewer keys but will never contain more.

Prefix

Limits the response to keys that begin with the specified prefix.

RequestPayer

Confirms that the requester knows that she or he will be charged for the list objects request. Bucket owners need not specify this parameter in their requests.

ExpectedBucketOwner

The account id of the expected bucket owner. If the bucket is owned by a different account, the request will fail with an HTTP 403 (Access Denied) error.

Request syntax

svc$list_objects(
  Bucket = "string",
  Delimiter = "string",
  EncodingType = "url",
  Marker = "string",
  MaxKeys = 123,
  Prefix = "string",
  RequestPayer = "requester",
  ExpectedBucketOwner = "string"
)

Examples

Run this code
if (FALSE) {
# The following example list two objects in a bucket.
svc$list_objects(
  Bucket = "examplebucket",
  MaxKeys = "2"
)
}

Run the code above in your browser using DataLab