forked from fog/fog
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request fog#420 from coliver/aws-iam-additions
Aws iam additions
- Loading branch information
Showing
18 changed files
with
372 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,35 @@ | |||
module Fog | |||
module Parsers | |||
module AWS | |||
module RDS | |||
|
|||
class DBEngineVersionParser < Fog::Parsers::Base | |||
|
|||
def reset | |||
@db_engine_version = fresh_engine_version | |||
end | |||
|
|||
def fresh_engine_version | |||
{} | |||
end | |||
|
|||
def start_element(name, attrs = []) | |||
super | |||
|
|||
end | |||
|
|||
def end_element(name) | |||
case name | |||
when 'DBEngineDescription' then @db_engine_version['DBEngineDescription'] = @value | |||
when 'DBEngineVersionDescription' then @db_engine_version['DBEngineVersionDescription'] = @value | |||
when 'DBParameterGroupFamily' then @db_engine_version['DBParameterGroupFamily'] = @value | |||
when 'DBEngineVersionIdentifier' then @db_engine_version['DBEngineVersionIdentifier'] = @value | |||
when 'Engine' then @db_engine_version['Engine'] = @value | |||
when 'EngineVersion' then @db_engine_version['EngineVersion'] = @value | |||
end | |||
end | |||
end | |||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,39 @@ | |||
module Fog | |||
module Parsers | |||
module AWS | |||
module RDS | |||
|
|||
require 'fog/aws/parsers/rds/db_engine_version_parser' | |||
|
|||
class DescribeDBEngineVersions < Fog::Parsers::AWS::RDS::DBEngineVersionParser | |||
|
|||
def reset | |||
@response = { 'DescribeDBEngineVersionsResult' => {'DBEngineVersions' => []}, 'ResponseMetadata' => {} } | |||
super | |||
end | |||
|
|||
def start_element(name, attrs = []) | |||
super | |||
end | |||
|
|||
def end_element(name) | |||
case name | |||
when 'DBEngineVersion' then | |||
@response['DescribeDBEngineVersionsResult']['DBEngineVersions'] << @db_engine_version | |||
@db_engine_version = fresh_engine_version | |||
when 'Marker' | |||
@response['DescribeDBEngineVersionsResult']['Marker'] = @value | |||
when 'RequestId' | |||
@response['ResponseMetadata'][name] = @value | |||
else | |||
super | |||
end | |||
|
|||
end | |||
|
|||
end | |||
|
|||
end | |||
end | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,43 @@ | |||
module Fog | |||
module Parsers | |||
module AWS | |||
module RDS | |||
|
|||
class DescribeDBReservedInstances < Fog::Parsers::Base | |||
|
|||
def reset | |||
@reserved_instance = {} | |||
@response = { 'ReservedDBInstances' => [] } | |||
end | |||
|
|||
def end_element(name) | |||
case name | |||
when 'ReservedDBInstanceId', 'ReservedDBInstancesOfferingId', 'DBInstanceClass', 'ProductDescription', 'State' | |||
@reserved_instance[name] = @value | |||
when 'Duration', 'DBInstanceCount' | |||
@reserved_instance[name] = @value.to_i | |||
when 'FixedPrice', 'UsagePrice' | |||
@reserved_instance[name] = @value.to_f | |||
when 'ReservedDBInstance' | |||
@response['ReservedDBInstances'] << @reserved_instance | |||
@reserved_instance = {} | |||
when 'Marker' | |||
@response[name] = @value | |||
when 'MultiAZ' | |||
if @value == 'false' | |||
@reserved_instance[name] = false | |||
else | |||
@reserved_instance[name] = true | |||
end | |||
when 'StartTime' | |||
@reserved_instance[name] = Time.parse(@value) | |||
end | |||
end | |||
|
|||
end | |||
|
|||
end | |||
end | |||
end | |||
end | |||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -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 |
Oops, something went wrong.