Skip to content

Cani alpha add metadata custom field

cani alpha add metadata custom-field

Create a custom field definition in the inventory.

Synopsis

Create a custom field definition in the inventory metadata catalog.

The key is the internal field name used in Nautobot (use underscores, not dashes). During export, cani ensures the custom field exists in Nautobot with the specified type and content types before syncing objects that carry values for it.

Supported types: text, integer, boolean, date, url, json, select, multi-select, markdown

Examples: cani alpha add metadata custom-field site_code --label "Site Code" --type text --content-types dcim.device,dcim.rack cani alpha add metadata custom-field environment --label "Environment" --type select --content-types dcim.device --choices "prod,staging,dev" cani alpha add metadata custom-field install_date --label "Install Date" --type date --content-types dcim.device --required

cani alpha add metadata custom-field [flags]

Options

      --label string           Human-readable label (defaults to key if not set)
      --type string            Field type: text, integer, boolean, date, url, json, select, multi-select, markdown (default "text")
      --choices stringSlice    Choices for select/multi-select fields (comma-separated)
      --required               Whether the field is required
      --weight int             Display weight (higher values appear lower in forms)

Options inherited from parent commands

      --content-types stringSlice Content types (e.g. dcim.device,dcim.rack)
      --color string           Color (hex, e.g. aa1409)
      --description string     Description
  -a, --auto                   Automatically recommend values for parent hardware
  -y, --accept                 Automatically accept recommended values.
  -L, --list-supported-types   List supported hardware types.
  -q, --qty int                Quantity of items to add. (default 1)
  -p, --parent string          Parent item UUID. (default "00000000-0000-0000-0000-000000000000")
      --prefix string          Name prefix for sequential naming (used with --qty).
      --start int              Starting number for sequential names (used with --prefix). (default 1)
      --pad-width int          Zero-pad width for sequential names (0 = auto).
      --tag stringArray        Tag(s) to apply to the item (repeatable)
      --metadata stringArray   Provider metadata key=value pairs (repeatable)
      --status string          Status (Active, Available, Connected, Decommissioned, Decommissioning, Deprecated, Deprovisioning, Down, End-of-Life, Extended Support, Failed, Inventory, Maintenance, Offline, Planned, Primary, Provisioning, Reserved, Retired, Secondary, Staging, or any custom status)
      --serial string          Serial number
      --config string          config file (default "/home/runner/.cani/cani.yml")
      --debug                  enable debug mode
      --datastore string       datastore type (json, postgres) (default "json")
      --datastore-path string  override path to the datastore file (for testing)
      --types-dirs stringSlice local directories with additional hardware types
      --types-repos stringSlice git repo URLs with additional hardware types
      --types-repo-clone       clone types repos that are not yet cached locally
      --types-repo-pull        pull latest changes from types repos on startup
      --strict                 require a resolved device type (slug) for all devices (default true)

SEE ALSO

  • cani alpha add metadata - Create metadata definitions (roles, statuses, tags, custom fields) in the local inventory.