Sha256: b173a7b89193ebd1b1f25d277421f114a5ca1cf7920617ffcd2357794fb6a63b

Contents?: true

Size: 686 Bytes

Versions: 6

Compression:

Stored size: 686 Bytes

Contents

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

module Fog
  module Identity
    class OpenStack
      class Tenants < Fog::Collection
        model Fog::Identity::OpenStack::Tenant

        def all
          load(connection.list_tenants.body['tenants'])
        end

        def find_by_id(id)
          self.find {|tenant| tenant.id == id} ||
            Fog::Identity::OpenStack::Tenant.new(
              connection.get_tenant(id).body['tenant'])
        end

        def destroy(id)
          tenant = self.find_by_id(id)
          tenant.destroy
        end
      end # class Tenants
    end # class OpenStack
  end # module Compute
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/tenants.rb
fog-test-again-1.6.0 lib/fog/openstack/models/identity/tenants.rb
fog-parser-fix-1.6.0 lib/fog/openstack/models/identity/tenants.rb
fog-1.6.0 lib/fog/openstack/models/identity/tenants.rb
fog-1.5.0 lib/fog/openstack/models/identity/tenants.rb
fog-1.4.0 lib/fog/openstack/models/identity/tenants.rb