Class: Infrawrench::CostAlertsNamespace

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

Overview

client.cost_alerts

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostAlertsNamespace

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

Parameters:



3929
3930
3931
3932
# File 'lib/infrawrench/client.rb', line 3929

def initialize(transport)
  @transport = transport
  @get = CostAlertsGetNamespace.new(@transport)
end

Instance Attribute Details

#getCostAlertsGetNamespace (readonly)

Returns client.cost_alerts.get.

Returns:



3925
3926
3927
# File 'lib/infrawrench/client.rb', line 3925

def get
  @get
end

Instance Method Details

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

Create a change-based cost alert

Requires permission: costs:write.

POST /api/org/orgId/cost-alerts

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

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

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

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

Returns:

  • (Hash)

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

Raises:



3948
3949
3950
3951
3952
3953
3954
3955
3956
# File 'lib/infrawrench/client.rb', line 3948

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

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

Delete a cost alert

Soft delete. Fired events disappear from the org-wide event feed with it.

Requires permission: costs:write.

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



3974
3975
3976
3977
3978
3979
3980
3981
# File 'lib/infrawrench/client.rb', line 3974

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

#events(org_id: nil, alert_id: nil, limit: nil, request_options: nil) ⇒ Hash

List recently fired cost-alert events

Newest first. Optionally scoped to one alert with ?alertId=; an unknown alertId is a 404, distinct from an alert that simply has no events yet.

Requires permission: costs:read.

GET /api/org/orgId/cost-alerts/events

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.

  • alert_id (String, nil) (defaults to: nil)
  • limit (Integer, nil) (defaults to: nil)
  • request_options (Hash, nil) (defaults to: nil)

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

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



4003
4004
4005
4006
4007
4008
4009
4010
4011
# File 'lib/infrawrench/client.rb', line 4003

def events(org_id: nil, alert_id: nil, limit: nil, request_options: nil)
  @transport.request(
    http_method: "GET",
    path: "/api/org/{orgId}/cost-alerts/events",
    path_params: { "orgId" => org_id },
    query: { "alertId" => alert_id, "limit" => limit },
    request_options: request_options
  )
end

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

Update a cost alert

Requires permission: costs:write.

PUT /api/org/orgId/cost-alerts/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 CostAlertInput.

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

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

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

Returns:

  • (Hash)

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

Raises:



4030
4031
4032
4033
4034
4035
4036
4037
4038
# File 'lib/infrawrench/client.rb', line 4030

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