ExAws.Dynamo.Adapter behaviour

The purpose of this module is to surface the ExAws.Dynamo API with a single configuration chosen, such that it does not need passed in with every request.

Usage:

defmodule MyApp.Dynamo do
  use ExAws.Dynamo.Adapter, otp_app: :my_otp_app
end

In your config

config :my_otp_app, ExAws,
  kinesis:  [], # kinesis config goes here
  dynamodb: [], # you get the idea

You can now use MyApp.Dynamo as the root module for the Dynamo api without needing to pass in a particular configuration. This enables different otp apps to configure their AWS configuration separately.

The alignment with a particular OTP app however is entirely optional. The following also works:

defmodule MyApp.Dynamo do
  use ExAws.Dynamo.Adapter

  def config do
    [
      dynamodb: [], # Config goes here
    ]
  end
end

This is in fact how the functions in ExAws.Dynamo that do not require a config work. Default config values can be found in ExAws.Config

http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Operations.html

Callbacks

batch_get_item/1

Specs:

  • batch_get_item(%{String.t => %{}}) :: term

Get up to 100 items (16mb)

Map of table names to request parameter maps. http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html

batch_write_item/1

Specs:

  • batch_write_item(%{String.t => %{}}) :: term

Put or delete up to 25 items (16mb)

Map of table names to request parameter maps. http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html

config/0

Specs:

create_table/5

Specs:

  • create_table(table_name :: iodata, primary_key :: iodata, key_definitions :: Keyword.t, read_capacity :: pos_integer, write_capacity :: pos_integer) :: term

Create table

create_table/7

Specs:

  • create_table(table_name :: iodata, primary_key :: iodata, key_definitions :: [Map.t], read_capacity :: pos_integer, write_capacity :: pos_integer, global_indexes :: Map.t, local_indexes :: Map.t) :: term

Create table with indices

delete_item/2

Specs:

  • delete_item(table_name :: iodata, primary_key_value :: iodata) :: term

Delete item in table

delete_table/1

Specs:

  • delete_table(table :: iodata) :: term

Delete Table

describe_table/1

Specs:

  • describe_table(name :: iodata) :: term

Describe table

get_item/2

Specs:

  • get_item(table_name :: iodata, primary_key_value :: iodata) :: term

Get item from table

list_tables/0

Specs:

  • list_tables :: term

List tables

put_item/2

Specs:

  • put_item(table_name :: iodata, record :: %{}) :: term

Put item in table

query/2

Specs:

  • query(table_name :: iodata, key_conditions :: %{}) :: term

Query Table

query/3

Specs:

  • query(table_name :: iodata, key_conditions :: %{}, opts :: %{}) :: term
scan/1

Specs:

  • scan(table_name :: iodata) :: term

Scan table

scan/2

Specs:

  • scan(table_name :: iodata, opts :: %{}) :: term
stream_scan/1

Specs:

  • stream_scan(table_name :: iodata) :: term

Stream records from table

Same as scan/1,2 but the records are a stream which will automatically handle pagination

stream_scan/2

Specs:

  • stream_scan(table_name :: iodata, opts :: %{}) :: term
update_item/3

Specs:

  • update_item(table_name :: iodata, primary_key_value :: iodata, update_args :: %{}) :: term

Update item in table

For update_args format see http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

update_table/2

Specs:

  • update_table(name :: iodata, attributes :: %{}) :: term

Update Table