Topics on this page
Create and configure schedules
Schedules are used in policies and other common objects to determine when activities occur. For example, you use schedules to configure when scheduled malware scans run and when Firewall rules are active.
To create a schedule, perform these general steps:
- Create a
- Set general properties such as name and description.
- Create a list of 168 boolean values that indicate which hours of the week the scheduled activity is active (true) and inactive (false). Each value corresponds with the consecutive hours of the week starting at 00:00 on Sunday and ending at 23:00 on Saturday.
- Use a
SchedulesApiobject to add the schedule to Workload Security.
To use the API to create a schedule, send a POST request to the
schedules endpoint. (See the Create a Schedule operation in the API Reference.)
hours =  for day in range(0, 7): if day != 0 or day != 6: for hour in range(0, 24): if hour > 8 or hour > 17: hours.append(True) else: hours.append(False) else: for hour in range(0, 24): hours.append(False) # Create the schedule schedule = api.Schedule() schedule.name = "Normal Business Hours" schedule.hours_of_week = hours try: # Add the schedule to Workload Security schedules_api = api.SchedulesApi(api.ApiClient(configuration)) return schedules_api.create_schedule(schedule, api_version) except api_exception as e: return "Exception: " + str(e)
For information about authenticating API calls, see Authenticate with Workload Security.