Sha256: 2528fc29bca90867adb4842d650b691224238b222f3323d5190959cea44739f0

Contents?: true

Size: 658 Bytes

Versions: 10

Compression:

Stored size: 658 Bytes

Contents

module Hawkular::Metrics
  class Client < Hawkular::BaseClient
    # 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 }, @client.admin_header)
      end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
hawkular-client-5.0.0 lib/hawkular/metrics/tenant_api.rb
hawkular-client-5.0.0.pre2 lib/hawkular/metrics/tenant_api.rb
hawkular-client-5.0.0.pre1 lib/hawkular/metrics/tenant_api.rb
hawkular-client-4.1.0 lib/hawkular/metrics/tenant_api.rb
hawkular-client-4.0.0 lib/hawkular/metrics/tenant_api.rb
hawkular-client-3.0.2 lib/hawkular/metrics/tenant_api.rb
hawkular-client-3.0.1 lib/hawkular/metrics/tenant_api.rb
hawkular-client-3.0.0 lib/hawkular/metrics/tenant_api.rb
hawkular-client-2.9.0 lib/hawkular/metrics/tenant_api.rb
hawkular-client-2.8.0 lib/hawkular/metrics/tenant_api.rb