Sha256: cb3275ae610d9aec00c1b10bb457e1ae0d99d88b6ab695edcc46ab3a9808daa6

Contents?: true

Size: 867 Bytes

Versions: 14

Compression:

Stored size: 867 Bytes

Contents

require 'fog/core/collection'
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 # 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 & 4 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/models/iam/roles.rb
nsidc-fog-1.24.1 lib/fog/aws/models/iam/roles.rb
fog-1.24.0 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.11 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.10 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.9 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.8 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.7 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.6 lib/fog/aws/models/iam/roles.rb
fog-1.23.0 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.4 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.3 lib/fog/aws/models/iam/roles.rb
ns-fog-1.22.2 lib/fog/aws/models/iam/roles.rb
fog-1.22.1 lib/fog/aws/models/iam/roles.rb