Class: Infrawrench::CustomGraphsNamespace

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

Overview

client.custom_graphs

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CustomGraphsNamespace

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 CustomGraphsNamespace.

Parameters:



5506
5507
5508
# File 'lib/infrawrench/client.rb', line 5506

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Type-check custom-graph source without saving it

Requires permission: dashboards:read.

POST /api/org/orgId/custom-graphs/check

Raises on 400: Bad request

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 CustomGraphCheckRequest.

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

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

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

Returns:

  • (Hash)

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

Raises:



5525
5526
5527
5528
5529
5530
5531
5532
5533
# File 'lib/infrawrench/client.rb', line 5525

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

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

Create a custom graph (paid plan required)

Requires permission: dashboards:write.

POST /api/org/orgId/custom-graphs

Raises on 400: Bad request

Raises on 402: Payment required — the organization's plan does not include this

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 CustomGraphInput.

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

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

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

Returns:

  • (Hash)

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

Raises:



5552
5553
5554
5555
5556
5557
5558
5559
5560
# File 'lib/infrawrench/client.rb', line 5552

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

#delete(id:, org_id: nil, request_options: nil) ⇒ Hash

Delete a custom graph (and its dashboard cards)

Requires permission: dashboards:write.

DELETE /api/org/orgId/custom-graphs/id

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



5576
5577
5578
5579
5580
5581
5582
5583
# File 'lib/infrawrench/client.rb', line 5576

def delete(id:, org_id: nil, request_options: nil)
  @transport.request(
    http_method: "DELETE",
    path: "/api/org/{orgId}/custom-graphs/{id}",
    path_params: { "orgId" => org_id, "id" => id },
    request_options: request_options
  )
end

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

Get a custom graph (including source)

Requires permission: dashboards:read.

GET /api/org/orgId/custom-graphs/id

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.

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

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

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

Returns:

  • (Hash)

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

Raises:



5599
5600
5601
5602
5603
5604
5605
5606
# File 'lib/infrawrench/client.rb', line 5599

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

#list(org_id: nil, request_options: nil) ⇒ Array<Hash>

List custom graphs

Requires permission: dashboards:read.

GET /api/org/orgId/custom-graphs

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:

  • (Array<Hash>)

    Parsed JSON, shaped as Array<CustomGraphSummary> — see sig/infrawrench/sdk.rbs.

Raises:



5620
5621
5622
5623
5624
5625
5626
5627
# File 'lib/infrawrench/client.rb', line 5620

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

#render(id:, org_id: nil, body: nil, request_options: nil) ⇒ Hash

Run the graph's script and return its render spec (paid plan required)

Requires permission: dashboards:read.

POST /api/org/orgId/custom-graphs/id/render

Raises on 400: Bad request

Raises on 402: Payment required — the organization's plan does not include this

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.

  • id (String)
  • body (Hash, nil) (defaults to: nil)

    Request body, shaped as CustomGraphRenderRequest.

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

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

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

Returns:

  • (Hash)

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

Raises:



5650
5651
5652
5653
5654
5655
5656
5657
5658
# File 'lib/infrawrench/client.rb', line 5650

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

#typings(org_id: nil, request_options: nil) ⇒ String

The ambient graph.d.ts for custom-graph source

Requires permission: dashboards:read.

GET /api/org/orgId/custom-graphs/typings

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:

  • (String)

    Raw response bytes.

Raises:



5671
5672
5673
5674
5675
5676
5677
5678
5679
# File 'lib/infrawrench/client.rb', line 5671

def typings(org_id: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/custom-graphs/typings",
    path_params: { "orgId" => org_id },
    accept: :binary,
    request_options: request_options
  )
end

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

Update a custom graph (paid plan required)

Requires permission: dashboards:write.

PUT /api/org/orgId/custom-graphs/id

Raises on 400: Bad request

Raises on 402: Payment required — the organization's plan does not include this

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.

  • id (String)
  • body (Hash)

    Request body, shaped as CustomGraphUpdate.

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

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

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

Returns:

  • (Hash)

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

Raises:



5701
5702
5703
5704
5705
5706
5707
5708
5709
# File 'lib/infrawrench/client.rb', line 5701

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