Class: Infrawrench::CostAnnotationsNamespace

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

Overview

client.cost_annotations

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostAnnotationsNamespace

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

Parameters:



3573
3574
3575
# File 'lib/infrawrench/client.rb', line 3573

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Pin a change's or deploy's cost impact onto the cost charts

Writes the finding as a cost annotation, so the step in the run rate is explained on the graph where it shows. Re-posting the same subject rewords the existing note rather than adding a second — which is what makes it safe to pin a finding again once the provider has finished restating. The note's date and report scope are never rewritten: they may have been edited deliberately.

A subject with no measurable impact is a 400, not a note reading $0.00/day.

Requires permission: costs:write.

POST /api/org/orgId/cost-annotations/change-impact

Raises on 400: Bad request

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.

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

    Request body, shaped as ChangeCostImpactAnnotationRequest.

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

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

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

Returns:

  • (Hash)

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

Raises:



3604
3605
3606
3607
3608
3609
3610
3611
3612
# File 'lib/infrawrench/client.rb', line 3604

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

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

Create a cost annotation

Requires permission: costs:write.

POST /api/org/orgId/cost-annotations

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

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

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

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

Returns:

  • (Hash)

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

Raises:



3628
3629
3630
3631
3632
3633
3634
3635
3636
# File 'lib/infrawrench/client.rb', line 3628

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

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

Delete a cost annotation

A hard delete. A withdrawn explanation should stop being drawn, and nothing references a note by id.

Requires permission: costs:write.

DELETE /api/org/orgId/cost-annotations/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:



3655
3656
3657
3658
3659
3660
3661
3662
# File 'lib/infrawrench/client.rb', line 3655

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

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

List cost annotations

Dated notes drawn over cost charts. With reportId, the set a chart for that report draws: the org-wide notes plus that report's own. Without it, every annotation in the org. Annotations are an overlay — they never appear in a series, a total, or an axis.

Requires permission: costs:read.

GET /api/org/orgId/cost-annotations

Parameters:

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

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

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

    Scope to the notes a chart for this report should draw.

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

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

  • org_id: (String, nil) (defaults to: nil)
  • report_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:



3681
3682
3683
3684
3685
3686
3687
3688
3689
# File 'lib/infrawrench/client.rb', line 3681

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

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

Update a cost annotation

Replaces the note's dates, text and scope. Moving a note between org-wide and one report is this same PUT with a different costReportId.

Requires permission: costs:write.

PUT /api/org/orgId/cost-annotations/id

Raises on 400: Bad request

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

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

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

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

Returns:

  • (Hash)

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

Raises:



3711
3712
3713
3714
3715
3716
3717
3718
3719
# File 'lib/infrawrench/client.rb', line 3711

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