UGS CLI for CCD

Note: The UCD CLI is officially deprecated and no longer receives updates so it's recommended that UCD CLI users transition to use this UGS CLI instead. You can still view the Deprecated UCD CLI documentation.

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:

    1. Create a Unity ID account (if you don’t already have one).
    2. Log into the Unity Dashboard.
    3. 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 Cloud Dashboard, select Products > Cloud Content Delivery > Launch. You can then fill in your details and access CCD.

Set up CCD for CLI

  1. In the Unity Cloud Dashboard, select Administration > Service accounts.
  2. Select the New button.
  3. Enter a name and description, and select Create.
  4. Select Add key, and save the Key ID and Secret key. Note: For more detailed instructions, refer to the Service Account Authentication Documentation.
  5. 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.
  6. Select Manage project roles, select your project, then select Next > Admin > Unity Environments Viewer to grant read access to all environments in a project.
  7. Run the CLI on the machine from which you upload content.
  8. Use the $ ugs login command to log into the CLI using your service account.

CCD is now ready for you to use.

CLI usage

The basic form of a UGS CCD command in the CLI is as follows:

$ ugs ccd [command] [subcommand] [parameters]

To see the version of the CLI you are currently using, add the --version flag:

$ ugs --version

You can add the following global flags after any command:

Global FlagDescription
-?, -h, --helpDisplays any further parameters and flags for a given command.
-q, --quietDisables the display of operations performed by the specified command.
-j, --jsonOutputs results in JSON format.

Authentication

Authenticates with CCD.

Usage: ugs login

Available commands:

  • 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.
  • logout: Clear stored Service Account Key ID and Secret Key from local configuration.
  • status: Checks if the current user has any Service Account Key ID and Secret Key stored locally.

For detailed instructions on logging in, visit the UGS CLI Login Documentation.

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 or --json to your command. This feature simplifies data integration and processing to ensure a more efficient workflow. For example, you can do the following:

$ ugs ccd [command] --json

Configuration

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_id
set UGS_CLI_SERVICE_SECRET_KEY=your_secret_key
set UGS_CLI_ENVIRONMENT_NAME=your_environment_name
set UGS_CLI_ENVIRONMENT_ID=your_environment_id
set UGS_CLI_BUCKET_NAME=your_bucket_name
set 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 -b.

ugs ccd entries list -b <bucket-name>

buckets

Manages buckets for a project.

Usage: ugs ccd buckets [command]

Available commands:

  • create <bucket-name> [-d, --description <description>] [-p, --private]: Create bucket for a project.
  • delete <bucket-name>: Delete bucket.
  • info <bucket-name>: Get bucket information.
  • list: List buckets in the current project.
  • permissions update <bucket-name>: Set permissions for a bucket.

entries

Manages entries for the current bucket.

Usage: ugs ccd entries [command]

Available commands:

  • copy <local-path> <remote-path>: Create entry for current bucket from a local file.
  • delete <entry-path>: Delete entry from the current bucket.
  • download <entry-path>: Download entry content from current bucket.
  • info <entry-path>: Get entry info from current bucket.
  • list: List entries for current bucket.
  • sync <local-dir-path>: Sync entries from local directory for current bucket.
  • update <entry-path>: Update entry for current bucket.

To cancel an entries sync command, press Ctrl+C during the process. Any entries synced prior to cancellation remain uploaded, so you must delete them from your bucket.

releases

Manages the releases for the current bucket.

Usage: ugs ccd releases [command]

Available commands:

  • create: Create release from latest version of current bucket.
  • info <release-num>: Get release info for specific release.
  • list: List releases for current bucket.
  • promote <release-num> <target-bucket-name> <target-environment-name>: Promote specified release to another bucket.
  • promotions status <promotion-id>: Get the status of a promotion.
  • update <release-num>: Update an existing release.

Bucket and entry names are case-sensitive.

badges

Manages badges for a release.

Usage: ugs ccd badges [command]

Available commands:

  • create <release-num> <badge-name>: Create a badge for a release.
  • delete <badge-name>: Delete a badge.
  • list: List badges in the current project.

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"

Note: For detailed help on any command, use -h or --help. For example, to get help on the list subcommand for buckets, you would use:

$ ugs ccd buckets list --help

These examples should give you a good starting point for using CCD with the UGS CLI. Remember that each command has additional flags and options which can be viewed by using the --help flag with the command.

