2 General Syntax of opc compute Commands
You can view the general syntax of opc compute
commands by running the following command:
opc -h
The following is the general syntax of opc compute
commands:
opc [global_options...] service_name [service_options...] resource_name command [arguments...] [options...]
Option | Description | More Information |
---|---|---|
global_options... |
The global command line options. | Global Options |
service_name
|
Specify compute .
|
|
service_options... |
Command line options that are specific to Compute Classic. | Service Options |
resource_name |
The Compute Classic resource that you want to manage using To view the list of Compute Classic resources that you can manage, run the following command: opc compute -h |
|
command |
An action that you can perform on Compute Classic objects by using the CLI commands. | General CLI Command Actions |
[arguments...] [options...]
|
Arguments and options are specific to each command. |
Global Options
The following table describes the general CLI command options that you can use. It is not mandatory to provide values for any of these options.
Option | Description |
---|---|
|
Specifies whether the command output should be presented in plain-text format without any table borders, table format, or JSON format. You can specify one of the following values:
|
|
Lists values only for the specified resource attributes. You can use this option to filter the output to show only the attributes that you want to see, particularly for objects that have numerous attributes. To use this option, you must also specify the If you have already set the The list of attributes that you can specify depends on the resource. For example, the SSH key resource has the attributes Example 1: Viewing filtered output in tabular format with borders To retrieve only the names and RAM of all available shapes: opc -f table -F name,ram compute shape list Sample output This is a sample output. The output you see will vary depending on your environment. Some lines may be truncated with ellipses (...) for readability. +------------+--------+ NAME | RAM +------------+--------+ oc3 | 7680 oc5 | 30720 oc4 | 15360 oc6 | 61440 ... +------------+--------+ Example 2: Viewing filtered output in text format without table borders To retrieve only the names and RAM of all available shapes: opc -f text -F name,ram compute shape list Sample output This is a sample output. The output you see will vary depending on your environment. Some lines may be truncated with ellipses (...) for readability. NAME RAM oc3 7680 oc5 30720 oc4 15360 oc6 61440 ... ... |
|
Indicates that the command must be run in debug mode. The output in this mode is very verbose. It includes the request and response details of the internal API call that is invoked for the CLI command. This output may be useful for debugging issues. If you have already set the |
|
Specify this option when you want to disable SSL certificate verification or if you are using an unsigned certificate. |
|
Specify this option when you want to use HTTP instead of HTTPS while connection to Oracle Cloud services. |
|
A text file that contains the user name and password for authenticating access to Compute Classic. It also contains information about the REST API endpoint URL for your Compute Classic site. For information about creating a profile, see Setting Up the Required Environment Variables and Files. Note that the file must not be world-readable. If you have already set the Required if you choose not to set the environment variables: If you don't use this option and you have not set the environment variables, then while running every command you must explicitly specify the REST API endpoint URL by using the |
|
The folder that contains the file name that you specify using the If you have already set the |
|
Show help message and exit. Example opc -h
|
|
Prints the version of the CLI. Example opc --version
Sample output opc version 17.2.4 |
|
Print verbose output (where supported). |
Service Options
The following table lists the command options that are specific to Compute Classic. For information about using these options, see Setting Up Environment Variables and Files.
Option | Description |
---|---|
|
User name for authenticating access to Compute Classic. |
|
Provide the full path of the text file containing the password for the user that you specify using the |
|
The API endpoint URL of your site in Compute Classic account. Some of the examples in this guide use the following API endpoint URL:
|
|
Provide a valid authentication cookie. |
|
Show help message and exit. Example opc compute -h |
General CLI Command Actions
The following table describes the general actions that you can perform on Compute Classic objects by using the CLI commands.
Note that some of these actions may not be supported for certain objects and there may be additional, unique actions for some objects.
Action | Description |
---|---|
|
Creates an object. |
|
Deletes an object. No response is returned for the delete action. |
|
Retrieves the names of the specified object in a container and the names of the sub-containers. This command does not retrieve details of the object and the contents of the sub-container. You must specify a container, which can only be a parent path of the key field. For example, |
|
Retrieves details of the specified object. |
|
Retrieves information about the specified object from the container you specify. This command not only retrieves the name of the object, but also all other details of the object. For some objects, you can also use additional arguments to filter the output. |
|
Updates values of all the parameters of the specified object. If you don’t provide a value for a parameter while running this command, that parameter is set to |
Accessing Context-Sensitive Help at the Command Line
While executing a command, you can access context-sensitive help at the command line. Here are a few examples.
opc --help
Provides information about the general syntax to use the CLI.
opc compute --help
Provides information about the general syntax to use the
opc compute
CLI, the command-line options, and lists all the Compute Classic resources that you can manage using the CLI.opc compute instances -help
Describes the Compute Classic resource,
instances
in this example and lists the actions that you can take on this resource.SUMMARY: An Compute Classic instance is a virtual machine running a specific operating system and with CPU and memory resources that you specify USAGE: opc compute instances command [arguments...] [options...] COMMANDS: delete Delete an Instance discover Retrieve Names of all Instances in a Container get Retrieve Details of an Instance list Retrieve Details of all Instances in a Container OPTIONS: --help, -h show help
opc compute instances get -help
Provides the syntax to perform the specified action on the specified resource. In this example, the
get
action is performed on theinstances
resource. It also lists all the required and mandatory arguments to run the command and describes each argument.NAME: compute instances get - Retrieve Details of an Instance USAGE: compute instances get name DESCRIPTION: Retrieve Details of an Instance REQUIRED ARGUMENTS: name - Multipart name of the object.
The CLI also prompts you to enter the correct command, if you misspell the action or the resource name. For example:
-
opc compute orchestaration Can't find "orchestaration", did you mean "orchestration"?
-
opc compute orchestration updat Can't find "updat", did you mean "update"?