Sha256: 761b647a769606b7a70a87f9a945390f2b7ce30d278be5a752fdbd1720947696

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

module Hawkular::Metrics
  class Client
    # Provides access to tenants API
    class Tenants
      # @param client [Client]
      def initialize(client)
        @client = client
        @resource = 'tenants'
      end

      # Create new tenant
      # @param id [String] tenant ID/Name
      def create(id)
        @client.http_post("/#{@resource}", id: id)
      end

      # Query existing tenants
      # @return [Array[Tenant]]
      def query
        @client.http_get("/#{@resource}").map do |t|
          Hawkular::Metrics::Tenant.new(t)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hawkular-client-0.1.2 lib/metrics/tenant_api.rb
hawkular-client-0.1.1 lib/metrics/tenant_api.rb