class Fog::OpenStack::Identity::V2::User

Attributes

email[RW]
enabled[RW]
name[RW]
password[RW]
tenant_id[RW]

Public Instance Methods

destroy() click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 52
def destroy
  requires :id
  service.delete_user(id)
  true
end
ec2_credentials() click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 18
def ec2_credentials
  requires :id
  service.ec2_credentials(:user => self)
end
roles(tenant_id = self.tenant_id) click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 58
def roles(tenant_id = self.tenant_id)
  if tenant_id
    service.list_roles_for_user_on_tenant(tenant_id, id).body['roles']
  else
    []
  end
end
save() click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 23
def save
  raise Fog::Errors::Error, 'Resaving an existing object may create a duplicate' if persisted?
  requires :name
  enabled = true if enabled.nil?
  data = service.create_user(name, password, email, tenant_id, enabled)
  merge_attributes(data.body['user'])
  true
end
update(options = {}) click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 32
def update(options = {})
  requires :id
  options.merge('id' => id)
  service.update_user(id, options)
  true
end
update_enabled(enabled) click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 48
def update_enabled(enabled)
  update(:enabled => enabled, 'url' => "/users/#{id}/OS-KSADM/enabled")
end
update_password(password) click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 39
def update_password(password)
  update('password' => password, 'url' => "/users/#{id}/OS-KSADM/password")
end
update_tenant(tenant) click to toggle source
# File lib/fog/openstack/identity/v2/models/user.rb, line 43
def update_tenant(tenant)
  tenant = tenant.id if tenant.class != String
  update(:tenantId => tenant, 'url' => "/users/#{id}/OS-KSADM/tenant")
end