Skip to main content

Schedule

Schedules define time-based policies for security rule enforcement. The scm CLI supports recurring daily, recurring weekly, and non-recurring schedule types.

Overview

The schedule commands allow you to:

  • Create recurring daily schedules with time ranges
  • Create recurring weekly schedules with per-day time ranges
  • Create non-recurring schedules for one-time windows
  • Delete schedules that are no longer needed
  • Bulk import schedules from YAML files
  • Export schedules for backup or migration

Set Schedule

Create or update a schedule.

Syntax

scm set object schedule NAME [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEName of the scheduleYes

Options

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--schedule-type TEXTSchedule type: recurring-daily, recurring-weekly, or non-recurringYes
--time-range TEXTTime ranges (for daily/non-recurring)No
--monday TEXTMonday time ranges (for weekly)No
--tuesday TEXTTuesday time ranges (for weekly)No
--wednesday TEXTWednesday time ranges (for weekly)No
--thursday TEXTThursday time ranges (for weekly)No
--friday TEXTFriday time ranges (for weekly)No
--saturday TEXTSaturday time ranges (for weekly)No
--sunday TEXTSunday time ranges (for weekly)No

* Exactly one of --folder, --snippet, or --device is required.

Examples

Create a Recurring Daily Schedule

$ scm set object schedule business-hours \
--schedule-type recurring-daily \
--folder Texas \
--time-range "08:00-17:00"
---> 100%
Created schedule: business-hours in folder Texas

Create a Recurring Weekly Schedule

$ scm set object schedule weekday-schedule \
--schedule-type recurring-weekly \
--folder Texas \
--monday "09:00-17:00" \
--tuesday "09:00-17:00" \
--wednesday "09:00-17:00" \
--thursday "09:00-17:00" \
--friday "09:00-12:00"
---> 100%
Created schedule: weekday-schedule in folder Texas

Delete Schedule

Delete a schedule from SCM.

Syntax

scm delete object schedule NAME [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEName of the schedule to deleteYes

Options

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--forceSkip confirmation promptNo

* Exactly one of --folder, --snippet, or --device is required.

Example

$ scm delete object schedule business-hours --folder Texas --force
---> 100%
Deleted schedule: business-hours from folder Texas

Load Schedules

Load multiple schedules from a YAML file.

Syntax

scm load object schedule [OPTIONS]

Options

OptionDescriptionRequired
--file TEXTPath to YAML file containing schedule definitionsYes
--folder TEXTOverride folder location for all objectsNo
--snippet TEXTOverride snippet location for all objectsNo
--device TEXTOverride device location for all objectsNo
--dry-runPreview changes without applying themNo

YAML File Format

---
schedules:
- name: business-hours
folder: Texas
schedule_type: recurring-daily
time_range: "08:00-17:00"

- name: weekday-schedule
folder: Texas
schedule_type: recurring-weekly
days_monday: "09:00-17:00"
days_tuesday: "09:00-17:00"
days_wednesday: "09:00-17:00"
days_thursday: "09:00-17:00"
days_friday: "09:00-12:00"

Examples

Load with Original Locations

$ scm load object schedule --file schedules.yaml
---> 100%
✓ Loaded schedule: business-hours
✓ Loaded schedule: weekday-schedule

Successfully loaded 2 out of 2 schedules from 'schedules.yaml'

Load with Folder Override

$ scm load object schedule --file schedules.yaml --folder Austin
---> 100%
✓ Loaded schedule: business-hours
✓ Loaded schedule: weekday-schedule

Successfully loaded 2 out of 2 schedules from 'schedules.yaml'
note

When using container override options (--folder, --snippet, --device), all schedules will be loaded into the specified container, ignoring the container specified in the YAML file.

Show Schedule

Display schedule objects.

Syntax

scm show object schedule [NAME] [OPTIONS]

Arguments

ArgumentDescriptionRequired
NAMEName of the schedule to show; omit to list allNo

Options

OptionDescriptionRequired
--folder TEXTFolder locationYes*
--snippet TEXTSnippet locationYes*
--device TEXTDevice locationYes*
--max-results INTEGERMaximum number of results to displayNo
--output [table|json|yaml]Output format (default: table)No

* Exactly one of --folder, --snippet, or --device is required.

note

When no NAME argument is provided, all items are listed by default.

Examples

Show Specific Schedule

$ scm show object schedule business-hours --folder Texas
---> 100%
Schedule: business-hours
Location: Folder 'Texas'
Type: recurring-daily
Time Range: 08:00-17:00

List All Schedules (Default Behavior)

$ scm show object schedule --folder Texas
---> 100%
Schedules in folder 'Texas':
------------------------------------------------------------
Name: business-hours
Type: recurring-daily
Time Range: 08:00-17:00
------------------------------------------------------------
Name: weekday-schedule
Type: recurring-weekly
Monday: 09:00-17:00
Tuesday: 09:00-17:00
Wednesday: 09:00-17:00
Thursday: 09:00-17:00
Friday: 09:00-12:00
------------------------------------------------------------

Backup Schedules

Backup all schedule objects from a specified location to a YAML file.

Syntax

scm backup object schedule [OPTIONS]

Options

OptionDescriptionRequired
--folder TEXTFolder to backup schedules fromNo*
--snippet TEXTSnippet to backup schedules fromNo*
--device TEXTDevice to backup schedules fromNo*
--file TEXTOutput filename (defaults to auto-generated)No

* One of --folder, --snippet, or --device is required.

Examples

Backup from Folder

$ scm backup object schedule --folder Texas
---> 100%
Successfully backed up 5 schedules to schedule_folder_texas_20240115_120530.yaml

Backup with Custom Filename

$ scm backup object schedule --folder Texas --file texas-schedules.yaml
---> 100%
Successfully backed up 5 schedules to texas-schedules.yaml

Best Practices

  1. Use Descriptive Names: Name schedules after their purpose (e.g., business-hours, maintenance-window).
  2. Time Format: Use 24-hour format (HH:MM) for time ranges.
  3. Weekly Schedules: Only define days that need specific time ranges.
  4. Use YAML for Bulk Operations: For managing multiple schedules, use YAML files.
  5. Organize by Folder: Keep schedules organized in logical folders alongside related policies.