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
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
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
Specs:
- config :: Keyword.t
Specs:
- create_table(table_name :: iodata, primary_key :: iodata, key_definitions :: Keyword.t, read_capacity :: pos_integer, write_capacity :: pos_integer) :: term
Create table
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
Specs:
- delete_item(table_name :: iodata, primary_key_value :: iodata) :: term
Delete item in table
Specs:
- delete_table(table :: iodata) :: term
Delete Table
Specs:
- describe_table(name :: iodata) :: term
Describe table
Specs:
- get_item(table_name :: iodata, primary_key_value :: iodata) :: term
Get item from table
Specs:
- list_tables :: term
List tables
Specs:
- put_item(table_name :: iodata, record :: %{}) :: term
Put item in table
Specs:
- query(table_name :: iodata, key_conditions :: %{}) :: term
Query Table
Specs:
- query(table_name :: iodata, key_conditions :: %{}, opts :: %{}) :: term
Specs:
- scan(table_name :: iodata) :: term
Scan table
Specs:
- scan(table_name :: iodata, opts :: %{}) :: term
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
Specs:
- stream_scan(table_name :: iodata, opts :: %{}) :: term
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
Specs:
- update_table(name :: iodata, attributes :: %{}) :: term
Update Table