Resource list per recommendation


This API returns all the existing recommendations given a set of filters aggregated by provided field.

This topic includes the following sections:

HTTP method: POST

Request URLhttps://portal.us1.onbmc.com/cloudops/api/v1/recommendations/aggregate

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

Request

Property

Type

Required

Description

category

String

Yes

Source of recommendation

Possible values: COST, SECURITY, PERFORMANCE, and so on.

resource_filter

String

No

A query to filter on the resource properties, that is, account_name, service_name, region, and type.

Examples:

  • "account_name STARTS_WITH 'test' AND service_name CONTAINS 'w'"
  • "resource_id IN['vpc-1234567890abcdef0', 'AWS-IRIS3-EC2'] && provider_id='aws'"
  • "type IN ['COMPUTE', 'STORAGE']
  • "type = 'COMPUTE'"

recommendation_filter

String

No

A query to filter on the cost/security recommendation properties (ie rule_id, optimal etc).

Examples:

  • "rule_id='1' && optimal='TRUE'"
  • type IN ['IDLE_VM', 'OVERALLOCATED_VM'] && ref_timestamp < 1547812197336
  • "risk>1000 && violation_count > 20 && violation_status='"

Note: Only type field is supported.

resource_pool_id

String

No

Filter the recommendations by resourcepool id.

sort

String

No

Sort on different attributes.

Accepted: asc, desc

Default: cost_saving:desc

Example: sort=cost_saving:desc

aggregate_by

String

Yes

Group the recommendations by the field specified.

Default: type

Example: aggregate_by=provider_id

Request body properties

Example request JSON

{
   "category": "COST",
   "resource_filter" : "resource_id IN ['vpc-2002', 'AWS-EC2'] && provider_id='aws'",
   "recommendation_filter": "type IN ['IDLE_VM', 'OVERALLOCATED_VM']",
   "sort": "cost_saving:desc",
   "aggregate_by":"type"
}

Response

Example response JSON

[
    {
       "cost_saving": 350000,
       "number_of_resources": 532,
       "type":"OVERALLOCATED_VM"
    },
    {
       "cost_saving": 90000,
       "number_of_resources": 54,
       "type":"IDLE_VM"
    }
]

Status codes and messages

HTTP code

Message

Description

200

OK

Request succeeded

401


Unauthorized

400


Bad request

Supported filter criteria

Criteria

Keyword

equals

=

does not  equal

!=

empty

IS EMPTY

not empty

IS NOT EMPTY

contains

CONTAINS

does not contain

NOT CONTAINS

begins with

STARTS_WITH

ends with

ENDS_WITH

greater than

>

greater than or equal to

>=

less than

<

less than or equal to

<=

like a substring

LIKE

in

IN

Supported datatypes and corresponding filter criteria

Datatype

Keyword

Supported Criteria

Numeric

NUM

equals, does not equal, empty, not empty, greater than, greater than or equal to, less than, less than or equal to

String

STR

equals, does not equal, empty, not empty, contains, does not contain, begins with, ends with

 

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