new_service: Return an AWS API service object

View source: R/service.R

new_serviceR Documentation

Return an AWS API service object

Description

Return an API service object with information and handlers needed to make API requests.

Usage

new_service(metadata, handlers, cfgs = NULL, operation = Operation())

Arguments

metadata

A named list of API metadata. It should look like:

list(
  service_name = "string",
  endpoints = list("region" = list(endpoint = "endpoint", global = FALSE)),
  service_id = "string",
  api_version = "string",
  signing_name = "string"|NULL,
  json_version = "string",
  target_prefix = "string"
)
handlers

A set of handlers, e.g. from new_handlers.

cfgs

A config defined by the service. Defaults to null.

operation

A operation defined by the service.

Region and credentials

new_service requires that you've set your AWS region in one of:

  1. AWS_REGION R environment variable

  2. AWS_REGION OS environment variable (Linux and macOS)

  3. ⁠~/.aws/config⁠ AWS configuration file

new_service also requires that you've set your AWS credentials in one of:

  1. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY R environment variables

  2. AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY OS environment variables (Linux and macOS)

  3. ⁠~/.aws/credentials⁠ AWS credentials file

  4. IAM role

See Also

new_operation()

Other API request functions: new_handlers(), new_operation(), new_request(), send_request()

Examples

## Not run: 
# Metadata for the S3 API.
metadata <- list(
  service_name = "s3",
  endpoints = list("us-east-1" = list(endpoint = "s3.amazonaws.com", global = FALSE)),
  service_id = "S3",
  api_version = "2006-03-01",
  signing_name = NULL,
  json_version = "",
  target_prefix = ""
)

# Handlers for S3.
handlers <- new_handlers("restxml", "v4")

# Build a service object for S3, containing the information necessary to
# build, send, and receive requests.
service <- new_service(metadata, handlers)

## End(Not run)


paws.common documentation built on Oct. 4, 2024, 1:08 a.m.