mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[AWS IAM] Added Alias related functionality to IAM. Also added get_group_policy.
This commit is contained in:
parent
a3ed0c4f92
commit
72cdcee0e8
6 changed files with 133 additions and 0 deletions
|
@ -8,10 +8,12 @@ module Fog
|
|||
request_path 'fog/aws/requests/iam'
|
||||
request :add_user_to_group
|
||||
request :create_access_key
|
||||
request :create_account_alias
|
||||
request :create_group
|
||||
request :create_user
|
||||
request :create_login_profile
|
||||
request :delete_access_key
|
||||
request :delete_account_alias
|
||||
request :delete_group
|
||||
request :delete_group_policy
|
||||
request :delete_login_profile
|
||||
|
@ -23,7 +25,9 @@ module Fog
|
|||
request :get_user
|
||||
request :get_user_policy
|
||||
request :get_group
|
||||
request :get_group_policy
|
||||
request :list_access_keys
|
||||
request :list_account_aliases
|
||||
request :list_groups
|
||||
request :list_groups_for_user
|
||||
request :list_group_policies
|
||||
|
|
27
lib/fog/aws/parsers/iam/get_group_policy.rb
Normal file
27
lib/fog/aws/parsers/iam/get_group_policy.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class GetGroupPolicy < Fog::Parsers::Base
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_GetGroupPolicy.html
|
||||
|
||||
def reset
|
||||
@response = {}
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'GroupName', 'PolicyName', 'PolicyDocument'
|
||||
@response[name] = @value
|
||||
when 'RequestId'
|
||||
@response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
28
lib/fog/aws/parsers/iam/list_account_aliases.rb
Normal file
28
lib/fog/aws/parsers/iam/list_account_aliases.rb
Normal file
|
@ -0,0 +1,28 @@
|
|||
module Fog
|
||||
module Parsers
|
||||
module AWS
|
||||
module IAM
|
||||
|
||||
class ListAccountAliases < Fog::Parsers::Base
|
||||
|
||||
def reset
|
||||
@response = { 'AccountAliases' => [] }
|
||||
end
|
||||
|
||||
def end_element(name)
|
||||
case name
|
||||
when 'member'
|
||||
@response['AccountAliases'] << @value
|
||||
when 'IsTruncated'
|
||||
response[name] = (@value == 'true')
|
||||
when 'Marker', 'RequestId'
|
||||
response[name] = @value
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
19
lib/fog/aws/requests/iam/create_account_alias.rb
Normal file
19
lib/fog/aws/requests/iam/create_account_alias.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/basic'
|
||||
|
||||
def create_account_alias(account_alias)
|
||||
request(
|
||||
'Action' => 'CreateAccountAlias',
|
||||
'AccountAlias' => account_alias,
|
||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
19
lib/fog/aws/requests/iam/delete_account_alias.rb
Normal file
19
lib/fog/aws/requests/iam/delete_account_alias.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/basic'
|
||||
|
||||
def delete_account_alias(account_alias)
|
||||
request(
|
||||
'Action' => 'DeleteAccountAlias',
|
||||
'AccountAlias' => account_alias,
|
||||
:parser => Fog::Parsers::AWS::IAM::Basic.new
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
36
lib/fog/aws/requests/iam/get_group_policy.rb
Normal file
36
lib/fog/aws/requests/iam/get_group_policy.rb
Normal file
|
@ -0,0 +1,36 @@
|
|||
module Fog
|
||||
module AWS
|
||||
class IAM
|
||||
class Real
|
||||
|
||||
require 'fog/aws/parsers/iam/get_group_policy'
|
||||
|
||||
# Get Group Policy
|
||||
#
|
||||
# ==== Parameters
|
||||
# * 'PolicyName'<~String>: Name of the policy to get
|
||||
# * 'GroupName'<~String>: Name of the Group who the policy is associated with.
|
||||
#
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * PolicyDocument<~String> The policy document.
|
||||
# * PolicyName<~String> The name of the policy.
|
||||
# * GroupName<~String> The Group the policy is associated with.
|
||||
#
|
||||
# ==== See Also
|
||||
# http://docs.amazonwebservices.com/IAM/latest/APIReference/API_GetGroupPolicy.html
|
||||
#
|
||||
def get_group_policy(policy_name, group_name)
|
||||
request({
|
||||
'Action' => 'GetGroupPolicy',
|
||||
'PolicyName' => policy_name,
|
||||
'GroupName' => group_name,
|
||||
:parser => Fog::Parsers::AWS::IAM::GetGroupPolicy.new
|
||||
})
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue