Class: Infrawrench::CostReportsNotificationsNamespace

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

Overview

client.cost_reports.notifications

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostReportsNotificationsNamespace

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

Parameters:



4172
4173
4174
# File 'lib/infrawrench/client.rb', line 4172

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Create a delivery schedule

On its cadence the server runs the report and sends a composed text summary — period total (converted to the org's display currency where configured, with the conversion caveat), change vs the previous period, top groups, and a deep link. No chart images. An empty result still sends, saying so.

Requires permission: org:settings:write.

POST /api/org/orgId/cost-reports/id/notifications

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

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

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

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

Returns:

  • (Hash)

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

Raises:



4200
4201
4202
4203
4204
4205
4206
4207
4208
# File 'lib/infrawrench/client.rb', line 4200

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

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

Delete a delivery schedule

Requires permission: org:settings:write.

DELETE /api/org/orgId/cost-reports/id/notifications/notificationId

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)
  • notification_id (String)
  • request_options (Hash, nil) (defaults to: nil)

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

  • id: (String)
  • notification_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:



4225
4226
4227
4228
4229
4230
4231
4232
# File 'lib/infrawrench/client.rb', line 4225

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

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

List a report's delivery schedules

Requires permission: costs:read.

GET /api/org/orgId/cost-reports/id/notifications

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:

  • (Array<Hash>)

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

Raises:



4249
4250
4251
4252
4253
4254
4255
4256
# File 'lib/infrawrench/client.rb', line 4249

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

#post_org_org_id_cost_reports_id_notifications_notification_id_send(id:, notification_id:, org_id: nil, request_options: nil) ⇒ Hash

Send a schedule's report now

Runs the report and delivers it to this schedule's destinations immediately, ignoring the schedule and its enabled flag. Fails with a 400 naming the reason when nothing could be delivered. A successful manual send clears a parked failure — it is the documented recovery for a partial delivery.

Requires permission: org:settings:write.

POST /api/org/orgId/cost-reports/id/notifications/notificationId/send

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)
  • notification_id (String)
  • request_options (Hash, nil) (defaults to: nil)

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

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

Returns:

  • (Hash)

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

Raises:



4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
# File 'lib/infrawrench/client.rb', line 4283

def post_org_org_id_cost_reports_id_notifications_notification_id_send(
  id:,
  notification_id:,
  org_id: nil,
  request_options: nil
)
  @transport.request(
    http_method: "POST",
    path: "/api/org/{orgId}/cost-reports/{id}/notifications/{notificationId}/send",
    path_params: { "orgId" => org_id, "id" => id, "notificationId" => notification_id },
    request_options: request_options
  )
end

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

List the destinations a schedule can deliver to

The org's live Slack channels and Teams webhooks, and whether this deployment can send mail. Destinations are picked from here — a schedule can only point at surfaces the org already connected.

Requires permission: org:settings:write.

GET /api/org/orgId/cost-reports/id/notifications/targets

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

Raises:



4314
4315
4316
4317
4318
4319
4320
4321
# File 'lib/infrawrench/client.rb', line 4314

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

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

Update a delivery schedule

Requires permission: org:settings:write.

PUT /api/org/orgId/cost-reports/id/notifications/notificationId

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)
  • notification_id (String)
  • body (Hash)

    Request body, shaped as ReportNotificationInput.

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

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

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

Returns:

  • (Hash)

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

Raises:



4342
4343
4344
4345
4346
4347
4348
4349
4350
# File 'lib/infrawrench/client.rb', line 4342

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