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:



4578
4579
4580
# File 'lib/infrawrench/client.rb', line 4578

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:



4600
4601
4602
4603
4604
4605
4606
4607
4608
# File 'lib/infrawrench/client.rb', line 4600

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:



4626
4627
4628
4629
4630
4631
4632
4633
# File 'lib/infrawrench/client.rb', line 4626

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:



4649
4650
4651
4652
4653
4654
4655
4656
# File 'lib/infrawrench/client.rb', line 4649

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:



4670
4671
4672
4673
4674
4675
4676
4677
# File 'lib/infrawrench/client.rb', line 4670

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:



4700
4701
4702
4703
4704
4705
4706
4707
# File 'lib/infrawrench/client.rb', line 4700

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:



4731
4732
4733
4734
4735
4736
4737
4738
4739
# File 'lib/infrawrench/client.rb', line 4731

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