Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include aws beam core as a dep #166

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 2 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@ name: Build
on:
pull_request:
push:
branches:
- master

jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest]
otp-version: [24, 25, 26, 27]
otp-version: [25, 26, 27]
runs-on: ${{ matrix.platform }}
container:
image: erlang:${{ matrix.otp-version }}
Expand All @@ -27,20 +25,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache Hex packages
uses: actions/cache@v4
with:
path: ~/.cache/rebar3/hex/hexpm/packages
key: ${{ runner.os }}-hex-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.lock')) }}
restore-keys: |
${{ runner.os }}-hex-
- name: Cache Dialyzer PLTs
uses: actions/cache@v4
with:
path: ~/.cache/rebar3/rebar3_*.plt
key: ${{ runner.os }}-dialyzer-${{ hashFiles(format('{0}{1}', github.workspace, '/rebar.config')) }}
restore-keys: |
${{ runner.os }}-dialyzer-
- name: Compile
run: rebar3 compile
- name: Run EUnit Tests
Expand All @@ -52,14 +36,8 @@ jobs:
S3MOCK_HOST: s3mock
- name: Check app calls
run: rebar3 check_app_calls
- name: Create Cover Reports
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: rebar3 cover
- name: Produce Documentation
run: rebar3 edoc || true
- name: Produce Documentation
run: rebar3 ex_doc || true
run: rebar3 ex_doc
- name: Publish Documentation
uses: actions/upload-artifact@v4
with:
Expand Down
39 changes: 21 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
:rocket: Create, configure, and manage AWS services from Erlang code. :rocket:

