abitdodgy

abitdodgy

New ExAws IAM service module

I wrote an IAM service module for ExAws. You can find it on GitHub.

It’s a work in progress, but I think I have the internal API figured out. Currently, the following services are supported:

* CreateAccessKey
* CreateUser
* DeleteAccessKey
* DeleteUser
* GetAccessKeyLastUsed
* GetUser
* ListAccessKeys
* ListUsers
* UpdateAccessKey
* UpdateUser

The API aims to be easy to use. For example:

  1. You can pass params as atoms and the lib converts them into the AWS IAM query format.
  2. Each operation has its own parser that translates the XML response into its equivalent map in Elixir.
  3. Helper functions are available to convert some responses into a data structure.
op = Iam.create_user("my_user", path: "/my/path/")

IO.inspect(op)
%ExAws.Operation.Query{
  action: "CreateUser",
  params: %{
    "Action" => "CreateUser",
    "Path" => "/my/path/",
    "UserName" => "my_user",
    "Version" => "2010-05-08"
  },
  parser: &ExAws.Iam.Parsers.User.create/2,
  path: "/my/path/",
  service: :iam
}

user = op |> ExAws.request() |> Iam.to_user()

IO.inspect(user)
%ExAws.Iam.User{
  arn: "arn:aws:iam::085326204011:user/my/path/my_user",
  create_date: "2018-10-18T15:47:08Z",
  path: "/my/path/",
  user_id: "AIDAIH3RMDWGIGEXAMPLE",
  username: "my_user"
}

Extending the library is straightforward. For example, adding a new operation is as easy as:

def create_group(name, opts \\ []) do
  :create_group
  |> to_params(opts, [group_name: name])
  |> to_op() 
end
Iam.create_group("my_group", path: "/my/path/")

You may need to write a parser, and, obviously, some tests, but it’s as easy as that.

I’ve not released the lib yet as I’d like to wait for some feedback before doing so.

Where Next?

Popular in Announcing Top

kelvinst
Hey everyone! Well, we made this lib a while ago and now we decided to finally go out and public with it! It’s a tool for creating and m...
New
treble37
Just looking for a little feedback on a tiny helper library I built - Sometimes I find the need to convert maps with atom keys to maps w...
New
kip
ex_cldr provides localisation and internationalisation support based upon the data from the Unicode CLDR project. Unicode released CLDR ...
407 13366 120
New
dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New
trisolaran
Hi! :waving_hand: I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
198 11283 107
New
woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries. offset-based pagination with...
New
restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 10796 134
New

Other popular topics Top

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement