Class: SeatLayer::Workspaces

Inherits:
Resource show all
Defined in:
lib/seatlayer/inventory.rb

Overview

Workspaces isolate one tenant's charts and events from another's.

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from SeatLayer::Resource

Instance Method Details

#create(name:, external_ref: nil, idempotency_key: nil) ⇒ Object



181
182
183
184
# File 'lib/seatlayer/inventory.rb', line 181

def create(name:, external_ref: nil, idempotency_key: nil)
  body = compact({ "name" => name, "externalRef" => external_ref })
  @client.post("/v1/workspaces", body, idempotency_key: idempotency_key)
end

#listObject



177
178
179
# File 'lib/seatlayer/inventory.rb', line 177

def list
  @client.get("/v1/workspaces")
end

#retrieve(workspace_id) ⇒ Object



186
187
188
# File 'lib/seatlayer/inventory.rb', line 186

def retrieve(workspace_id)
  @client.get("/v1/workspaces/#{encode(workspace_id)}")
end

#update(workspace_id, fields) ⇒ Object

Rename, re-reference, or disable a workspace.

The organisation's default workspace cannot be disabled — the API answers 409 default_workspace_required. Promote another one first.



194
195
196
# File 'lib/seatlayer/inventory.rb', line 194

def update(workspace_id, fields)
  @client.patch("/v1/workspaces/#{encode(workspace_id)}", fields)
end