Class: Hawkular::Metrics::Client::Tenants

Inherits:
Object
  • Object
show all
Defined in:
lib/hawkular/metrics/tenant_api.rb

Overview

Provides access to tenants API

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Tenants

Returns a new instance of Tenants

Parameters:



6
7
8
9
# File 'lib/hawkular/metrics/tenant_api.rb', line 6

def initialize(client)
  @client = client
  @resource = 'tenants'
end

Instance Method Details

#create(id) ⇒ Object

Create new tenant

Parameters:

  • id (String)

    tenant ID/Name



13
14
15
# File 'lib/hawkular/metrics/tenant_api.rb', line 13

def create(id)
  @client.http_post("/#{@resource}", { id: id }, @client.admin_header)
end

#queryArray[Tenant]

Query existing tenants

Returns:



19
20
21
22
23
# File 'lib/hawkular/metrics/tenant_api.rb', line 19

def query
  @client.http_get("/#{@resource}", @client.admin_header).map do |t|
    Hawkular::Metrics::Tenant.new(t)
  end
end