Document navigation

Network Security Policy Schedule Operations

CreateNetworkSecurityPolicySchedule

API Request

URLs
POST zstack/v1/network-security-policy-schedules
Headers
Authorization: OAuth the-session-uuid
Body
{
  "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-schedules
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
nameStringbody (contained in the params structure)The name.5.5.38
descriptionStringbody (contained in the params structure)Optional. The description.5.5.38
resourceTypeStringbody (contained in the params structure)The type of the associated resource.
  • SecurityGroup
  • VpcFirewallRuleSet
5.5.38
resourceUuidStringbody (contained in the params structure)The UUID of the associated resource.5.5.38
timeTypeStringbody (contained in the params structure)The time type. Local or UTC.
  • Local
  • UTC
5.5.38
repeatTypeStringbody (contained in the params structure)The schedule type.
  • Once
  • Weekly
5.5.38
startDateStringbody (contained in the params structure)The start date, in the format of yyyy-MM-dd.5.5.38
endDateStringbody (contained in the params structure)The end date, in the format of yyyy-MM-dd.5.5.38
startTimeStringbody (contained in the params structure)The start time, in the format of HH:mm.5.5.38
endTimeStringbody (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
weekDaysListbody (contained in the params structure)Optional. The weekdays when the Weekly schedule takes effect. 1 indicates Monday, and 7 indicates Sunday.5.5.38
systemTagsListbodyOptional. The system tags.5.5.38
userTagsListbodyOptional. 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"
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the operation succeeds.5.5.38
errorErrorCodeSee error.5.5.38
inventoryNetworkSecurityPolicyScheduleInventorySee inventory.5.5.38
#inventory
NameTypeDescriptionStarting Version
uuidStringThe schedule UUID.5.5.38
nameStringThe name.5.5.38
descriptionStringThe description.5.5.38
resourceTypeStringThe type of the associated resource.5.5.38
resourceUuidStringThe UUID of the associated resource.5.5.38
timeTypeStringThe time type. Local or UTC.5.5.38
repeatTypeStringOnce or Weekly5.5.38
startDateStringThe start date, in the format of yyyy-MM-dd.5.5.38
endDateStringThe end date, in the format of yyyy-MM-dd.5.5.38
startTimeStringThe start time, in the format of HH:mm.5.5.38
endTimeStringThe end time, in the format of HH:mm.5.5.38
weekDaysListThe weekdays when the Weekly schedule takes effect.5.5.38
expiringbooleanThe time until the end of the last valid window is greater than 0 and less than 24 hours.5.5.38
createDateTimestampThe creation time.5.5.38
lastOpDateTimestampThe last modification time.5.5.38
timeStatusNetworkSecurityPolicyScheduleTimeStatusSee timeStatus.5.5.38
#timeStatus
NameTypeDescriptionStarting Version
NotStartedNetworkSecurityPolicyScheduleTimeStatusThe overall start boundary has not been reached.5.5.38
InWindowNetworkSecurityPolicyScheduleTimeStatusThe current minute is within a valid time window.5.5.38
OutOfWindowNetworkSecurityPolicyScheduleTimeStatusThe current time is not within a valid time window, but subsequent valid windows still exist.5.5.38
EndedNetworkSecurityPolicyScheduleTimeStatusNo subsequent valid window exists.5.5.38
#error
NameTypeDescriptionStarting Version
codeStringThe error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001.5.3.20
descriptionStringThe brief description of the error.5.3.20
detailsStringThe details about the error.5.3.20
elaborationStringThe reserved field. Default: null.5.3.20
opaqueLinkedHashMapThe reserved field. Default: null.5.3.20
causeErrorCodeThe 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-uuid
Curl 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/d2dd5f75e21f3a7bb196887388092856
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
uuidStringurlThe schedule UUID.5.5.38
deleteModeStringbodyOptional. The deletion mode.5.5.38
systemTagsListbodyOptional. The system tags.5.5.38
userTagsListbodyOptional. 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-schedules
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/network-security-policy-schedules?resourceUuid=ff9de337b8e93ddd8d0e384d7314c028&timeStatus=OutOfWindow&repeatType=Weekly&timeType=UTC
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
resourceUuidStringqueryThe resource UUID.5.5.38
timeStatusStringqueryOptional. The time status.
  • NotStarted
  • InWindow
  • OutOfWindow
  • Ended
5.5.38
repeatTypeStringqueryOptional. The schedule type.
  • Once
  • Weekly
5.5.38
timeTypeStringqueryOptional. The time type.
  • Local
  • UTC
5.5.38
systemTagsListqueryOptional. The system tags.5.5.38
userTagsListqueryOptional. 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"
    }
  ]
}
NameTypeDescriptionStarting Version
successbooleanWhether the operation succeeds.5.5.38
errorErrorCodeSee error.5.5.38
inventoriesListThe schedule list of the associated resource.5.5.38
#error
NameTypeDescriptionStarting Version
codeStringThe error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001.5.3.20
descriptionStringThe brief description of the error.5.3.20
detailsStringThe details about the error.5.3.20
elaborationStringThe reserved field. Default: null.5.3.20
opaqueLinkedHashMapThe reserved field. Default: null.5.3.20
causeErrorCodeThe 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/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "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/actions
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
scheduleUuidStringbody (contained in the setNetworkSecurityPolicySchedule structure)Optional. The schedule UUID. If empty, the current setting is cancelled.5.5.38
resourceTypeStringbody (contained in the setNetworkSecurityPolicySchedule structure)The target resource type.
  • SecurityGroup
  • VpcFirewallRuleSet
