Method: Fog::AWS::IAM::Real#create_role

Defined in:
lib/fog/aws/requests/iam/create_role.rb

#create_role(role_name, assume_role_policy_document, path = '/') ⇒ Object

Creates a new role for your AWS account

Parameters

  • RoleName<~String>: name of the role to create

  • AssumeRolePolicyDocument<~String>: The policy that grants an entity permission to assume the role.

  • Path<~String>: This parameter is optional. If it is not included, it defaults to a slash (/).

Returns

  • response<~Excon::Response>:

    • body<~Hash>:

      • ‘Role’<~Hash>:

        • ‘Arn’<~String> -

        • ‘AssumeRolePolicyDocument’<~String<

        • ‘Path’<~String> -

        • ‘RoleId’<~String> -

        • ‘RoleName’<~String> -

      • ‘RequestId’<~String> - Id of the request

See Also

docs.amazonwebservices.com/IAM/latest/APIReference/API_CreateRole.html

[View source]

43
44
45
46
47
48
49
50
51
# File 'lib/fog/aws/requests/iam/create_role.rb', line 43

def create_role(role_name, assume_role_policy_document, path = '/')
  request(
    'Action'    => 'CreateRole',
    'RoleName'  => role_name,
    'AssumeRolePolicyDocument'      => assume_role_policy_document,
    'Path'      => path,
    :parser     => Fog::Parsers::AWS::IAM::SingleRole.new
  )
end