Class: Infrawrench::SavedCostFiltersNamespace

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

Overview

client.saved_cost_filters

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ SavedCostFiltersNamespace

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

Parameters:



11898
11899
11900
# File 'lib/infrawrench/client.rb', line 11898

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Create a saved cost filter

Names must be unique per organization (case-insensitively) — they are how the CLI's --filter <name> and humans address the filter. A name collision is a 409.

Requires permission: costs:write.

POST /api/org/orgId/saved-cost-filters

Raises on 400: Bad request

Raises on 409: A live saved filter already uses this name.

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

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

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

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

Returns:

  • (Hash)

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

Raises:



11922
11923
11924
11925
11926
11927
11928
11929
11930
# File 'lib/infrawrench/client.rb', line 11922

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

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

Delete a saved cost filter

Soft delete — refused with a 409 while anything references the filter, with the referents in the body. Deleting a referenced filter would silently widen every referent's scope to all spend; for a budget that can fire or suppress alerts, so detaching the referents is a deliberate step, never a side effect of deletion.

Requires permission: costs:write.

DELETE /api/org/orgId/saved-cost-filters/id

Raises on 404: Not found

Raises on 409: Still referenced — the body lists every referent.

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:



11954
11955
11956
11957
11958
11959
11960
11961
# File 'lib/infrawrench/client.rb', line 11954

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

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

Get a saved cost filter

Requires permission: costs:read.

GET /api/org/orgId/saved-cost-filters/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 SavedCostFilter — see sig/infrawrench/sdk.rbs.

Raises:



11977
11978
11979
11980
11981
11982
11983
11984
# File 'lib/infrawrench/client.rb', line 11977

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

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

List saved cost filters

Named, reusable cost filter sets. Graphs, reports and budgets reference one by id (savedFilterId in their configs and in POST /costs/query), and the server resolves the reference at query time — so editing a saved filter changes every referent at once, and nothing ever holds a copy.

Requires permission: costs:read.

GET /api/org/orgId/saved-cost-filters

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<SavedCostFilter> — see sig/infrawrench/sdk.rbs.

Raises:



12004
12005
12006
12007
12008
12009
12010
12011
# File 'lib/infrawrench/client.rb', line 12004

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

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

List a saved filter's referents

Every budget, cost report and dashboard cost graph referencing this filter — what an edit will re-scope, and what a delete would be refused over.

Requires permission: costs:read.

GET /api/org/orgId/saved-cost-filters/id/referents

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 Hash — see sig/infrawrench/sdk.rbs.

Raises:



12030
12031
12032
12033
12034
12035
12036
12037
# File 'lib/infrawrench/client.rb', line 12030

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

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

Update a saved cost filter

Replaces the filter's name, description and terms. This is the high-leverage write: every graph, report and budget referencing the filter runs the new terms on its next query — re-scoping a referenced budget can change which alerts fire. GET /{id}/referents names what a change will touch.

Requires permission: costs:write.

PUT /api/org/orgId/saved-cost-filters/id

Raises on 400: Bad request

Raises on 404: Not found

Raises on 409: A live saved filter already uses this name.

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

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

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

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

Returns:

  • (Hash)

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

Raises:



12064
12065
12066
12067
12068
12069
12070
12071
12072
# File 'lib/infrawrench/client.rb', line 12064

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