Class: Infrawrench::CostExportsNamespace

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

Overview

client.cost_exports

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ CostExportsNamespace

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

Parameters:



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

def initialize(transport)
  @transport = transport
end

Instance Method Details

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

Create a cost export

Credentials are required on create. They are encrypted at rest and no route ever returns them; responses carry a redacted credentialHint instead.

Requires permission: org:settings:write.

POST /api/org/orgId/cost-exports

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

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

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

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

Returns:

  • (Hash)

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

Raises:



3952
3953
3954
3955
3956
3957
3958
3959
3960
# File 'lib/infrawrench/client.rb', line 3952

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

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

Delete a cost export

Soft delete. Objects already written to the destination are left alone.

Requires permission: org:settings:write.

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



3978
3979
3980
3981
3982
3983
3984
3985
# File 'lib/infrawrench/client.rb', line 3978

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

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

Get a cost export

Requires permission: costs:read.

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

Raises:



4001
4002
4003
4004
4005
4006
4007
4008
# File 'lib/infrawrench/client.rb', line 4001

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

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

List scheduled cost exports

Requires permission: costs:read.

GET /api/org/orgId/cost-exports

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

Raises:



4022
4023
4024
4025
4026
4027
4028
4029
# File 'lib/infrawrench/client.rb', line 4022

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

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

Run a cost export now

Runs the export immediately against the same code path the poller uses, writing every period in the restatement window. Answers 200 with status: "failed" and a message rather than an error status when the destination rejects the write — the caller wants the reason, and the same failure is recorded on the export.

Requires permission: org:settings:write.

POST /api/org/orgId/cost-exports/id/run

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

Raises:



4052
4053
4054
4055
4056
4057
4058
4059
# File 'lib/infrawrench/client.rb', line 4052

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

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

Update a cost export

Replaces everything but the credential. Omit accessKeyId/secretAccessKey/url to keep the stored credential; changing the destination type requires supplying a new one. Saving reschedules the export from now.

Requires permission: org:settings:write.

PUT /api/org/orgId/cost-exports/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 CostExportInput.

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

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

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

Returns:

  • (Hash)

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

Raises:



4083
4084
4085
4086
4087
4088
4089
4090
4091
# File 'lib/infrawrench/client.rb', line 4083

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