Document navigation

Settings Operations

Global Settings Operations

QueryGlobalConfig

API Request

URLs
GET zstack/v1/global-configurations
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 036d9a68cd8243e99e8d740eaf8b4baf" \
-X GET http://localhost:8080/zstack/v1/global-configurations

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryGlobalConfig, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "name": "reservedCapacity",
      "category": "backupStorage",
      "description": "Reserved capcacity on every backup storage",
      "defaultValue": "1G",
      "value": "2G"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventories List See inventories. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventories
Name Type Description Starting Version
name String The resource name. 0.6
category String 0.6
description String The detailed description of the resource. 0.6
defaultValue String 0.6
value String 0.6

SDK Sample

Java SDK
QueryGlobalConfigAction action = new QueryGlobalConfigAction();
action.conditions = asList();
action.sessionId = "8509eaa6301b4935a4b100a05f1fe2ba";
QueryGlobalConfigAction.Result res = action.call();
Python SDK
QueryGlobalConfigAction action = QueryGlobalConfigAction()
action.conditions = []
action.sessionId = "e085fdf6aa354291b71ae8dc5fa880fe"
QueryGlobalConfigAction.Result res = action.call()

UpdateGlobalConfig

API Request

URLs
PUT zstack/v1/global-configurations/{category}/{name}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
"updateGlobalConfig": {
"value": "90"
  },
"systemTags": [],
"userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateGlobalConfig":{"value":"90"}}' \
http://localhost:8080/zstack/v1/global-configurations/quota/scheduler.num/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
category String url The category. 0.6
name String url The resource name. 0.6
value String body (contained in the updateGlobalConfig structure) Optional. The value. 0.6
systemTags List body Optional. The system tags. 0.6
userTags List body Optional. The user tags. 0.6

API Response

