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:



3855
3856
3857
# File 'lib/infrawrench/client.rb', line 3855

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:



3877
3878
3879
3880
3881
3882
3883
3884
3885
# File 'lib/infrawrench/client.rb', line 3877

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:



3903
3904
3905
3906
3907
3908
3909
3910
# File 'lib/infrawrench/client.rb', line 3903

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:



3926
3927
3928
3929
3930
3931
3932
3933
# File 'lib/infrawrench/client.rb', line 3926

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:



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

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:



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

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:



4008
4009
4010
4011
4012
4013
4014
4015
4016
# File 'lib/infrawrench/client.rb', line 4008

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