Skip to 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 [OPTIONS]

Options

Option Description Required
--name TEXT Label name Yes
--description TEXT Description No

Examples

Create a Simple Label

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

Create a Label with Description

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

Delete Label

Delete a label from SCM.

Syntax

scm delete setup label [OPTIONS]

Options

Option Description Required
--name TEXT Name of the label to delete Yes
--force Skip confirmation prompt No

Example

$ scm delete setup label --name 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 [OPTIONS]

Options

Option Description Required
--name TEXT Name of the label to show No

Note

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

Examples

Show Specific Label

$ scm show setup label --name 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

  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.