Resource
A Resource is a resource used for analysis on all microservices used in Cloudforet.
Package : spaceone.api.statistics.v1
Resource
Resource Methods:
Method
Request
Response
stat
POST /statistics/v1/resources/stat
Enables data preprocessing of different services. Although limited, it is possible to create not only basic queries but also data suitable for users' needs, such as joins between two tables created by the query, handling missing values, and sorting.
Type
Message
Request
Response
{
"aggregate": [
{
"query": {
"resource_type": "inventory.CloudServiceType",
"query": {
"filter": [
{
"k": "labels",
"v": [
"Server"
],
"o": "in"
},
{
"k": "is_primary",
"v": true,
"o": "eq"
}
],
"aggregate": [
{
"group": {
"keys": [
{
"key": "cloud_service_type_id",
"name": "cloud_service_type_id"
},
{
"key": "name",
"name": "cloud_service_type"
},
{
"key": "group",
"name": "cloud_service_group"
},
{
"key": "provider",
"name": "provider"
},
{
"key": "cloud_service_type_id",
"name": "cloud_service_type_id"
}
],
"fields": [
{
"key": "tags",
"name": "tags",
"operator": "first"
},
{
"key": "labels",
"name": "labels",
"operator": "first"
}
]
}
}
]
}
}
},
{
"join": {
"resource_type": "inventory.CloudService",
"query": {
"filter": [
{
"k": "ref_cloud_service_type.cloud_service_type_id",
"v": [
"cloud-svc-type-58c926b19aca",
"cloud-svc-type-c7e5bc38d911",
"cloud-svc-type-8dd4d7a13b95",
"cloud-svc-type-719e705cb529",
"cloud-svc-type-50bd62cf6e0e"
],
"o": "in"
}
],
"aggregate": [
{
"group": {
"keys": [
{
"key": "cloud_service_type",
"name": "cloud_service_type"
},
{
"key": "cloud_service_group",
"name": "cloud_service_group"
},
{
"key": "provider",
"name": "provider"
}
],
"fields": [
{
"name": "count",
"operator": "count"
}
]
}
}
]
},
"keys": [
"cloud_service_type",
"cloud_service_group",
"provider"
]
}
},
{
"fill_na": {
"data": {
"count": 0.0
}
}
},
{
"formula": {
"query": "count > 0"
}
},
{
"sort": {
"key": "count",
"desc": true
}
}
],
"domain_id": "domain-58010aa2e451"
}
{
"total_count": 5.0,
"results": [
{
"labels": [
"Compute",
"Server"
],
"cloud_service_type_id": "cloud-svc-type-58c926b19aca",
"cloud_service_type": "Instance",
"count": 44.0,
"tags": [
{
"key": "spaceone:icon",
"value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/aws-ec2.svg"
}
],
"provider": "aws",
"cloud_service_group": "EC2"
},
{
"tags": [
{
"key": "spaceone:icon",
"value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/openstack/openstack_compute.svg"
},
{
"key": "spaceone:display_name",
"value": "Instance"
}
],
"cloud_service_group": "Compute",
"cloud_service_type": "Instance",
"provider": "openstack",
"count": 12.0,
"labels": [
"Compute",
"Server"
],
"cloud_service_type_id": "cloud-svc-type-50bd62cf6e0e"
},
{
"cloud_service_type": "Node",
"count": 8.0,
"provider": "kubernetes",
"cloud_service_type_id": "cloud-svc-type-719e705cb529",
"cloud_service_group": "Cluster",
"tags": [
{
"value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/kubernetes/node.svg",
"key": "spaceone:icon"
}
],
"labels": [
"Compute",
"Server",
"Container"
]
},
{
"cloud_service_type_id": "cloud-svc-type-8dd4d7a13b95",
"cloud_service_type": "Instance",
"cloud_service_group": "ComputeEngine",
"labels": [
"Compute",
"Server"
],
"tags": [
{
"key": "spaceone:icon",
"value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/cloud-services/google_cloud/Compute_Engine.svg"
}
],
"count": 5.0,
"provider": "google_cloud"
},
{
"tags": [
{
"value": "https://spaceone-custom-assets.s3.ap-northeast-2.amazonaws.com/console-assets/icons/azure-vm.svg",
"key": "spaceone:icon"
}
],
"cloud_service_type": "VirtualMachine",
"cloud_service_group": "Compute",
"count": 2.0,
"provider": "azure",
"cloud_service_type_id": "cloud-svc-type-c7e5bc38d911",
"labels": [
"Compute",
"Server"
]
}
]
}
Message
ResourceStatRequest
Field
Type
Required
Description
aggregate
✔
page
✘
domain_id
string
✔
SortKey
Field
Type
Description
key
string
desc
bool
StatAggregate
Field
Type
Description
query
join
concat
sort
formula
fill_na
StatAggregateConcat
Field
Type
Required
Description
resource_type
string
✔
query
✔
extend_data
✘
StatAggregateFillNA
Field
Type
Required
Description
data
✔
StatAggregateFormula
Field
Type
Description
eval
string
query
string
StatAggregateJoin
Field
Type
Required
Description
resource_type
string
✔
query
✔
extend_data
✘
type
LEFT
RIGHT
OUTER
INNER
✘
keys
list of string
✘
StatAggregateQuery
Field
Type
Required
Description
resource_type
string
✔
query
✔
extend_data
✘
StatAggregateSort
Field
Type
Required
Description
key
string
✘
desc
bool
✘
keys
✘
StatPage
Field
Type
Required
Description
start
✘
limit
✔
Last updated