2 Overview of the Oracle Compute CLI

This section provides an overview for using the oracle-compute command for managing Oracle Compute Cloud Service on Oracle Public Cloud Machine.

General Syntax

The oracle-compute CLI tool has the following syntax:

oracle-compute -u user [ -a url] [ -p file] [options] action object [--parameter1 arg1 --parameter2 arg2 ...]
Command Option Description

-u username| --user=username

The tenant user name (/tenant_name/username), or tenant administrators (/tenant_name/username)

Defaults to ORACLE_COMPUTE_USER environment variable.

-a url| --address=url

(Optional) URL of Oracle Compute API service.

Defaults to ORACLE_COMPUTE_API environment variable.

-p file| --pass=file

(Optional) File containing the user password.

--options

(Optional)See General Command Options.

action

An operation to execute. See General Command Actions.

object

The target of the action. See About Object Names.

--parameters

(Optional) Action-specific and object-specific parameters to direct the operation.

General Command Options

This section lists the options common to all commands.

-d, --debug

Enables the debug mode that shows the full details of the requests and responses.

-f format | --format=format

Specifies the format of the command output:

  • table (default): Each field is displayed in a separate column.

  • tabbed: Each record is displayed as a tab-separated list on a single line.

  • csv: Each record is displayed as a comma-separated list on a single line.

  • json: The output is displayed in JavaScript Object Notation (JSON) format. When you specify this format, the CLI ignores the -F option.

  • xml: The output is displayed in XML format. This format can be used only for commands for the user resource.

-F fields |, --fields=fields

Specifies the fields depending on the type of object. Use this option to filter the fields or columns in the display of a large result.

-h | --help

Shows the help message and then exits.

-H | --no-header

Suppresses column headings in the default table output.

General Command Actions

This section lists the actions that can be executed on an object. Not all objects can use all actions.

add

Creates an object in a container.

delete

Deletes an object. No response is returned.

discover

Discovers objects in a container without the requirement of list or get permissions on each object. You must specify a container, which can only be a parent path of the key field (for example, / or /mytenant). Only objects in that container and names of subcontainers that the user has permission to discover are returned. The contents of subcontainers are not returned.

get

Retrieves information of a specific object.

list

Retrieves information about the listed object in the container you specify. The container can only be a key field of the specific object (for example, the tenant name, such as /mytenant/public) or a parent path of the key field (for example, / or /cloud) subject to listing permissions. Oracle Compute object key fields are usually the object names or ID fields (for example, /mytenant/public/myinstance for an instance). Be sure to use the correct field as the container, as detailed in the specific command descriptions. Use arguments to filter the output as needed.

update

Updates information of an object.

Each action can display its specific requirements for each type of object.

You can also expand Oracle Compute CLI commands at the action level to list all the objects associated with that action. For example, the oracle-compute add command lists all the objects for which the add action can be performed.

$ oracle-compute add

oracle-compute add alertrule <name> <subscriber> [--event] [--event_type] [--severity] [--error_code] [--alert_type] \
[--frequency]
oracle-compute add imagelist <name> <description> [--default]
oracle-compute add imagelistentry <imagelist name> <machineimages> <version> [--attributes]
oracle-compute add machineimage <name> <file> [--attributes] [--quota]
oracle-compute add orchestration <filename>
oracle-compute add servicenet <name> <type> [--pkey] [--num_provider_nodes] [--description]
oracle-compute add snapshot <instance> [--name] [--machineimage] [--quota]
oracle-compute add sshkey <name> <key> [--enabled] [--osuser]
oracle-compute add storageattachment <instance_name> <storage_volume_name> <index>
oracle-compute add storagevolume <name> <size> <properties> [--description] [--source_storagevolume_name] [--imagelist] \
[--imagelist_entry] [--tags] [--quota]
oracle-compute add user <username> <fullname> <email> [--role] [--password]
oracle-compute add vethernet <name> <description> <type> <id> [--switchports] [--svcnet]
In the same way, the Oracle Compute CLI also lists all the actions that can be performed on an object. For example, the oracle-compute instance command lists all the actions associated with object instance.
$oracle-compute instance

oracle-compute delete instance <name>
oracle-compute discover instance <container>
oracle-compute get instance <name>
oracle-compute list instance <container> [--tags] [--quota] [--vcable_id]
oracle-compute restart instance <name>
oracle-compute shutdown instance <name>
oracle-compute update instance <name> [--shape] [--networking] [--nis] [--tag] [--delete_tag]

About Object Names

Each Oracle Compute object for which you can execute a CLI command is identified uniquely by its URI. An object such as an instance, a storage volume, or an SSH key has a name based on its position in a hierarchy of containers.

For example, the object name /mytenant/public/8e7c16ad-1bc4-4743-a9ce-781be4e26f24 indicates that this instance 8e7c16ad-1bc4-4743-a9ce-781be4e26f24 is in the container public, and public is in the container mytenant.