Module erlcloud_ddb2

An Erlang interface to Amazon's DynamoDB.

Authors: Ransom Richardson (ransom@ransomr.net).

Description

An Erlang interface to Amazon's DynamoDB.

http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/operationlist.html

erlcloud_ddb2 implements the entire 20120810 API.

Method names match DynamoDB operations converted to lower_case_with_underscores. The one exception is query, which is an Erlang reserved word. The q method implements Query.

Required parameters are passed as function arguments. In addition all methods take an options proplist argument which can be used to pass optional parameters. See function documentation for examples.

Table names, key names, attribute names and any other input strings except attribute values must be binary strings.

Attribute values may be either {Type, Value} or Value. If only Value is provided then the type is inferred. Lists (iolists are handled), binaries and atoms are assumed to be strings. The following are equivalent: {s, <<"value">>}, <<"value">>, "value", value. Numbers are assumed to be numbers. The following are equivalent: {n, 42}, 42. To specify the AWS binary or set types an explicit Type must be provided. For example: {b, <<1,2,3>>} or {ns, [4,5,6]}. Note that binary values will be base64 encoded and decoded automatically. Since some atoms (such as true, false, not_null, null, undefined, delete, etc) have special meanings in some cases, use them carefully.

Output is in the form of {ok, Value} or {error, Reason}. The format of Value is controlled by the out option, which defaults to simple. The possible values are:

* simple - The most interesting part of the output. For example get_item will return the item.

* record - A record containing all the information from the DynamoDB response except field types. This is useful if you need more detailed information than what is returned with simple. For example, with scan and query the record will contain the last evaluated key which can be used to continue the operation.

* typed_record - A record containing all the information from the DynamoDB response. All field values are returned with type information.

* json - The output from DynamoDB as processed by jsx:decode but with no further manipulation. This would rarely be useful, unless the DynamoDB API is updated to include data that is not yet parsed correctly.

Items will be returned as a list of {Name, Value}. In most cases the output will have type information removed. For example: [{<<"String Attribute">>, <<"value">>}, {<<"Number Attribute">>, 42}, {<<"BinaryAttribute">>, <<1,2,3>>}]. The exception is for output fields that are intended to be passed to a subsequent call, such as unprocessed_keys and last_evaluated_key. Those will contain typed attribute values so that they may be correctly passed to subsequent calls.

DynamoDB errors for most cases are returned in the form {error, {ErrorCode, Message}} where ErrorCode and Message are both binary strings. List of error codes: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ErrorHandling.html. So to handle conditional check failures, match {error, {<<"ConditionalCheckFailedException">>, _}}. Note that in the case of a TransactionCanceledException DynamoDB error, the error response has the form {error, {<<"TransactionCanceledException">>, {Message, CancellationReasons}}} where Message is a binary string and CancellationReasons is an ordered list in the form [{Code, Message}], where Code is the status code of the result and Message is the cancellation reason message description.

erlcloud_ddb_util provides a higher level API that implements common operations that may require multiple DynamoDB API calls.

See the unit tests for additional usage examples beyond what are provided for each function.

Data Types

attr_defs()

attr_defs() = maybe_list({attr_name(), attr_type()})

attr_name()

attr_name() = binary()

attr_type()

attr_type() = s | n | b | bool | null | ss | ns | bs | l | m

attributes_to_get_opt()

attributes_to_get_opt() = {attributes_to_get, [attr_name()]}

auto_scaling_policy_opt()

auto_scaling_policy_opt() = {policy_name, binary()} | {target_tracking_scaling_policy_configuration, auto_scaling_target_tracking_scaling_policy_configuration_update_opts()}

auto_scaling_policy_opts()

auto_scaling_policy_opts() = [auto_scaling_policy_opt()]

auto_scaling_settings_update_opt()

auto_scaling_settings_update_opt() = {auto_scaling_disabled, boolean()} | {auto_scaling_role_arn, binary()} | {maximum_units, non_neg_integer()} | {minimum_units, non_neg_integer()} | {scaling_policy_update, auto_scaling_policy_opts()}

auto_scaling_settings_update_opts()

auto_scaling_settings_update_opts() = [auto_scaling_settings_update_opt()]

auto_scaling_target_tracking_scaling_policy_configuration_update_opt()

auto_scaling_target_tracking_scaling_policy_configuration_update_opt() = {disable_scale_in, boolean()} | {scale_in_cooldown, pos_integer()} | {scale_out_cooldown, pos_integer()} | {target_value, number()}

auto_scaling_target_tracking_scaling_policy_configuration_update_opts()

auto_scaling_target_tracking_scaling_policy_configuration_update_opts() = [auto_scaling_target_tracking_scaling_policy_configuration_update_opt()]

batch_get_item_opt()

batch_get_item_opt() = return_consumed_capacity_opt() | out_opt()

batch_get_item_opts()

batch_get_item_opts() = [batch_get_item_opt()]

batch_get_item_request_item()

batch_get_item_request_item() = {table_name(), [key(), ...], batch_get_item_request_item_opts()} | {table_name(), [key(), ...]}

batch_get_item_request_item_opt()

batch_get_item_request_item_opt() = expression_attribute_names_opt() | projection_expression_opt() | attributes_to_get_opt() | consistent_read_opt()

batch_get_item_request_item_opts()

batch_get_item_request_item_opts() = [batch_get_item_request_item_opt()]

batch_get_item_request_items()

batch_get_item_request_items() = maybe_list(batch_get_item_request_item())

batch_get_item_return()

