UGS CLI for CCD
Use the command-line interface to manage Cloud Content Delivery buckets, entries, and release pipelines efficiently.
Read time 9 minutesLast updated 17 hours ago
The command-line interface (CLI) is an efficient way to interact with Cloud Content Delivery (CCD). With the CLI, you can use the command line to control every aspect of your project, from file management to release pipeline organization.
The Unity Cloud Dashboard provides a lot of functionality, but you need to use the CLI for certain actions, such as to copy files to your bucket or synchronize entire folders.
For more information about the UGS CLI, refer to the Unity Gaming Services CLI documentation.
Installation
For information on how to install the CLI, refer to the Installation guide.Migration information
With the integration of CCD into the UGS CLI ecosystem, there are the improvements available that are designed to enhance your experience and streamline your workflows.Unified with UGS tooling
Seamless integration
CCD is now a cohesive part of the UGS CLI ecosystem. This integration means that you no longer need to install and maintain a separate tool for CCD functionalities. Install the UGS CLI once, and you're set to manage multiple UGS services efficiently including CCD.Authentication updates
Transition to service accounts
The CLI now uses service accounts for authentication to provide more secure, versatile and streamlined user verification. For more information, refer to Authentication.Enhanced user experience
Unified command interface
CCD has standardized the CLI's commands, inputs, and outputs to align with other UGS services and provide two output formats (JSON and plain text). The response are more detailed and aligned with the ccd rest api. For more information, refer to the available outputs.Intuitive command arguments
We now have more intuitive command arguments: Instead of asking for UUID arguments such as environment id, bucket id, badge id, release id, users should now use human friendly arguments such as environment names, bucket names, badge names, and release number.Get started
Prerequisites
-
If you already have a project, go to the next section. Otherwise, if you are using Unity services for the first time:
- Create a Unity ID account (if you don’t already have one).
- Log into the Unity Dashboard.
- Click the Projects dropdown, then Create project. In the Create project window, fill in the required details.
- To download and install the CLI, follow this guide.
- To set up CCD in the Unity Dashboard, select Products > Cloud Content Delivery > Launch. You can then fill in your details and access CCD.
Set up CCD for CLI
- In the Unity Dashboard, select Administration > Service accounts.
- Select the New button.
- Enter a name and description, and select Create.
- Select Add key, and save the Key ID and Secret key. Note: For more detailed instructions, refer to the Service Account Authentication Documentation.
- Select Manage organization roles > LiveOps > Cloud Content Delivery API Public Editor to grant read and write access to public endpoints of the CCD Management API.
- Select Manage project roles, select your project, then select Next > Admin > Unity Environments Viewer to grant read access to all environments in a project.
- Run the CLI on the machine from which you upload content.
- Use the command to log into the CLI using your service account.
$ ugs login
CLI usage
The basic form of a UGS CCD command in the CLI is as follows:$ ugs ccd [command] [subcommand] [parameters]--version$ ugs --versionGlobal Flag | Description |
|---|---|
| Displays any further parameters and flags for a given command. |
| Disables the display of operations performed by the specified command. |
| Outputs results in JSON format. |
Authentication
Authenticates with CCD. Usage:ugs login- : Save Service Account Key ID and Secret Key. You can save the Key ID and Secret Key with this command or system environment variables: UGS_CLI_SERVICE_KEY_ID and UGS_CLI_SERVICE_SECRET_KEY. Visit https://services.docs.unity.com/docs/service-account-auth to create or manage service account.
login - : Clear stored Service Account Key ID and Secret Key from local configuration.
logout - : Checks if the current user has any Service Account Key ID and Secret Key stored locally.
status
Output
The CLI offers two output formats to address diverse user needs for data representation: the default YAML and an optional JSON format. To obtain outputs in JSON, append-j--json$ ugs ccd [command] --jsonConfiguration
Environment setup for the UGS CLI is simple. You can use environment variables, CLI commands, or sometimes options within commands for configuration. You can use the following information to get started.Use environment variables
Environment variables allow you to configure the CLI without having to enter details every time you run a command. Open your terminal and run these commands to set your environment variables:For Unix-based Systems (Linux, macOS)
export UGS_CLI_SERVICE_KEY_ID="your_key_id"export UGS_CLI_SERVICE_SECRET_KEY="your_secret_key"export UGS_CLI_ENVIRONMENT_NAME="your_environment_name"export UGS_CLI_ENVIRONMENT_ID="your_environment_id"export UGS_CLI_BUCKET_NAME="your_bucket_name"export UGS_CLI_PROJECT_ID="your_project_id"
For Windows
For Windows users, open Command Prompt and enter:set UGS_CLI_SERVICE_KEY_ID=your_key_idset UGS_CLI_SERVICE_SECRET_KEY=your_secret_keyset UGS_CLI_ENVIRONMENT_NAME=your_environment_nameset UGS_CLI_ENVIRONMENT_ID=your_environment_idset UGS_CLI_BUCKET_NAME=your_bucket_nameset UGS_CLI_PROJECT_ID=your_project_id
Use CLI Commands for configuration
The CLI also supports direct configuration through commands. Here are some examples to set the active environment, project-id and bucket-name:ugs env use <environment-name>ugs config set project-id <project-id>ugs config set bucket-name <bucket-name>
Use Option with a command
The CLI supports specifying a bucket for any ccd command using the option-bugs ccd entries list -b <bucket-name>
Buckets
Manages buckets for a project. Usage:ugs ccd buckets [command]- : Create bucket for a project.
create <bucket-name> [-d, --description <description>] [-p, --private] - : Delete bucket.
delete <bucket-name> - : Get bucket information.
info <bucket-name> - : List buckets in the current project.
list - : Set permissions for a bucket.
permissions update <bucket-name>
Entries
Manages entries for the current bucket. Usage:ugs ccd entries [command]- : Create entry for current bucket from a local file.
copy <local-path> <remote-path> - : Delete entry from the current bucket.
delete <entry-path> - : Download entry content from current bucket.
download <entry-path> - : Get entry info from current bucket.
info <entry-path> - : List entries for current bucket.
list - : Sync entries from local directory for current bucket.
sync <local-dir-path> - : Update entry for current bucket.
update <entry-path>
Releases
Manages the releases for the current bucket. Usage:ugs ccd releases [command]- : Create release from latest version of current bucket.
create - : Get release info for specific release.
info <release-num> - : List releases for current bucket.
list - : Promote specified release to another bucket.
promote <release-num> <target-bucket-name> <target-environment-name> - : Get the status of a promotion.
promotions status <promotion-id> - : Update an existing release.
update <release-num>
Badges
Manages badges for a release. Usage:ugs ccd badges [command]- : Create a badge for a release.
create <release-num> <badge-name> - : Delete a badge.
delete <badge-name> - : List badges in the current project.
list
CLI examples
Here are some examples of how you might use the UGS CLI for CCD:-
To create a bucket:
$ ugs ccd buckets create "MyBucket" --description "This is my bucket." --private -
To set the current bucket as the active bucket:
$ ugs config set bucket "MyBucket" -
To synchronize a local folder with the current bucket:
$ ugs ccd entries sync ./myLocalDir -
To list all buckets for a project:
$ ugs ccd buckets list --sort-by name --sort-order desc -
To view a list of all entries in the current bucket:
$ ugs ccd entries list -
To delete a bucket:
$ ugs ccd buckets delete "MyBucket"
--helpDeprecated UCD CLI
The command-line interface (CLI) is the recommended method of interacting with Cloud Content Delivery (CCD). With this tool, you can use the command line to control every aspect of your project, from file management to organizing your release pipeline..You can perform many similar functions in the Dashboard, but you need to use the CLI to copy files to your bucket, or synchronize entire folders.
Getting started
To set up CCD for CLI:- If you already have a project, go to the next step. Otherwise, if you are using Unity services for the first time:
- Create a Unity ID account (if you don’t already have one).
- Log into the Unity Dashboard.
- Select Projects > Create project. In the Create project window, fill in the required details.
- To download the CLI, identify the version that aligns with your Operating System.
- Mac OSX Requires Mac OS 10.12 or later
- Windows Requires Windows 10 or later
- Linux Compatible with Red Hat, Debian, and most other major distros
- In the Unity Dashboard, select Products > Cloud Content Delivery.
- In the left-side navigation bar, go to the API Key section.
- Copy your API key.
- Run the CLI on the machine from which you are uploading content.
-
Log into the CLI using your API key via the command.
auth
CLI usage
The basic form of a CCD command in the CLI is as follows:$ ucd [command]To see the version of the CLI you are currently using, add the
--version$ ucd --version- : User-specified API key for accessing Content Delivery.
--apikey string - ,
-h: Displays any further parameters and flags for a given command.--help - ,
-q: Disables the display of operations performed by the specified command.--quiet - ,
-v: Displays error information.--verbose
The following commands are available:
auth
Authenticates with CCD.Usage:ucd auth [command]- : Display current user info.
info - : Log in to access project data and content delivery services.
login [apikey] - : Log out of current account.
logout
badges
Manages badges for a release.Usage:ucd badges [command]- : Add a badge to a release.
add [badge_name] [release_id] - : List badges in the current bucket.
list - : Remove a badge.
remove [badge_name]
buckets
Manages buckets for a project.Usage:ucd buckets [command]- : Create bucket for a project.
create [project_guid] [bucket name] - : Delete bucket.
delete [bucket_id] - : Get bucket information.
info [bucket_id] - : List buckets for a project.
list [project_guid]
config
Manages options for setting and identifying the current bucket.Usage:ucd config [command]- : Clear all local configuration options.
clear - : Set environment as current.
set environment [environment_id] --project=[project_id] - : Set the specified bucket as the current (active) bucket.
set bucket [bucket_id] [flags] - : Show current local configuration.
show
entries
Manages entries for the current bucket.Usage:ucd entries [command]- : Create entry for current bucket from a local file.
copy [local_path] [entry file name] - : Delete entry from the current bucket.
delete [entry file name] - : Download entry content from current bucket.
download [entry file name] - : Get entry info from current bucket.
info [entry file name] - : List entries for current bucket.
list - : Sync entries from local directory for current bucket.
sync [local_dir_path] - : Update entry for current bucket.
update [entry file name]
releases
Manages the releases for the current bucket.Usage:ucd releases [command]- : Create release from latest version of current bucket.
create - : Get release info for specific release.
info [release_id] - : List releases for current bucket.
list - : Promote specified release to another bucket. An optional
promote [release_id] --target_bucket [bucket_id],-nflag adds a note string.--notes - : Update an existing release. An optional
update [release_id],-nflag adds a note string.--notes
CLI examples
- To create a bucket:
$ ucd buckets create [project_id] [bucket_name] - To delete a bucket:
$ ucd buckets delete [bucket_id] - To list all buckets for a project, including their :
bucket_id
$ ucd buckets list [project_id] - To set the current bucket as the active bucket:
$ ucd config set bucket [bucket_id] - To synchronize a local folder with the current bucket:
$ ucd entries sync [local_dir_path] - To view a list of all entries in the current bucket:
$ ucd entries list
For a sequential example of how to use the command-line interface, see Using CCD via the CLI.