Sha256: 35e7d08e53e351aabef91ac0a5a6c4b41f4fedb9dfd76c62a74f6bf9faa36afd

Contents?: true

Size: 1.67 KB

Versions: 1

Compression:

Stored size: 1.67 KB

Contents

module Fog
  module AWS
    class IAM
        # At the moment this is the only policy you can use
        EC2_ASSUME_ROLE_POLICY = <<-JSON
{
  "Version":"2008-10-17",
  "Statement":[
      {
        "Effect":"Allow",
        "Principal":{
          "Service":["ec2.amazonaws.com"]
        },
        "Action":["sts:AssumeRole"]
      }
  ]
}
        JSON

      class Real
        require 'rackspace-fog/aws/parsers/iam/single_role'

        # 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
        # http://docs.amazonwebservices.com/IAM/latest/APIReference/API_CreateRole.html
        #
        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

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rackspace-fog-1.4.2 lib/rackspace-fog/aws/requests/iam/create_role.rb