{"id":23331160,"url":"https://github.com/sassoftware/viya4-orders-cli","last_synced_at":"2025-04-09T16:10:49.879Z","repository":{"id":37648567,"uuid":"290589371","full_name":"sassoftware/viya4-orders-cli","owner":"sassoftware","description":"A CLI that calls the appropriate SAS Viya Orders API endpoint to obtain the requested Viya software order assets for the given order.","archived":false,"fork":false,"pushed_at":"2025-04-07T02:37:27.000Z","size":186,"stargazers_count":14,"open_issues_count":8,"forks_count":6,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-04-09T16:10:38.346Z","etag":null,"topics":["sas-osp","viya4"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sassoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-26T19:42:43.000Z","updated_at":"2025-02-19T23:33:06.000Z","dependencies_parsed_at":"2024-06-19T04:00:40.082Z","dependency_job_id":null,"html_url":"https://github.com/sassoftware/viya4-orders-cli","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fviya4-orders-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fviya4-orders-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fviya4-orders-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sassoftware%2Fviya4-orders-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sassoftware","download_url":"https://codeload.github.com/sassoftware/viya4-orders-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248065284,"owners_count":21041872,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sas-osp","viya4"],"created_at":"2024-12-20T22:31:35.724Z","updated_at":"2025-04-09T16:10:49.871Z","avatar_url":"https://github.com/sassoftware.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SAS Viya Orders CLI\n\nSAS Viya Orders is a command-line interface (CLI) that calls the appropriate\n[SAS Viya Orders API](https://developer.sas.com/guides/sas-viya-orders.html)\nendpoint to obtain the requested deployment assets for a specified SAS Viya\nsoftware order.\n\n## Overview\n\nYou can use this CLI both as a tool and as an example of how to use Golang to\ncall the\n[SAS Viya Orders API](https://developer.sas.com/guides/sas-viya-orders.html).\nYou can also import the assetreqs and authn packages and use them in your own\nGolang project.\n\n```\nUsage:\n  viya4-orders-cli [command]\n\nAvailable Commands:\n  assetHistory     Get the list of completed asset downloads for the given order number\n  certificates     Download certificates for the given order number\n  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\n  help             Help about any command\n  license          Download a license for the given order number at the given cadence name and version\n\nFlags:\n  -c, --config string      config file (default is $HOME/.viya4-orders-cli)\n  -n, --file-name string   name of the file where you want the downloaded order asset to be stored\n                           (defaults:\n                                assetHistory - assetHistory_\u003corder number\u003e.json\n                                certs - SASViyaV4_\u003corder number\u003e_certs.zip\n                                license and depassets - SASViyaV4_\u003corder number\u003e_\u003crenewal sequence\u003e_\u003ccadence information\u003e_\u003casset name\u003e_\u003cdate time stamp\u003e.\u003casset extension\u003e\n                           )\n  -p, --file-path string   path to where you want the downloaded order asset to be stored (default is path to your current working directory)\n  -h, --help               help for viya4-orders-cli\n  -o, --output string      output format - valid values:\n                                j, json\n                                t, text\n                            (default \"text\")\n  -v, --version            version for viya4-orders-cli\n\nUse \"viya4-orders-cli [command] --help\" for more information about a command.\n```\n\n### Prerequisites\n\n- API credentials for the\n  [SAS Viya Orders API](https://developer.sas.com/guides/sas-viya-orders.html)\n  are required. You can obtain them from the\n  [SAS API Portal](https://apiportal.sas.com/get-started).\n- [Go](https://golang.org/) 1.22.3 (or later) or [Docker](https://www.docker.com/) is required if you intend to build your own image.\n- [git](https://git-scm.com/) version 2 or later is required if you intend to clone the repository.\n\n### Installation\n\n#### Option 1 - Download a pre-built binary file.\n\nBinaries for Windows, macOS, and Linux are available as downloads from\nhttps://github.com/sassoftware/viya4-orders-cli/releases. Expand `Assets` under\nthe release of interest.\n\n#### Option 2 - Build the project yourself.\n\nTo build the project, you have several options:\n\n- Using [Make](https://www.gnu.org/software/make/): \u003cbr\u003e Clone the project from\n  the GitHub repo. Then, from the project root you can do the following:\n  - Build a Windows executable (viya4-orders-cli_windows_amd64.exe) by running\n    the following command:\n    ```\n    make win\n    ```\n  - Build a Linux executable (viya4-orders-cli_linux_amd64.exe) by running the\n    following command:\n    ```\n    make linux\n    ```\n  - Build a macOS executable (viya4-orders-cli_darwin_amd64.exe) by running the\n    following command:\n    ```\n    make darwin\n    ```\n  - Build all of the above executables by running the following command:\n    ```\n    make build\n    ```\n    Remove all of the above executables by running the following command:\n    ```\n    make clean\n    ```\n- Using [Docker](https://www.docker.com/): \u003cbr\u003e You can build the project\n  without cloning first:\u003cbr/\u003e\u003cbr/\u003e\n  - http:\n    ```\n    docker build github.com/sassoftware/viya4-orders-cli -t viya4-orders-cli\n    ```\n  - ssh:\n    ```\n    docker build git@github.com:sassoftware/viya4-orders-cli.git -t viya4-orders-cli\n    ```\n    Or you can clone the project from the GitHub repository. Then, from the\n    project root, run the following command:\n    ```\n    docker build . -t viya4-orders-cli\n    ```\n- Using `go build`: \u003cbr\u003e Clone the project from the GitHub repository. Then,\n  from the project root, run the following command:\n  ```\n  go build -o {executable file name} main.go\n  ```\n\n## Getting Started\n\nTake the following steps to start using SAS Viya Orders CLI:\n\n1. If you do not yet have credentials for the\n   [SAS Viya Orders API](https://developer.sas.com/guides/sas-viya-orders.html),\n   obtain them from the [SAS API Portal](https://apiportal.sas.com/get-started).\n\n1. Record the `Key` and the `Secret` values that serve as your API credentials.\n1. Base64 encode each value.\n   \u003e **NOTE:** When base64 encoding the credentials, take care not to encode\n   \u003e end-of-line characters into the result. \u003cbr/\u003e Here is an example of the\n   \u003e correct way to encode from a Linux command prompt:\u003cbr/\u003e\n   \u003e `echo -n {secret} | base64`\u003cbr/\u003e\u003cbr/\u003e Here is an example of the\n   \u003e _incorrect_ way to encode from a Linux command prompt (the encoded result\n   \u003e will include `\\n`):\u003cbr/\u003e `echo {secret} | base64`\n1. Add both credentials to your configuration file, or define them as\n   environment variables:\n\n   - Assign the encoded value of `Key` to `clientCredentialsId` (if using environment variables, use\n    `CLIENTCREDENTIALSID`).\n   - Assign the encoded value of `Secret` to `clientCredentialsSecret` (if using environment variables, use\n    `CLIENTCREDENTIALSSECRET`).\n\n1. Select CLI options. You can then specify them on the command line, pass them\n   in as environment variables, or include them in a configuration file.\n\n   SAS Viya Orders CLI options are applied in order of precedence, as follows:\n\n   1. command-line specification\n   1. environment variable specification\n   1. config file specification\n   1. default\n\n1. If you want to use a configuration file, create it.\n\n   The default location for the configuration file is `$HOME/.viya4-orders-cli` and the default format is [YAML](https://yaml.org/).\n   You can save the file anywhere you want and use any supported format, as long as you use the `--config` /\n   `-c` option to specify its path and name to the CLI.\n\n   When using the `-c` option to specify a config file, that file must have a valid extension denoting its format. Supported\n   formats are [JSON](https://www.json.org/),\n   [TOML](https://github.com/toml-lang/toml), [YAML](https://yaml.org/),\n   [HCL](https://github.com/hashicorp/hcl),\n   [INI](\u003chttps://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms717987(v=vs.85)\u003e),\n   [envfile](https://www.npmjs.com/package/envfile), or\n   [Java properties](https://docs.oracle.com/javase/tutorial/essential/environment/properties.html)\n   formats.\n\nHere is a sample YAML configuration file that contains client credentials:\n\n```\nclientCredentialsId: 1a2B3c4D5e6F7h8I9j10K=\nclientCredentialsSecret: 4D5e6F7g8H9i==\n```\n\n### Running\n\nYou have the following options for launching SAS Viya Orders CLI:\n\n- Running the executable that you downloaded or built previously in the\n  [Installation](#installation) section:\n\n  ```\n  {executable file name} [command] [args] [flags]\n  ```\n\n- Using Docker (this assumes that you have already executed the Docker build\n  step described in the [Installation](#installation) section): \u003cbr\u003e\n\n  ```docker\n  docker run -v /my/local/path:/containerdir viya4-orders-cli [command] [args] [flags]\n  ```\n\n- Using `go run`: \u003cbr\u003e If you have not done so already, clone the project from\n  the GitHub repo. Then run the following command from the project root:\n\n  ```\n  go run main.go [command] [args] [flags]\n  ```\n\n### Examples\n\nThe examples in this section correspond to typical tasks that you might perform\nusing SAS Viya Orders CLI:\n\n- Using a configuration file, `/c/Users/auser/vocli/.viya4-orders-cli.yaml`, to\n  convey your API credentials, get deployment assets for SAS Viya order `923456`\n  at the latest version of the Long Term Support (`lts`) cadence. Send the\n  contents to file `/c/Users/auser/vocli/sasfiles/923456_lts_depassets.tgz`:\n  \u003cbr\u003e\n\n  ```docker\n  docker run -v /c/Users/auser/vocli:/sasstuff viya4-orders-cli deploymentAssets 923456 lts \\\n   --config /sasstuff/.viya4-orders-cli.yaml --file-path /sasstuff/sasfiles --file-name 923456_lts_depassets\n  ```\n\n  Sample output:\n\n  ```text\n  2020/10/02 19:16:30 Using config file: /sasstuff/.viya4-orders-cli.yaml\n  OrderNumber: 923456\n  AssetName: deploymentAssets\n  AssetReqURL: https://api.sas.com/mysas/orders/923456/cadenceNames/lts/deploymentAssets\n  AssetLocation: /sasstuff/sasfiles/923456_lts_depassets.tgz\n  Cadence: Long Term Support 2020.0\n  CadenceRelease: 20200808.1596943588306\n  ```\n\n- Get a renewal license for the deployment of SAS Viya order `923456` and send\n  the contents to file\n  `/auser/vocli/sasfiles/923456_lts_2020.0_license_ren1.jwt`:\n\n  ```go\n  go run main.go lic 923456 lts 2020.0 -p /auser/vocli/sasfiles -n 923456_lts_2020.0_license_ren1\n  ```\n\n  Sample output: \u003cbr\u003e\n\n  ```text\n  OrderNumber: 923456\n  AssetName: license\n  AssetReqURL: https://api.sas.com/mysas/orders/923456/cadenceNames/lts/cadenceVersions/2020.0/license\n  AssetLocation: /auser/vocli/sasfiles/923456_lts_2020.0_license_ren1.jwt\n  Cadence: Long Term Support 2020.0\n  CadenceRelease:\n  ```\n\n- Get certificates for SAS Viya order `923457` and send the contents to file\n  `C:\\Users\\auser\\vocli\\sasfiles\\923457_certs.zip`. Receive the output in JSON\n  format:\n\n  ```\n  viya4-orders-cli_windows_amd64.exe cer 923457 -p C:\\Users\\auser\\vocli\\sasfiles -n 923457_certs -o json\n  ```\n\n  Sample output:\n\n  ```\n  {\n      \"orderNumber\": \"923457\",\n      \"assetName\": \"certificates\",\n      \"assetReqURL\": \"https://api.sas.com/mysas/orders/923457/certificates\",\n      \"assetLocation\": \"C:\\Users\\auser\\vocli\\sasfiles\\923457_certs.zip\",\n      \"cadence\": \"\",\n      \"cadenceRelease\": \"\"\n  }\n  ```\n\n## Contributing\n\nWe welcome your contributions! Please read [CONTRIBUTING.md](CONTRIBUTING.md)\nfor details on how to submit contributions to this project.\n\n## License\n\nThis project is licensed under the [Apache 2.0 License](LICENSE).\n\n## Additional Resources\n\n- [SAS API Portal](https://apiportal.sas.com/docs/mysasprod/1/overview)\n- [SAS Viya Orders API](https://developer.sas.com/guides/sas-viya-orders.html)\n- [SAS Viya Operations Guide](https://documentation.sas.com/?softwareId=mysas\u0026softwareVersion=prod\u0026docsetId=itopswlcm\u0026docsetTarget=home.htm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassoftware%2Fviya4-orders-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsassoftware%2Fviya4-orders-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsassoftware%2Fviya4-orders-cli/lists"}