batch_get_item_return() = ddb_return(#ddb2_batch_get_item{}, [out_item()])

batch_write_item_delete()

batch_write_item_delete() = {delete, key()}

batch_write_item_opt()

batch_write_item_opt() = return_consumed_capacity_opt() | return_item_collection_metrics_opt() | out_opt()

batch_write_item_opts()

batch_write_item_opts() = [batch_write_item_opt()]

batch_write_item_put()

batch_write_item_put() = {put, in_item()}

batch_write_item_request()

batch_write_item_request() = batch_write_item_put() | batch_write_item_delete()

batch_write_item_request_item()

batch_write_item_request_item() = {table_name(), [batch_write_item_request()]}

batch_write_item_request_items()

batch_write_item_request_items() = maybe_list(batch_write_item_request_item())

batch_write_item_return()

batch_write_item_return() = ddb_return(#ddb2_batch_write_item{}, #ddb2_batch_write_item{})

billing_mode()

billing_mode() = provisioned | pay_per_request

boolean_opt()

boolean_opt(Name) = Name | {Name, boolean()}

client_request_token()

client_request_token() = binary()

client_request_token_opt()

client_request_token_opt() = {client_request_token, client_request_token()}

comparison_op()

comparison_op() = eq | ne | le | lt | ge | gt | not_null | null | contains | not_contains | begins_with | in | between

condition()

condition() = {attr_name(), not_null | null} | {attr_name(), in_attr_value()} | {attr_name(), in_attr_value(), comparison_op()} | {attr_name(), {in_attr_value(), in_attr_value()}, between} | {attr_name(), [in_attr_value(), ...], in}

condition_expression_opt()

condition_expression_opt() = {condition_expression, expression()}

conditional_op()

conditional_op() = 'and' | 'or'

conditional_op_opt()

conditional_op_opt() = {conditional_op, conditional_op()}

conditions()

conditions() = maybe_list(condition())

consistent_read_opt()

consistent_read_opt() = boolean_opt(consistent_read)

create_backup_return()

create_backup_return() = ddb_return(#ddb2_create_backup{}, #ddb2_backup_details{})

create_global_table_return()

create_global_table_return() = ddb_return(#ddb2_create_global_table{}, #ddb2_global_table_description{})

create_table_opt()

create_table_opt() = {billing_mode, billing_mode()} | {local_secondary_indexes, local_secondary_indexes()} | {global_secondary_indexes, global_secondary_indexes()} | {provisioned_throughput, {read_units(), write_units()}} | {sse_specification, sse_specification()} | {stream_specification, stream_specification()}

create_table_opts()

create_table_opts() = [create_table_opt()]

create_table_return()

create_table_return() = ddb_return(#ddb2_create_table{}, #ddb2_table_description{})

ddb_opts()

ddb_opts() = [out_opt()]

ddb_return()

ddb_return(Record, Simple) = {ok, jsx:json_term() | Record | Simple} | {error, term()}

delete_backup_return()

delete_backup_return() = ddb_return(#ddb2_delete_backup{}, #ddb2_backup_description{})

delete_item_opt()

delete_item_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | condition_expression_opt() | conditional_op_opt() | expected_opt() | {return_values, none | all_old} | return_consumed_capacity_opt() | return_item_collection_metrics_opt() | out_opt()

delete_item_opts()

delete_item_opts() = [delete_item_opt()]

delete_item_return()

delete_item_return() = ddb_return(#ddb2_delete_item{}, out_item())

delete_table_return()

delete_table_return() = ddb_return(#ddb2_delete_table{}, #ddb2_table_description{})

describe_backup_return()

describe_backup_return() = ddb_return(#ddb2_describe_backup{}, #ddb2_backup_description{})

describe_continuous_backup_return()

describe_continuous_backup_return() = ddb_return(#ddb2_describe_continuous_backups{}, #ddb2_continuous_backups_description{})

describe_global_table_return()

describe_global_table_return() = ddb_return(#ddb2_describe_global_table{}, #ddb2_global_table_description{})

describe_global_table_settings_return()

describe_global_table_settings_return() = ddb_return(#ddb2_describe_global_table_settings{}, #ddb2_replica_settings_description{})

describe_limits_return()

describe_limits_return() = ddb_return(#ddb2_describe_limits{}, #ddb2_describe_limits{})

describe_table_replica_auto_scaling_return()

describe_table_replica_auto_scaling_return() = ddb_return(#ddb2_describe_table_replica_auto_scaling{}, #ddb2_table_auto_scaling_description{})

describe_table_return()

describe_table_return() = ddb_return(#ddb2_describe_table{}, #ddb2_table_description{})

describe_time_to_live_return()

describe_time_to_live_return() = ddb_return(#ddb2_describe_time_to_live{}, #ddb2_time_to_live_description{})

expected_opt()

expected_opt() = {expected, in_expected()}

expression()

expression() = binary()

expression_attribute_names()

expression_attribute_names() = [{binary(), attr_name()}]

expression_attribute_names_opt()

expression_attribute_names_opt() = {expression_attribute_names, expression_attribute_names()}

expression_attribute_values()

expression_attribute_values() = [{binary(), in_attr_value()}]

expression_attribute_values_opt()

expression_attribute_values_opt() = {expression_attribute_values, expression_attribute_values()}

get_item_opt()

get_item_opt() = expression_attribute_names_opt() | projection_expression_opt() | attributes_to_get_opt() | consistent_read_opt() | return_consumed_capacity_opt() | out_opt()

get_item_opts()

get_item_opts() = [get_item_opt()]

get_item_return()

get_item_return() = ddb_return(#ddb2_get_item{}, out_item())

global_secondary_index_auto_scaling_update_opt()

global_secondary_index_auto_scaling_update_opt() = {index_name, binary()} | {provisioned_read_capacity_auto_scaling_update, auto_scaling_settings_update_opts()}

global_secondary_index_auto_scaling_update_opts()

global_secondary_index_auto_scaling_update_opts() = [global_secondary_index_auto_scaling_update_opt()]

global_secondary_index_def()

global_secondary_index_def() = {index_name(), key_schema(), projection()} | {index_name(), key_schema(), projection(), read_units(), write_units()}

global_secondary_index_update()

global_secondary_index_update() = {index_name(), read_units(), write_units()} | {index_name(), delete} | global_secondary_index_def()

global_secondary_index_updates()

global_secondary_index_updates() = maybe_list(global_secondary_index_update())

global_secondary_indexes()

global_secondary_indexes() = maybe_list(global_secondary_index_def())

global_table_global_secondary_index_settings_update_opt()

global_table_global_secondary_index_settings_update_opt() = {index_name, binary()} | {provisioned_write_capacity_auto_scaling_settings_update, auto_scaling_settings_update_opts()} | {provisioned_read_capacity_units, read_units()} | {provisioned_write_capacity_units, write_units()}

global_table_global_secondary_index_settings_update_opts()

global_table_global_secondary_index_settings_update_opts() = [global_table_global_secondary_index_settings_update_opt()]

hash_key_name()

hash_key_name() = attr_name()

in_attr()

in_attr() = {attr_name(), in_attr_value()}

in_attr_value()

in_attr_value() = in_string_value() | in_number_value() | {s, in_string_value()} | {n, in_number_value()} | {b, in_binary_value()} | {bool, boolean()} | {null, true} | {ss, [in_string_value(), ...]} | {ns, [in_number_value(), ...]} | {bs, [in_binary_value(), ...]} | {l, [in_attr_value()]} | {m, [in_attr()]}

in_binary_value()

in_binary_value() = binary() | [byte()]

non-empty

in_expected()

in_expected() = maybe_list(in_expected_item())

in_expected_item()

in_expected_item() = {attr_name(), false} | {attr_name(), true, in_attr_value()} | condition()

in_item()

in_item() = [in_attr()]

in_number_value()

in_number_value() = number()

in_string_value()

in_string_value() = binary() | iolist() | atom()

non-empty

in_update()

in_update() = {attr_name(), in_attr_value(), update_action()} | in_attr() | {attr_name(), delete}

in_updates()

in_updates() = maybe_list(in_update())

index_name()

index_name() = binary()

key()

key() = maybe_list(in_attr())

key_schema()

key_schema() = hash_key_name() | {hash_key_name(), range_key_name()}

list_backups_opt()

list_backups_opt() = {limit, pos_integer()} | {exclusive_start_backup_arn, binary()} | {table_name, table_name()} | {time_range_lower_bound, number()} | {time_range_upper_bound, number()}

list_backups_return()

list_backups_return() = ddb_return(#ddb2_list_backups{}, #ddb2_backup_summary{})

list_global_tables_opt()

list_global_tables_opt() = {limit, pos_integer()} | {exclusive_start_global_table_name, table_name() | undefined} | out_opt()

list_global_tables_opts()

list_global_tables_opts() = [list_global_tables_opt()]

list_global_tables_return()

list_global_tables_return() = ddb_return(#ddb2_list_global_tables{}, [#ddb2_global_table{}])

list_tables_opt()

list_tables_opt() = {limit, pos_integer()} | {exclusive_start_table_name, table_name() | undefined} | out_opt()

list_tables_opts()

list_tables_opts() = [list_tables_opt()]

list_tables_return()

list_tables_return() = ddb_return(#ddb2_list_tables{}, [table_name()])

list_tags_of_resource_opt()

list_tags_of_resource_opt() = {next_token, binary()} | out_opt()

list_tags_of_resource_opts()

list_tags_of_resource_opts() = [list_tags_of_resource_opt()]

list_tags_of_resource_return()

list_tags_of_resource_return() = ddb_return(#ddb2_list_tags_of_resource{}, tags())

local_secondary_index_def()

local_secondary_index_def() = {index_name(), range_key_name(), projection()}

local_secondary_indexes()

local_secondary_indexes() = maybe_list(local_secondary_index_def())

maybe_list()

maybe_list(T) = T | [T]

ok_return()

ok_return(T) = {ok, T} | {error, term()}

out_attr()

out_attr() = {attr_name(), out_attr_value()}

out_attr_value()

out_attr_value() = binary() | number() | boolean() | undefined | [binary()] | [number()] | [out_attr_value()] | [out_attr()]

out_item()

out_item() = [out_attr() | in_attr()]

in_attr in the case of typed_record

out_opt()

out_opt() = {out, out_type()}

out_type()

out_type() = json | record | typed_record | simple

projection()

projection() = keys_only | {include, [attr_name()]} | all

projection_expression_opt()

projection_expression_opt() = {projection_expression, expression()}

put_item_opt()

put_item_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | condition_expression_opt() | conditional_op_opt() | expected_opt() | {return_values, none | all_old} | return_consumed_capacity_opt() | return_item_collection_metrics_opt() | out_opt()

put_item_opts()

put_item_opts() = [put_item_opt()]

put_item_return()

put_item_return() = ddb_return(#ddb2_put_item{}, out_item())

q_opt()

q_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | projection_expression_opt() | attributes_to_get_opt() | consistent_read_opt() | {filter_expression, expression()} | conditional_op_opt() | {query_filter, conditions()} | {limit, pos_integer()} | {exclusive_start_key, key() | undefined} | boolean_opt(scan_index_forward) | {index_name, index_name()} | {select, select()} | return_consumed_capacity_opt() | out_opt()

q_opts()

q_opts() = [q_opt()]

q_return()

q_return() = ddb_return(#ddb2_q{}, [out_item()])

range_key_name()

range_key_name() = attr_name()

read_units()

read_units() = pos_integer()

replica()

replica() = {region_name, binary()} | #ddb2_replica{}

replica_auto_scaling_update_opt()

replica_auto_scaling_update_opt() = {region_name, binary()} | {replica_global_secondary_index_updates, [replica_global_secondary_index_auto_scaling_opts()]} | {replica_provisioned_read_capacity_auto_scaling_update, auto_scaling_settings_update_opts()}

replica_auto_scaling_update_opts()

replica_auto_scaling_update_opts() = [replica_auto_scaling_update_opt()]

replica_description()

replica_description() = #ddb2_replica_description{}

replica_global_secondary_index_auto_scaling_opt()

replica_global_secondary_index_auto_scaling_opt() = {index_name, binary()} | {provisioned_read_capacity_auto_scaling_update, auto_scaling_settings_update_opts()}

replica_global_secondary_index_auto_scaling_opts()

replica_global_secondary_index_auto_scaling_opts() = [replica_global_secondary_index_auto_scaling_opt()]

replica_settings_update_opts()

replica_settings_update_opts() = [replica_settings_update_opts()]

replica_update()

replica_update() = {create | delete, replica()}

restore_table_from_backup_return()

restore_table_from_backup_return() = ddb_return(#ddb2_restore_table_from_backup{}, #ddb2_table_description{})

restore_table_to_point_in_time_opt()

restore_table_to_point_in_time_opt() = {restore_date_time, date_time()} | {use_latest_restorable_time, boolean()}

restore_table_to_point_in_time_return()

restore_table_to_point_in_time_return() = ddb_return(#ddb2_restore_table_to_point_in_time{}, #ddb2_table_description{})

return_consumed_capacity()

return_consumed_capacity() = none | total | indexes

return_consumed_capacity_opt()

return_consumed_capacity_opt() = {return_consumed_capacity, return_consumed_capacity()}

return_item_collection_metrics()

return_item_collection_metrics() = none | size

return_item_collection_metrics_opt()

return_item_collection_metrics_opt() = {return_item_collection_metrics, return_item_collection_metrics()}

return_value()

return_value() = none | all_old | updated_old | all_new | updated_new

return_value_on_condition_check_failure_opt()

return_value_on_condition_check_failure_opt() = {return_values_on_condition_check_failure, return_value()}

scan_opt()

scan_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | projection_expression_opt() | attributes_to_get_opt() | consistent_read_opt() | {filter_expression, expression()} | conditional_op_opt() | {scan_filter, conditions()} | {limit, pos_integer()} | {exclusive_start_key, key() | undefined} | {segment, non_neg_integer()} | {total_segments, pos_integer()} | {index_name, index_name()} | {select, select()} | return_consumed_capacity_opt() | out_opt()

scan_opts()

scan_opts() = [scan_opt()]

scan_return()

scan_return() = ddb_return(#ddb2_scan{}, [out_item()])

select()

select() = all_attributes | all_projected_attributes | count | specific_attributes

sse_description()

sse_description() = {status, sse_description_status()}

sse_description_status()

sse_description_status() = enabling | enabled | disabling | disabled

sse_specification()

sse_specification() = {enabled, boolean()}

stream_specification()

stream_specification() = false | {true, stream_view_type()}

stream_view_type()

stream_view_type() = keys_only | new_image | old_image | new_and_old_images

table_name()

table_name() = binary()

tag()

tag() = {tag_key(), tag_value()}

tag_key()

tag_key() = binary()

tag_resource_return()

tag_resource_return() = ok | {error, term()}

tag_value()

tag_value() = binary()

tags()

tags() = [tag()]

time_to_live_status()

time_to_live_status() = enabled | disabled | enabling | disabling

transact_get_items_get()

transact_get_items_get() = {get, transact_get_items_get_item()}

transact_get_items_get_item()

transact_get_items_get_item() = {table_name(), key()} | {table_name(), key(), transact_get_items_opts()}

transact_get_items_opts()

transact_get_items_opts() = [transact_get_items_transact_item_opts()]

transact_get_items_return()

transact_get_items_return() = ddb_return(#ddb2_transact_get_items{}, out_item())

transact_get_items_transact_item()

transact_get_items_transact_item() = transact_get_items_get()

transact_get_items_transact_item_opts()

transact_get_items_transact_item_opts() = expression_attribute_names_opt() | projection_expression_opt() | return_consumed_capacity_opt() | out_opt()

transact_get_items_transact_items()

transact_get_items_transact_items() = maybe_list(transact_get_items_transact_item())

transact_write_items_condition_check()

transact_write_items_condition_check() = {condition_check, transact_write_items_condition_check_item()}

transact_write_items_condition_check_item()

transact_write_items_condition_check_item() = {table_name(), key(), transact_write_items_transact_item_opts()} | {table_name(), key(), binary(), transact_write_items_transact_item_opts()}

transact_write_items_delete()

transact_write_items_delete() = {delete, transact_write_items_delete_item()}

transact_write_items_delete_item()

transact_write_items_delete_item() = {table_name(), key()} | {table_name(), key(), transact_write_items_transact_item_opts()}

transact_write_items_opt()

transact_write_items_opt() = client_request_token_opt() | return_consumed_capacity_opt() | return_item_collection_metrics_opt() | out_opt()

transact_write_items_opts()

transact_write_items_opts() = [transact_write_items_opt()]

transact_write_items_put()

transact_write_items_put() = {put, transact_write_items_put_item()}

transact_write_items_put_item()

transact_write_items_put_item() = {table_name(), in_item()} | {table_name(), in_item(), transact_write_items_transact_item_opts()}

transact_write_items_return()

transact_write_items_return() = ddb_return(#ddb2_transact_write_items{}, out_item())

transact_write_items_transact_item()

transact_write_items_transact_item() = transact_write_items_condition_check() | transact_write_items_delete() | transact_write_items_put() | transact_write_items_update()

transact_write_items_transact_item_opt()

transact_write_items_transact_item_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | condition_expression_opt() | return_value_on_condition_check_failure_opt()

transact_write_items_transact_item_opts()

transact_write_items_transact_item_opts() = [transact_write_items_transact_item_opt()]

transact_write_items_transact_items()

transact_write_items_transact_items() = maybe_list(transact_write_items_transact_item())

transact_write_items_update()

transact_write_items_update() = {update, transact_write_items_update_item()}

transact_write_items_update_item()

transact_write_items_update_item() = {table_name(), key(), expression(), transact_write_items_transact_item_opts()}

untag_resource_return()

untag_resource_return() = ok | {error, term()}

update_action()

update_action() = put | add | delete

update_continuous_backups_return()

update_continuous_backups_return() = ddb_return(#ddb2_describe_continuous_backups{}, #ddb2_continuous_backups_description{})

update_global_table_return()

update_global_table_return() = ddb_return(#ddb2_update_global_table{}, #ddb2_global_table_description{})

update_global_table_settings_opt()

update_global_table_settings_opt() = {global_table_billing_mode, billing_mode()} | {global_table_global_secondary_index_settings_update, [global_table_global_secondary_index_settings_update_opts()]} | {global_table_provisioned_write_capacity_auto_scaling_settings_update, auto_scaling_settings_update_opts()} | {global_table_provisioned_write_capacity_units, write_units()} | {replica_settings_update, [replica_settings_update_opts()]} | out_opt()

update_global_table_settings_opts()

update_global_table_settings_opts() = [update_global_table_settings_opt()]

update_global_table_settings_return()

update_global_table_settings_return() = ddb_return(#ddb2_update_global_table_settings{}, [#ddb2_replica_settings_description{}])

update_item_opt()

update_item_opt() = expression_attribute_names_opt() | expression_attribute_values_opt() | condition_expression_opt() | conditional_op_opt() | expected_opt() | {return_values, return_value()} | return_consumed_capacity_opt() | return_item_collection_metrics_opt() | out_opt()

update_item_opts()

update_item_opts() = [update_item_opt()]

update_item_return()

update_item_return() = ddb_return(#ddb2_update_item{}, out_item())

update_table_opt()

update_table_opt() = {billing_mode, billing_mode()} | {provisioned_throughput, {read_units(), write_units()}} | {attribute_definitions, attr_defs()} | {global_secondary_index_updates, global_secondary_index_updates()} | {stream_specification, stream_specification()} | out_opt()

update_table_opts()

update_table_opts() = [update_table_opt()]

update_table_replica_auto_scaling_opt()

update_table_replica_auto_scaling_opt() = {global_secondary_index_updates, [global_secondary_index_auto_scaling_update_opts()]} | {provisioned_write_capacity_auto_scaling_update, auto_scaling_settings_update_opts()} | {replica_updates, [replica_auto_scaling_update_opts()]} | out_opt()

update_table_replica_auto_scaling_opts()

update_table_replica_auto_scaling_opts() = [update_table_replica_auto_scaling_opt()]

update_table_replica_auto_scaling_return()

update_table_replica_auto_scaling_return() = ddb_return(#ddb2_update_table_replica_auto_scaling{}, #ddb2_table_auto_scaling_description{})

update_table_return()

update_table_return() = ddb_return(#ddb2_update_table{}, #ddb2_table_description{})

update_time_to_live_opt()

update_time_to_live_opt() = {attribute_name, attr_name()} | {enabled, boolean()}

update_time_to_live_opts()

update_time_to_live_opts() = [update_time_to_live_opt()]

update_time_to_live_return()

update_time_to_live_return() = ddb_return(#ddb2_update_time_to_live{}, #ddb2_time_to_live_specification{})

write_units()

write_units() = pos_integer()

Function Index

batch_get_item/1
batch_get_item/2
batch_get_item/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html
batch_write_item/1
batch_write_item/2
batch_write_item/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html
configure/2
configure/3
configure/4
configure/5
create_backup/2
create_backup/3
create_backup/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateBackup.html
create_global_table/2
create_global_table/3
create_global_table/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateGlobalTable.html
create_table/4
create_table/5 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html
create_table/6
create_table/7
delete_backup/1
delete_backup/2
delete_backup/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteBackup.html
delete_item/2
delete_item/3
delete_item/4 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html
delete_table/1
delete_table/2
delete_table/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteTable.html
describe_backup/1
describe_backup/2
describe_backup/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeBackup.html
describe_continuous_backups/1
describe_continuous_backups/2
describe_continuous_backups/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeContinuousBackups.html
describe_global_table/1
describe_global_table/2
describe_global_table/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeGlobalTable.html
describe_global_table_settings/1
describe_global_table_settings/2
describe_global_table_settings/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeGlobalTableSettings.html
describe_limits/0
describe_limits/1
describe_limits/2 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeLimits.html
describe_table/1
describe_table/2
describe_table/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html
describe_table_replica_auto_scaling/1
describe_table_replica_auto_scaling/2
describe_table_replica_auto_scaling/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTableReplicaAutoScaling.html Note: This method only applies to Version 2019.11.21 of global tables.
describe_time_to_live/1
describe_time_to_live/2
describe_time_to_live/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTimeToLive.html
get_item/2
get_item/3
get_item/4 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html
list_backups/0
list_backups/1
list_backups/2 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListBackups.html
list_global_tables/0
list_global_tables/1
list_global_tables/2 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListGlobalTables.html
list_tables/0
list_tables/1
list_tables/2 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html
list_tags_of_resource/1
list_tags_of_resource/2
list_tags_of_resource/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTagsOfResource.html
new/2
new/3
new/4
new/5
put_item/2
put_item/3
put_item/4 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html
q/2
q/3
q/4 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html
restore_table_from_backup/2
restore_table_from_backup/3
restore_table_from_backup/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_RestoreTableFromBackup.html
restore_table_to_point_in_time/2
restore_table_to_point_in_time/3
restore_table_to_point_in_time/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_RestoreTableToPointInTime.html
scan/1
scan/2
scan/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html
tag_resource/2
tag_resource/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TagResource.html
transact_get_items/1
transact_get_items/2
transact_get_items/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html
transact_write_items/1
transact_write_items/2
transact_write_items/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html
untag_resource/2
untag_resource/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UntagResource.html
update_continuous_backups/2
update_continuous_backups/3
update_continuous_backups/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateContinuousBackups.html
update_global_table/2
update_global_table/3
update_global_table/4 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateGlobalTable.html
update_global_table_settings/2
update_global_table_settings/3 DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateGlobalTableSettings.html
update_item/3
update_item/4
update_item/5 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html
update_table/2
update_table/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html
update_table/4
update_table/5
update_table_replica_auto_scaling/2
update_table_replica_auto_scaling/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTableReplicaAutoScaling.html
update_time_to_live/2
update_time_to_live/3 DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTimeToLive.html
update_time_to_live/4

Function Details

batch_get_item/1

batch_get_item(RequestItems::batch_get_item_request_items()) -> batch_get_item_return()

batch_get_item/2

batch_get_item(RequestItems::batch_get_item_request_items(), Opts::batch_get_item_opts()) -> batch_get_item_return()

batch_get_item/3

batch_get_item(RequestItems::batch_get_item_request_items(), Opts::batch_get_item_opts(), Config::aws_config()) -> batch_get_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchGetItem.html

Example

Get 4 items total from 2 tables.

{ok, Record} = erlcloud_ddb2:batch_get_item( [{<<"Forum">>, [{<<"Name">>, {s, <<"Amazon DynamoDB">>}}, {<<"Name">>, {s, <<"Amazon RDS">>}}, {<<"Name">>, {s, <<"Amazon Redshift">>}}], [{projection_expression, <<"Name, Threads, Messages, Views">>}]}, {<<"Thread">>, [[{<<"ForumName">>, {s, <<"Amazon DynamoDB">>}}, {<<"Subject">>, {s, <<"Concurrent reads">>}}]], [{projection_expression, <<"Tags, Message">>}]}], [{return_consumed_capacity, total}, {out, record}]),

See also erlcloud_ddb_util:get_all which provides retry and parallel batching.

batch_write_item/1

batch_write_item(RequestItems::batch_write_item_request_items()) -> batch_write_item_return()

batch_write_item/2

batch_write_item(RequestItems::batch_write_item_request_items(), Opts::batch_write_item_opts()) -> batch_write_item_return()

batch_write_item/3

batch_write_item(RequestItems::batch_write_item_request_items(), Opts::batch_write_item_opts(), Config::aws_config()) -> batch_write_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_BatchWriteItem.html

Example

Put 4 items in the "Forum" table.

{ok, Record} = erlcloud_ddb2:batch_write_item( [{<<"Forum">>, [{put, [{<<"Name">>, {s, <<"Amazon DynamoDB">>}}, {<<"Category">>, {s, <<"Amazon Web Services">>}}]}, {put, [{<<"Name">>, {s, <<"Amazon RDS">>}}, {<<"Category">>, {s, <<"Amazon Web Services">>}}]}, {put, [{<<"Name">>, {s, <<"Amazon Redshift">>}}, {<<"Category">>, {s, <<"Amazon Web Services">>}}]}, {put, [{<<"Name">>, {s, <<"Amazon ElastiCache">>}}, {<<"Category">>, {s, <<"Amazon Web Services">>}}]} ]}], [{return_consumed_capacity, total}, {out, record}]),

configure/2

configure(AccessKeyID::string(), SecretAccessKey::string()) -> ok

configure/3

configure(AccessKeyID::string(), SecretAccessKey::string(), Host::string()) -> ok

configure/4

configure(AccessKeyID::string(), SecretAccessKey::string(), Host::string(), Port::non_neg_integer()) -> ok

configure/5

configure(AccessKeyID::string(), SecretAccessKey::string(), Host::string(), Port::non_neg_integer(), Scheme::string()) -> ok

create_backup/2

create_backup(BackupName::binary(), TableName::table_name()) -> create_backup_return()

create_backup/3

create_backup(BackupName::binary(), TableName::table_name(), Opts::ddb_opts()) -> create_backup_return()

create_backup/4

create_backup(BackupName::binary(), TableName::table_name(), Opts::ddb_opts(), Config::aws_config()) -> create_backup_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateBackup.html

Example

Creates a backup for an existing table.

{ok, BackupDetails} = erlcloud_ddb2:create_backup(<<"Forum_Backup">>, <<"Forum">>),

create_global_table/2

create_global_table(GlobalTableName::table_name(), ReplicationGroup::maybe_list(replica())) -> create_global_table_return()

create_global_table/3

create_global_table(GlobalTableName::table_name(), ReplicationGroup::maybe_list(replica()), Opts::ddb_opts() | aws_config()) -> create_global_table_return()

create_global_table/4

create_global_table(GlobalTableName::table_name(), ReplicationGroup::[replica()], Opts::ddb_opts(), Config::aws_config()) -> create_global_table_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateGlobalTable.html

Example

Create a global table called "Thread" in us-east-1 and eu-west-1.

{ok, Record} = erlcloud_ddb2:create_global_table(<<"Thread">>, [{region_name, <<"us-east-1">>}, {region_name, <<"eu-west-1">>}]),

create_table/4

create_table(Table::table_name(), AttrDefs::attr_defs(), KeySchema::key_schema(), Opts::create_table_opts()) -> create_table_return()

create_table/5

create_table(Table::table_name(), AttrDefs::attr_defs(), KeySchema::key_schema(), ReadUnits::read_units(), WriteUnits::write_units()) -> create_table_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html

Example

Create a table with hash key "ForumName" and range key "Subject" with a local secondary index on "LastPostDateTime" and a global secondary index on "Subject" as hash key and "LastPostDateTime" as range key, read and write capacity 10, projecting all fields

{ok, Description} = erlcloud_ddb2:create_table( <<"Thread">>, [{<<"ForumName">>, s}, {<<"Subject">>, s}, {<<"LastPostDateTime">>, s}], {<<"ForumName">>, <<"Subject">>}, [{provisioned_throughput, {5, 5}}, {local_secondary_indexes, [{<<"LastPostIndex">>, <<"LastPostDateTime">>, keys_only}]}, {global_secondary_indexes, [ {<<"SubjectTimeIndex">>, {<<"Subject">>, <<"LastPostDateTime">>}, all, 10, 10} ]} ]),

create_table/6

create_table(Table::table_name(), AttrDefs::attr_defs(), KeySchema::key_schema(), ReadUnits::read_units(), WriteUnits::write_units(), Opts::create_table_opts()) -> create_table_return()

create_table/7

create_table(Table::table_name(), AttrDefs::attr_defs(), KeySchema::key_schema(), ReadUnits::read_units(), WriteUnits::write_units(), Opts0::create_table_opts(), Config::aws_config()) -> create_table_return()

delete_backup/1

delete_backup(BackupArn::binary()) -> delete_backup_return()

delete_backup/2

delete_backup(BackupArn::binary(), Opts::ddb_opts()) -> delete_backup_return()

delete_backup/3

delete_backup(BackupArn::binary(), Opts::ddb_opts(), Config::aws_config()) -> delete_backup_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteBackup.html

Example

Deletes an existing backup of a table.

{ok, BackupDescription} = erlcloud_ddb2:delete_backup(<<"BackupArn">>),

delete_item/2

delete_item(Table::table_name(), Key::key()) -> delete_item_return()

delete_item/3

delete_item(Table::table_name(), Key::key(), Opts::delete_item_opts()) -> delete_item_return()

delete_item/4

delete_item(Table::table_name(), Key::key(), Opts::delete_item_opts(), Config::aws_config()) -> delete_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteItem.html

Example

Delete an item from the "Thread" table if it doesn't have a "Replies" attribute.

{ok, Item} = erlcloud_ddb2:delete_item( <<"Thread">>, [{<<"ForumName">>, {s, <<"Amazon DynamoDB">>}}, {<<"Subject">>, {s, <<"How do I update multiple items?">>}}], [{return_values, all_old}, {condition_expression, <<"attribute_not_exists(Replies)">>}]),

The ConditionExpression option can also be used in place of the legacy ConditionalOperator or Expected parameters.

{ok, Item} = erlcloud_ddb2:delete_item( <<"Thread">>, [{<<"ForumName">>, {s, <<"Amazon DynamoDB">>}}, {<<"Subject">>, {s, <<"How do I update multiple items?">>}}], [{return_values, all_old}, {condition_expression, <<"attribute_not_exists(#replies)">>}, {expression_attribute_names, [{<<"#replies">>, <<"Replies">>}]}]),

delete_table/1

delete_table(Table::table_name()) -> delete_table_return()

delete_table/2

delete_table(Table::table_name(), Opts::ddb_opts()) -> delete_table_return()

delete_table/3

delete_table(Table::table_name(), Opts::ddb_opts(), Config::aws_config()) -> delete_table_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DeleteTable.html

Example

Delete "Reply" table.

{ok, Description} = erlcloud_ddb2:delete_table(<<"Reply">>),

describe_backup/1

describe_backup(BackupArn::binary()) -> describe_backup_return()

describe_backup/2

describe_backup(BackupArn::binary(), Opts::ddb_opts()) -> describe_backup_return()

describe_backup/3

describe_backup(BackupArn::binary(), Opts::ddb_opts(), Config::aws_config()) -> describe_backup_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeBackup.html

Example

Describes an existing backup of a table.

{ok, BackupDescription} = erlcloud_ddb2:describe_backup(<<"BackupArn">>),

describe_continuous_backups/1

describe_continuous_backups(TableName::table_name()) -> describe_continuous_backup_return()

describe_continuous_backups/2

describe_continuous_backups(TableName::table_name(), Opts::ddb_opts()) -> describe_continuous_backup_return()

describe_continuous_backups/3

describe_continuous_backups(TableName::table_name(), Opts::ddb_opts(), Config::aws_config()) -> describe_continuous_backup_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeContinuousBackups.html

Example

Checks the status of continuous backups and point in time recovery on the specified table.

{ok, ContinuousBackupDescription} = erlcloud_ddb2:describe_continuous_backups(<<"Forum">>),

describe_global_table/1

describe_global_table(GlobalTableName::table_name()) -> describe_global_table_return()

describe_global_table/2

describe_global_table(GlobalTableName::table_name(), Opts::ddb_opts() | aws_config()) -> describe_global_table_return()

describe_global_table/3

describe_global_table(GlobalTableName::table_name(), Opts::ddb_opts(), Config::aws_config()) -> describe_global_table_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeGlobalTable.html

Example

Describe "Thread" global table.

{ok, Description} = erlcloud_ddb2:describe_table(<<"Thread">>),

describe_global_table_settings/1

describe_global_table_settings(GlobalTableName::table_name()) -> describe_global_table_settings_return()

describe_global_table_settings/2

describe_global_table_settings(GlobalTableName::table_name(), Opts::ddb_opts()) -> describe_global_table_settings_return()

describe_global_table_settings/3

describe_global_table_settings(GlobalTableName::table_name(), Opts::ddb_opts(), Config::aws_config()) -> describe_global_table_settings_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeGlobalTableSettings.html

Note: This method only applies to Version 2017.11.29 of global tables.

Example

Describes Region-specific settings for "Thread" global table.

{ok, GlobalTableSettings} = erlcloud_ddb2:describe_global_table_settings(<<"Thread">>),

describe_limits/0

describe_limits() -> describe_limits_return()

describe_limits/1

describe_limits(Opts::ddb_opts()) -> describe_limits_return()

describe_limits/2

describe_limits(Opts::ddb_opts(), Config::aws_config()) -> describe_limits_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeLimits.html

Example

Describe the current provisioned-capacity limits for your AWS account.

{ok, Limits} = erlcloud_ddb2:describe_limits(),

describe_table/1

describe_table(Table::table_name()) -> describe_table_return()

describe_table/2

describe_table(Table::table_name(), Opts::ddb_opts()) -> describe_table_return()

describe_table/3

describe_table(Table::table_name(), Opts::ddb_opts(), Config::aws_config()) -> describe_table_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html

Example

Describe "Thread" table.

{ok, Description} = erlcloud_ddb2:describe_table(<<"Thread">>),

describe_table_replica_auto_scaling/1

describe_table_replica_auto_scaling(Table::table_name()) -> describe_table_replica_auto_scaling_return()

describe_table_replica_auto_scaling/2

describe_table_replica_auto_scaling(Table::table_name(), Opts::ddb_opts()) -> describe_table_replica_auto_scaling_return()

describe_table_replica_auto_scaling/3

describe_table_replica_auto_scaling(Table::table_name(), Opts::ddb_opts(), Config::aws_config()) -> describe_table_replica_auto_scaling_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTableReplicaAutoScaling.html Note: This method only applies to Version 2019.11.21 of global tables.

Example

Describes auto scaling settings across replicas of the global table called "Thread" at once.

{ok, Description} = erlcloud_ddb2:describe_table_replica_auto_scaling(<<"Thread">>),

describe_time_to_live/1

describe_time_to_live(Table::table_name()) -> describe_time_to_live_return()

describe_time_to_live/2

describe_time_to_live(Table::table_name(), DbOpts::ddb_opts()) -> describe_time_to_live_return()

describe_time_to_live/3

describe_time_to_live(Table::table_name(), DbOpts::ddb_opts(), Config::aws_config()) -> describe_time_to_live_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTimeToLive.html

Example

Describe TimeToLive for table "SessionData". {ok, Description} = erlcloud_ddb2:describe_time_to_live(<<"SessionData">>),

get_item/2

get_item(Table::table_name(), Key::key()) -> get_item_return()

get_item/3

get_item(Table::table_name(), Key::key(), Opts::get_item_opts()) -> get_item_return()

get_item/4

get_item(Table::table_name(), Key::key(), Opts::get_item_opts(), Config::aws_config()) -> get_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GetItem.html

Example

Get selected attributes from an item in the "Thread" table.

{ok, Item} = erlcloud_ddb2:get_item( <<"Thread">>, [{<<"ForumName">>, {s, <<"Amazon DynamoDB">>}}, {<<"Subject">>, {s, <<"How do I update multiple items?">>}}], [{projection_expression, <<"LastPostDateTime, Message, Tags">>}, consistent_read, {return_consumed_capacity, total}]),

list_backups/0

list_backups() -> list_backups_return()

list_backups/1

list_backups(Opts::[list_backups_opt()]) -> list_backups_return()

list_backups/2

list_backups(Opts::[list_backups_opt()], Config::aws_config()) -> list_backups_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListBackups.html

Example

Get the table backups. {ok, Tables} = erlcloud_ddb2:list_backups(), Get the last 4 table backups for "Forum" table between April 5, 2018 and April 6, 2018. {ok, Tables} = erlcloud_ddb2:list_backups( [{limit, 4}, {table_name, <<"Forum">>}, {time_range_lower_bound, 1522926603.688}, {time_range_upper_bound, 1523022454.098}]),

list_global_tables/0

list_global_tables() -> list_global_tables_return()

list_global_tables/1

list_global_tables(Opts::list_global_tables_opts() | aws_config()) -> list_global_tables_return()

list_global_tables/2

list_global_tables(Opts::list_global_tables_opts(), Config::aws_config()) -> list_global_tables_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListGlobalTables.html

Example

Get the next 3 global table names after "Thread".

{ok, Tables} = erlcloud_ddb2:list_global_tables( [{limit, 3}, {exclusive_start_global_table_name, <<"Thread">>}]),

list_tables/0

list_tables() -> list_tables_return()

list_tables/1

list_tables(Opts::list_tables_opts()) -> list_tables_return()

list_tables/2

list_tables(Opts::list_tables_opts(), Config::aws_config()) -> list_tables_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html

Example

Get the next 3 table names after "Forum".

{ok, Tables} = erlcloud_ddb2:list_tables( [{limit, 3}, {exclusive_start_table_name, <<"Forum">>}]),

list_tags_of_resource/1

list_tags_of_resource(ResourceArn::binary()) -> list_tags_of_resource_return()

list_tags_of_resource/2

list_tags_of_resource(ResourceArn::binary(), Opts::list_tags_of_resource_opts()) -> list_tags_of_resource_return()

list_tags_of_resource/3

list_tags_of_resource(ResourceArn::binary(), Opts::list_tags_of_resource_opts(), Config::aws_config()) -> list_tags_of_resource_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTagsOfResource.html

Example

List the tags for "Forum".

{ok, Tags} = erlcloud_ddb2:list_tags_of_resource( <<"arn:aws:dynamodb:us-west-2:111122223333:table/Forum">>, [{next_token, <<"TestToken">>}]),

new/2

new(AccessKeyID::string(), SecretAccessKey::string()) -> aws_config()

new/3

new(AccessKeyID::string(), SecretAccessKey::string(), Host::string()) -> aws_config()

new/4

new(AccessKeyID::string(), SecretAccessKey::string(), Host::string(), Port::non_neg_integer()) -> aws_config()

new/5

new(AccessKeyID::string(), SecretAccessKey::string(), Host::string(), Port::non_neg_integer(), Scheme::string()) -> aws_config()

put_item/2

put_item(Table::table_name(), Item::in_item()) -> put_item_return()

put_item/3

put_item(Table::table_name(), Item::in_item(), Opts::put_item_opts()) -> put_item_return()

put_item/4

put_item(Table::table_name(), Item::in_item(), Opts::put_item_opts(), Config::aws_config()) -> put_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html

Example

Put an item in the "Thread" table if it does not already exist.

{ok, []} = erlcloud_ddb2:put_item( <<"Thread">>, [{<<"LastPostedBy">>, <<"fred@example.com">>}, {<<"ForumName">>, <<"Amazon DynamoDB">>}, {<<"LastPostDateTime">>, <<"201303190422">>}, {<<"Tags">>, {ss, [<<"Update">>, <<"Multiple Items">>, <<"HelpMe">>]}}, {<<"Subject">>, <<"How do I update multiple items?">>}, {<<"Message">>, <<"I want to update multiple items in a single API call. What is the best way to do that?">>}], [{condition_expression, <<"ForumName <> :f and Subject <> :s">>}, {expression_attribute_values, [{<<":f">>, <<"Amazon DynamoDB">>}, {<<":s">>, <<"How do I update multiple items?">>}]}]),

The ConditionExpression option can be used in place of the legacy Expected parameter.

{ok, []} = erlcloud_ddb2:put_item( <<"Thread">>, [{<<"LastPostedBy">>, <<"fred@example.com">>}, {<<"ForumName">>, <<"Amazon DynamoDB">>}, {<<"LastPostDateTime">>, <<"201303190422">>}, {<<"Tags">>, {ss, [<<"Update">>, <<"Multiple Items">>, <<"HelpMe">>]}}, {<<"Subject">>, <<"How do I update multiple items?">>}, {<<"Message">>, <<"I want to update multiple items in a single API call. What is the best way to do that?">>}], [{condition_expression, <<"#forum <> :forum AND attribute_not_exists(#subject)">>}, {expression_attribute_names, [{<<"#forum">>, <<"ForumName">>}, {<<"#subject">>, <<"Subject">>}]}, {expression_attribute_values, [{<<":forum">>, <<"Amazon DynamoDB">>}]}]),

q/2

q(Table::table_name(), KeyConditionsOrExpression::conditions() | expression()) -> q_return()

q/3

q(Table::table_name(), KeyConditionsOrExpression::conditions() | expression(), Opts::q_opts()) -> q_return()

q/4

q(Table::table_name(), KeyConditionsOrExpression::conditions() | expression(), Opts::q_opts(), Config::aws_config()) -> q_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html

KeyConditions are treated as a required parameter, which appears to be the case despite what the documentation says.

Example

Get up to 3 itesm from the "Thread" table with "ForumName" of "Amazon DynamoDB" and "LastPostDateTime" between specified value. Use the "LastPostIndex".

{ok, Items} = erlcloud_ddb2:q( <<"Thread">>, <<"ForumName = :n AND LastPostDateTime BETWEEN :t1 AND :t2">>, [{expression_attribute_values, [{<<":n">>, <<"Amazon DynamoDB">>}, {<<":t1">>, <<"20130101">>}, {<<":t2">>, <<"20130115">>}]}, {index_name, <<"LastPostIndex">>}, {select, all_attributes}, {limit, 3}, {consistent_read, true}, {filter_expression, <<"#user = :user">>}, {expression_attribute_names, [{<<"#user">>, <<"User">>}]}, {expression_attribute_values, [{<<":user">>, <<"User A">>}]}]),

restore_table_from_backup/2

restore_table_from_backup(BackupArn::binary(), TargetTableName::table_name()) -> restore_table_from_backup_return()

restore_table_from_backup/3

restore_table_from_backup(BackupArn::binary(), TargetTableName::table_name(), Opts::ddb_opts()) -> restore_table_from_backup_return()

restore_table_from_backup/4

restore_table_from_backup(BackupArn::binary(), TargetTableName::table_name(), Opts::ddb_opts(), Config::aws_config()) -> restore_table_from_backup_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_RestoreTableFromBackup.html

Example

Creates a new table from an existing backup.

{ok, Table} = erlcloud_ddb2:restore_table_from_backup(<<"BackupArn">>, <<"Forum">>),

restore_table_to_point_in_time/2

restore_table_to_point_in_time(SourceTableName::table_name(), TargetTableName::table_name()) -> restore_table_to_point_in_time_return()

restore_table_to_point_in_time/3

restore_table_to_point_in_time(SourceTableName::table_name(), TargetTableName::table_name(), Opts::[restore_table_to_point_in_time_opt()]) -> restore_table_to_point_in_time_return()

restore_table_to_point_in_time/4

restore_table_to_point_in_time(SourceTableName::table_name(), TargetTableName::table_name(), Opts::[restore_table_to_point_in_time_opt()], Config::aws_config()) -> restore_table_to_point_in_time_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_RestoreTableToPointInTime.html

Example

Restores the specified table to the specified point in time within EarliestRestorableDateTime and LatestRestorableDateTime.

{ok, Table} = erlcloud_ddb2:restore_table_to_point_in_time(<<"Thread">>, <<"ThreadTo">>, [{restore_date_time, 1522926603.688}, {use_latest_restorable_time, false}]),

scan/1

scan(Table::table_name()) -> scan_return()

scan/2

scan(Table::table_name(), Opts::scan_opts()) -> scan_return()

scan/3

scan(Table::table_name(), Opts::scan_opts(), Config::aws_config()) -> scan_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Scan.html

Example

Return all items in the "Reply" table.

{ok, Record} = erlcloud_ddb2:scan( <<"Reply">>, [{return_consumed_capacity, total}, {out, record}]),

tag_resource/2

tag_resource(ResourceArn::binary(), Tags::tags()) -> tag_resource_return()

tag_resource/3

tag_resource(ResourceArn::binary(), Tags::tags(), Config::aws_config()) -> tag_resource_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TagResource.html

Example

Tag the Forum table with example keys.

ok = erlcloud_ddb2:tag_resource( <<"arn:aws:dynamodb:us-west-2:111122223333:table/Forum">>, [{<<"example_key1">>, <<"example_value1">>}, {<<"example_key2">>, <<"example_value2">>}]),

transact_get_items/1

transact_get_items(RequestItems::transact_get_items_transact_items()) -> transact_get_items_return()

transact_get_items/2

transact_get_items(RequestItems::transact_get_items_transact_items(), Opts::transact_get_items_opts()) -> transact_get_items_return()

transact_get_items/3

transact_get_items(TransactItems::transact_get_items_transact_items(), Opts::transact_get_items_opts(), Config::aws_config()) -> transact_get_items_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactGetItems.html

Note that in the case of a TransactionCanceledException DynamoDB error, the error response has the form {error, {<<"TransactionCanceledException">>, {Message, CancellationReasons}}} where Message is a binary string and CancellationReasons is an ordered list in the form [{Code, Message}], where Code is the status code of the result and Message is the cancellation reason message description.

Example

Get two items in a transaction.

{ok, Record} = erlcloud_ddb2:transact_get_items( [{get, {<<"PersonalInfo">>, [{<<"Name">>, {s, <<"John Smith">>}}, {<<"DOB">>, {s, <<"11/11/2011">>}}]}}, {get, {<<"EmployeeRecord">>, [{<<"Name">>, {s, <<"John Smith">>}}, {<<"DOH">>, {s, <<"11/11/2018">>}}]}}], [{return_consumed_capacity, total}, {out, record}]),

transact_write_items/1

transact_write_items(RequestItems::transact_write_items_transact_items()) -> transact_write_items_return()

transact_write_items/2

transact_write_items(RequestItems::transact_write_items_transact_items(), Opts::transact_write_items_opts()) -> transact_write_items_return()

transact_write_items/3

transact_write_items(TransactItems::transact_write_items_transact_items(), Opts::transact_write_items_opts(), Config::aws_config()) -> transact_write_items_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_TransactWriteItems.html

Note that in the case of a TransactionCanceledException DynamoDB error, the error response has the form {error, {<<"TransactionCanceledException">>, {Message, CancellationReasons}}} where Message is a binary string and CancellationReasons is an ordered list in the form [{Code, Message}], where Code is the status code of the result and Message is the cancellation reason message description.

Example

Put two items in a transaction.

{ok, Record} = erlcloud_ddb2:transact_write_items( [{put, {<<"PersonalInfo">>, [{<<"Name">>, {s, <<"John Smith">>}}, {<<"DOB">>, {s, <<"11/11/2011">>}}]}}, {put, {<<"EmployeeRecord">>, [{<<"Name">>, {s, <<"John Smith">>}}, {<<"DOH">>, {s, <<"11/11/2018">>}}]}}], [{return_consumed_capacity, total}, {out, record}]),

untag_resource/2

untag_resource(ResourceArn::binary(), TagKeys::[tag_key()]) -> untag_resource_return()

untag_resource/3

untag_resource(ResourceArn::binary(), TagKeys::[tag_key()], Config::aws_config()) -> untag_resource_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UntagResource.html

Example

Untag the example keys of the Forum table.

ok = erlcloud_ddb2:untag_resource( <<"arn:aws:dynamodb:us-west-2:111122223333:table/Forum">>, [<<"example_key1">>, <<"example_key2">>]),

update_continuous_backups/2

update_continuous_backups(TableName::table_name(), PointInTimeRecoveryEnabled::boolean()) -> update_continuous_backups_return()

update_continuous_backups/3

update_continuous_backups(TableName::table_name(), PointInTimeRecoveryEnabled::boolean(), Opts::ddb_opts()) -> update_continuous_backups_return()

update_continuous_backups/4

update_continuous_backups(TableName::table_name(), PointInTimeRecoveryEnabled::boolean(), Opts::ddb_opts(), Config::aws_config()) -> update_continuous_backups_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateContinuousBackups.html

Example

Enables or disables point in time recovery for the specified table.

{ok, Record} = erlcloud_ddb2:update_continuous_backups(<<"Thread">>, true),

update_global_table/2

update_global_table(GlobalTableName::table_name(), ReplicaUpdates::maybe_list(replica_update())) -> update_global_table_return()

update_global_table/3

update_global_table(GlobalTableName::table_name(), ReplicaUpdates::maybe_list(replica_update()), Opts::ddb_opts() | aws_config()) -> update_global_table_return()

update_global_table/4

update_global_table(GlobalTableName::table_name(), ReplicaUpdates::[replica_update()], Opts::ddb_opts(), Config::aws_config()) -> update_global_table_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateGlobalTable.html

Example

Update a global table called "Thread" in us-east-1 and eu-west-1.

{ok, Record} = erlcloud_ddb2:update_global_table(<<"Thread">>, [{create, {region_name, <<"us-east-1">>}}, {delete, {region_name, <<"eu-west-1">>}}]),

update_global_table_settings/2

update_global_table_settings(GlobalTableName::table_name(), Opts::update_global_table_settings_opts()) -> update_global_table_settings_return()

update_global_table_settings/3

update_global_table_settings(GlobalTableName::table_name(), Opts::update_global_table_settings_opts(), Config::aws_config()) -> update_global_table_settings_return()

DynamoDB API: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateGlobalTableSettings.html

Example

Update global table settings for a table called "Thread" in us-west-2 and eu-west-2.

ReadUnits = 10, WriteUnits = 10, erlcloud_ddb2:update_global_table_settings( <<"Thread">>, [{global_table_billing_mode, provisioned}, {global_table_global_secondary_index_settings_update, [[{index_name, <<"id-index">>}, {provisioned_write_capacity_units, WriteUnits}]]}, {global_table_provisioned_write_capacity_units, WriteUnits}, {replica_settings_update, [[{region_name, <<"us-west-2">>}, {replica_global_secondary_index_settings_update, [[{index_name, <<"id-index">>}, {provisioned_read_capacity_units, ReadUnits}]]}, {replica_provisioned_read_capacity_units, ReadUnits}], [{region_name, <<"eu-west-2">>}, {replica_global_secondary_index_settings_update, [[{index_name, <<"id-index">>}, {provisioned_read_capacity_units, ReadUnits}]]}, {replica_provisioned_read_capacity_units, ReadUnits}]]}])

update_item/3

update_item(Table::table_name(), Key::key(), UpdatesOrExpression::in_updates() | expression()) -> update_item_return()

update_item/4

update_item(Table::table_name(), Key::key(), UpdatesOrExpression::in_updates() | expression(), Opts::update_item_opts()) -> update_item_return()

update_item/5

update_item(Table::table_name(), Key::key(), UpdatesOrExpression::in_updates() | expression(), Opts::update_item_opts(), Config::aws_config()) -> update_item_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html

AttributeUpdates is treated as a required parameter because callers will almost always provide it. If no updates are desired, You can pass [] for that argument.

Example

Update specific item in the "Thread" table by setting "LastPostBy" if it has the expected previous value.

{ok, Item} = erlcloud_ddb2:update_item( <<"Thread">>, [{<<"ForumName">>, {s, <<"Amazon DynamoDB">>}}, {<<"Subject">>, {s, <<"How do I update multiple items?">>}}], <<"set LastPostedBy = :val1">>, [{condition_expression, <<"LastPostedBy = :val2">>}, {expression_attribute_values, [{<<":val1">>, <<"alice@example.com">>}, {<<":val2">>, <<"fred@example.com">>}]}, {return_values, all_new}]),

update_table/2

update_table(Table::table_name(), Opts::update_table_opts()) -> update_table_return()

update_table/3

update_table(Table::table_name(), Opts::update_table_opts(), Config::aws_config()) -> update_table_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html

Example

Update table "Thread" to have 10 units of read and write capacity. Update secondary index <<"SubjectIdx">> to have 10 units of read write capacity
  erlcloud_ddb2:update_table(
    <<"Thread">>,
    [{provisioned_throughput, {10, 10}},
     {global_secondary_index_updates, [{<<"SubjectIdx">>, 10, 10}]}])

update_table/4

update_table(Table::table_name(), ReadUnits::read_units(), WriteUnits::write_units(), Opts::update_table_opts()) -> update_table_return()

update_table/5

update_table(Table::table_name(), ReadUnits::non_neg_integer(), WriteUnits::non_neg_integer(), Opts::update_table_opts(), Config::aws_config()) -> update_table_return()

update_table_replica_auto_scaling/2

update_table_replica_auto_scaling(Table::table_name(), Opts::update_table_replica_auto_scaling_opts()) -> update_table_replica_auto_scaling_return()

update_table_replica_auto_scaling/3

update_table_replica_auto_scaling(Table::table_name(), Opts::update_table_replica_auto_scaling_opts(), Config::aws_config()) -> update_table_replica_auto_scaling_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTableReplicaAutoScaling.html

Note: This method only applies to Version 2019.11.21 of global tables. Note:

Example

Update table "Thread" to scale between 10 and 20 provisioned read and write units uniformly across replica regions.
  AutoScalingSettingsUpdate = [{maximum_units, 20},
                               {minimum_units, 10},
                               {scaling_policy_update, [{target_tracking_scaling_policy_configuration, [{target_value, 60.0}]}]}],
  erlcloud_ddb2:update_table_replica_auto_scaling(
    <<"Thread">>,
    [{global_secondary_index_updates, [[{index_name, <<"id-index">>},
                                        {provisioned_write_capacity_auto_scaling_update, AutoScalingSettingsUpdate}]]},
     {provisioned_write_capacity_auto_scaling_update, AutoScalingSettingsUpdate},
     {replica_updates, [[{region_name, <<"us-west-2">>},
                         {replica_global_secondary_index_updates, [[{index_name, <<"id-index">>},
                                                                    {provisioned_read_capacity_auto_scaling_update, AutoScalingSettingsUpdate}]]},
                         {replica_provisioned_read_capacity_auto_scaling_update, AutoScalingSettingsUpdate}],
                        [{region_name, <<"eu-west-2">>},
                         {replica_global_secondary_index_updates, [[{index_name, <<"id-index">>},
                                                                    {provisioned_read_capacity_auto_scaling_update, AutoScalingSettingsUpdate}]]},
                         {replica_provisioned_read_capacity_auto_scaling_update, AutoScalingSettingsUpdate}]]}]).

update_time_to_live/2

update_time_to_live(Table::table_name(), Opts::update_time_to_live_opts()) -> update_time_to_live_return()

update_time_to_live/3

update_time_to_live(Table::table_name(), Opts::update_time_to_live_opts(), Config::aws_config()) -> update_time_to_live_return()

DynamoDB API: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTimeToLive.html

Example

Enable TTL for table "SessionData" by setting attribute "ExpirationTime" as expiration date.
  erlcloud_ddb2:update_time_to_live(
    <<"SessionData">>,
    [{attribute_name, <<"ExpirationTime">>},
     {enabled, true}])

update_time_to_live/4

update_time_to_live(Table::table_name(), AttributeName::attr_name(), Enabled::boolean(), Config::aws_config()) -> update_time_to_live_return()


Generated by EDoc