- Home
- API and CLI Reference
- CLI Reference
xcware CLI Reference
What is CLI?
The Command Line Interface (CLI) acts as the primary method for interacting with the xcware platform through the command line. It provides simplicity and is preferred for automating tasks such as infrastructure creation, application/service deployment, or scheduling operational/maintenance tasks.
Nexus CLI Mode
The CLI is embedded within the Nexus server executable (nexus). If launched without arguments, it initiates the Nexus server. However, when specific arguments are provided, it operates in CLI mode, executing designated API tasks.
Activating the CLI Mode Example
Here's an example of activating the CLI mode of Nexus in your operating system's terminal screen:
Nexus CLI Mode Result Example
The CLI Mode of Nexus accepts JSON data as input and returns JSON data as output. The following JSON represents the result of the aforementioned API task:
Supported Arguments
Now that we've covered the basics, let's explore the supported arguments of Nexus's CLI Mode.
--mode=help
--mode=reset
This argument activates the reset menu, allowing you to perform reset operations.
--mode=cli
This argument activates the CLI mode.
--api=APINAME
This argument defines the name of the API containing the commands and is obligatory in cli mode. Refer to the API Builder for potential API names.
--command=CMDNAME
This argument specifies the name of the function to be executed and is mandatory in cli mode. Refer to the API Builder for potential command names.
--account=ID
This argument indicates the account ID and is necessary in cli mode if the --secrets argument is not provided. You can locate your account ID in the "Actions" menu at the top right corner of the Nexus interface.
--accesskey=KEY
This argument signifies the authorization key associated with the roles and policies of the given account, and it's required in cli mode if the --secrets argument is not provided. Your system administrator can provide you with an authorization key.
--secretkey=KEY
This argument represents the secret key associated with the roles and policies of the specified account, and it's mandatory in cli mode if the --secrets argument is not provided. Your system administrator can provide you with a secret key.
--data='{}'
This argument represents the input data passed to the API task and is necessary in cli mode if the --datafile argument is not included. Please consult the API Builder for possible data input options.
--secrets=filename
This optional argument in cli mode denotes the file containing the account ID, access key, and secret key, organized as illustrated below. It's utilized to load credentials from a file.:
--datafile=filename
This optional argument in cli mode indicates the JSON file containing the input data passed to the API task, simplifying the handling of complex JSON structures.
The Command Line Interface (CLI) acts as the primary method for interacting with the xcware platform through the command line. It provides simplicity and is preferred for automating tasks such as infrastructure creation, application/service deployment, or scheduling operational/maintenance tasks.
Nexus CLI Mode
The CLI is embedded within the Nexus server executable (nexus). If launched without arguments, it initiates the Nexus server. However, when specific arguments are provided, it operates in CLI mode, executing designated API tasks.
Activating the CLI Mode Example
Here's an example of activating the CLI mode of Nexus in your operating system's terminal screen:
Copy
nexus --mode=cli \
--api=instances-cn \
--command=list \
--account=YOUR_ACCOUNT_ID \
--accesskey=YOUR_ACCESS_KEY \
--secretkey=YOUR_SECRET_KEY \
--data='{}'
Nexus CLI Mode Result Example
The CLI Mode of Nexus accepts JSON data as input and returns JSON data as output. The following JSON represents the result of the aforementioned API task:
Copy
{
"result": "OK",
"payload": [
{
"id": "V7a64ff98e-xxxx-xxxx-xxxx-8e91b8a5f9e9",
"operator": "V7sys2a8bd4a1-xxxx-xxxx-xxxx-ef673031e350",
"name": "prod_cldb01",
"os": "cn-rocky-9",
"cloudnode": "V7d41fdc53-xxxx-xxxx-xxxx-5c1fc94d3cbc",
"password": {
"iv": "f5b908e47xxxx53xxxx98xxxxf9aa3d",
"content": "6dxxxxb8"
},
"cpu": "1",
"cputime": "50",
"ram": "1",
"net": "150",
"disk": "10",
"gpu": "none",
"vlan": "0",
"network": "xcNET"
}
]
}
Supported Arguments
Now that we've covered the basics, let's explore the supported arguments of Nexus's CLI Mode.
--mode=help
Copy
nexus --mode=help
Using the --mode=help argument will display instructions on constructing an API task and list
the
supported arguments, as illustrated below:
Copy
xcware Nexus 7.0 - CLI HELP
usage:
nexus args
args:
--mode=help > switch to display this help
--mode=reset > switch to display reset menu
--mode=cli > switch to run in cli mode
--api=APINAME > specifies the api to use - required in cli mode
--command=CMDNAME > specifies the api command - required in cli mode
--account=ID > specifies the account id - required in cli mode if --secrets is not specified
--accesskey=KEY > specifies the access key - required in cli mode if --secrets is not specified
--secretkey=KEY > specifies the secret key - required in cli mode if --secrets is not specified
--data='{}' > valid JSON string - required in cli mode if --datafile is not specified
--secrets=filename > file that contains keys - optional in cli mode
--datafile=filename > valid JSON data file - optional in cli mode
returns:
{JSON}
--mode=reset
This argument activates the reset menu, allowing you to perform reset operations.
--mode=cli
This argument activates the CLI mode.
--api=APINAME
This argument defines the name of the API containing the commands and is obligatory in cli mode. Refer to the API Builder for potential API names.
--command=CMDNAME
This argument specifies the name of the function to be executed and is mandatory in cli mode. Refer to the API Builder for potential command names.
--account=ID
This argument indicates the account ID and is necessary in cli mode if the --secrets argument is not provided. You can locate your account ID in the "Actions" menu at the top right corner of the Nexus interface.
--accesskey=KEY
This argument signifies the authorization key associated with the roles and policies of the given account, and it's required in cli mode if the --secrets argument is not provided. Your system administrator can provide you with an authorization key.
--secretkey=KEY
This argument represents the secret key associated with the roles and policies of the specified account, and it's mandatory in cli mode if the --secrets argument is not provided. Your system administrator can provide you with a secret key.
--data='{}'
This argument represents the input data passed to the API task and is necessary in cli mode if the --datafile argument is not included. Please consult the API Builder for possible data input options.
--secrets=filename
This optional argument in cli mode denotes the file containing the account ID, access key, and secret key, organized as illustrated below. It's utilized to load credentials from a file.:
Copy
account=YOUR_ACCOUNT_ID
accesskey=YOUR_ACCESS_KEY
secretkey=YOUR_SECRET_KEY
--datafile=filename
This optional argument in cli mode indicates the JSON file containing the input data passed to the API task, simplifying the handling of complex JSON structures.
Get Started with API Builder