Class: Fog::AWS::IAM::Users

Inherits:
Collection
  • Object
show all
Defined in:
lib/fog/aws/models/iam/users.rb

Instance Method Summary collapse

Instance Method Details

#all(options = {}) ⇒ Object



13
14
15
16
17
18
# File 'lib/fog/aws/models/iam/users.rb', line 13

def all(options = {})
  merge_attributes(options)
  data = service.list_users(options).body
  merge_attributes('IsTruncated' => data['IsTruncated'], 'Marker' => data['Marker'])
  load(data['Users']) # data is an array of attribute hashes
end

#eachObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fog/aws/models/iam/users.rb', line 29

def each
  if !block_given?
    self
  else
    subset = dup.all

    subset.each_user_this_page {|f| yield f}
    while subset.is_truncated
      subset = subset.all('Marker' => subset.marker, 'MaxItems' => 1000)
      subset.each_user_this_page {|f| yield f}
    end

    self
  end
end

#each_user_this_pageObject



27
# File 'lib/fog/aws/models/iam/users.rb', line 27

alias_method :each_user_this_page, :each

#get(identity) ⇒ Object



20
21
22
23
24
25
# File 'lib/fog/aws/models/iam/users.rb', line 20

def get(identity)
  data = service.get_user(identity).body['User']
  new(data) # data is an attribute hash
rescue Fog::AWS::IAM::NotFound
  nil
end