Class: Infrawrench::LogWorkspacesNamespace

Inherits:
Object
  • Object
show all
Defined in:
lib/infrawrench/client.rb,
sig/infrawrench/sdk.rbs

Overview

client.log_workspaces

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ LogWorkspacesNamespace

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of LogWorkspacesNamespace.

Parameters:



9378
9379
9380
# File 'lib/infrawrench/client.rb', line 9378

def initialize(transport)
  @transport = transport
end

Instance Method Details

#create(body:, org_id: nil, request_options: nil) ⇒ Hash

Save a log workspace query

Save a named multi-resource tail: up to 8 log streams plus a search expression, so the workspace can be reopened. With alertEnabled the poller evaluates the query every few minutes over a bounded tail window and notifies (push/Slack/Teams, logMatchAlerts trigger) when a line matches, with a cooldown between alerts. Alerting requires a non-empty search expression. Audit-logged.

Requires permission: resources:write.

POST /api/org/orgId/log-workspaces

Raises on 400: Bad request

Raises on 404: Not found

Raises on 409: A saved query with this name already exists

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • body (Hash)

    Request body, shaped as LogWorkspaceQueryCreate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • body: (log_workspace_query_create)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LogWorkspaceQuery — see sig/infrawrench/sdk.rbs.

Raises:



9407
9408
9409
9410
9411
9412
9413
9414
9415
# File 'lib/infrawrench/client.rb', line 9407

def create(body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/log-workspaces",
    path_params: { "orgId" => org_id },
    body: body,
    request_options: request_options
  )
end

#delete(query_id:, org_id: nil, request_options: nil) ⇒ nil

Delete a saved log query

Remove the saved query and stop any alerting it carried. Audit-logged.

Requires permission: resources:write.

DELETE /api/org/orgId/log-workspaces/queryId

Raises on 404: Not found

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • query_id (String)
  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • query_id: (String)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (nil)

    This endpoint returns no content.

Raises:



9433
9434
9435
9436
9437
9438
9439
9440
9441
# File 'lib/infrawrench/client.rb', line 9433

def delete(query_id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/log-workspaces/{queryId}",
    path_params: { "orgId" => org_id, "queryId" => query_id },
    accept: :empty,
    request_options: request_options
  )
end

#get(org_id: nil, request_options: nil) ⇒ Hash

List saved log queries

Every saved log-workspace query in the organization: its name, the set of log streams it tails, the search expression, the alert flag and the alert pass's last evaluation state. Log text itself is fetched per resource via POST /api/org/{orgId}/resources/{pluginId}/{typeId}/logs.

Requires permission: resources:read.

GET /api/org/orgId/log-workspaces

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LogWorkspaceQueryList — see sig/infrawrench/sdk.rbs.

Raises:



9460
9461
9462
9463
9464
9465
9466
9467
# File 'lib/infrawrench/client.rb', line 9460

def get(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/log-workspaces",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#resources(org_id: nil, request_options: nil) ⇒ Hash

List log-capable resources

Synced resources whose rendered detail declares the logs capability — the candidates a log workspace can tail — plus sidecar streams reached through a peer integration (pods and workloads inside a managed cluster, listed live from the provider and marked with parentResourceId). Discovered from the plugin contract (never a hardcoded provider list), capped at 500 results.

Requires permission: resources:read.

GET /api/org/orgId/log-workspaces/resources

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LogCapableResourceList — see sig/infrawrench/sdk.rbs.

Raises:



9488
9489
9490
9491
9492
9493
9494
9495
# File 'lib/infrawrench/client.rb', line 9488

def resources(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/log-workspaces/resources",
    path_params: { "orgId" => org_id },
    request_options: request_options
  )
end

#update(query_id:, body:, org_id: nil, request_options: nil) ⇒ Hash

Update a saved log query

Edit the name, resource set, search expression and/or the alert toggle. Changing the search or the resources resets the alert pass's evaluation state; turning the alert on makes the query due for evaluation immediately. Audit-logged.

Requires permission: resources:write.

PUT /api/org/orgId/log-workspaces/queryId

Raises on 400: Bad request

Raises on 404: Not found

Raises on 409: A saved query with this name already exists

Parameters:

  • org_id (String, nil) (defaults to: nil)

    Organization id. Defaults to the org_id the client was constructed with.

  • query_id (String)
  • body (Hash)

    Request body, shaped as LogWorkspaceQueryUpdate.

  • request_options (Hash, nil) (defaults to: nil)

    Per-call :headers, :timeout and :open_timeout.

  • query_id: (String)
  • body: (log_workspace_query_update)
  • org_id: (String, nil) (defaults to: nil)
  • request_options: (Hash[Symbol, untyped], nil) (defaults to: nil)

Returns:

  • (Hash)

    Parsed JSON, shaped as LogWorkspaceQuery — see sig/infrawrench/sdk.rbs.

Raises:



9521
9522
9523
9524
9525
9526
9527
9528
9529
# File 'lib/infrawrench/client.rb', line 9521

def update(query_id:, body:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "PUT",
    path: "/api/org/{orgId}/log-workspaces/{queryId}",
    path_params: { "orgId" => org_id, "queryId" => query_id },
    body: body,
    request_options: request_options
  )
end