Skip to content

Paginate

paginate R Documentation

Paginate over an operation.

Description

Some AWS operations return results that are incomplete and require subsequent requests in order to attain the entire result set. The process of sending subsequent requests to continue where a previous request left off is called pagination. For example, the list_objects operation of Amazon S3 returns up to 1000 objects at a time, and you must send subsequent requests with the appropriate Marker in order to retrieve the next page of results.

Usage

paginate(
  Operation,
  PageSize = NULL,
  MaxItems = NULL,
  StartingToken = NULL,
  StopOnSameToken = FALSE
)

paginate_lapply(
  Operation,
  FUN,
  ...,
  PageSize = NULL,
  MaxItems = NULL,
  StartingToken = NULL,
  StopOnSameToken = FALSE
)

paginate_sapply(
  Operation,
  FUN,
  ...,
  simplify = TRUE,
  PageSize = NULL,
  MaxItems = NULL,
  StartingToken = NULL,
  StopOnSameToken = FALSE
)

Arguments

Operation

The operation for example an s3 operation: svc$list_buckets()

PageSize

The size of each page.

MaxItems

Limits the maximum number of total returned items returned while paginating.

StartingToken

Can be used to modify the starting marker or token of a paginator. This argument if useful for resuming pagination from a previous token or starting pagination at a known position.

StopOnSameToken

Exits paginator if previous token matches current token. For some APIs, such as CloudWatchLogs events, the next page token will always be present. When set to TRUE, the paginator will stop when the token doesn't change.

FUN

the function to be applied to each response element of operation.

...

optional arguments to FUN.

simplify

See base::sapply().

Value

list of responses from the operation.

Examples

## Not run: 
# The following example retrieves object list. The request specifies max
# keys to limit response to include only 2 object keys.
paginate(
  svc$list_objects_v2(
    Bucket = "DOC-EXAMPLE-BUCKET"
  ),
  MaxItems = 50
)

## End(Not run)