Create a Cluster
This endpoint is used to create a new cluster.
POST /openapi/v1/applications/{application_id}/clusters
Parameters: The request URL contains the following parameters
Name |
Type |
Description |
---|---|---|
application_id |
string |
The id for the workspace to which the cluster belongs. |
The JSON query body contains the following keys
Attribute |
Type |
Description |
---|---|---|
name |
string |
The name of the cluster. |
version |
string |
Indicates the version of the workspace the cluster will be added to. |
description |
string |
(optional) The description of the cluster. |
approved |
boolean |
(optional) An approved cluster will not be updated during an automatic policy discovery run. Default false. |
query |
JSON |
Filter (or match criteria) associated with the filter. Alternate Query Mode (also called Dynamic Mode) must be enabled on the workspace, otherwise ignored. |
query |
JSON |
Filter (or match criteria) associated with the filter. Alternate Query Mode (also called Dynamic Mode) must be enabled on the workspace, otherwise ignored. |
nodes |
Array |
List of ip addresses or endpoints. Will be used to create the query matching these ips unless a query is provided and the workspace is in Dynamic Mode. |
Nodes object attributes:
Name |
Type |
Description |
---|---|---|
ip |
string |
IP address |
name |
string |
(optional) The name of the node. |
prefix_len |
integer |
(optional) Subnet mask. |
|
The nodes will be used to create a query unless a query is provided and the workspace is in Dynamic Mode. |
Response object: Returns the newly created cluster object.
Sample python code
application_id = '5d02b493755f0237a3d6e078'
payload = {
'name': 'test_cluster',
'version': 'v2',
'description': 'basic granularity',
'approved': False,
'query': {
'type': 'eq',
'field': 'host_name',
'value': 'centos6001'
}
}
restclient.post('/applications/%s/clusters' % application_id)