Skip to main content

Label

Labels provide metadata tags for organizing folders and resources in Strata Cloud Manager. The scm CLI provides commands to create, update, delete, list, bulk import, and back up labels.

Overview​

The label commands allow you to:

  • Create labels with optional descriptions
  • Update existing label configurations
  • Delete labels that are no longer needed
  • Bulk import labels from YAML files
  • Export labels for backup or migration

Set Label​

Create or update a label.

Syntax​

scm set setup label NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMELabel nameYes

Options​

OptionDescriptionRequired
--description TEXTDescriptionNo

Examples​

Create a Simple Label​

$ scm set setup label production
---> 100%
Created label: production

Create a Label with Description​

$ scm set setup label staging \
--description "Staging environment"
---> 100%
Created label: staging

Delete Label​

Delete a label from SCM.

Syntax​

scm delete setup label NAME [OPTIONS]

Arguments​

ArgumentDescriptionRequired
NAMEName of the label to deleteYes

Options​

OptionDescriptionRequired
--forceSkip confirmation promptNo

Example​

$ scm delete setup label staging --force
---> 100%
Deleted label: staging

Load Label​

Load multiple labels from a YAML file.

Syntax​

scm load setup label [OPTIONS]

Options​

OptionDescriptionRequired
--file PATHYAML file to load configurations fromYes
--dry-runSimulate execution without applying changesNo

YAML File Format​

---
labels:
- name: production
description: "Production environment"

- name: staging
description: "Staging environment"

Examples​

Load Labels from File​

$ scm load setup label --file labels.yaml
---> 100%
✓ Loaded label: production
✓ Loaded label: staging

Processed 2 labels from labels.yaml

Dry Run​

$ scm load setup label --file labels.yaml --dry-run
---> 100%
Dry run mode: would apply the following configurations:
- name: production
description: Production environment
- name: staging
description: Staging environment

Show Label​

Display label objects.

Syntax​

scm show setup label [NAME] [OPTIONS]

Arguments​

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

Options​

OptionDescriptionRequired
--output, -o [table|json|yaml]Output format (default: table)No
--max-results INTEGERMaximum number of results to displayNo
note

When no NAME is specified, all labels are listed by default.

Examples​

Show Specific Label​

$ scm show setup label production
---> 100%
Label: production
================================================================================
Description: Production environment

List All Labels (Default Behavior)​

$ scm show setup label
---> 100%
Labels (3):
--------------------------------------------------------------------------------
Name: production
Description: Production environment
--------------------------------------------------------------------------------
Name: staging
Description: Staging environment
--------------------------------------------------------------------------------
Name: development
Description: Development environment
--------------------------------------------------------------------------------

Backup Labels​

Backup all label objects to a YAML file.

Syntax​

scm backup setup label [OPTIONS]

Options​

OptionDescriptionRequired
--file TEXTOutput filename for backupNo

Examples​

Backup with Default Filename​

$ scm backup setup label
---> 100%
Successfully backed up 5 labels to labels_20240115_120530.yaml

Backup with Custom Filename​

$ scm backup setup label --file my-labels.yaml
---> 100%
Successfully backed up 5 labels to my-labels.yaml

Best Practices​

  1. Use Consistent Naming: Adopt a naming convention for labels (e.g., lowercase with hyphens) and apply it uniformly.
  2. Add Descriptions: Include descriptions to clarify each label's purpose for team members.
  3. Back Up Regularly: Export labels before making bulk changes to preserve your organization scheme.
  4. Use Dry Run for Bulk Imports: Preview bulk imports with --dry-run before applying changes.

Using labels on resources​

Labels can be applied to folders, snippets, and devices. Create the labels first with scm set setup label, then attach them via each resource's --labels flag:

# Folder
scm set setup folder Austin --parent Texas --labels production

# Snippet
scm set setup snippet Web-Security --labels production

# Device (must already exist)
scm set setup device PA-VM-01 --labels production --labels west

See folders, snippets, and devices for full details on each command.