Get Resource List
Description
Get Resource List is a key API to retrieve a complete list of cloud resource details.
The API call requires companyId and roleId which can be retrieved from Get Resource Map
URL
/api/workload/v1/profile/resource/list
Method: POST
Request Headers
Key |
Value |
Type |
Description |
---|---|---|---|
Authorization | Bearer <Authorization Token> | String | Authorization credential generated by FortiCNP |
Content-Type | application/json | String | |
companyid | <12345> | Integer | Company ID - Company ID can be obtained through Get Resource Map |
roleid |
<12345> |
Long |
Login user identity, can be obtained through Get Resource Map |
Request Body Parameters
Name | Required | Type | Description |
---|---|---|---|
filter | Required | String | Top of the request header, start of the JSON file. |
resourceType | Required | String | Filter for the resource type. |
option | Required | Sting | Filter option group. There can be multiple option groups. |
Key (resource platform) | Required | String | Filter resource platform by key words. Cloud resource platform options: "AWS", "GoogleCloud", "Azure". |
Key (resource type) | Required | String | Filter resource type of the resource name. Cloud resource type options: "EC2 Instance", "Compute Engine Instance", "Azure Virtual Machine". |
status | Optional | String | Status that track deleted resource, enter "deleted" to find deleted resources. |
skip | Optional | integer | Indexes in a result set, used to exclude response from the first N items of a resource collection. |
limit | Optional | integer | Maximum number of returned items. |
orderDirection | Optional | String | The order of the returned resource list, it can be "asc" for ascending order or "dsc" for descending order. |
orderBy | Optional | String | The filter options for the return resource list, available options: "id", "region", "resource_type", risk_level" |
Sample Request
The variable "key" in the request body determines which cloud account resource list will be retrieved.
Enter "GoogleCloud" for the "key" variable in the first option and "Compute Engine Instance" for the"key" variable in second option to retrieve Google Cloud account resource list. Likewise, enter "AWS" and "EC2 Instance" to retrieve AWS account resource list, and enter "Azure" and "Azure Virtual Machine" for Azure account resource list.
Request URL |
POST https://www.forticnp.com/api/workload/v1/profile/resource/list |
Request Header |
Authorization: Bearer <Authorization_Token> Content-Type: application/json roleid: 895145 companyid: 895146 |
Request Body |
{ "filter":{ "resourceType":{ "option":[ { "key":"GoogleCloud", "option":[ { "key":"Compute Engine Instance" } ] } ] }, }, "skip":0, "limit":1, "orderDirection":"asc", "orderBy":"risk_level" } |
Response Variables
Name | Type | Description |
---|---|---|
id | String | Resource ID, this is the "rid" to be used in request header in Get Resource Detail |
name | String | Name of the cloud resource, it can be a Azure Virtual Machine, Google Compute Engine, or EC2 Instance. |
region | String | The region (AWS) or the project name (Google Cloud) of the cloud resource. |
resoureceId | String | The directory path of the resource location. |
riskLevel | String | The risk level of the resource rated by FortiCNP (Info, Low, Medium, High) |
account |
String |
Account information of the cloud resource. |
totalPage | Integer | Total page of searched resources. |
limit | Integer | Maximum number of return resources in one page |
skip | Integer | Indexes in a result set, used to exclude a response from the first N items of a resource collection. |
totalCount | Integer | Total number of resources. |
Sample Response
{
"datas": [
{
"id": 8372508,
"name": "david-vm01",
"region": "forticasb-production",
"resourceId": "projects/forticasb-production/zones/us-west1-b/instances/david-vm01",
"category": "Compute Engine Instance",
"riskLevel": "Low",
"fcasbTagGroup": {
"select": false,
"key": "fcasb highlight",
"option": [
{
"select": true,
"key": "Network",
"name": "Internet facing - anywhere"
}
]
},
"availableActions": [
"PROFILE",
"TRAFFIC",
"RESOURCEMAP",
"ASSETVIEW",
"SUPPORT"
],
"account": {
"service": "GoogleCloud",
"accountName": "@forticasb.com",
"accountNumber": "@forticasb.com",
"accountEmail": "forticasb@forticasb.com",
"organizationDomain": "@forticasb.com",
"status": "LICENSE"
},
"lastScanTime": 1656281520000,
"rriSupport": true,
"state": "New",
"riskScore": 52
}
],
"totalPage": 27,
"limit": 1,
"skip": 0,
"totalCount": 27
}