# Unity Gaming Services CLI

> Create and manage schedule configurations from the command line using the Unity Gaming Services command-line interface.

[Unity Gaming Services CLI](https://services.docs.unity.com/guides/ugs-cli/latest/general/overview)를 사용하여 일정과 상호 작용할 수 있습니다. CLI를 사용하면 커맨드 라인에서 일정 구성을 관리할 수 있습니다.

## 필수 조건##prerequisites

CLI에 대한 보다 포괄적인 내용을 알아보려면 [Unity Gaming Services CLI 시작하기 가이드](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/install-the-cli/)에 나와 있는 단계를 따르십시오.

이 가이드를 따르려면 먼저 다음 작업을 완료해야 합니다.

1. [UGS CLI를 설치합니다](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/install-the-cli/).

2. 다음을 사용하여 프로젝트 ID와 환경을 구성합니다.
   `ugs config set project-id <your-project-id>`
   `ugs config set environment-name <your-environment-name>`

3. [Scheduler](https://services.docs.unity.com/docs/service-account-auth/index.html#scheduler-configuration-editor)와 [환경 관리](https://services.docs.unity.com/docs/service-account-auth/index.html#unity-environments-admin)에 필요한 역할을 사용하여 서비스 계정을 구성합니다. 자세한 내용은 [인증 받기](https://services.docs.unity.com/guides/ugs-cli/latest/general/get-started/get-authenticated/)를 참고하십시오.

## CLI 사용##using-the-cli

커맨드와 옵션이 모두 나와 있는 전체 레퍼런스가 필요한 경우, [Schedules 커맨드 라인 기술 자료](https://services.docs.unity.com/guides/ugs-cli/latest/scheduler/Scheduler%20Command%20Line/overview)를 참고하십시오.

> **Note:**
>
> **참고:** `ugs scheduler` 커맨드는 `ugs sched`로도 사용할 수 있습니다.

### 일정 배포##deploy-schedules

`new-file` 커맨드를 실행하여 로컬에서 일정 구성을 생성합니다.

```bash
ugs scheduler new-file <file-name>
```

구성 파일 콘텐츠의 예시는 다음과 같습니다.

```json
{
  "$schema": "https://ugs-config-schemas.unity3d.com/v1/schedules.schema.json",
  "Configs": {
    "Schedule1": {
      "EventName": "EventType1",
      "Type": "recurring",
      "Schedule": "0 * * * *",
      "PayloadVersion": 1,
      "Payload": "{}"
    },
    "Schedule2": {
      "EventName": "EventType2",
      "Type": "one-time",
      "Schedule": "2024-03-08T13:06:32.311+00:00",
      "PayloadVersion": 1,
      "Payload": "{ \"message\": \"Hello, world!\"}"
    }
  }
}
```

필요한 경우 일정 구성을 여러 파일로 분리할 수도 있습니다.

```json
{
  "$schema": "https://ugs-config-schemas.unity3d.com/v1/schedules.schema.json",
  "Configs": {
    "Schedule1": {
      "EventName": "EventType1",
      "Type": "recurring",
      "Schedule": "0 * * * *",
      "PayloadVersion": 1,
      "Payload": "{}"
    }
  }
}
```

```json
{
  "$schema": "https://ugs-config-schemas.unity3d.com/v1/schedules.schema.json",
  "Configs": {
    "Schedule2": {
      "EventName": "EventType2",
      "Type": "one-time",
      "Schedule": "2024-03-08T13:06:32.311+00:00",
      "PayloadVersion": 1,
      "Payload": "{ \"message\": \"Hello, world!\"}"
    }
  }
}
```

`Deploy` 커맨드를 사용하면 로컬 일정 구성 파일을 원격 환경으로 승격할 수 있습니다.

일정이 활성화될 수 있도록 구성 파일을 배포해야 합니다.

```bash
ugs deploy <path-to-schedules-file> <path-to-schedules-file>
```

```bash
ugs deploy <path-to-directory>
```

### 일정 검색##retrieve-schedules

현재 활성화된 일정을 모두 나열하려면 다음 커맨드를 실행합니다.

```bash
ugs scheduler list
```

`Fetch` 커맨드를 사용하면 원격 환경에서 여러 일정을 한 번에 가져올 수 있습니다.

제공되는 경로는 일정이 저장되는 디렉토리입니다.

```bash
ugs fetch <path>
```

### 일정 삭제##delete-schedules

`--reconcile` 플래그가 있는 `deploy` 커맨드를 실행하여 일정을 삭제할 수 있습니다.

> **Warning:**
>
> **경고:** reconcile은 파괴적 작업입니다. 이 작업은 제공된 경로에 표시되지 않는 모든 일정을 삭제합니다. 해당 커맨드를 실행하기 전에 이를 제외하고 `--dry-run` 플래그로 커맨드의 출력을 확인할 수 있습니다.

```bash
ugs deploy --services scheduler <path-to-config-file> --reconcile
```
