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
| Argument | Description | Required |
|---|---|---|
NAME | Label name | Yes |
Options
| Option | Description | Required |
|---|---|---|
--description TEXT | Description | No |
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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the label to delete | Yes |
Options
| Option | Description | Required |
|---|---|---|
--force | Skip confirmation prompt | No |
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
| Option | Description | Required |
|---|---|---|
--file PATH | YAML file to load configurations from | Yes |
--dry-run | Simulate execution without applying changes | No |
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
| Argument | Description | Required |
|---|---|---|
NAME | Name of the label to show; omit to list all | No |
Options
| Option | Description | Required |
|---|---|---|
--output, -o [table|json|yaml] | Output format (default: table) | No |
--max-results INTEGER | Maximum number of results to display | No |
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
| Option | Description | Required |
|---|---|---|
--file TEXT | Output filename for backup | No |
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
- Use Consistent Naming: Adopt a naming convention for labels (e.g., lowercase with hyphens) and apply it uniformly.
- Add Descriptions: Include descriptions to clarify each label's purpose for team members.
- Back Up Regularly: Export labels before making bulk changes to preserve your organization scheme.
- Use Dry Run for Bulk Imports: Preview bulk imports with
--dry-runbefore 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.