[Haskell-cafe] [ANN] aws-arn-0.1.0.0 - Library and optics for munging Amazon Resource Names (ARNs)

Jack Kelly jack.kelly at bellroy.com
Wed Apr 7 00:36:41 UTC 2021


I have just pushed an initial release of aws-arn[1] to Hackage.

This library provides a type representing Amazon Resource Names
(ARNs)[2], and parsing/unparsing functions for them. The provided
optics make it very convenient to rewrite parts of ARNs.

An example, from the documentation: API Gateway Lambda Authorizers are
given the ARN of the requested endpoint and method, and are expected
to respond with an IAM Policy Document. It is sometimes useful to
manipulate the given ARN when describing which resources to authorize:

-- Returns "arn:aws:execute-api:us-east-1:123456789012:my-spiffy-api/stage/*"
let
  authorizerSampleARN =
"arn:aws:execute-api:us-east-1:123456789012:my-spiffy-api/stage/GET/some/deep/path"
in
  over (_ARN . arnResource . slashes) (\parts -> take 2 parts ++
["*"]) authorizerSampleARN

The code is available on GitHub[3]; bug reports and pull requests are
welcome. There is some additional support for parsing specific
resource types -- PRs to support more resource types are especially
welcome.

Best,

-- Jack

[1]: https://hackage.haskell.org/package/aws-arn-0.1.0.0
[2]: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
[3]: https://github.com/bellroy/aws-arn


More information about the Haskell-Cafe mailing list