This section provides an overview for using the oracle-compute command for managing Oracle Compute Cloud Service on Oracle Public Cloud Machine.
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 |
|---|---|
|
|
The tenant user name ( Defaults to ORACLE_COMPUTE_USER environment variable. |
|
|
(Optional) URL of Oracle Compute API service. Defaults to ORACLE_COMPUTE_API environment variable. |
|
|
(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. |
This section lists the options common to all commands.
-d, --debugEnables the debug mode that shows the full details of the requests and responses.
-f format | --format=formatSpecifies 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=fieldsSpecifies 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 | --helpShows the help message and then exits.
-H | --no-headerSuppresses column headings in the default table output.
This section lists the actions that can be executed on an object. Not all objects can use all actions.
addCreates an object in a container.
deleteDeletes an object. No response is returned.
discoverDiscovers 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.
getRetrieves information of a specific object.
listRetrieves 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.
updateUpdates information of an 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]
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]
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.