Class: Fog::AWS::IAM::ManagedPolicies

Inherits:
PagedCollection show all
Defined in:
lib/fog/aws/models/iam/managed_policies.rb

Instance Method Summary collapse

Methods inherited from PagedCollection

#each, #each_entry, inherited

Instance Method Details

#all(options = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/aws/models/iam/managed_policies.rb', line 15

def all(options={})
  data = if self.username
           all_by_user(self.username, options)
         elsif self.group_name
           all_by_group(self.group_name, options)
         elsif self.role_name
           all_by_role(self.role_name, options)
         else
           all_policies(options)
         end

  load(data)
end

#get(identity) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/fog/aws/models/iam/managed_policies.rb', line 29

def get(identity)
  response = service.get_policy(identity)

  new(response.body['Policy'])
rescue Fog::AWS::IAM::NotFound
  nil
end