SAS Viya Orders is a command-line interface (CLI) that calls the appropriate SAS Viya Orders API endpoint to obtain the requested assets for a specified SAS Viya software order.
You can use this CLI both as a tool and as an example of how to use Golang to call the SAS Viya Orders API. You can also import the assetreqs package and use it in your own Golang project.
Usage:
viya4-orders-cli [command]
Available Commands:
assetHistory Get the list of completed asset downloads for the given order number
certificates Download certificates for the given order number
deploymentAssets Download deployment assets for the given order number at the given cadence name and version - if version not specified, get the latest version of the given cadence name
help Help about any command
license Download a license for the given order number at the given cadence name and version
Flags:
-c, --config string config file (default is $HOME/.viya4-orders-cli)
-n, --file-name string name of the file where you want the downloaded order asset to be stored
(defaults:
assetHistory - assetHistory_<order number>.json
certs - SASViyaV4_<order number>_certs.zip
license and depassets - SASViyaV4_<order number>_<renewal sequence>_<cadence information>_<asset name>_<date time stamp>.<asset extension>
)
-p, --file-path string path to where you want the downloaded order asset to be stored (default is path to your current working directory)
-h, --help help for viya4-orders-cli
-o, --output string output format - valid values:
j, json
t, text
(default "text")
-v, --version version for viya4-orders-cli
Use "viya4-orders-cli [command] --help" for more information about a command.
- API credentials for the
SAS Viya Orders API
are required. You can obtain them here.
IMPORTANT This is a new developer portal that generates keys used with the new APIM proxy for Viya Orders API. If you have keys that were generated in the SAS Apigee Developer Portal, they will work until April 20, 2026.
- Go 1.25.6 (or later) or Docker is required if you intend to build your own image.
- git version 2 or later is required if you intend to clone the repository.
Binaries for Windows, macOS, and Linux are available as downloads from https://github.com/sassoftware/viya4-orders-cli/releases/latest.
If you choose this option, refer to Verifying Release Signatures to verify the authenticity and integrity of the downloaded binary.
To build the project, you have several options:
- Using Make:
Clone the project from the GitHub repo. Then, from the project root you can do the following:- Build a Windows executable (viya4-orders-cli_windows_amd64.exe) by running
the following command:
make win - Build a Linux executable (viya4-orders-cli_linux_amd64.exe) by running the
following command:
make linux - Build a macOS executable (viya4-orders-cli_darwin_amd64.exe) by running the
following command:
make darwin - Build all of the above executables by running the following command:
Remove all of the above executables by running the following command:
make buildmake clean
- Build a Windows executable (viya4-orders-cli_windows_amd64.exe) by running
the following command:
- Using Docker:
You can build the project without cloning first:
- http:
docker build github.com/sassoftware/viya4-orders-cli -t viya4-orders-cli - ssh:
Or you can clone the project from the GitHub repository. Then, from the project root, run the following command:
docker build git@github.com:sassoftware/viya4-orders-cli.git -t viya4-orders-clidocker build . -t viya4-orders-cli
- http:
- Using
go build:
Clone the project from the GitHub repository. Then, from the project root, run the following command:go build -o {executable file name} main.go
Take the following steps to start using SAS Viya Orders CLI:
-
If you do not yet have credentials for the SAS Viya Orders API, obtain them here - instructions can be found on the Authentication tab in the same UI here.
-
Save off the
Client IDand theClient Secretvalues, which will serve as your API credentials.NOTE You only need one of the
Client Secretvalues - either will work. -
Base64 encode each value.
NOTE When base64 encoding the credentials, take care not to encode end-of-line characters into the result.
Here is an example of the correct way to encode from a Linux command prompt:
echo -n {secret} | base64
Here is an example of the incorrect way to encode from a Linux command prompt (the encoded result will include\n):
echo {secret} | base64 -
Add both credentials to your configuration file, or define them as environment variables:
- Assign the encoded value of
Client IDtoapimClientCredentialsId(if using environment variables, useAPIMCLIENTCREDENTIALSID). - Assign the encoded value of
Client SecrettoapimClientCredentialsSecret(if using environment variables, useAPIMCLIENTCREDENTIALSSECRET).
IMPORTANT If you are using keys generated in the SAS Apigee Developer Portal, the property names to convey those in are
clientCredentialsId/CLIENTCREDENTIALSIDandclientCredentialsSecret/CLIENTCREDENTIALSSECRET. These keys will cease to work on April 20, 2026. - Assign the encoded value of
-
Select CLI options. You can then specify them on the command line, pass them in as environment variables, or include them in a configuration file.
SAS Viya Orders CLI options are applied in order of precedence, as follows:
- command-line specification
- environment variable specification
- config file specification
- default
-
If you want to use a configuration file, create it.
The default location for the configuration file is
$HOME/.viya4-orders-cliand the default format is YAML. You can save the file anywhere you want and use any supported format, as long as you use the--config/-coption to specify its path and name to the CLI.When using the
-coption to specify a config file, that file must have a valid extension denoting its format. Supported formats are JSON, TOML, YAML, HCL, INI, envfile, or Java properties formats.
Here is a sample YAML configuration file that contains client credentials:
apimClientCredentialsId: 1a2B3c4D5e6F7h8I9j10K=
apimClientCredentialsSecret: 4D5e6F7g8H9i==
You have the following options for launching SAS Viya Orders CLI:
-
Running the executable that you downloaded or built previously in the Installation section:
{executable file name} [command] [args] [flags] -
Using Docker (this assumes that you have already executed the Docker build step described in the Installation section):
docker run -v /my/local/path:/containerdir viya4-orders-cli [command] [args] [flags] -
Using
go run:
If you have not done so already, clone the project from the GitHub repo. Then run the following command from the project root:go run main.go [command] [args] [flags]
The examples in this section correspond to typical tasks that you might perform using SAS Viya Orders CLI:
-
Using a configuration file,
/c/Users/auser/vocli/.viya4-orders-cli.yaml, to convey your API credentials, get deployment assets for SAS Viya order923456at the latest version of the Long Term Support (lts) cadence. Send the contents to file/c/Users/auser/vocli/sasfiles/923456_lts_depassets.tgz:docker run -v /c/Users/auser/vocli:/sasstuff viya4-orders-cli deploymentAssets 923456 lts \ --config /sasstuff/.viya4-orders-cli.yaml --file-path /sasstuff/sasfiles --file-name 923456_lts_depassetsSample output:
2020/10/02 19:16:30 Using config file: /sasstuff/.viya4-orders-cli.yaml OrderNumber: 923456 AssetName: deploymentAssets AssetReqURL: https://api.apiproxy.sas.com/mysas/orders/923456/cadenceNames/lts/deploymentAssets AssetLocation: /sasstuff/sasfiles/923456_lts_depassets.tgz Cadence: Long Term Support 2020.0 CadenceRelease: 20200808.1596943588306 -
Get a renewal license for the deployment of SAS Viya order
923456and send the contents to file/auser/vocli/sasfiles/923456_lts_2020.0_license_ren1.jwt:go run main.go lic 923456 lts 2020.0 -p /auser/vocli/sasfiles -n 923456_lts_2020.0_license_ren1
Sample output:
OrderNumber: 923456 AssetName: license AssetReqURL: https://api.apiproxy.sas.com/mysas/orders/923456/cadenceNames/lts/cadenceVersions/2020.0/license AssetLocation: /auser/vocli/sasfiles/923456_lts_2020.0_license_ren1.jwt Cadence: Long Term Support 2020.0 CadenceRelease: -
Get certificates for SAS Viya order
923457and send the contents to fileC:\Users\auser\vocli\sasfiles\923457_certs.zip. Receive the output in JSON format:viya4-orders-cli_windows_amd64.exe cer 923457 -p C:\Users\auser\vocli\sasfiles -n 923457_certs -o jsonSample output:
{ "orderNumber": "923457", "assetName": "certificates", "assetReqURL": "https://api.apiproxy.sas.com/mysas/orders/923457/certificates", "assetLocation": "C:\Users\auser\vocli\sasfiles\923457_certs.zip", "cadence": "", "cadenceRelease": "" } -
Get deployment assets for SAS Viya order
923457at release20260127.1769510312235of cadence versionStable 2026.01. Receive the output in text format:viya4-orders-cli_windows_amd64.exe dep 923457 stable 2026.01 20260127.1769510312235Sample output:
OrderNumber: 923457 AssetName: deploymentAssets AssetReqURL: https://api.apiproxy.sas.com/mysas/orders/923457/cadenceNames/stable/cadenceVersions/2026.01/cadenceReleases/20260127.1769510312235/deploymentAssets AssetLocation: /path/to/cwd/SASViyaV4_923457_0_stable_2026.01_20260127.1769510312235_deploymentAssets_1769555752230.tgz Cadence: Stable 2026.01 CadenceRelease: 20260127.1769510312235
SAS Viya Orders CLI releases are cryptographically signed with GPG. To verify the authenticity of a downloaded binary:
# Download and import the public key
curl -LO https://github.com/sassoftware/viya4-orders-cli/releases/latest/download/sas-release-signing-key.asc
gpg --import sas-release-signing-key.ascEnsure the imported key matches this fingerprint:
A604 6426 9268 85FD 8E00 5C42 D7EC 86DE FBC5 F8E2
You can check with:
gpg --fingerprint sas.softwareorders@sas.comDownload both the binary and its corresponding .asc signature file from https://github.com/sassoftware/viya4-orders-cli/releases/latest, then verify:
# Example for Linux binary
gpg --verify viya4-orders-cli_linux_amd64.asc viya4-orders-cli_linux_amd64A successful verification will show:
gpg: Good signature from "SAS Institute, Inc. (Release Signing) <sas.softwareorders@sas.com>"
Note: You may see a warning about the key not being "certified with a trusted signature." This is normal and does not affect the verification. The warning simply means you haven't explicitly marked the key as trusted in your keyring.
We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project.
This project is licensed under the Apache 2.0 License.
