1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/lib/fog/aws/models/iam/roles.rb
Paulo Henrique Lopes Ribeiro 722bbdfa45 Remove unecessary requires
2015-04-06 11:23:35 -03:00

36 lines
862 B
Ruby

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