Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinTangg authored Nov 3, 2021
2 parents 94aa1c9 + b1ac4cd commit f93ddcf
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Parsers are currently implemented for the following actions:
* GetGroup
* GetUser
* ListAccessKeys
* ListAccountAliases
* ListGroup
* ListRoles
* ListRoleTags
Expand Down
13 changes: 13 additions & 0 deletions lib/ex_aws/iam.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ defmodule ExAws.Iam do
* GetGroup
* GetUser
* ListAccessKeys
* ListAccountAliases
* ListGroup
* ListRoles
* ListRoleTags
Expand Down Expand Up @@ -455,6 +456,18 @@ defmodule ExAws.Iam do
def list_server_certificates(opts \\ []) do
operation(:list_server_certificates, opts)
end

@doc """
Creates an ExAws operation for a `ListAccountAliases` IAM request.
## Options
* `:marker` - Use this parameter only when paginating results.
* `:max_items` - Use this only when paginating results to indicate
the maximum number of items you want in the response.
See shared options in moduledoc.
"""
def list_account_aliases(opts \\ []) do
operation(:list_account_aliases, opts)
end

defp to_operation(params, opts) do
%ExAws.Operation.Query{
Expand Down
9 changes: 9 additions & 0 deletions lib/ex_aws/iam/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule ExAws.Iam.Parser do

alias ExAws.Iam.Parsers.{
AccessKey,
AccountAlias,
Certificate,
Group,
Metadata,
Expand Down Expand Up @@ -89,4 +90,12 @@ defmodule ExAws.Iam.Parser do
defp dispatch(xml, action) when action in @certificate_actions do
Certificate.parse(xml, action)
end

@account_alias_actions ~w[
ListAccountAliases
]

defp dispatch(xml, action) when action in @account_alias_actions do
AccountAlias.parse(xml, action)
end
end
22 changes: 22 additions & 0 deletions lib/ex_aws/iam/parsers/account_alias.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule ExAws.Iam.Parsers.AccountAlias do
@moduledoc """
Defines parsers for handling AWS IAM `AccountAlias` query reponses.
"""

import SweetXml, only: [sigil_x: 2]

@doc """
Parses XML from IAM `ListAccountAliases` response.
"""
def parse(xml, "ListAccountAliases") do
xml
|> SweetXml.xpath(~x"//ListAccountAliasesResponse",
account_aliases: ~x"./ListAccountAliasesResult/AccountAliases/member/text()"sl,
marker: ~x"./ListAccountAliasesResult/Marker/text()"o,
is_truncated: ~x"./ListAccountAliasesResult/IsTruncated/text()"s,
request_id: ~x"./ResponseMetadata/RequestId/text()"s
)
end
end

0 comments on commit f93ddcf

Please sign in to comment.