For a sequential example of how to use the command-line interface, see Using CCD via the CLI.

Deprecated UCD CLI

See Deprecated UCD CLI documentation

The CCD UCD CLI is officially deprecated and will no longer receive updates. We recommend all users to transition to the UGS CLI instead to benefit from the latest features, security updates, and technical support.

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:

  1. If you already have a project, go to the next step. Otherwise, if you are using Unity services for the first time:

  2. Create a Unity ID account (if you don’t already have one).

  3. Log into the Unity Cloud Dashboard.

  4. Select Projects > Create project. In the Create project window, fill in the required details.

  5. 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
  1. Go to cloud.unity.com, and select Products > Cloud Content Delivery.

  2. In the left-side navigation bar, go to the API Key section.

  3. Copy your API key.

  4. Run the CLI on the machine from which you are uploading content.

  5. Log into the CLI using your API key via the auth command.

CCD is now ready for you to use.

CLI usage

The basic form of a CCD command in the CLI is as follows:

$ ucd [command]

Be sure to enter -h or --help at the end of any command to display any further parameters and flags for that command that might be available.

To see the version of the CLI you are currently using, add the --version flag:

$ ucd --version

You can add the following global flags after any command:

  • --apikey string: User-specified API key for accessing Content Delivery.
  • -h, --help: Displays any further parameters and flags for a given command.
  • -q, --quiet: Disables the display of operations performed by the specified command.
  • -v, --verbose: Displays error information.

For CLI versions greater than 0.11.0, you need to add the --environment flag to most commands. See CLI examples and Using CCD via the CLI.

The available commands are:

auth

Authenticates with CCD.

Usage: ucd auth [command]

Available commands:

  • info: Display current user info.
  • login [apikey]: Log in to access project data and content delivery services.
  • logout: Log out of current account.

badges

Manages badges for a release.

Usage: ucd badges [command]

Available commands:

  • add [badge_name] [release_id]: Add a badge to a release.
  • list: List badges in the current bucket.
  • remove [badge_name]: Remove a badge.

buckets

Manages buckets for a project.

Usage: ucd buckets [command]

Available commands:

  • create [project_guid] [bucket name]: Create bucket for a project.
  • delete [bucket_id]: Delete bucket.
  • info [bucket_id]: Get bucket information.
  • list [project_guid]: List buckets for a project.

config

Manages options for setting and identifying the current bucket.

Usage: ucd config [command]

Available commands:

  • clear: Clear all local configuration options.
  • set environment [environment_id] --project=[project_id]: Set environment as current.
  • set bucket [bucket_id] [flags]: Set the specified bucket as the current (active) bucket.
  • show: Show current local configuration.

entries

Manages entries for the current bucket.

Usage: ucd entries [command]

Available commands:

  • copy [local_path] [entry file name]: Create entry for current bucket from a local file.
  • delete [entry file name]: Delete entry from the current bucket.
  • download [entry file name]: Download entry content from current bucket.
  • info [entry file name]: Get entry info from current bucket.
  • list: List entries for current bucket.
  • sync [local_dir_path]: Sync entries from local directory for current bucket.
  • update [entry file name]: Update entry for current bucket.

To cancel an entries sync command, press Ctrl+C during the process. Any entries synced prior to cancellation remain uploaded, so you must delete them from your bucket.

releases

Manages the releases for the current bucket.

Usage: ucd releases [command]

Available commands:

  • create: Create release from latest version of current bucket.
  • info [release_id]: Get release info for specific release.
  • list: List releases for current bucket.
  • promote [release_id] --target_bucket [bucket_id]: Promote specified release to another bucket. An optional -n, --notes flag adds a note string.
  • update [release_id]: Update an existing release. An optional -n, --notes flag adds a note string.

Bucket and entry names are case-sensitive.

bucket_name is only a label you assign to a bucket upon creation. All other commands require the bucket_ID, which you can find using the buckets list command, or through CCD in the Unity Cloud Dashboard.

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 CLI versions greater than 0.11.0, you need to add the --environment flag to most commands.

Example:

ucd buckets list --environment=[environment_id] [PROJECT_ID]

You can also save an environment to be used in all future commands by using the config environment command:

ucd config set environment [environment_id] --project=[project_id]

If you set the environment in config, you don’t need to add the --environment flag.

For a sequential example of how to use the command-line interface, see Using CCD via the CLI.