Skip to main content

Data Sources API

Data sources — cloud accounts — are managed through the REST API so you can automate onboarding and lifecycle. All calls require the x-optscale-token header (see Authentication).

List data sources

Returns the cloud accounts connected to the organization, each with its identifier, name, type, and status. Use this to enumerate accounts before pulling cost or recommendation data.

Connect a data source

Create a cloud account by supplying a name, a provider type, and a provider-specific config object. To connect Huawei Cloud, use the huawei_cnr type and provide the access key pair:
KOSTRA validates the credentials during creation and, for Huawei Cloud, automatically determines the correct BSS billing endpoint. Other providers use their own type and config shape — for example, an AWS account uses AWS credentials and report settings. The response returns the created account, including the identifier you use in subsequent calls.

Get a data source

Returns a single cloud account by identifier, including its configuration summary and import status. Secret values are never returned.

Update a data source

Update mutable fields such as the account name or credentials. Provide only the fields you want to change. Rotating credentials is done here by submitting a new config; the previous secret is replaced, not merged.

Remove a data source

Disconnects the account from the organization. Use with care: removing a data source stops further imports for that account.

List resources for a data source

Returns the resources KOSTRA has discovered for the account — for a Huawei Cloud account, this includes ECS instances, EVS volumes and snapshots, OBS buckets, Elastic IPs, RDS instances, load balancers, and images. Individual resources can be retrieved by identifier:

A typical onboarding flow

  1. POST .../cloud_accounts to connect the account.
  2. Poll GET /cloud_accounts/{id} until the first import reports success.
  3. GET .../cloud_resources to confirm discovery, then pull cost and recommendation data from the other endpoint groups.