class Fog::AWS::IAM::ManagedPolicies
Public Instance Methods
all(options={})
click to toggle source
# File lib/fog/aws/models/iam/managed_policies.rb, line 14 def all(options={}) data = if self.username all_by_user(self.username, options) elsif self.group_name all_by_group(self.group_name, options) else all_policies(options) end load(data) end
get(identity)
click to toggle source
# File lib/fog/aws/models/iam/managed_policies.rb, line 26 def get(identity) response = service.get_policy(identity) new(response.body['Policy']) rescue Fog::AWS::IAM::NotFound nil end
Protected Instance Methods
all_by_group(group_name, options={})
click to toggle source
# File lib/fog/aws/models/iam/managed_policies.rb, line 45 def all_by_group(group_name, options={}) body = service.list_attached_group_policies(group_name, page_params(options)).body merge_attributes(body) body['Policies'].map do |policy| service.get_policy(policy['PolicyArn']).body['Policy'] end end
all_by_user(username, options={})
click to toggle source
# File lib/fog/aws/models/iam/managed_policies.rb, line 36 def all_by_user(username, options={}) body = service.list_attached_user_policies(username, page_params(options)).body merge_attributes(body) body['Policies'].map do |policy| service.get_policy(policy['PolicyArn']).body['Policy'] end end
all_policies(options={})
click to toggle source
# File lib/fog/aws/models/iam/managed_policies.rb, line 54 def all_policies(options={}) body = service.list_policies(page_params(options)).body merge_attributes(body) body['Policies'] end