Network Security Policy Schedule Operations
CreateNetworkSecurityPolicySchedule
API Request
URLs
POST zstack/v1/network-security-policy-schedulesHeaders
Authorization: OAuth the-session-uuidBody
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
{
"params": {
"name": "office-hours",
"description": "Weekday office hours",
"resourceType": "SecurityGroup",
"resourceUuid": "d1a544b28f443966aa454aa2f6fc4ba9",
"timeType": "UTC",
"repeatType": "Weekly",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"startTime": "09:00",
"endTime": "18:00",
"weekDays": [
1,
2,
3,
4,
5
]
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"name":"office-hours","description":"Weekday office hours","resourceType":"SecurityGroup","resourceUuid":"d1a544b28f443966aa454aa2f6fc4ba9","timeType":"UTC","repeatType":"Weekly","startDate":"2026-01-01","endDate":"2026-12-31","startTime":"09:00","endTime":"18:00","weekDays":[1,2,3,4,5]}}' \
http://localhost:8080/zstack/v1/network-security-policy-schedulesRequest Parameters
| Name | Type | Location | Description | Optional Values | Starting Version |
|---|---|---|---|---|---|
| name | String | body (contained in the params structure) | The name. | 5.5.38 | |
| description | String | body (contained in the params structure) | Optional. The description. | 5.5.38 | |
| resourceType | String | body (contained in the params structure) | The type of the associated resource. |
| 5.5.38 |
| resourceUuid | String | body (contained in the params structure) | The UUID of the associated resource. | 5.5.38 | |
| timeType | String | body (contained in the params structure) | The time type. Local or UTC. |
| 5.5.38 |
| repeatType | String | body (contained in the params structure) | The schedule type. |
| 5.5.38 |
| startDate | String | body (contained in the params structure) | The start date, in the format of yyyy-MM-dd. | 5.5.38 | |
| endDate | String | body (contained in the params structure) | The end date, in the format of yyyy-MM-dd. | 5.5.38 | |
| startTime | String | body (contained in the params structure) | The start time, in the format of HH:mm. | 5.5.38 | |
| endTime | String | body (contained in the params structure) | The end time, in the format of HH:mm. For Weekly, 00:00 to 00:00 indicates all day. | 5.5.38 | |
| weekDays | List | body (contained in the params structure) | Optional. The weekdays when the Weekly schedule takes effect. 1 indicates Monday, and 7 indicates Sunday. | 5.5.38 | |
| systemTags | List | body | Optional. The system tags. | 5.5.38 | |
| userTags | List | body | Optional. The user tags. | 5.5.38 |
API Response
Sample Response
{
"inventory": {
"uuid": "4c4aa4f9b7254d76b48ad99f6a20c9ee",
"name": "office-hours",
"description": "Weekday office hours",
"resourceType": "SecurityGroup",
"resourceUuid": "f1a72f89f9624c92a84cbd07347be003",
"timeType": "UTC",
"repeatType": "Weekly",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"startTime": "09:00",
"endTime": "18:00",
"weekDays": [
1,
2,
3,
4,
5
],
"timeStatus": "InWindow",
"expiring": false,
"createDate": "Jan 1, 2026 12:00:00 AM",
"lastOpDate": "Jan 1, 2026 12:00:00 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeds. | 5.5.38 |
| error | ErrorCode | See error. | 5.5.38 |
| inventory | NetworkSecurityPolicyScheduleInventory | See inventory. | 5.5.38 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The schedule UUID. | 5.5.38 |
| name | String | The name. | 5.5.38 |
| description | String | The description. | 5.5.38 |
| resourceType | String | The type of the associated resource. | 5.5.38 |
| resourceUuid | String | The UUID of the associated resource. | 5.5.38 |
| timeType | String | The time type. Local or UTC. | 5.5.38 |
| repeatType | String | Once or Weekly | 5.5.38 |
| startDate | String | The start date, in the format of yyyy-MM-dd. | 5.5.38 |
| endDate | String | The end date, in the format of yyyy-MM-dd. | 5.5.38 |
| startTime | String | The start time, in the format of HH:mm. | 5.5.38 |
| endTime | String | The end time, in the format of HH:mm. | 5.5.38 |
| weekDays | List | The weekdays when the Weekly schedule takes effect. | 5.5.38 |
| expiring | boolean | The time until the end of the last valid window is greater than 0 and less than 24 hours. | 5.5.38 |
| createDate | Timestamp | The creation time. | 5.5.38 |
| lastOpDate | Timestamp | The last modification time. | 5.5.38 |
| timeStatus | NetworkSecurityPolicyScheduleTimeStatus | See timeStatus. | 5.5.38 |
#timeStatus
| Name | Type | Description | Starting Version |
|---|---|---|---|
| NotStarted | NetworkSecurityPolicyScheduleTimeStatus | The overall start boundary has not been reached. | 5.5.38 |
| InWindow | NetworkSecurityPolicyScheduleTimeStatus | The current minute is within a valid time window. | 5.5.38 |
| OutOfWindow | NetworkSecurityPolicyScheduleTimeStatus | The current time is not within a valid time window, but subsequent valid windows still exist. | 5.5.38 |
| Ended | NetworkSecurityPolicyScheduleTimeStatus | No subsequent valid window exists. | 5.5.38 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 5.3.20 |
| description | String | The brief description of the error. | 5.3.20 |
| details | String | The details about the error. | 5.3.20 |
| elaboration | String | The reserved field. Default: null. | 5.3.20 |
| opaque | LinkedHashMap | The reserved field. Default: null. | 5.3.20 |
| cause | ErrorCode | The root error, which is the source error that causes the current error. If there is no source error, this field is null. | 5.3.20 |
SDK Sample
Java SDK
CreateNetworkSecurityPolicyScheduleAction action = new CreateNetworkSecurityPolicyScheduleAction();
action.name = "office-hours";
action.description = "Weekday office hours";
action.resourceType = "SecurityGroup";
action.resourceUuid = "d1a544b28f443966aa454aa2f6fc4ba9";
action.timeType = "UTC";
action.repeatType = "Weekly";
action.startDate = "2026-01-01";
action.endDate = "2026-12-31";
action.startTime = "09:00";
action.endTime = "18:00";
action.weekDays = asList(1,2,3,4,5);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateNetworkSecurityPolicyScheduleAction.Result res = action.call();Python SDK
action = CreateNetworkSecurityPolicyScheduleAction()
action.name = "office-hours"
action.description = "Weekday office hours"
action.resourceType = "SecurityGroup"
action.resourceUuid = "d1a544b28f443966aa454aa2f6fc4ba9"
action.timeType = "UTC"
action.repeatType = "Weekly"
action.startDate = "2026-01-01"
action.endDate = "2026-12-31"
action.startTime = "09:00"
action.endTime = "18:00"
action.weekDays = [1, 2, 3, 4, 5]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()DeleteNetworkSecurityPolicySchedule
API Request
URLs
DELETE zstack/v1/network-security-policy-schedules/{uuid}Headers
Authorization: OAuth the-session-uuidCurl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X DELETE \
http://localhost:8080/zstack/v1/network-security-policy-schedules/d2dd5f75e21f3a7bb196887388092856Request Parameters
| Name | Type | Location | Description | Optional Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The schedule UUID. | 5.5.38 | |
| deleteMode | String | body | Optional. The deletion mode. | 5.5.38 | |
| systemTags | List | body | Optional. The system tags. | 5.5.38 | |
| userTags | List | body | Optional. The user tags. | 5.5.38 |
API Response
The API returns an empty JSON structure
{} when the operation succeeds. If an error occurs, the returned JSON structure contains 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
DeleteNetworkSecurityPolicyScheduleAction action = new DeleteNetworkSecurityPolicyScheduleAction();
action.uuid = "d2dd5f75e21f3a7bb196887388092856";
action.deleteMode = "Permissive";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
DeleteNetworkSecurityPolicyScheduleAction.Result res = action.call();Python SDK
action = DeleteNetworkSecurityPolicyScheduleAction()
action.uuid = "d2dd5f75e21f3a7bb196887388092856"
action.deleteMode = "Permissive"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()GetNetworkSecurityPolicySchedule
API Request
URLs
GET zstack/v1/network-security-policy-schedulesHeaders
Authorization: OAuth the-session-uuidCurl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET \
http://localhost:8080/zstack/v1/network-security-policy-schedules?resourceUuid=ff9de337b8e93ddd8d0e384d7314c028&timeStatus=OutOfWindow&repeatType=Weekly&timeType=UTCRequest Parameters
| Name | Type | Location | Description | Optional Values | Starting Version |
|---|---|---|---|---|---|
| resourceUuid | String | query | The resource UUID. | 5.5.38 | |
| timeStatus | String | query | Optional. The time status. |
| 5.5.38 |
| repeatType | String | query | Optional. The schedule type. |
| 5.5.38 |
| timeType | String | query | Optional. The time type. |
| 5.5.38 |
| systemTags | List | query | Optional. The system tags. | 5.5.38 | |
| userTags | List | query | Optional. The user tags. | 5.5.38 |
API Response
Sample Response
{
"inventories": [
{
"uuid": "4c4aa4f9b7254d76b48ad99f6a20c9ee",
"name": "office-hours",
"description": "Weekday office hours",
"resourceType": "SecurityGroup",
"resourceUuid": "f1a72f89f9624c92a84cbd07347be003",
"timeType": "UTC",
"repeatType": "Weekly",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"startTime": "09:00",
"endTime": "18:00",
"weekDays": [
1,
2,
3,
4,
5
],
"timeStatus": "InWindow",
"expiring": false,
"createDate": "Jan 1, 2026 12:00:00 AM",
"lastOpDate": "Jan 1, 2026 12:00:00 AM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeds. | 5.5.38 |
| error | ErrorCode | See error. | 5.5.38 |
| inventories | List | The schedule list of the associated resource. | 5.5.38 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 5.3.20 |
| description | String | The brief description of the error. | 5.3.20 |
| details | String | The details about the error. | 5.3.20 |
| elaboration | String | The reserved field. Default: null. | 5.3.20 |
| opaque | LinkedHashMap | The reserved field. Default: null. | 5.3.20 |
| cause | ErrorCode | The root error, which is the source error that causes the current error. If there is no source error, this field is null. | 5.3.20 |
SDK Sample
Java SDK
GetNetworkSecurityPolicyScheduleAction action = new GetNetworkSecurityPolicyScheduleAction();
action.resourceUuid = "ff9de337b8e93ddd8d0e384d7314c028";
action.timeStatus = "OutOfWindow";
action.repeatType = "Weekly";
action.timeType = "UTC";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
GetNetworkSecurityPolicyScheduleAction.Result res = action.call();Python SDK
action = GetNetworkSecurityPolicyScheduleAction()
action.resourceUuid = "ff9de337b8e93ddd8d0e384d7314c028"
action.timeStatus = "OutOfWindow"
action.repeatType = "Weekly"
action.timeType = "UTC"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()SetNetworkSecurityPolicySchedule
API Request
URLs
PUT zstack/v1/network-security-policy-schedules/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
{
"setNetworkSecurityPolicySchedule": {
"scheduleUuid": "e789526dcde034068670924472952842",
"resourceType": "SecurityGroup",
"resourceUuid": "e32979f01e2f3f32a6eafcfb26b985d0"
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"setNetworkSecurityPolicySchedule":{"scheduleUuid":"e789526dcde034068670924472952842","resourceType":"SecurityGroup","resourceUuid":"e32979f01e2f3f32a6eafcfb26b985d0"}}' \
http://localhost:8080/zstack/v1/network-security-policy-schedules/actionsRequest Parameters
| Name | Type | Location | Description | Optional Values | Starting Version |
|---|---|---|---|---|---|
| scheduleUuid | String | body (contained in the setNetworkSecurityPolicySchedule structure) | Optional. The schedule UUID. If empty, the current setting is cancelled. | 5.5.38 | |
| resourceType | String | body (contained in the setNetworkSecurityPolicySchedule structure) | The target resource type. |
| 5.5.38 |
| resourceUuid | String | body (contained in the setNetworkSecurityPolicySchedule structure) | The target resource UUID. | 5.5.38 | |
| systemTags | List | body | Optional. The system tags. | 5.5.38 | |
| userTags | List | body | Optional. The user tags. | 5.5.38 |
API Response
The API returns an empty JSON structure
{} when the operation succeeds. If an error occurs, the returned JSON structure contains 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
SetNetworkSecurityPolicyScheduleAction action = new SetNetworkSecurityPolicyScheduleAction();
action.scheduleUuid = "e789526dcde034068670924472952842";
action.resourceType = "SecurityGroup";
action.resourceUuid = "e32979f01e2f3f32a6eafcfb26b985d0";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
SetNetworkSecurityPolicyScheduleAction.Result res = action.call();Python SDK
action = SetNetworkSecurityPolicyScheduleAction()
action.scheduleUuid = "e789526dcde034068670924472952842"
action.resourceType = "SecurityGroup"
action.resourceUuid = "e32979f01e2f3f32a6eafcfb26b985d0"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()UpdateNetworkSecurityPolicySchedule
API Request
URLs
PUT zstack/v1/network-security-policy-schedules/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.
{
"updateNetworkSecurityPolicySchedule": {
"name": "office-hours",
"description": "Weekday office hours",
"timeType": "UTC",
"repeatType": "Weekly",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"startTime": "09:00",
"endTime": "18:00",
"weekDays": [
1,
2,
3,
4,
5
]
},
"systemTags": [],
"userTags": []
}
Note: In the preceding example, the systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateNetworkSecurityPolicySchedule":{"name":"office-hours","description":"Weekday office hours","timeType":"UTC","repeatType":"Weekly","startDate":"2026-01-01","endDate":"2026-12-31","startTime":"09:00","endTime":"18:00","weekDays":[1,2,3,4,5]}}' \
http://localhost:8080/zstack/v1/network-security-policy-schedules/a293605961af30939fddccb54074b85e/actionsRequest Parameters
| Name | Type | Location | Description | Optional Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The schedule UUID. | 5.5.38 | |
| name | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The name. | 5.5.38 | |
| description | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | Optional. The description. If not specified, it is cleared. | 5.5.38 | |
| timeType | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The time type. Local or UTC. |
| 5.5.38 |
| repeatType | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The schedule type. |
| 5.5.38 |
| startDate | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The start date, in the format of yyyy-MM-dd. | 5.5.38 | |
| endDate | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The end date, in the format of yyyy-MM-dd. | 5.5.38 | |
| startTime | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The start time, in the format of HH:mm. | 5.5.38 | |
| endTime | String | body (contained in the updateNetworkSecurityPolicySchedule structure) | The end time, in the format of HH:mm. For Weekly, 00:00 to 00:00 indicates all day. | 5.5.38 | |
| weekDays | List | body (contained in the updateNetworkSecurityPolicySchedule structure) | Optional. The weekdays when the Weekly schedule takes effect. 1 indicates Monday, and 7 indicates Sunday. | 5.5.38 | |
| systemTags | List | body | Optional. The system tags. | 5.5.38 | |
| userTags | List | body | Optional. The user tags. | 5.5.38 |
API Response
Sample Response
{
"inventory": {
"uuid": "4c4aa4f9b7254d76b48ad99f6a20c9ee",
"name": "office-hours",
"description": "Weekday office hours",
"resourceType": "SecurityGroup",
"resourceUuid": "f1a72f89f9624c92a84cbd07347be003",
"timeType": "UTC",
"repeatType": "Weekly",
"startDate": "2026-01-01",
"endDate": "2026-12-31",
"startTime": "09:00",
"endTime": "18:00",
"weekDays": [
1,
2,
3,
4,
5
],
"timeStatus": "InWindow",
"expiring": false,
"createDate": "Jan 1, 2026 12:00:00 AM",
"lastOpDate": "Jan 1, 2026 12:00:00 AM"
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| success | boolean | Whether the operation succeeds. | 5.5.38 |
| error | ErrorCode | See error. | 5.5.38 |
| inventory | NetworkSecurityPolicyScheduleInventory | See inventory. | 5.5.38 |
#inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The schedule UUID. | 5.5.38 |
| name | String | The name. | 5.5.38 |
| description | String | The description. | 5.5.38 |
| resourceType | String | The type of the associated resource. | 5.5.38 |
| resourceUuid | String | The UUID of the associated resource. | 5.5.38 |
| timeType | String | The time type. Local or UTC. | 5.5.38 |
| repeatType | String | Once or Weekly | 5.5.38 |
| startDate | String | The start date, in the format of yyyy-MM-dd. | 5.5.38 |
| endDate | String | The end date, in the format of yyyy-MM-dd. | 5.5.38 |
| startTime | String | The start time, in the format of HH:mm. | 5.5.38 |
| endTime | String | The end time, in the format of HH:mm. | 5.5.38 |
| weekDays | List | The weekdays when the Weekly schedule takes effect. | 5.5.38 |
| expiring | boolean | The time until the end of the last valid window is greater than 0 and less than 24 hours. | 5.5.38 |
| createDate | Timestamp | The creation time. | 5.5.38 |
| lastOpDate | Timestamp | The last modification time. | 5.5.38 |
| timeStatus | NetworkSecurityPolicyScheduleTimeStatus | See timeStatus. | 5.5.38 |
#timeStatus
| Name | Type | Description | Starting Version |
|---|---|---|---|
| NotStarted | NetworkSecurityPolicyScheduleTimeStatus | The overall start boundary has not been reached. | 5.5.38 |
| InWindow | NetworkSecurityPolicyScheduleTimeStatus | The current minute is within a valid time window. | 5.5.38 |
| OutOfWindow | NetworkSecurityPolicyScheduleTimeStatus | The current time is not within a valid time window, but subsequent valid windows still exist. | 5.5.38 |
| Ended | NetworkSecurityPolicyScheduleTimeStatus | No subsequent valid window exists. | 5.5.38 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001. | 5.3.20 |
| description | String | The brief description of the error. | 5.3.20 |
| details | String | The details about the error. | 5.3.20 |
| elaboration | String | The reserved field. Default: null. | 5.3.20 |
| opaque | LinkedHashMap | The reserved field. Default: null. | 5.3.20 |
| cause | ErrorCode | The root error, which is the source error that causes the current error. If there is no source error, this field is null. | 5.3.20 |
SDK Sample
Java SDK
UpdateNetworkSecurityPolicyScheduleAction action = new UpdateNetworkSecurityPolicyScheduleAction();
action.uuid = "a293605961af30939fddccb54074b85e";
action.name = "office-hours";
action.description = "Weekday office hours";
action.timeType = "UTC";
action.repeatType = "Weekly";
action.startDate = "2026-01-01";
action.endDate = "2026-12-31";
action.startTime = "09:00";
action.endTime = "18:00";
action.weekDays = asList(1,2,3,4,5);
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateNetworkSecurityPolicyScheduleAction.Result res = action.call();Python SDK
action = UpdateNetworkSecurityPolicyScheduleAction()
action.uuid = "a293605961af30939fddccb54074b85e"
action.name = "office-hours"
action.description = "Weekday office hours"
action.timeType = "UTC"
action.repeatType = "Weekly"
action.startDate = "2026-01-01"
action.endDate = "2026-12-31"
action.startTime = "09:00"
action.endTime = "18:00"
action.weekDays = [1, 2, 3, 4, 5]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()