Sha256: badbee2d00ff1618796b7f29609310c2cf9fad85857e741039e2a30834f89179

Contents?: true

Size: 757 Bytes

Versions: 6

Compression:

Stored size: 757 Bytes

Contents

require 'fog/core/collection'
require 'fog/openstack/models/identity/user'

module Fog
  module Identity
    class OpenStack
      class Users < Fog::Collection
        model Fog::Identity::OpenStack::User

        attribute :tenant

        def all
          tenant_id = tenant.nil? ? nil : tenant.id
          load(connection.list_users(tenant_id).body['users'])
        end

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

        def destroy(id)
          user = self.find_by_id(id)
          user.destroy
        end
      end # class Users
    end # class OpenStack
  end # module Identity
end # module Fog

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
fog-parser-fix-1.6.1 lib/fog/openstack/models/identity/users.rb
fog-test-again-1.6.0 lib/fog/openstack/models/identity/users.rb
fog-parser-fix-1.6.0 lib/fog/openstack/models/identity/users.rb
fog-1.6.0 lib/fog/openstack/models/identity/users.rb
fog-1.5.0 lib/fog/openstack/models/identity/users.rb
fog-1.4.0 lib/fog/openstack/models/identity/users.rb