diff --git a/lib/ex_aws/dynamo.ex b/lib/ex_aws/dynamo.ex index 3b20897..82d6f62 100644 --- a/lib/ex_aws/dynamo.ex +++ b/lib/ex_aws/dynamo.ex @@ -309,7 +309,7 @@ defmodule ExAws.Dynamo do end @spec maybe_convert_billing_mode(attributes :: Keyword.t() | Map.t()) :: Keyword.t() | Map.t() - def maybe_convert_billing_mode(attributes) do + defp maybe_convert_billing_mode(attributes) do case attributes[:billing_mode] do nil -> attributes _ -> convert_billing_mode(attributes, attributes[:billing_mode]) @@ -317,13 +317,13 @@ defmodule ExAws.Dynamo do end @spec convert_billing_mode(attributes :: Keyword.t() | Map.t(), dynamo_billing_types) :: Keyword.t() | Map.t() - defp convert_billing_mode(attributes, :provisioned), do: do_convert(attributes, "PROVISIONED") - defp convert_billing_mode(attributes, :pay_per_request), do: do_convert(attributes, "PAY_PER_REQUEST") + defp convert_billing_mode(attributes, :provisioned), do: do_convert_billing_mode(attributes, "PROVISIONED") + defp convert_billing_mode(attributes, :pay_per_request), do: do_convert_billing_mode(attributes, "PAY_PER_REQUEST") - @spec do_convert(attributes :: Keyword.t() | Map.t(), value :: String.t()) :: Keyword.t() | Map.t() - defp do_convert(attributes, value) when is_map(attributes), + @spec do_convert_billing_mode(attributes :: Keyword.t() | Map.t(), value :: String.t()) :: Keyword.t() | Map.t() + defp do_convert_billing_mode(attributes, value) when is_map(attributes), do: Map.replace!(attributes, :billing_mode, value) - defp do_convert(attributes, value), + defp do_convert_billing_mode(attributes, value) when is_list(attributes), do: Keyword.replace!(attributes, :billing_mode, value) @doc "Delete Table" diff --git a/test/lib/dynamo_test.exs b/test/lib/dynamo_test.exs index 5e0ef81..c4710ed 100644 --- a/test/lib/dynamo_test.exs +++ b/test/lib/dynamo_test.exs @@ -118,11 +118,11 @@ defmodule ExAws.DynamoTest do assert Dynamo.update_table( "TestUsers", - [provisioned_throughput: - [read_capacity_units: 1, - write_capacity_units: 1], + %{provisioned_throughput: + %{read_capacity_units: 1, + write_capacity_units: 1}, billing_mode: :provisioned - ]).data == expected + }).data == expected expected = %{ "ProvisionedThroughput" => %{