ExAws.Location (ex_aws_location v0.1.0)

Copy Markdown

Amazon Location Service support for ExAws.

The API is split up by service, with one module for each:

Each function builds an operation which is then passed to ExAws.request/2:

"my-tracker"
|> ExAws.Location.Trackers.create_tracker(description: "Delivery vans")
|> ExAws.request(region: "eu-west-1")

Required parameters are positional. Optional parameters are passed as a keyword list, using the snake_case form of the name given in the AWS API reference (so KmsKeyId becomes :kms_key_id). Passing an option the operation doesn't know about raises an ArgumentError.

Nested request data types each have their own struct, for example ExAws.Location.DevicePositionUpdate. Timestamps may be given as DateTime structs or as ISO 8601 strings.

This module holds the helpers shared by the service modules.

Summary

Types

Describes how the arguments of an operation map on to the request.

Functions

Percent-encodes a value for use as a single segment of a request path.

Builds an operation that sends a JSON body and expects a JSON response.

Converts request data in to the form expected by the AWS API.

Builds a body-less operation whose response is returned as is.

Builds a body-less operation (GET or DELETE) that expects a JSON response.

Types

spec()

@type spec() :: [
  required_body: %{optional(String.t()) => term()},
  required_query: [{String.t(), term()}],
  body: [atom()],
  query: [{atom(), String.t()}],
  idempotency_token: atom()
]

Describes how the arguments of an operation map on to the request.

  • :required_body - map of wire name to value for required body members
  • :required_query - list of {wire name, value} for required query string parameters
  • :body - names of the options sent in the request body
  • :query - keyword list of option name to query string parameter name
  • :idempotency_token - name of a body option that is generated when not supplied

Functions

encode_path(value)

@spec encode_path(term()) :: String.t()

Percent-encodes a value for use as a single segment of a request path.

json_request(service, method, path, opts, spec \\ [])

@spec json_request(atom(), atom(), String.t(), keyword(), spec()) ::
  ExAws.Operation.JSON.t()

Builds an operation that sends a JSON body and expects a JSON response.

normalise_data(datetime)

@spec normalise_data(term()) :: term()

Converts request data in to the form expected by the AWS API.

Structs and maps with atom keys have their keys converted from :snake_case to "CamelCase" and any nil values dropped. String keys (for example in tags) are left untouched. DateTime values are converted to ISO 8601 strings.

raw_request(service, method, path, opts, spec \\ [])

@spec raw_request(atom(), atom(), String.t(), keyword(), spec()) ::
  ExAws.Operation.RestQuery.t()

Builds a body-less operation whose response is returned as is.

This is used for operations that return something other than a JSON document, such as map tiles.

rest_request(service, method, path, opts, spec \\ [])

@spec rest_request(atom(), atom(), String.t(), keyword(), spec()) ::
  ExAws.Operation.RestQuery.t()

Builds a body-less operation (GET or DELETE) that expects a JSON response.