Sample Response
{
  "inventory": {
    "name": "scheduler.num",
    "category": "quota",
    "description": "default quota for scheduler.num",
    "defaultValue": "80",
    "value": "90"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 0.6
inventory GlobalConfigInventory See inventory. 0.6
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 0.6
description String The brief description of the error. 0.6
details String The details about the error. 0.6
elaboration String The reserved field. Default value: null. 0.6
opaque LinkedHashMap The reserved field. Default value: null. 0.6
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 0.6
#inventory
Name Type Description Starting Version
name String The resource name. 0.6
category String 0.6
description String The detailed description of the resource. 0.6
defaultValue String 0.6
value String 0.6

SDK Sample

Java SDK
UpdateGlobalConfigAction action = new UpdateGlobalConfigAction();
action.category = "quota";
action.name = "scheduler.num";
action.value = "90";
action.sessionId = "84a1a9ed2d54449db13e01f7d6face7e";
UpdateGlobalConfigAction.Result res = action.call();
Python SDK
UpdateGlobalConfigAction action = UpdateGlobalConfigAction()
action.category = "quota"
action.name = "scheduler.num"
action.value = "90"
action.sessionId = "b077cfa8599a4ff1ac4fd7ba67b20a82"
UpdateGlobalConfigAction.Result res = action.call()

ResetGlobalConfig

API Request

URLs
PUT zstack/v1/global-configurations/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "resetGlobalConfig": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"resetGlobalConfig":{}}' http://localhost:8080/zstack/v1/global-configurations/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
systemTags List body Optional. The system tags. 3.1.0
userTags List body Optional. The user tags. 3.1.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
ResetGlobalConfigAction action = new ResetGlobalConfigAction();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ResetGlobalConfigAction.Result res = action.call();
Python SDK
ResetGlobalConfigAction action = ResetGlobalConfigAction()
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ResetGlobalConfigAction.Result res = action.call()

Advanced Settings Operations

GetResourceConfig

API Request

URLs
GET zstack/v1/resource-configurations/{resourceUuid}/{category}/{name}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resource-configurations/77663dd5ff84460bbf1817aa3c59d125/host/cpu.overProvisioning.ratio
Request Parameters
Name Type Location Description Optional Value Starting Version
category String url The setting category. 3.4.0
name String url The setting name. 3.4.0
resourceUuid String url The resource UUID. 3.4.0
systemTags List query Optional. The system tags. 3.4.0
userTags List query Optional. The user tags. 3.4.0

API Response

Sample Response
{
  "value": "5",
  "effectiveConfigs": [
    {
      "uuid": "dae9aeb6d74e4f44823f2e0c4f1cc79f",
      "resourceUuid": "46597de31eac41539c4e6eda52885769",
      "resourceType": "HostVO",
      "name": "cpu.overProvisioning.ratio",
      "category": "host",
      "value": "5",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    },
    {
      "uuid": "5c3c94a73d7b4a95a1818241f2e427ae",
      "resourceUuid": "371519310f344695854de27bb9743121",
      "resourceType": "ClusterVO",
      "name": "cpu.overProvisioning.ratio",
      "category": "host",
      "value": "10",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
value String The setting value. 3.4.0
success boolean 3.4.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.4.0
effectiveConfigs List The setting list that takes effect. Settings are ordered from high to low priorities. For more information, see effectiveConfigs. 3.4.0
error ErrorCode See error. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0
#effectiveConfigs
Name Type Description Starting Version
uuid String The resource UUID. 3.4.0
resourceUuid String The resource UUID corresponded by the setting. 3.4.0
resourceType String The resource type corresponded by the setting. 3.4.0
name String The setting name. 3.4.0
description String The detailed description of the setting. 3.4.0
category String The setting category. 3.4.0
value String The setting value. 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0

SDK Sample

Java SDK
GetResourceConfigAction action = new GetResourceConfigAction();
action.category = "host";
action.name = "cpu.overProvisioning.ratio";
action.resourceUuid = "70fdcc564f564c29af98e48e78be56e4";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceConfigAction.Result res = action.call();
Python SDK
GetResourceConfigAction action = GetResourceConfigAction()
action.category = "host"
action.name = "cpu.overProvisioning.ratio"
action.resourceUuid = "b1ea1d424bf04a50b15b33bcd0f8a80d"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetResourceConfigAction.Result res = action.call()

GetResourceBindableConfig

API Request

URLs
GET zstack/v1/resource-configurations/bindable
GET zstack/v1/resource-configurations/bindable/{category}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resource-configurations/bindable?category=host
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resource-configurations/bindable/host?category=host
Request Parameters
Name Type Location Description Optional Value Starting Version
category String query Optional. The setting category. 3.4.0
systemTags List query Optional. The system tags. 3.4.0
userTags List query Optional. The user tags. 3.4.0

API Response

Sample Response
{
  "bindableConfigs": [
    {
      "name": "cpu.overProvisioning.ratio",
      "category": "host",
      "bindResourceTypes": [
        "HostVO",
        "ClusterVO",
        "ZoneVO"
      ]
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.4.0
bindableConfigs List See bindableConfigs. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0
#bindableConfigs
Name Type Description Starting Version
name String The setting name. 3.4.0
category String The setting category. 3.4.0
description String The detailed description of the setting. 3.4.0
bindResourceTypes List The resource types that can be bound by the setting. 3.4.0

SDK Sample

Java SDK
GetResourceBindableConfigAction action = new GetResourceBindableConfigAction();
action.category = "host";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetResourceBindableConfigAction.Result res = action.call();
Python SDK
GetResourceBindableConfigAction action = GetResourceBindableConfigAction()
action.category = "host"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
GetResourceBindableConfigAction.Result res = action.call()

DeleteResourceConfig

API Request

URLs
DELETE zstack/v1/resource-configurations/{category}/{name}/{resourceUuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE http://localhost:8080/zstack/v1/resource-configurations/host/cpu.overProvisioning.ratio/02bcf0b045e247e59bfd51630064443f
Request Parameters
Name Type Location Description Optional Value Starting Version
category String url The setting category. 3.4.0
name String url The setting name. 3.4.0
resourceUuid String url The resource UUID. 3.4.0
deleteMode String body Optional. The delete mode. 3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
DeleteResourceConfigAction action = new DeleteResourceConfigAction();
action.category = "host";
action.name = "cpu.overProvisioning.ratio";
action.resourceUuid = "763612d48d514b35a7df506cf1a23f57";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteResourceConfigAction.Result res = action.call();
Python SDK
DeleteResourceConfigAction action = DeleteResourceConfigAction()
action.category = "host"
action.name = "cpu.overProvisioning.ratio"
action.resourceUuid = "4ac85edbee2c489ea58e3f26b53182de"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
DeleteResourceConfigAction.Result res = action.call()

QueryResourceConfig

API Request

URLs
GET zstack/v1/resource-configurations
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/resource-configurations

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryResourceConfig, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "4944c2599c394bd5be5ccc1099dfdb4b",
      "resourceUuid": "45a511dfef1b474dbef3c1ff88275465",
      "resourceType": "ClusterVO",
      "name": "cpu.overProvisioning.ratio",
      "category": "host",
      "value": "10",
      "createDate": "Nov 14, 2017 10:20:57 PM",
      "lastOpDate": "Nov 14, 2017 10:20:57 PM"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.4.0
inventories List See inventories. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.4.0
resourceUuid String The resource UUID corresponded by the setting. 3.4.0
resourceType String The resource type corresponded by the setting. 3.4.0
name String The setting name. 3.4.0
description String The detailed description of the setting. 3.4.0
category String The setting category. 3.4.0
value String The setting value. 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0

SDK Sample

Java SDK
QueryResourceConfigAction action = new QueryResourceConfigAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryResourceConfigAction.Result res = action.call();
Python SDK
QueryResourceConfigAction action = QueryResourceConfigAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryResourceConfigAction.Result res = action.call()

UpdateResourceConfig

API Request

URLs
PUT zstack/v1/resource-configurations/{category}/{name}/{resourceUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateResourceConfig": {
    "value": "10"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateResourceConfig":{"value":"10"}}' http://localhost:8080/zstack/v1/resource-configurations/host/cpu.overProvisioning.ratio/afd5f67a253b4990b9e8160672357eed/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
category String url The setting category. 3.4.0
name String url The setting name. 3.4.0
resourceUuid String url The resource UUID. 3.4.0
value String body (contained in the updateResourceConfig structure) The setting value. 3.4.0
systemTags List body Optional. The system tags. 3.4.0
userTags List body Optional. The user tags. 3.4.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "ce61962673574ff689e2e6cb6f8cf558",
    "resourceUuid": "435a7c71c82b4b0b971f4674ab346822",
    "resourceType": "ClusterVO",
    "name": "cpu.overProvisioning.ratio",
    "category": "host",
    "value": "10",
    "createDate": "Nov 14, 2017 10:20:57 PM",
    "lastOpDate": "Nov 14, 2017 10:20:57 PM"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.4.0
inventory ResourceConfigInventory See inventory. 3.4.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.4.0
description String The brief description of the error. 3.4.0
details String The details about the error. 3.4.0
elaboration String The reserved field. Default value: null. 3.4.0
opaque LinkedHashMap The reserved field. Default value: null. 3.4.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.4.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 3.4.0
resourceUuid String The resource UUID corresponded by the setting. 3.4.0
resourceType String The resource type corresponded by the setting. 3.4.0
name String The setting name. 3.4.0
description String The detailed description of the setting. 3.4.0
category String The setting category. 3.4.0
value String The setting value. 3.4.0
createDate Timestamp The creation date. 3.4.0
lastOpDate Timestamp The last operation date. 3.4.0

SDK Sample

Java SDK
UpdateResourceConfigAction action = new UpdateResourceConfigAction();
action.category = "host";
action.name = "cpu.overProvisioning.ratio";
action.resourceUuid = "5fa296dff4f04c96b29f38bef93e9e15";
action.value = "10";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateResourceConfigAction.Result res = action.call();
Python SDK
UpdateResourceConfigAction action = UpdateResourceConfigAction()
action.category = "host"
action.name = "cpu.overProvisioning.ratio"
action.resourceUuid = "1e0f389aca364a1f94929bb4f39597b3"
action.value = "10"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateResourceConfigAction.Result res = action.call()

Template Operations

ApplyTemplateConfig

API Request

URLs
PUT zstack/v1/template-configurations/{templateUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "applyTemplateConfig": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"applyTemplateConfig":{}}' http://localhost:8080/zstack/v1/template-configurations/00000000/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
templateUuid String url The template UUID. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
ApplyTemplateConfigAction action = new ApplyTemplateConfigAction();
action.templateUuid = "00000000";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ApplyTemplateConfigAction.Result res = action.call();
Python SDK
ApplyTemplateConfigAction action = ApplyTemplateConfigAction()
action.templateUuid = "00000000"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ApplyTemplateConfigAction.Result res = action.call()

QueryGlobalConfigTemplate

API Request

URLs
GET zstack/v1/template-configurations/templates
GET zstack/v1/template-configurations/templates/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/template-configurations/templates?

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryGlobalConfigTemplate, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "uuid": "reservedCapacity",
      "name": "scenes1",
      "type": "System",
      "description": "For scenes1"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.6.0
inventories List See inventories. 3.6.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0
#inventories
Name Type Description Starting Version
uuid String The resource UUID. 3.6.0
name String The template name. 3.6.0
type String The template type. 3.6.0
description String The detailed description of and the recommended scenario of the template. 3.6.0

SDK Sample

Java SDK
QueryGlobalConfigTemplateAction action = new QueryGlobalConfigTemplateAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryGlobalConfigTemplateAction.Result res = action.call();
Python SDK
QueryGlobalConfigTemplateAction action = QueryGlobalConfigTemplateAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryGlobalConfigTemplateAction.Result res = action.call()

QueryTemplateConfig

API Request

URLs
GET zstack/v1/template-configurations/configs
GET zstack/v1/template-configurations/configs/{uuid}
Headers
Authorization: OAuth the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/template-configurations/configs?

Queryable Fields

You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryTemplateConfig, and pressing the Tab key.

API Response

Sample Response
{
  "inventories": [
    {
      "templateUuid": "0000111122223333",
      "category": "backupStorage",
      "name": "reservedCapacity",
      "defaultValue": "1G",
      "value": "2G"
    }
  ]
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.6.0
inventories List See inventories. 3.6.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0
#inventories
Name Type Description Starting Version
templateUuid String The template UUID. 3.6.0
category String The setting category. 3.6.0
name String The setting name. 3.6.0
defaultValue String The default template value. 3.6.0
value String The template value. 3.6.0

SDK Sample

Java SDK
QueryTemplateConfigAction action = new QueryTemplateConfigAction();
action.conditions = asList();
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryTemplateConfigAction.Result res = action.call();
Python SDK
QueryTemplateConfigAction action = QueryTemplateConfigAction()
action.conditions = []
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryTemplateConfigAction.Result res = action.call()

UpdateTemplateConfig

API Request

URLs
PUT zstack/v1/template-configurations/{templateUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateTemplateConfig": {
    "category": "quota",
    "name": "scheduler.num",
    "value": "90"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateTemplateConfig":{"category":"quota","name":"scheduler.num","value":"90"}}' http://localhost:8080/zstack/v1/template-configurations/0000/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
templateUuid String url The template UUID. 3.6.0
category String body (contained in the updateTemplateConfig structure) The corresponding global setting category. 3.6.0
name String body (contained in the updateTemplateConfig structure) The corresponding global setting name. 3.6.0
value String body (contained in the updateTemplateConfig structure) The template value. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

Sample Response
{
  "inventory": {
    "templateUuid": "000011112222",
    "category": "vm",
    "name": "emulateHyperV",
    "defaultValue": "true",
    "value": "true"
  }
}
Name Type Description Starting Version
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 3.6.0
inventory TemplateConfigInventory See inventory. 3.6.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 3.6.0
description String The brief description of the error. 3.6.0
details String The details about the error. 3.6.0
elaboration String The reserved field. Default value: null. 3.6.0
opaque LinkedHashMap The reserved field. Default value: null. 3.6.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 3.6.0
#inventory
Name Type Description Starting Version
templateUuid String The template UUID. 3.6.0
category String The setting category. 3.6.0
name String The setting name. 3.6.0
defaultValue String The default template value. 3.6.0
value String The template value. 3.6.0

SDK Sample

Java SDK
UpdateTemplateConfigAction action = new UpdateTemplateConfigAction();
action.templateUuid = "0000";
action.category = "quota";
action.name = "scheduler.num";
action.value = "90";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateTemplateConfigAction.Result res = action.call();
Python SDK
UpdateTemplateConfigAction action = UpdateTemplateConfigAction()
action.templateUuid = "0000"
action.category = "quota"
action.name = "scheduler.num"
action.value = "90"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateTemplateConfigAction.Result res = action.call()

ResetTemplateConfig

API Request

URLs
PUT zstack/v1/template-configurations/{templateUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "resetTemplateConfig": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"resetTemplateConfig":{}}' http://localhost:8080/zstack/v1/template-configurations/00000000/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
templateUuid String url The template UUID. 3.6.0
systemTags List body Optional. The system tags. 3.6.0
userTags List body Optional. The user tags. 3.6.0

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
ResetTemplateConfigAction action = new ResetTemplateConfigAction();
action.templateUuid = "00000000";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
ResetTemplateConfigAction.Result res = action.call();
Python SDK
ResetTemplateConfigAction action = ResetTemplateConfigAction()
action.templateUuid = "00000000"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
ResetTemplateConfigAction.Result res = action.call()

RevertTemplateConfig

API Request

URLs
PUT zstack/v1/template-configurations/{templateUuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "resetTemplateConfig": {},
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \-X PUT -d '{"revertTemplateConfig":{}}' http://localhost:8080/zstack/v1/template-configurations/fd5ae067a0b037d2af3a6ec060c4be86/actions
Request Parameters
Name Type Location Description Valid Value Starting Version
templateUuid String url The template UUID. 4.6.21
systemTags List body Optional. The system tags. 4.6.21
userTags List body Optional. The user tags. 4.6.21

API Response

When the API succeeded, an empty JSON structure {} is returned. When the API failed, the returned JSON structure includes an error field. For example,
{
	"error": {
		"code": "SYS.1001",
		"description": "A message or a operation timeout",
		"details": "Create VM on KVM timeout after 300s"
	}
}

SDK Sample

Java SDK
RevertTemplateConfigAction action = new RevertTemplateConfigAction();
action.templateUuid = "fd5ae067a0b037d2af3a6ec060c4be86";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
RevertTemplateConfigAction.Result res = action.call();
Python SDK
RevertTemplateConfigAction action = RevertTemplateConfigAction()
action.templateUuid = "fd5ae067a0b037d2af3a6ec060c4be86"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
RevertTemplateConfigAction.Result res = action.call()

HA Policy Operations

UpdateHaStrategyCondition

API Request

URLs
PUT zstack/v1/ha-strategy-condition/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "updateHaStrategyCondition": {
    "name": "new ha strategycondition name",
    "state": "Enable"
  },
  "systemTags": [],
  "userTags": []
}
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateHaStrategyCondition":{"name":"new ha strategycondition name","state":"Enable"}}' http://localhost:8080/zstack/v1/ha-strategy-condition/bf798f9ae94f3007a293f090ec555d57/actions
Request Parameters
Name Type Location Description Optional Value Starting Version
uuid String url The resource UUID. 4.7.0
name String body (contained in the updateHaStrategyCondition structure) Optional. The resource name. 4.7.0
state String body(contained in the updateHaStrategyCondition structure) Optional. The state 4.7.0
systemTags List body Optional. The system tags. 4.7.0
userTags List body Optional. The user tags. 4.7.0

API Response

Sample Response
{
  "inventory": {
    "uuid": "9a01c1cea2793814b8b1bf228a2ff601",
    "name": "test",
    "fencerName": "hostStorageState"
  }
}
Name Type Description Starting Version
success boolean 4.7.0
error ErrorCode The error code. If not null, the operation fails, or vice versa. For more information, see error. 4.7.0
inventory ResourceConfigInventory See inventory. 4.7.0
#error
Name Type Description Starting Version
code String The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. 4.7.0
description String The brief description of the error. 4.7.0
details String The details about the error. 4.7.0
elaboration String The reserved field. Default value: null. 4.7.0
opaque LinkedHashMap The reserved field. Default value: null. 4.7.0
cause ErrorCode The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. 4.7.0
#inventory
Name Type Description Starting Version
uuid String The resource UUID. 4.7.0
name String The resource namne. 4.7.0
fencerName String The fencer name. 4.7.0
state String The state. 4.7.0
createDate Timestamp The creation date. 4.7.0
lastOpDate Timestamp The last operation date. 4.7.0

SDK Sample

Java SDK
UpdateHaStrategyConditionAction action = new UpdateHaStrategyConditionAction();
action.uuid = "bf798f9ae94f3007a293f090ec555d57";
action.name = "new ha strategycondition name";
action.state = "Enable";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateHaStrategyConditionAction.Result res = action.call();
Python SDK
UpdateHaStrategyConditionAction action = UpdateHaStrategyConditionAction()
action.uuid = "bf798f9ae94f3007a293f090ec555d57"
action.name = "new ha strategycondition name"
action.state = "Enable"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateHaStrategyConditionAction.Result res = action.call()
API Reference | 5.4.12 | ZStack Cloud · ZCF | ZStack Resource Center