Class: Fog::AWS::IAM::Real
- Inherits:
-
Object
- Object
- Fog::AWS::IAM::Real
- Defined in:
- lib/fog/aws/iam.rb,
lib/fog/aws/requests/iam/list_groups.rb,
lib/fog/aws/requests/iam/create_group.rb,
lib/fog/aws/requests/iam/delete_group.rb
Instance Method Summary collapse
-
#create_group(group_name, path = '/') ⇒ Object
Create a new group.
-
#delete_group(group_name) ⇒ Object
Delete a group.
-
#initialize(options = {}) ⇒ Real
constructor
Initialize connection to IAM.
-
#list_groups ⇒ Object
List groups.
- #reload ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Real
Initialize connection to IAM
Notes
options parameter must include values for :aws_access_key_id and :aws_secret_access_key in order to create a connection
Examples
iam = IAM.new(
:aws_access_key_id => your_aws_access_key_id,
:aws_secret_access_key => your_aws_secret_access_key
)
Parameters
-
options<~Hash> - config arguments for connection. Defaults to {}.
Returns
-
IAM object with connection to AWS.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/fog/aws/iam.rb', line 38 def initialize(={}) @aws_access_key_id = [:aws_access_key_id] @aws_secret_access_key = [:aws_secret_access_key] @hmac = Fog::HMAC.new('sha256', @aws_secret_access_key) @host = [:host] || 'iam.amazonaws.com' @path = [:path] || '/' @port = [:port] || 443 @scheme = [:scheme] || 'https' @connection = Fog::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", [:persistent]) end |
Instance Method Details
#create_group(group_name, path = '/') ⇒ Object
Create a new group
Parameters
-
‘GroupName’<~String>: name of the group to create (do not include path)
-
‘Path’<~String>: optional path to group, defaults to ‘/’
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘Group’<~Hash>:
-
Arn<~String> -
-
GroupId<~String> -
-
GroupName<~String> -
-
Path<~String> -
-
-
‘RequestId’<~String> - Id of the request
-
-
23 24 25 26 27 28 29 30 |
# File 'lib/fog/aws/requests/iam/create_group.rb', line 23 def create_group(group_name, path = '/') request( 'Action' => 'CreateGroup', 'GroupName' => group_name, 'Path' => path, :parser => Fog::Parsers::AWS::IAM::CreateGroups.new ) end |
#delete_group(group_name) ⇒ Object
Delete a group
Parameters
-
‘GroupName’<~String>: name of the group to delete
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘RequestId’<~String> - Id of the request
-
-
17 18 19 20 21 22 23 |
# File 'lib/fog/aws/requests/iam/delete_group.rb', line 17 def delete_group(group_name) request( 'Action' => 'DeleteGroup', 'GroupName' => group_name, :parser => Fog::Parsers::AWS::IAM::Basic.new ) end |
#list_groups ⇒ Object
List groups
Parameters
-
options<~Hash>:
-
‘Marker’<~String>: used to paginate subsequent requests
-
‘MaxItems’<~Integer>: limit results to this number per page
-
‘PathPrefix’<~String>: prefix for filtering results
-
Returns
-
response<~Excon::Response>:
-
body<~Hash>:
-
‘Groups’<~Array> - Matching groups
-
group<~Hash>:
-
Arn<~String> -
-
GroupId<~String> -
-
GroupName<~String> -
-
Path<~String> -
-
-
-
‘IsTruncated<~Boolean> - Whether or not results were truncated
-
‘RequestId’<~String> - Id of the request
-
-
27 28 29 30 31 32 |
# File 'lib/fog/aws/requests/iam/list_groups.rb', line 27 def list_groups request( 'Action' => 'ListGroups', :parser => Fog::Parsers::AWS::IAM::ListGroups.new ) end |
#reload ⇒ Object
49 50 51 |
# File 'lib/fog/aws/iam.rb', line 49 def reload @connection.reset end |