5.5.38
resourceUuidStringbody (contained in the setNetworkSecurityPolicySchedule structure)The target resource UUID.5.5.38
systemTagsListbodyOptional. The system tags.5.5.38
userTagsListbodyOptional. 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}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{
  "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/actions
Request Parameters
NameTypeLocationDescriptionOptional ValuesStarting Version
uuidStringurlThe schedule UUID.5.5.38
nameStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The name.5.5.38
descriptionStringbody (contained in the updateNetworkSecurityPolicySchedule structure)Optional. The description. If not specified, it is cleared.5.5.38
timeTypeStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The time type. Local or UTC.
  • Local
  • UTC
5.5.38
repeatTypeStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The schedule type.
  • Once
  • Weekly
5.5.38
startDateStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The start date, in the format of yyyy-MM-dd.5.5.38
endDateStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The end date, in the format of yyyy-MM-dd.5.5.38
startTimeStringbody (contained in the updateNetworkSecurityPolicySchedule structure)The start time, in the format of HH:mm.5.5.38
endTimeStringbody (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
weekDaysListbody (contained in the updateNetworkSecurityPolicySchedule structure)Optional. The weekdays when the Weekly schedule takes effect. 1 indicates Monday, and 7 indicates Sunday.5.5.38
systemTagsListbodyOptional. The system tags.5.5.38
userTagsListbodyOptional. 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"
  }
}
NameTypeDescriptionStarting Version
successbooleanWhether the operation succeeds.5.5.38
errorErrorCodeSee error.5.5.38
inventoryNetworkSecurityPolicyScheduleInventorySee inventory.5.5.38
#inventory
NameTypeDescriptionStarting Version
uuidStringThe schedule UUID.5.5.38
nameStringThe name.5.5.38
descriptionStringThe description.5.5.38
resourceTypeStringThe type of the associated resource.5.5.38
resourceUuidStringThe UUID of the associated resource.5.5.38
timeTypeStringThe time type. Local or UTC.5.5.38
repeatTypeStringOnce or Weekly5.5.38
startDateStringThe start date, in the format of yyyy-MM-dd.5.5.38
endDateStringThe end date, in the format of yyyy-MM-dd.5.5.38
startTimeStringThe start time, in the format of HH:mm.5.5.38
endTimeStringThe end time, in the format of HH:mm.5.5.38
weekDaysListThe weekdays when the Weekly schedule takes effect.5.5.38
expiringbooleanThe time until the end of the last valid window is greater than 0 and less than 24 hours.5.5.38
createDateTimestampThe creation time.5.5.38
lastOpDateTimestampThe last modification time.5.5.38
timeStatusNetworkSecurityPolicyScheduleTimeStatusSee timeStatus.5.5.38
#timeStatus
NameTypeDescriptionStarting Version
NotStartedNetworkSecurityPolicyScheduleTimeStatusThe overall start boundary has not been reached.5.5.38
InWindowNetworkSecurityPolicyScheduleTimeStatusThe current minute is within a valid time window.5.5.38
OutOfWindowNetworkSecurityPolicyScheduleTimeStatusThe current time is not within a valid time window, but subsequent valid windows still exist.5.5.38
EndedNetworkSecurityPolicyScheduleTimeStatusNo subsequent valid window exists.5.5.38
#error
NameTypeDescriptionStarting Version
codeStringThe error code, which is a globally unique identifier of the error, for example, SYS.1000 or HOST.1001.5.3.20
descriptionStringThe brief description of the error.5.3.20
detailsStringThe details about the error.5.3.20
elaborationStringThe reserved field. Default: null.5.3.20
opaqueLinkedHashMapThe reserved field. Default: null.5.3.20
causeErrorCodeThe 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()
API Reference | 5.5.38 | ZStack Cloud · ZCF | ZStack Resource Center