Common options

Read the common command options, which describe about the arguments and options that are similar across all targets.

Common create and update options

-f, --set
The -f, --file and --set options are frequently used by actions, which result in the modification of an object, such as create or update.
With -f, you might reference a local file that contains either YAML or JSON representation of the object you are attempting to create or update.
The following descriptor.yaml command shows an example of the assembly.
name: assembly::example::1.0
description: An example descriptor
properties:
  propA:
    type: string
Run the following command to create this descriptor in a TNCO environment.
lmctl create descriptor -e dev-env -f descriptor.yaml
The --set option instead, passes the object's attribute on the command line. For example, you might create some of the descriptors mentioned earlier without any file.
lmctl create descriptor -e frosty --set name=assembly::example::1.0 --set "description=An example descriptor"
As the descriptor is a nested object, you cannot add properties. As a result, --set is only suggested for creating simple objects.
Attributes that are included in a file or with --set
Any field that is accepted on the Rest API for the target object type might be used. In simple terms, by using -f, you are writing the request body that is sent.
Use the genfile command that generates an example file, which supports many targets.
lmctl genfile assembly
The following output is generated.
Generated file: assembly.yaml
--og, --object-group
Use this option with the name of an object group to specify the group to which to assign a new object.
This option triggers an API call to retrieve the ID of the object group first, before the object can be assigned to the group. To avoid extra API calls, use the --ogid or --object-group-id options instead.
Available on the create and get options only.
--ogid, --object-group-id
Use this option with the ID of an object group to specify the group to which to assign a new object.
Available on the create and get options only.

Common get options

-o, --output
This option determines the format of the output on the console. By default, most commands use the table format.
lmctl get descriptor -e dev-env
The following output is generated.

| Name | Description |
|-------------------------------------------------+---------------------|
| resource::example::1.0 | An example resource |

You can use -o command to print YAML.
lmctl get descriptor -e dev-env -o yaml
The following output is generated.
items:
- name: resource::example::1.0
  description: An example resource
Alternatively, use -o command to print JSON.
lmctl get descriptor -e dev-env -o json
The following output is generated.
{
  "items": [
    "name": "resource::example::1.0",
    "description": "An example resource"
  ]
}
The YAML and JSON options are convenient for pushing the result to a file.
lmctl get descriptor -e dev-env -o yaml > descriptors.yaml
-f as reference
Another benefit of -f, --file is the ability to reuse the file. Many action commands, which target an existing object can use -f to determine the instance.
For example, if you created an assembly with a file and named as my-assembly.yaml, then you can use the same file to remove that assembly also.
lmctl delete assembly -e dev-env -f my-assembly.yaml
The file is parsed to resolve the name of the assembly to delete.
--og, --object-group
Use this option to list the objects in an object group by specifying the name of the group. You can't use this option when you retrieve an individual object group, only when you are retrieving a list of object groups.
For example, use the following command to retrieve a list of the descriptors in the mygroup object group:
lmctl get descriptor --og mygroup
This option triggers an API call to retrieve the ID of the object group first, before the objects in the group can be listed. To avoid extra API calls, use the --ogid or --object-group-id options instead.
--ogid, --object-group-id
Use this option to list the objects in an object group by specifying the ID of the group. You can't use this option when you retrieve an individual object group, only when you are retrieving a list of object groups.

Common delete options

--ignore-missing
You get a similar error as follows, when you attempt to delete an object that does not exist.

TNCO error occurred: DELETE request to https://9.20.192.196/api/catalog/descriptors/assembly::example::1.0 failed: status=404, message=No descriptor found with name: assembly::example::1.0

In many circumstances, if the object does not exist then the delete result must be positive. In such case, include the --ignore-missing option in your command.
lmctl delete descriptor -e dev-env assembly::example::1.0 --ignore-missing
The following output is generated.

No Descriptor found with name assembly::testexample::1.0 (ignoring)

The command indicates that the object was not found, but exits with a 0 code (success) instead of generating an error.
Warning: You must be careful with --ignore-missing. A spelling mistake in the ID or name of the target object might be overlooked as the command passes.