Class: Fog::Identity::OpenStack::Users

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

Instance Method Summary collapse

Instance Method Details

#allObject



12
13
14
# File 'lib/fog/openstack/models/identity/users.rb', line 12

def all
  load(service.list_users(tenant_id).body['users'])
end

#destroy(id) ⇒ Object



34
35
36
37
# File 'lib/fog/openstack/models/identity/users.rb', line 34

def destroy(id)
  user = self.find_by_id(id)
  user.destroy
end

#find_by_id(id) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/fog/openstack/models/identity/users.rb', line 16

def find_by_id(id)
  self.find {|user| user.id == id} ||
    Fog::Identity::OpenStack::User.new(
      service.get_user_by_id(id).body['user'].merge(
        'service' => service
      )
    )
end

#find_by_name(name) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/fog/openstack/models/identity/users.rb', line 25

def find_by_name(name)
  self.find {|user| user.name == name} ||
    Fog::Identity::OpenStack::User.new(
      service.get_user_by_name(name).body['user'].merge(
        'service' => service
      )
    )
end