cub link create
cub link create
Create a new link or bulk create (copy) links
Synopsis
Create a new link between two units or bulk create links by copying existing links.
SINGLE LINK CREATION:
Create a single link between two units. Links define relationships between units and can be used to establish dependencies or connections between resources.
A link can be created:
- Between units in the same space
- Between units across different spaces (by specifying the target space)
BULK LINK CREATION (COPY):
When no positional arguments are provided with --where or --filter plus at least --reverse or --from-downstream-where, bulk create mode is activated. This mode copies existing links and retargets their From and/or To units using downstream UpgradeUnit links.
Single Link Examples:
# Create a link between a deployment and its namespace in the same space
cub link create --space my-space --json to-ns my-deployment my-ns --wait
# Create a link for a complex application to its namespace
cub link create --space my-space --json headlamp-to-ns headlamp my-ns --wait
# Create a link between a cloned unit and a namespace
cub link create --space my-space --json clone-to-ns my-clone my-ns --wait
Bulk Create (Copy) Examples:
# Copy outgoing links from prod-v1 units to their downstream copies in prod-v2
cub link create --where "Space.Slug = 'prod-v1' AND ToSpaceID != SpaceID AND UpdateType != 'UpgradeUnit'" \
--from-downstream-where "UpdateType = 'UpgradeUnit' AND Space.Slug = 'prod-v2'"
# Also retarget the To units to their downstream copies
cub link create --where "Space.Slug = 'prod-v1' AND ToSpaceID != SpaceID" \
--from-downstream-where "UpdateType = 'UpgradeUnit' AND Space.Slug = 'prod-v2'" \
--to-downstream-where "UpdateType = 'UpgradeUnit' AND Space.Slug = 'prod-v2'"
# Reverse cross-space UpgradeUnit links (create the link in the To unit's space)
cub link create --where "Space.Slug = 'prod-v2' AND UpdateType = 'UpgradeUnit'" --reverse
cub link create [<link slug> <from unit slug> <to unit slug> [<to space slug>]] [flags]
Options
--allow-exists Allow creation of resources that already exist
--annotation strings annotations in key=value format; can separate by commas and/or use multiple instances of the flag
--auto-update enable automatic downstream unit updates when upstream changes
--delete-gate strings delete gates in key[=true] format; can separate by commas and/or use multiple instances of the flag
--filename string Read the ConfigHub entity JSON from file, URL (https://), or stdin (-); mutually exclusive with --from-stdin
--filter string Filter entity to apply to the list. Specify as 'space/filter' for cross-space filters or just 'filter' for current space. Supports both slugs and UUIDs. The filter will be combined with any --where clause using AND logic. Examples: "production-filters/security-check", "my-filter-uuid", "validation-rules"
--from-downstream-where string where expression to find downstream UpgradeUnit links from each source link's FromUnit; creates one copy per match
--from-stdin Read the ConfigHub entity JSON (e.g., retrieved with cub <entity> get --quiet --json) from stdin; merged with command arguments on create, and merged with command arguments and existing entity on update
-h, --help help for create
--label strings labels in key=value format; can separate by commas and/or use multiple instances of the flag
--link strings target specific links by slug or UUID for bulk create (can be repeated or comma-separated)
--make-current set link revision numbers to current unit revisions (skips initial merge)
--no-auto-update disable automatic downstream unit updates
--no-use-live-state use Data of upstream unit instead of LiveState
-o, --output string Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
--quiet No default output.
--reverse swap FromUnit and ToUnit directions of copied links (for cross-space link reversal)
--timeout string completion timeout as a duration with units, such as 10s or 2m (default "10m0s")
--to-downstream-where string where expression to find downstream UpgradeUnit link from each source link's ToUnit; exactly one match required
--update-type string link update type (NeedsProvides, MergeUnits, or UpgradeUnit)
--use-live-state use LiveState of upstream unit instead of Data
--verbose Detailed output, additive with default output
--wait wait for completion (default true)
--where string Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, NOT LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"
--where-mutation string where expression to filter mutations during merge
--where-resource string where expression to select upstream resources for propagation
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
--space string space ID to perform command on
SEE ALSO
- cub link - Link commands