Skip to main content
When you create a resource or list resources in interactive mode, the CLI prompts you for parameter values step by step, validates each value before continuing and shows the resulting configuration before you apply it. To use the interactive mode, add the -i or --interactive parameter to your CLI command.

Creating resources interactively

When you run a resource creation command in the interactive mode, the CLI prompts for parameters in this order:
  1. Metadata parameters.
  2. Required parameters.
  3. Optional parameters.
How the parameters are filled in depends on their data type:
  • For string parameters, specify the string directly or use the contents of a file if the string is too long. For example:
  • For the oneof, enum and bool parameters, the CLI prompts you to select one of the supported values.
If some parameters repeat, the CLI prompts you to fill in each of them separately. After you fill in the parameters, the CLI shows the full resource configuration and lets you apply it, correct the values or abort creation. For example, to create a virtual machine (VM) in the interactive mode:
  1. Create a boot disk.
  2. Run the VM creation command:
    Example session:
    First, set the metadata parameters, such as parent-id and name. Then, set the required parameters, such as resources-platform and resources-preset. Finally, set the optional parameters, such as boot-disk-attach-mode and boot-disk-existing-disk-id. Although the boot disk parameters are marked as optional, they still require input for the command to succeed.
    To create a VM, you can either create a boot disk in advance and then set it in the boot-disk-existing-disk configuration. Alternatively, use the boot-disk-managed-disk configuration, and create the boot disk and the VM simultaneously.
    After you fill in the parameters, the CLI shows the full resource and lets you apply it.

Listing resources interactively

When you run a command in interactive mode, the CLI displays the output in an alternate screen with pagination. In this mode, you can:
  • Use the keyboard to switch between pages.
  • Use the keyboard or mouse to scroll through the current page.
For example, to check Audit Logs in the interactive mode, run:
The --page-size parameter sets the number of items per page. If you do not specify this parameter, the default value is 100. The --format parameter sets the output format. Supported values are yaml, json, jsonpath, table and text. In the given example, the --format parameter displays the output as a table and includes only the action, resource.metadata.type, status and time columns. Example output: