Sha256: 630b68839ad8d25cfbe435fb0b76e0099e5e20e91c7c59cc53375592d4de5b22

Contents?: true

Size: 862 Bytes

Versions: 14

Compression:

Stored size: 862 Bytes

Contents

require 'fog/aws/models/iam/role'

module Fog
  module AWS
    class IAM
      class Roles < Fog::Collection
        model Fog::AWS::IAM::Role

        def initialize(attributes = {})
          super
        end

        def all
          data = service.list_roles.body['Roles']
          load(data)
        end

        def get(identity)
          role = nil
          begin
            role = service.roles.new( service.get_role( identity ).data[:body]["Role"] )
          rescue Excon::Errors::NotFound, Fog::AWS::IAM::NotFound # ignore not found error
          end
          role
        end

        def new(attributes = {})
          if not attributes.key?(:assume_role_policy_document)
            attributes[:assume_role_policy_document] = Fog::AWS::IAM::EC2_ASSUME_ROLE_POLICY.to_s
          end
          super
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-aws-0.7.5/lib/fog/aws/models/iam/roles.rb
fog-aws-0.7.6 lib/fog/aws/models/iam/roles.rb
fog-aws-0.7.5 lib/fog/aws/models/iam/roles.rb
fog-aws-0.7.4 lib/fog/aws/models/iam/roles.rb
fog-aws-0.7.3 lib/fog/aws/models/iam/roles.rb
fog-aws-0.7.2 lib/fog/aws/models/iam/roles.rb
fog-aws-0.6.0 lib/fog/aws/models/iam/roles.rb
fog-aws-0.5.0 lib/fog/aws/models/iam/roles.rb
fog-aws-0.4.1 lib/fog/aws/models/iam/roles.rb
fog-aws-0.4.0 lib/fog/aws/models/iam/roles.rb
fog-aws-0.3.0 lib/fog/aws/models/iam/roles.rb
fog-aws-0.2.2 lib/fog/aws/models/iam/roles.rb
fog-aws-0.2.0 lib/fog/aws/models/iam/roles.rb
fog-aws-0.1.2 lib/fog/aws/models/iam/roles.rb