## Features
This repo only holds generated code :exclamation: All non-generated code is included as part of [aws_beam_core](https://github.com/aws-beam/aws_beam_core).
Any changes that need to be made should hence be made through [aws_beam_core](https://github.com/aws-beam/aws_beam_core) or [aws-codegen](https://github.com/aws-beam/aws-codegen) :exclamation:

* Completely generated by [aws-codegen](https://github.com/aws-beam/aws-codegen) from the same JSON descriptions of AWS services used to build the AWS SDKs (See: [aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2))
* A clean API separated per service. One module per service.
* Support for most of the AWS services.
* Generated by [aws-codegen](https://github.com/aws-beam/aws-codegen) using the
same JSON descriptions of AWS services used to build the
[AWS SDK for Go](https://github.com/aws/aws-sdk-go/tree/master/models/apis).
* Support for most (almost all!) of the AWS services.
* Documentation updated from the official AWS docs.
* Type specs generated from the same JSON descriptions as the SDK

## Usage

Expand Down Expand Up @@ -54,8 +55,9 @@ through the `aws_s3_presigned_url` module.
```

### AWS RDS IAM Token Creation
Support for creating IAM Tokens (more info [here](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.Connecting.html)) has been added as part of the `aws_rds_iam_token` module.
Support for creating IAM Tokens (more info here) has been added as part of the aws_rds_iam_token module as part of [aws_beam_core](https://github.com/aws-beam/aws_beam_core).
onno-vos-dev marked this conversation as resolved.
Show resolved Hide resolved
This allows for easy creation of RDS/Aurora tokens to be used for IAM based authentication instead of username/password combination.

```erlang
> Client = aws_client:make_temporary_client(<<"AccessKeyID">>, <<"SecretAccessKey">>, <<"Token">>, <<"eu-west-1">>).
[...]
Expand All @@ -65,6 +67,17 @@ This allows for easy creation of RDS/Aurora tokens to be used for IAM based auth

This token can subsequently be used to connect to the database over IAM.

### AWS S3 Presigned Url
Support for Presigning S3 urls has been added as part of the aws_s3_presigned_url module as part of [aws_beam_core](https://github.com/aws-beam/aws_beam_core).
onno-vos-dev marked this conversation as resolved.
Show resolved Hide resolved
This allows generating either a get or put presigned s3 url,
which can be used by external clients such as cURL to access (get/put) the object in question.
```erlang
> Client = aws_client:make_temporary_client(<<"AccessKeyID">>, <<"SecretAccessKey">>, <<"Token">>, <<"eu-west-1">>).
[...]
> {ok, Url} = aws_s3_presigned_url:make_presigned_v4_url(Client, put, 3600, <<"bucket">>, <<"key">>)
[...]
```

### retry options

Each API which takes `Options` allows a `retry_options` key and can allow for automatic retries.
Expand All @@ -79,7 +92,7 @@ This implementation is based on [AWS: Exponential Backoff And Jitter](https://aw
Simply add the library to your `rebar.config`:

```erlang
{deps, [{aws, "1.0.0", {pkg, aws_erlang}}]}.
{deps, [{aws, "1.1.0", {pkg, aws_erlang}}]}.
```

## Obtaining Credentials
Expand All @@ -103,11 +116,7 @@ Here is an example on how to obtain credentials:
, secret_access_key := SecretAccessKey } = Credentials.
```

The `aws_credentials` application can be installed by adding the following to your `rebar.config`:

```erlang
{deps, [{aws_credentials, "0.1.10"}]}.
```
The `aws_credentials` application is part of [aws_beam_core](https://github.com/aws-beam/aws_beam_core) and included in this package.

## Development

Expand All @@ -116,13 +125,7 @@ The service-specific modules are generated using the [aws-codegen](https://githu
The rest of the code is manually written and used as support for the generated code.

## Documentation

### Check it Online

* [Hex Docs](https://hexdocs.pm/aws_erlang/)

### Build it locally

Unfortunately the docs generated are too big for hexdocs.pm. Hence, the docs can be generated locally using:
```bash
$ rebar3 ex_doc
```
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{erl_opts, [nowarn_unused_type, debug_info, {d, maps_support}]}.
{deps, [{hackney, "1.18.0"},
{jsx, "3.0.0"},
{aws_signature, "0.3.3"}
{aws_beam_core, "1.0.0"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not important for this PR: Since you are using hex.pm, you can use semver-like syntax

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a 🐔 when it comes to the semver-like syntax. Even though aws_beam_core is owned by us, I'd prefer hard-pinning it just to ensure that updated dependencies are explicitly bumped rather than implicitly.

]}.
{project_plugins, [rebar3_hex, rebar3_ex_doc, rebar3_check_app_calls]}.
{hex, [{doc, #{provider => ex_doc}}]}.
Expand Down
14 changes: 13 additions & 1 deletion rebar.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{"1.2.0",
[{<<"aws_signature">>,{pkg,<<"aws_signature">>,<<"0.3.3">>},0},
[{<<"aws_beam_core">>,{pkg,<<"aws_beam_core">>,<<"1.0.0">>},0},
{<<"aws_credentials">>,{pkg,<<"aws_credentials">>,<<"0.3.2">>},1},
{<<"aws_signature">>,{pkg,<<"aws_signature">>,<<"0.3.3">>},0},
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.5.2">>},1},
{<<"eini">>,{pkg,<<"eini_beam">>,<<"2.2.4">>},2},
{<<"hackney">>,{pkg,<<"hackney">>,<<"1.16.0">>},0},
{<<"idna">>,{pkg,<<"idna">>,<<"6.0.1">>},1},
{<<"iso8601">>,{pkg,<<"iso8601">>,<<"1.3.4">>},2},
{<<"jsx">>,{pkg,<<"jsx">>,<<"3.0.0">>},0},
{<<"metrics">>,{pkg,<<"metrics">>,<<"1.0.1">>},1},
{<<"mimerl">>,{pkg,<<"mimerl">>,<<"1.2.0">>},1},
Expand All @@ -11,21 +15,29 @@
{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.5.0">>},2}]}.
[
{pkg_hash,[
{<<"aws_beam_core">>, <<"F5BAD0147038A0B921844B530A8D937D8BF569B5E1FD0658FA0A6586EB98375C">>},
{<<"aws_credentials">>, <<"BA2CCEE4EC6DCB5426CF71830B7AFD73795B1F19655F401D4401015B468FEC6F">>},
{<<"aws_signature">>, <<"5844BEE0D3CC42EEFD21D236BBFAA8AA9B16E2F2B7EE79EDAECB321DB3FB6ADF">>},
{<<"certifi">>, <<"B7CFEAE9D2ED395695DD8201C57A2D019C0C43ECAF8B8BCB9320B40D6662F340">>},
{<<"eini">>, <<"02143B1DCE4DDA4243248E7D9B3D8274B8D9F5A666445E3D868E2CCE79E4FF22">>},
{<<"hackney">>, <<"5096AC8E823E3A441477B2D187E30DD3FFF1A82991A806B2003845CE72CE2D84">>},
{<<"idna">>, <<"1D038FB2E7668CE41FBF681D2C45902E52B3CB9E9C77B55334353B222C2EE50C">>},
{<<"iso8601">>, <<"7B1F095F86F6CF65E1E5A77872E8E8BF69BD58D4C3A415B3F77D9CC9423ECBB9">>},
{<<"jsx">>, <<"20A170ABD4335FC6DB24D5FAD1E5D677C55DADF83D1B20A8A33B5FE159892A39">>},
{<<"metrics">>, <<"25F094DEA2CDA98213CECC3AEFF09E940299D950904393B2A29D191C346A8486">>},
{<<"mimerl">>, <<"67E2D3F571088D5CFD3E550C383094B47159F3EEE8FFA08E64106CDF5E981BE3">>},
{<<"parse_trans">>, <<"09765507A3C7590A784615CFD421D101AEC25098D50B89D7AA1D66646BC571C1">>},
{<<"ssl_verify_fun">>, <<"CF344F5692C82D2CD7554F5EC8FD961548D4FD09E7D22F5B62482E5AEAEBD4B0">>},
{<<"unicode_util_compat">>, <<"8516502659002CEC19E244EBD90D312183064BE95025A319A6C7E89F4BCCD65B">>}]},
{pkg_hash_ext,[
{<<"aws_beam_core">>, <<"421C24834B210A10698ADB29282FF96777C711D85AC57FE6DF9C39DFB2E1FD58">>},
{<<"aws_credentials">>, <<"2E748626A935A7A544647FB79D7054F38DB8BF378978542C962CCBEAB387387B">>},
{<<"aws_signature">>, <<"87E8F42B8E49002AA8D0350A71D13D69EA91B9AFB4CA9B526AE36DB1D585C924">>},
{<<"certifi">>, <<"3B3B5F36493004AC3455966991EAF6E768CE9884693D9968055AEEEB1E575040">>},
{<<"eini">>, <<"12DE479D144B19E09BB92BA202A7EA716739929AFDF9DFF01AD802E2B1508471">>},
{<<"hackney">>, <<"3BF0BEBBD5D3092A3543B783BF065165FA5D3AD4B899B836810E513064134E18">>},
{<<"idna">>, <<"A02C8A1C4FD601215BB0B0324C8A6986749F807CE35F25449EC9E69758708122">>},
{<<"iso8601">>, <<"A334469C07F1C219326BC891A95F5EEC8EB12DD8071A3FFF56A7843CB20FAE34">>},
{<<"jsx">>, <<"37BECA0435F5CA8A2F45F76A46211E76418FBEF80C36F0361C249FC75059DC6D">>},
{<<"metrics">>, <<"69B09ADDDC4F74A40716AE54D140F93BEB0FB8978D8636EADED0C31B6F099F16">>},
{<<"mimerl">>, <<"F278585650AA581986264638EBF698F8BB19DF297F66AD91B18910DFC6E19323">>},
Expand Down
3 changes: 1 addition & 2 deletions src/aws.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
, { applications
, [ kernel
, stdlib
, xmerl
, crypto
, hackney
, jsx
, aws_signature
, aws_beam_core
]
}
, {env,[]}
Expand Down
Loading