From 15457bcf9fb0728938ba971bb5590debd28d707b Mon Sep 17 00:00:00 2001 From: David Parry Date: Mon, 24 Oct 2022 16:32:31 +1100 Subject: [PATCH 1/3] Fix jason, ex_aws deps conflict --- mix.exs | 2 +- mix.lock | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/mix.exs b/mix.exs index 8675c89..96ba347 100644 --- a/mix.exs +++ b/mix.exs @@ -21,7 +21,7 @@ defmodule ExAws.QLDB.MixProject do # Run "mix help deps" to learn about dependencies. defp deps do [ - {:ex_aws, git: "https://github.com/ex-aws/ex_aws"}, + {:ex_aws, "~> 2.4"}, {:jason, "~> 1.1"}, {:hackney, "~> 1.9"}, {:erlport, "~> 0.9"} diff --git a/mix.lock b/mix.lock index b4f4fab..8f295e0 100644 --- a/mix.lock +++ b/mix.lock @@ -1,13 +1,15 @@ %{ - "certifi": {:hex, :certifi, "2.5.1", "867ce347f7c7d78563450a18a6a28a8090331e77fa02380b4a21962a65d36ee5", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm"}, - "erlport": {:hex, :erlport, "0.10.1", "c96ffa51bbcab0298232fcdfe8c3e110f1598011de71ae6b9082b80c9e2e476a", [:rebar3], [], "hexpm"}, - "ex_aws": {:git, "https://github.com/ex-aws/ex_aws", "7843167836f6ee291241073be21118314e554533", []}, - "hackney": {:hex, :hackney, "1.15.2", "07e33c794f8f8964ee86cebec1a8ed88db5070e52e904b8f12209773c1036085", [:rebar3], [{:certifi, "2.5.1", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.5", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm"}, - "idna": {:hex, :idna, "6.0.0", "689c46cbcdf3524c44d5f3dde8001f364cd7608a99556d8fbd8239a5798d4c10", [:rebar3], [{:unicode_util_compat, "0.4.1", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm"}, - "jason": {:hex, :jason, "1.1.2", "b03dedea67a99223a2eaf9f1264ce37154564de899fd3d8b9a21b1a6fd64afe7", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm"}, - "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm"}, - "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm"}, - "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"}, - "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, + "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, + "erlport": {:hex, :erlport, "0.10.1", "c96ffa51bbcab0298232fcdfe8c3e110f1598011de71ae6b9082b80c9e2e476a", [:rebar3], [], "hexpm", "34931e8cb62a131d1bc8a2bd04d4007c73c03e4f10e22ee4a218e7172227a918"}, + "ex_aws": {:hex, :ex_aws, "2.4.0", "f2c978e15145722258513907a9d73ef1d81ed92e76331138d42649ae2b1b6eba", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8 or ~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "66dd0bacaa4113d372d61d795c22d78af170672384c81ebab97a42edf4128543"}, + "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"}, + "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, + "mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"}, + "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, + "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, + "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, + "telemetry": {:hex, :telemetry, "1.1.0", "a589817034a27eab11144ad24d5c0f9fab1f58173274b1e9bae7074af9cbee51", [:rebar3], [], "hexpm", "b727b2a1f75614774cff2d7565b64d0dfa5bd52ba517f16543e6fc7efcc0df48"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } From c25e860b742274005921bdf60354cafb0da78553 Mon Sep 17 00:00:00 2001 From: David Parry Date: Tue, 25 Oct 2022 14:57:07 +1100 Subject: [PATCH 2/3] Update Jason version --- lib/ex_aws/ion_hash.ex | 3 -- lib/ex_aws/qldb.ex | 61 +++++++++++++++----------------------- lib/ex_aws/qldb_session.ex | 22 +++++++------- mix.exs | 2 +- 4 files changed, 36 insertions(+), 52 deletions(-) diff --git a/lib/ex_aws/ion_hash.ex b/lib/ex_aws/ion_hash.ex index e3eb799..76ed81c 100644 --- a/lib/ex_aws/ion_hash.ex +++ b/lib/ex_aws/ion_hash.ex @@ -9,11 +9,8 @@ defmodule ExAws.IonHash do defp call_python(module, function, args) do pid = default_instance() - return = ExAws.ExPython.call_python(pid, module, function, args) - ExAws.ExPython.stop(pid) - return end diff --git a/lib/ex_aws/qldb.ex b/lib/ex_aws/qldb.ex index 5e2cf5c..0771422 100644 --- a/lib/ex_aws/qldb.ex +++ b/lib/ex_aws/qldb.ex @@ -1,8 +1,8 @@ defmodule ExAws.QLDB do - @type pagination :: [ - {:max_results, binary} | - {:next_token, binary} - ] + @type pagination :: %{ + next_token: binary(), + max_results: binary() + } @actions %{ create_ledger: :post, @@ -22,23 +22,11 @@ defmodule ExAws.QLDB do update_ledger: :patch, } - @spec create_ledger( - name :: binary - ) :: ExAws.Operation.JSON.t - @spec create_ledger( - name :: binary, - permission_mode :: binary - ) :: ExAws.Operation.JSON.t @spec create_ledger( name :: binary, permission_mode :: binary, - deletion_protection :: binary - ) :: ExAws.Operation.JSON.t - @spec create_ledger( - name :: binary, - permission_mode :: binary, - deletion_protection :: binary, - tags :: binary + deletion_protection :: boolean(), + tags :: map() ) :: ExAws.Operation.JSON.t def create_ledger(name, permission_mode \\ "ALLOW_ALL", deletion_protection \\ false, tags \\ %{}) do data = %{ @@ -92,33 +80,33 @@ defmodule ExAws.QLDB do "ExclusiveEndTime" => opts.exclusive_end_time, "InclusiveStartTime" => opts.inclusive_start_time, "RoleArn" => opts.role_arn, - "S3ExportConfiguration" => %{ + "S3ExportConfiguration" => %{ "Bucket" => opts.s3_bucket, - "EncryptionConfiguration" => %{ + "EncryptionConfiguration" => %{ "KmsKeyArn" => opts.s3_kms_key_arn, "ObjectEncryptionType" => opts.object_encryption_type }, "Prefix" => opts.prefix } } - + request(:export_journal_to_s3, data, "/ledgers/#{name}/journal-s3-exports") end - @type get_block_opts :: [ - {:block_address, binary} | - {:digest_tip_address, binary} - ] + @type get_block_opts :: %{ + required(:block_address) => binary, + required(:digest_tip_address) => binary + } @spec get_block( name :: binary, opts :: get_block_opts ) :: ExAws.Operation.JSON.t def get_block(name, opts) do data = %{ - "BlockAddress" => %{ + "BlockAddress" => %{ "IonText" => opts.block_address }, - "DigestTipAddress" => %{ + "DigestTipAddress" => %{ "IonText" => opts.digest_tip_address } } @@ -133,21 +121,21 @@ defmodule ExAws.QLDB do request(:get_digest, %{}, "/ledgers/#{name}/digest") end - @type get_revision_opts :: [ - {:block_address, binary} | - {:digest_tip_address, binary} | - {:document_id, binary} - ] + @type get_revision_opts :: %{ + required(:block_address) => binary, + required(:digest_tip_address) => binary, + required(:document_id) => binary + } @spec get_revision( name :: binary, - opts :: get_block_opts + opts :: get_revision_opts ) :: ExAws.Operation.JSON.t def get_revision(name, opts) do data = %{ - "BlockAddress" => %{ + "BlockAddress" => %{ "IonText" => opts.block_address }, - "DigestTipAddress" => %{ + "DigestTipAddress" => %{ "IonText" => opts.digest_tip_address }, "DocumentId" => opts.document_id @@ -214,7 +202,7 @@ defmodule ExAws.QLDB do @spec untag_resource( resource_arn :: binary, - tag_keys :: binary + tag_keys :: map() ) :: ExAws.Operation.JSON.t def untag_resource(resource_arn, tag_keys) do params = %{ @@ -248,4 +236,3 @@ defmodule ExAws.QLDB do }) end end - diff --git a/lib/ex_aws/qldb_session.ex b/lib/ex_aws/qldb_session.ex index 7a20e40..5290644 100644 --- a/lib/ex_aws/qldb_session.ex +++ b/lib/ex_aws/qldb_session.ex @@ -3,7 +3,7 @@ defmodule ExAws.QLDBSession do {:ion_binary, binary} | {:ion_text, binary} ] - + @type start_session_request :: [ {:ledger_name, binary} ] @@ -30,16 +30,16 @@ defmodule ExAws.QLDBSession do {:next_page_token, binary} ] - @type send_command_request :: [ - {:session_token, binary | nil} | - {:start_session, start_session_request | nil} | - {:start_transaction, start_transaction_request | nil} | - {:end_session, end_session_request | nil} | - {:commit_transaction, commit_transaction_request | nil} | - {:abort_transaction, abort_transaction_request | nil} | - {:execute_statement, execute_statement_request | nil} | - {:fetch_page, fetch_page_request | nil} - ] + @type send_command_request :: %{ + optional(:session_token) => binary, + optional(:start_session) => start_session_request, + optional(:start_transaction) => start_transaction_request, + optional(:end_session) => end_session_request, + optional(:commit_transaction) => commit_transaction_request, + optional(:abort_transaction) => abort_transaction_request, + optional(:execute_statement) => execute_statement_request, + optional(:fetch_page) => fetch_page_request + } @spec send_command( request :: send_command_request diff --git a/mix.exs b/mix.exs index 96ba347..d3eccff 100644 --- a/mix.exs +++ b/mix.exs @@ -22,7 +22,7 @@ defmodule ExAws.QLDB.MixProject do defp deps do [ {:ex_aws, "~> 2.4"}, - {:jason, "~> 1.1"}, + {:jason, "~> 1.4"}, {:hackney, "~> 1.9"}, {:erlport, "~> 0.9"} ] From de494cc31665ad5c31cba93012267aef0a53cd7c Mon Sep 17 00:00:00 2001 From: David Parry Date: Tue, 25 Oct 2022 14:59:50 +1100 Subject: [PATCH 3/3] Updated README to show `ex_aws_qldb` instead of `ex_aws_lambda` --- README.md | 2 +- mix.exs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 627272a..385e8ae 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ by adding `ex_aws_qldb` to your list of dependencies in `mix.exs`: def deps do [ {:ex_aws, "~> 2.0"}, - {:ex_aws_lambda, "~> 2.0"}, + {:ex_aws_qldb, "~> 0.1"}, {:poison, "~> 3.0"}, {:hackney, "~> 1.9"}, ] diff --git a/mix.exs b/mix.exs index d3eccff..d06d82a 100644 --- a/mix.exs +++ b/mix.exs @@ -4,7 +4,7 @@ defmodule ExAws.QLDB.MixProject do def project do [ app: :ex_aws_qldb, - version: "0.1.0", + version: "0.1.1", elixir: "~> 1.9", start_permanent: Mix.env() == :prod, deps: deps()