diff --git a/README.md b/README.md index c731e63..4e8de11 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # ExAws IAM -Easily interact with the AWS IAM API to work with users, access keys, and much more. This is an IAM service module for [ExAws](https://github.com/ex-aws/ex_aws). +Easily interact with the AWS IAM API to work with users, access keys, and much more. + +This is an IAM service module for [ExAws](https://github.com/ex-aws/ex_aws). ```elixir user = @@ -61,7 +63,7 @@ config :ex_aws, ## Usage -The following operations are currently available. +See the documentation for details. The following operations are currently available. ### User diff --git a/lib/ex_aws/iam.ex b/lib/ex_aws/iam.ex index 2e9086c..08cffaf 100644 --- a/lib/ex_aws/iam.ex +++ b/lib/ex_aws/iam.ex @@ -241,9 +241,27 @@ defmodule ExAws.Iam do |> to_op() end - def to_user({:ok, %{body: body}}), do: User.new(body) + @doc """ + Converts a parsed IAM response into a `User` struct. + + ## Parameters + + * `resp` - The parsed response of an IAM API query request. + + """ + def to_user({:ok, %{body: body}}) do + User.new(body) + end + + @doc """ + Converts a parsed IAM response into an `AccessKey` struct. - def to_access_key({:ok, %{body: body}}), do: AccessKey.new(body) + * `resp` - The parsed response of an IAM API query request. + + """ + def to_access_key({:ok, %{body: body}}) do + AccessKey.new(body) + end defp to_params(action, opts, args \\ []) do @shared_opts diff --git a/lib/ex_aws/iam/access_key.ex b/lib/ex_aws/iam/access_key.ex index 34b1d73..768afcc 100644 --- a/lib/ex_aws/iam/access_key.ex +++ b/lib/ex_aws/iam/access_key.ex @@ -29,6 +29,10 @@ defmodule ExAws.Iam.AccessKey do username: String.t() } + @doc """ + Returns a struct representation of an IAM AccessKey. + + """ def new(%{list_access_keys_result: %{access_key_metadata: access_keys}}) do Enum.map(access_keys, fn key -> access_key_to_struct(key) diff --git a/lib/ex_aws/iam/parsers/access_key.ex b/lib/ex_aws/iam/parsers/access_key.ex index 12aa75a..8403554 100644 --- a/lib/ex_aws/iam/parsers/access_key.ex +++ b/lib/ex_aws/iam/parsers/access_key.ex @@ -1,10 +1,13 @@ defmodule ExAws.Iam.Parsers.AccessKey do - @moduledoc false + @moduledoc """ + Defines parsers for handling AWS IAM access key query reponses. + + """ import SweetXml, only: [sigil_x: 2] @doc """ - Parses XML from IAM API query responses. + Parses XML from IAM API access key query responses. """ def parse(xml, "ListAccessKeys") do diff --git a/lib/ex_aws/iam/parsers/user.ex b/lib/ex_aws/iam/parsers/user.ex index ee9c18a..69f9182 100644 --- a/lib/ex_aws/iam/parsers/user.ex +++ b/lib/ex_aws/iam/parsers/user.ex @@ -1,8 +1,15 @@ defmodule ExAws.Iam.Parsers.User do - @moduledoc false + @moduledoc """ + Defines parsers for handling AWS IAM user query reponses. + + """ import SweetXml, only: [sigil_x: 2] + @doc """ + Parses XML from IAM API user query responses. + + """ def parse(xml, "ListUsers") do SweetXml.xpath(xml, ~x"//ListUsersResponse", list_users_result: [ diff --git a/lib/ex_aws/iam/user.ex b/lib/ex_aws/iam/user.ex index d376613..a89ede4 100644 --- a/lib/ex_aws/iam/user.ex +++ b/lib/ex_aws/iam/user.ex @@ -21,6 +21,10 @@ defmodule ExAws.Iam.User do username: String.t() } + @doc """ + Returns a struct representation of an IAM User. + + """ def new(%{get_user_result: %{user: user}}), do: to_struct(user) def new(%{create_user_result: %{user: user}}), do: to_struct(user)