Sha256: 9cd77fc5fc47279f761f0be6fd6fa8a516cf57c0b2b2394c937238bfe9363c92

Contents?: true

Size: 1.66 KB

Versions: 20

Compression:

Stored size: 1.66 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 '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

20 entries across 20 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/requests/iam/create_role.rb
fog-aws-0.0.8 lib/fog/aws/requests/iam/create_role.rb
fog-aws-0.0.7 lib/fog/aws/requests/iam/create_role.rb
fog-aws-0.0.6 lib/fog/aws/requests/iam/create_role.rb
fog-aws-0.0.5 lib/fog/aws/requests/iam/create_role.rb
fog-1.26.0 lib/fog/aws/requests/iam/create_role.rb
fog-1.25.0 lib/fog/aws/requests/iam/create_role.rb
nsidc-fog-1.24.1 lib/fog/aws/requests/iam/create_role.rb
fog-1.24.0 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.11 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.10 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.9 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.8 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.7 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.6 lib/fog/aws/requests/iam/create_role.rb
fog-1.23.0 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.4 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.3 lib/fog/aws/requests/iam/create_role.rb
ns-fog-1.22.2 lib/fog/aws/requests/iam/create_role.rb
fog-1.22.1 lib/fog/aws/requests/iam/create_role.rb