Budget for a given list of resource pools


This API queries all the cost data for all resource pools in this tenant with some filtering. You can include out-of-the-box filters for with-budget, without-budget, in-budget, overspenders, and underspenders.

This API does not return the budget value for the resource pools where the enabled flag is set to false.

This topic includes the following sections:

HTTP method: POST

Request URL: https://portal.us1.onbmc.com/cloudcost/api/v1/budgets/resource_pools/cost

HeaderSee HTTP-request-and-response-headers for header information, such as required authorization token.

Request

Request body properties

Property

Type

Required

Description

resource_pool_ids

list

No

List of resource pool IDs to fetch cost data.

Optional: If not provided, API must return the details of all the resource pools in this tenant.

If this property is set, size and from properties are ignored.

start_date

long

Yes

Start date in msec epoch time (GMT)

to_date

long

Yes

End date in msec epoch time (GMT)

size

integer

No

Possible values: -1, >0

Default: 20

If set to -1, the entire data set is returned.

from

integer

No

Possible values: >=0

Default: 0

This property is ignored if size property is set to -1.

sort

string

No

Sort on different attributes.

Possible values: asc, desc

Default value: actual_cost:desc

Example: sort=forecast_cost:desc

Possible values for sorting;

actual_cost, forecast_cost, budget

filter

string

No

Default (all)

Possible values for filtering;

all, with_budget, without_budget, in_budget, underspenders, overspenders

Example request JSON

Sample 1
{
   "start_date":1534751527925,
   "to_date":1534751577925,
   "size":3,
   "from":0,
   "sort":"actual_cost:desc",
   "filters":"all"
}
Sample 2
{
   "start_date":1534751527925,
   "to_date":1534751577925,
   "size":-1,
   "sort":"actual_cost:desc",
   "filters":"all"
}
Sample 3
{
   "resource_pool_ids":[
       "abcd-xyz-12345",
       "abcd-xyz-1234567",
       "abcd-xyz-123456789",
       "abcd-xyz-12345678912",
       "abcd-xyz-1234567891234",
       "abcd-xyz-123456789123456"
    ],
   "start_date":1534751527925,
   "to_date":1534751577925
   "sort":"actual_cost:desc",
   "filters":"all"
}

Response

Response body properties

Property

Type

Description

total

Integer

Total count of RPs

resource_pool_id

UUID

Resource pool ID.

resource_pool_name

String

Name of the resource pool.

number_of_resources

Integer

Number of resources within the RPs or no

budget

Float

Budget of the RP for the specified period.

actual_cost

Float

Actual cost of the RP for the specified period.

forecast_cost

Float

Forecasted cost for the remaining period from the total specified period.

tag

String

Predefined tags, such as, underspender and overspender.

dirty

Boolean

Indicates that the resource pool is been modified currently and the resource pool data might be old or incorrect at the moment.

Example response JSON

HTTP/1.1 207 Multi-Status for Sample 1 request
{
   "200": {
       "total": 75,
       "resource_pools":[
            {
               "resource_pool_id":"abcd-xyz-12345",
               "resource_pool_name":"Mercury Resources",
               "number_of_resources":32345,
               "budget":5000.00,
               "actual_cost":72328.00,
               "forecast_cost":403000.00,
               "tag":"overspender",
               "dirty": false,
            },
            {
               "resource_pool_id":"abcd-xyz-1234567",
               "resource_pool_name":"Venus Resources",
               "number_of_resources":63345,
               "budget":30000.00,
               "actual_cost":11503.00,
               "forecast_cost":14777.00,
               "tag":"underspender",
               "dirty": false,
            },
            {
               "resource_pool_id":"abcd-xyz-123456789",
               "resource_pool_name":"Earth Resources",
               "number_of_resources":3245,
               "actual_cost":3975.00,
               "forecast_cost":7004.00,
               "dirty": false
            }
        ]
    }
}
HTTP/1.1 207 Multi-Status for Sample 3 request
{
   "200": {
       "resource_pools":[
            {
               "resource_pool_id":"abcd-xyz-12345",
               "resource_pool_name":"Mercury Resources",
               "number_of_resources":32345,
               "budget":5000.00,
               "actual_cost":72328.00,
               "forecast_cost":403000.00,
               "tag":"overspender",
               "dirty": false
            },
            {
               "resource_pool_id":"abcd-xyz-1234567",
               "resource_pool_name":"Venus Resources",
               "number_of_resources":63345,
               "budget":30000.00,
               "actual_cost":11503.00,
               "forecast_cost":14777.00,
               "tag":"underspender",
               "dirty": false
            },
            {
               "resource_pool_id":"abcd-xyz-123456789",
               "resource_pool_name":"Earth Resources",
               "number_of_resources":3245,
               "actual_cost":3975.00,
               "forecast_cost":7004.00,
               "dirty": false
            }
        ]
    },
   "403": [
       "abcd-xyz-123456789123456"
    ],
   "404": [
       "abcd-xyz-1234567891234",
       "abcd-xyz-12345678912"
    ]
}

Status codes and messages

HTTP code

Message

Description

200

OK

Request succeeded

401


Unauthorized

400


Bad request

403


Forbidden


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC Helix Cloud Cost