> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Matchmaking Deploy/CDK 레퍼런스

GS2-Deploy의 스택을 생성할 때 사용하는 템플릿 포맷과, CDK를 이용한 각종 언어의 템플릿 출력 구현 예제




## 엔티티

Deploy 처리에서 조작 대상이 되는 리소스

### Namespace

네임스페이스<br>

네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.<br>
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.<br>

따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | 트랜잭션 설정<br>매치메이킹 조작 시 트랜잭션 처리 방법을 제어하는 설정입니다. |
| enableRating | bool |  | | false |  | 레이팅 계산 기능 활성화<br>Glicko-2 기반의 레이팅 계산 기능을 활성화할지 여부입니다.<br>활성화하면, 플레이어는 Vote 시스템을 통해 대전 결과를 제출하고 레이팅이 자동으로 갱신됩니다.<br>RatingModel 마스터 데이터의 설정이 필요합니다. 기본값은 false입니다. |
| enableDisconnectDetection | 문자열 열거형<br>enum {<br>"disable",<br>"enable"<br>}<br> |  | | "disable" |  | 연결 끊김 감지<br>매치메이킹 중인 플레이어가 대기 중임을 정기적으로 보고해야 하는지 여부를 제어합니다.<br>활성화하면, 플레이어가 설정된 타임아웃 시간 내에 킵얼라이브를 전송하지 않을 경우 자동으로 개더링에서 퇴장 처리됩니다.<br>이를 통해 "고스트" 플레이어가 매치메이킹 완료를 방해하는 것을 방지합니다. 기본값은 "disable" 입니다.disable: 비활성화 / enable: 활성화 /  |
| disconnectDetectionTimeoutSeconds | int | {enableDisconnectDetection} == "enable" | ✓※|  | 15 ~ 600 | 연결 끊김 감지 타임아웃(초)<br>킵얼라이브 보고 없이 플레이어를 연결 끊김으로 간주하여 개더링에서 퇴장시키기까지의 대기 시간(초).<br>연결 끊김 감지가 활성화된 경우에만 적용됩니다. 15에서 600초 범위로 지정합니다.<br>※ enableDisconnectDetection이(가) "enable" 이면 필수 |
| createGatheringTriggerType | 문자열 열거형<br>enum {<br>"none",<br>"gs2_realtime",<br>"gs2_script"<br>}<br> |  | | "none" |  | 개더링 생성 시 트리거 타입<br>새로운 개더링이 생성되었을 때 실행할 액션의 종류.<br>GS2-Realtime의 룸 생성을 트리거하여 실시간 통신을 시작하거나, GS2-Script를 실행하여 커스텀 로직을 실행할 수 있습니다. 기본값은 "none" 입니다.none: 없음 / gs2_realtime: GS2-Realtime의 룸 생성 / gs2_script: GS2-Script의 실행 /  |
| createGatheringTriggerRealtimeNamespaceId | string | {createGatheringTriggerType} == "gs2_realtime" | ✓※|  |  ~ 1024자 | 개더링 생성 시 룸을 생성할 GS2-Realtime의 네임스페이스<br>※ createGatheringTriggerType이(가) "gs2_realtime" 이면 필수 |
| createGatheringTriggerScriptId | string | {createGatheringTriggerType} == "gs2_script" | ✓※|  |  ~ 1024자 | 개더링 생성 시 실행되는 GS2-Script의 스크립트GRN<br>Script 트리거 레퍼런스 - [`createGathering`](../script/#creategathering)<br>※ createGatheringTriggerType이(가) "gs2_script" 이면 필수 |
| completeMatchmakingTriggerType | 문자열 열거형<br>enum {<br>"none",<br>"gs2_realtime",<br>"gs2_script"<br>}<br> |  | | "none" |  | 매치메이킹 완료 시 트리거 타입<br>매치메이킹이 완료되었을 때(모든 역할 슬롯이 채워졌을 때) 실행할 액션의 종류.<br>매칭된 플레이어를 대상으로 GS2-Realtime의 룸 생성을 트리거하거나, GS2-Script를 실행하여 커스텀 사후 처리 로직을 실행할 수 있습니다. 기본값은 "none" 입니다.none: 없음 / gs2_realtime: GS2-Realtime의 룸 생성 / gs2_script: GS2-Script의 실행 /  |
| completeMatchmakingTriggerRealtimeNamespaceId | string | {completeMatchmakingTriggerType} == "gs2_realtime" | ✓※|  |  ~ 1024자 | 매치메이킹 완료 시 룸을 생성할 GS2-Realtime의 네임스페이스GRN<br>※ completeMatchmakingTriggerType이(가) "gs2_realtime" 이면 필수 |
| completeMatchmakingTriggerScriptId | string | {completeMatchmakingTriggerType} == "gs2_script" | ✓※|  |  ~ 1024자 | 매치메이킹 완료 시 실행되는 GS2-Script의 스크립트GRN<br>Script 트리거 레퍼런스 - [`completeMatchmaking`](../script/#completematchmaking)<br>※ completeMatchmakingTriggerType이(가) "gs2_script" 이면 필수 |
| enableCollaborateSeasonRating | 문자열 열거형<br>enum {<br>"enable",<br>"disable"<br>}<br> |  | | "disable" |  | 시즌 레이팅 연계 활성화<br>시즌 기반 레이팅 계산을 위해 GS2-SeasonRating과의 연계를 활성화할지 여부.<br>활성화하면, 매치메이킹 완료 시 지정한 GS2-SeasonRating의 네임스페이스에 레이팅 계산 세션이 자동으로 생성됩니다.<br>기본값은 "disable" 입니다.enable: 활성화 / disable: 비활성화 /  |
| collaborateSeasonRatingNamespaceId | string | {enableCollaborateSeasonRating} == "enable" | ✓※|  |  ~ 1024자 | 시즌 레이팅 네임스페이스GRN<br>매치메이킹 완료 시 레이팅 계산 세션이 생성되는 GS2-SeasonRating의 네임스페이스 GRN.<br>시즌 레이팅 연계가 활성화된 경우에만 적용됩니다.<br>※ enableCollaborateSeasonRating이(가) "enable" 이면 필수 |
| collaborateSeasonRatingTtl | int | {enableCollaborateSeasonRating} == "enable" | | 60 | 60 ~ 7200 | 시즌 레이팅 결과 TTL(초)<br>매치메이킹 완료 후, GS2-SeasonRating을 통한 대전 결과 전송을 받아들이는 최대 대기 시간(초).<br>이 기간 내에 결과가 전송되지 않으면, 레이팅 세션은 만료됩니다. 60에서 7200초 범위로 지정합니다. 기본값은 60입니다.<br>※ enableCollaborateSeasonRating이(가) "enable" 이면 필수 |
| changeRatingScript | [ScriptSetting](#scriptsetting) |  | |  |  | 레이팅 값이 변경되었을 때 실행할 스크립트의 설정<br>Script 트리거 레퍼런스 - [`changeRating`](../script/#changerating) |
| joinNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 참가 알림<br>새로운 플레이어가 개더링에 참가했을 때의 푸시 알림 설정.<br>기존 참가자에게 새로운 플레이어가 참가했음을 알려, 게임 클라이언트가 매치메이킹 UI를 업데이트할 수 있도록 합니다. |
| leaveNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 이탈 알림<br>플레이어가 개더링에서 이탈했을 때의 푸시 알림 설정.<br>남은 참가자에게 플레이어가 이탈했음을 알려, 게임 클라이언트가 변경 사항을 반영할 수 있도록 합니다. |
| completeNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 완료 알림<br>매치메이킹이 완료되었을 때(모든 역할 슬롯이 채워졌을 때)의 푸시 알림 설정.<br>모든 참가자에게 개더링이 가득 차 대전을 시작할 수 있음을 알립니다. |
| changeRatingNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 레이팅 변동 알림<br>투표 처리 후 플레이어의 레이팅 값이 변동되었을 때의 푸시 알림 설정.<br>영향을 받은 플레이어에게 새로운 레이팅을 알려, 게임 클라이언트가 업데이트된 값을 표시할 수 있도록 합니다. |
| logSetting | [LogSetting](#logsetting) |  | |  |  | 로그 출력 설정<br>API 요청/응답 로그를 GS2-Log에 출력하기 위한 설정.<br>설정하면, 매치메이킹 조작(개더링 생성·참가·이탈, 투표, 레이팅 변동 등)이 모니터링 및 분석을 위해 로그로 출력됩니다. |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [Namespace](../sdk#namespace) | 생성한 네임스페이스

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Matchmaking::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  EnableRating: true
  EnableDisconnectDetection: null
  DisconnectDetectionTimeoutSeconds: null
  CreateGatheringTriggerType: none
  CreateGatheringTriggerRealtimeNamespaceId: null
  CreateGatheringTriggerScriptId: null
  CompleteMatchmakingTriggerType: none
  CompleteMatchmakingTriggerRealtimeNamespaceId: null
  CompleteMatchmakingTriggerScriptId: null
  EnableCollaborateSeasonRating: disable
  CollaborateSeasonRatingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001
  CollaborateSeasonRatingTtl: 60
  ChangeRatingScript: null
  JoinNotification: null
  LeaveNotification: null
  CompleteNotification: null
  ChangeRatingNotification: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/matchmaking"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
matchmaking.NewNamespace(
    &SampleStack,
    "namespace-0001",
    matchmaking.NamespaceOptions{
        EnableRating: true,
        CreateGatheringTriggerType: matchmaking.NamespaceCreateGatheringTriggerTypeNone,
        CompleteMatchmakingTriggerType: matchmaking.NamespaceCompleteMatchmakingTriggerTypeNone,
        EnableCollaborateSeasonRating: matchmaking.NamespaceEnableCollaborateSeasonRatingDisable,
        CollaborateSeasonRatingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001"),
        CollaborateSeasonRatingTtl: pointy.Int32(60),
        LogSetting: &core.LogSetting{
            LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
        },
    },
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Matchmaking\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Matchmaking\Model\Options\NamespaceOptions(
                enableRating: true,
                createGatheringTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCreateGatheringTriggerType::NONE,
                completeMatchmakingTriggerType: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceCompleteMatchmakingTriggerType::NONE,
                enableCollaborateSeasonRating: \Gs2Cdk\Matchmaking\Model\Enums\NamespaceEnableCollaborateSeasonRating::DISABLE,
                collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001",
                collaborateSeasonRatingTtl: 60,
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.matchmaking.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.matchmaking.model.options.NamespaceOptions()
                        .withEnableRating(true)
                        .withCreateGatheringTriggerType(io.gs2.cdk.matchmaking.model.enums.NamespaceCreateGatheringTriggerType.NONE)
                        .withCompleteMatchmakingTriggerType(io.gs2.cdk.matchmaking.model.enums.NamespaceCompleteMatchmakingTriggerType.NONE)
                        .withEnableCollaborateSeasonRating(io.gs2.cdk.matchmaking.model.enums.NamespaceEnableCollaborateSeasonRating.DISABLE)
                        .withCollaborateSeasonRatingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001")
                        .withCollaborateSeasonRatingTtl(60)
                        .withLogSetting(new io.gs2.cdk.core.model.LogSetting(
                            "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                        ))
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Matchmaking.Model.Options.NamespaceOptions
            {
                enableRating = true,
                createGatheringTriggerType = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCreateGatheringTriggerType.None,
                completeMatchmakingTriggerType = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceCompleteMatchmakingTriggerType.None,
                enableCollaborateSeasonRating = Gs2Cdk.Gs2Matchmaking.Model.Enums.NamespaceEnableCollaborateSeasonRating.Disable,
                collaborateSeasonRatingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001",
                collaborateSeasonRatingTtl = 60,
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import matchmaking from "@/gs2cdk/matchmaking";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new matchmaking.model.Namespace(
            this,
            "namespace-0001",
            {
                enableRating: true,
                createGatheringTriggerType: matchmaking.model.NamespaceCreateGatheringTriggerType.NONE,
                completeMatchmakingTriggerType: matchmaking.model.NamespaceCompleteMatchmakingTriggerType.NONE,
                enableCollaborateSeasonRating: matchmaking.model.NamespaceEnableCollaborateSeasonRating.DISABLE,
                collaborateSeasonRatingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001",
                collaborateSeasonRatingTtl: 60,
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, matchmaking

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        matchmaking.Namespace(
            stack=self,
            name='namespace-0001',
            options=matchmaking.NamespaceOptions(
                enable_rating=True,
                create_gathering_trigger_type=matchmaking.NamespaceCreateGatheringTriggerType.NONE,
                complete_matchmaking_trigger_type=matchmaking.NamespaceCompleteMatchmakingTriggerType.NONE,
                enable_collaborate_season_rating=matchmaking.NamespaceEnableCollaborateSeasonRating.DISABLE,
                collaborate_season_rating_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001',
                collaborate_season_rating_ttl=60,
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

print(SampleStack().yaml())  # Generate Template

```


#### TransactionSetting

트랜잭션 설정<br>

트랜잭션 설정은 트랜잭션의 실행 방식, 정합성, 비동기 처리, 충돌 회피 메커니즘을 제어하는 설정입니다.<br>
자동 실행(AutoRun), 원자적 실행(AtomicCommit), GS2-Distributor를 이용한 비동기 실행, 스크립트 결과의 일괄 적용, GS2-JobQueue를 통한 입수 액션의 비동기화 등을 조합하여 게임 로직에 맞는 견고한 트랜잭션 관리를 가능하게 합니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| enableAutoRun | bool |  |  | false |  | 발행한 트랜잭션을 서버 사이드에서 자동으로 실행할지 여부 |
| enableAtomicCommit | bool | {enableAutoRun} == true |  | false |  | 트랜잭션의 실행을 원자적으로 커밋할지 여부<br>※ enableAutoRun이(가) true 이면 활성화 |
| transactionUseDistributor | bool | {enableAtomicCommit} == true |  | false |  | 트랜잭션을 비동기 처리로 실행할지 여부<br>※ enableAtomicCommit이(가) true 이면 활성화 |
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true |  | false |  | 스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부<br>※ transactionUseDistributor이(가) true 이면 활성화 |
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true |  | false |  | 입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부<br>※ enableAtomicCommit이(가) true 이면 활성화 |
| distributorNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:distributor:default" |  ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스GRN |
| queueNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:queue:default" |  ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스GRN |

#### ScriptSetting

스크립트 설정<br>

GS2에서는 마이크로서비스의 이벤트에 연결하여 커스텀 스크립트를 실행할 수 있습니다.<br>
이 모델은 스크립트 실행을 트리거하기 위한 설정을 보유합니다.<br>

스크립트 실행 방식은 크게 두 가지로, 바로 "동기 실행"과 "비동기 실행"입니다.<br>
동기 실행은 스크립트 실행이 완료될 때까지 처리가 블록됩니다.<br>
대신 스크립트 실행 결과를 이용하여 API 실행을 중단시키거나 API 응답 내용을 제어할 수 있습니다.<br>

한편, 비동기 실행에서는 스크립트 완료를 기다리기 위해 처리가 블록되는 일이 없습니다.<br>
다만 스크립트 실행 결과를 이용하여 API 실행을 중단하거나 API 응답 내용을 변경할 수는 없습니다.<br>
비동기 실행은 API의 응답 흐름에 영향을 주지 않으므로 원칙적으로 비동기 실행을 권장합니다.<br>

비동기 실행에는 실행 방식이 두 가지 있으며, GS2-Script와 Amazon EventBridge가 있습니다.<br>
Amazon EventBridge를 사용함으로써 Lua 이외의 언어로 처리를 작성할 수 있습니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| triggerScriptId | string |  |  |  |  ~ 1024자 | API 실행 시 동기적으로 실행되는 GS2-Script의 스크립트GRN<br>"grn:gs2:"로 시작하는 GRN 형식의 ID로 지정해야 합니다. |
| doneTriggerTargetType | 문자열 열거형<br>enum {<br>"none",<br>"gs2_script",<br>"aws"<br>}<br> |  |  | "none" |  | 비동기 스크립트의 실행 방법<br>비동기 실행에서 사용할 스크립트의 종류를 지정합니다.<br>"비동기 실행의 스크립트를 사용하지 않음(none)", "GS2-Script를 사용함(gs2_script)", "Amazon EventBridge를 사용함(aws)" 중에서 선택할 수 있습니다.none: 없음 / gs2_script: GS2-Script / aws: Amazon EventBridge /  |
| doneTriggerScriptId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024자 | 비동기 실행할 GS2-Script 스크립트GRN<br>"grn:gs2:"로 시작하는 GRN 형식의 ID로 지정해야 합니다.<br>※ doneTriggerTargetType이(가) "gs2_script" 이면 활성화 |
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == "gs2_script" |  |  |  ~ 1024자 | 비동기 실행 스크립트를 실행하는 GS2-JobQueue 네임스페이스GRN<br>비동기 실행 스크립트를 직접 실행하지 않고 GS2-JobQueue를 경유하는 경우 GS2-JobQueue의 네임스페이스GRN을 지정합니다.<br>GS2-JobQueue를 이용해야 할 이유는 많지 않으므로, 특별한 이유가 없다면 지정할 필요는 없습니다.<br>※ doneTriggerTargetType이(가) "gs2_script" 이면 활성화 |

#### NotificationSetting

푸시 통지에 관한 설정<br>

GS2의 마이크로서비스 내에서 어떠한 이벤트가 발생했을 때, 푸시 통지를 전송하기 위한 설정입니다.<br>
여기서 말하는 푸시 통지란 GS2-Gateway가 제공하는 WebSocket 인터페이스를 경유하는 처리이며, 스마트폰의 푸시 통지와는 성질이 다릅니다.<br>
예를 들어 매치메이킹이 완료되었을 때나 친구 요청이 도착했을 때 등, 게임 클라이언트의 조작과는 관계없이 상태가 변화했을 때 GS2-Gateway를 경유하여 푸시 통지를 함으로써, 게임 클라이언트는 상태 변화를 감지할 수 있습니다.<br>

GS2-Gateway의 푸시 통지는 통지 대상 디바이스가 오프라인이었을 때 추가 처리로 모바일 푸시 통지를 전송할 수 있습니다.<br>
모바일 푸시 통지를 잘 활용하면, 매치메이킹 중에 게임을 종료하더라도 모바일 푸시 통지를 사용하여 플레이어에게 알리고, 게임으로 복귀하도록 하는 흐름을 구현할 수 있을 가능성이 있습니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| gatewayNamespaceId | string |  |  | "grn:gs2:{region}:{ownerId}:gateway:default" |  ~ 1024자 | 푸시 통지에 사용할 GS2-Gateway의 네임스페이스<br>"grn:gs2:"로 시작하는 GRN 형식으로 GS2-Gateway의 네임스페이스 ID를 지정합니다. |
| enableTransferMobileNotification | bool? |  |  | false |  | 모바일 푸시 통지로 전달할지 여부<br>이 통지를 전송하려 할 때, 통지 대상 디바이스가 오프라인일 경우 모바일 푸시 통지로 전달할지 여부를 지정합니다. |
| sound | string | {enableTransferMobileNotification} == true |  |  |  ~ 1024자 | 모바일 푸시 통지에서 사용할 사운드 파일명<br>여기서 지정한 사운드 파일명은 모바일 푸시 통지를 전송할 때 사용되며, 특별한 사운드로 통지를 출력할 수 있습니다.<br>※ enableTransferMobileNotification이(가) true 이면 활성화 |
| enable | 문자열 열거형<br>enum {<br>"Enabled",<br>"Disabled"<br>}<br> |  |  | "Enabled" |  | 푸시 통지를 활성화할지 여부Enabled: 활성화 / Disabled: 비활성화 /  |

#### LogSetting

로그 출력 설정<br>

로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하기 위해 사용되는 GS2-Log 네임스페이스의 식별자(Namespace ID)를 보관합니다.<br>
로그 네임스페이스ID(loggingNamespaceId)에는 로그 데이터를 수집하여 저장하는 GS2-Log의 네임스페이스를 GRN 형식으로 지정합니다.<br>
이 설정을 하면 설정된 네임스페이스 내에서 발생한 API 요청·응답 로그 데이터가 대상 GS2-Log 네임스페이스 쪽으로 출력됩니다.<br>
GS2-Log에서는 실시간으로 로그가 제공되어 시스템 모니터링, 분석, 디버깅 등에 활용할 수 있습니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| loggingNamespaceId | string |  | ✓ |  |  ~ 1024자 | 로그를 출력할 GS2-Log의 네임스페이스GRN<br>"grn:gs2:"로 시작하는 GRN 형식의 ID로 지정해야 합니다. |

---

### CurrentModelMaster

현재 활성화된 모델의 마스터 데이터<br>

현재 네임스페이스 내에서 유효한 모델의 정의를 기술한 마스터 데이터입니다.<br>
GS2에서는 마스터 데이터 관리에 JSON 형식의 파일을 사용합니다.<br>
파일을 업로드하면 실제로 서버에 설정을 반영할 수 있습니다.<br>

JSON 파일을 작성하는 방법으로, 매니지먼트 콘솔 내에 마스터 데이터 에디터를 제공하고 있습니다.<br>
또한 게임 운영에 더 적합한 도구를 직접 제작하여 적절한 형식의 JSON 파일을 출력하는 방식으로도 서비스를 이용할 수 있습니다.
**ℹ️ Note**

JSON 파일 형식에 대해서는 [GS2-Matchmaking 마스터 데이터 레퍼런스](api_reference/matchmaking/master_data/)를 참조해 주세요.

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| namespaceName | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| mode | 문자열 열거형<br>enum {<br>"direct",<br>"preUpload"<br>}<br> |  | | "direct" |  | 업데이트 모드direct: 마스터 데이터를 직접 업데이트 / preUpload: 마스터 데이터를 업로드한 후 업데이트 /  |
| settings | string | {mode} == "direct" | ✓※|  |  ~ 5242880 바이트 (5MB) | 마스터 데이터<br>※ mode이(가) "direct" 이면 필수 |
| uploadToken | string | {mode} == "preUpload" | ✓※|  |  ~ 1024자 | 사전 업로드로 획득한 토큰<br>업로드한 마스터 데이터를 적용하기 위해 사용됩니다.<br>※ mode이(가) "preUpload" 이면 필수 |

#### GetAttr

[!GetAttr](/articles/tech/deploy/#getattr) 태그로 취득 가능한 리소스 생성 결과

| | 타입 | 설명 |
| --- | --- | --- |
| Item | [CurrentModelMaster](../sdk#currentmodelmaster) | 갱신된 현재 활성화된 모델의 마스터 데이터

#### 구현 예제




**GS2-Deploy(YAML)**
```yaml

Type: GS2::Matchmaking::CurrentModelMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2020-06-24",
    "ratingModels": [
      {
        "name": "rating-0001",
        "initialValue": 1500,
        "volatility": 100,
        "metadata": "RATING_0001"
      },
      {
        "name": "rating-0002",
        "initialValue": 1500,
        "volatility": 150,
        "metadata": "RATING_0002"
      }
    ],
    "seasonModels": [
      {
        "name": "season-0001",
        "maximumParticipants": 50,
        "challengePeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
      },
      {
        "name": "season-0002",
        "maximumParticipants": 100,
        "challengePeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
      }
    ]
  }
  UploadToken: null

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/matchmaking"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
matchmaking.NewNamespace(
    &SampleStack,
    "namespace-0001",
    matchmaking.NamespaceOptions{},
).MasterData(
    []matchmaking.RatingModel{
        matchmaking.NewRatingModel(
            "rating-0001",
            1500,
            100,
            matchmaking.RatingModelOptions{
                Metadata: pointy.String("RATING_0001"),
            },
        ),
        matchmaking.NewRatingModel(
            "rating-0002",
            1500,
            150,
            matchmaking.RatingModelOptions{
                Metadata: pointy.String("RATING_0002"),
            },
        ),
    },
    []matchmaking.SeasonModel{
        matchmaking.NewSeasonModel(
            "season-0001",
            50,
            "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001",
            matchmaking.SeasonModelOptions{
            },
        ),
        matchmaking.NewSeasonModel(
            "season-0002",
            100,
            "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002",
            matchmaking.SeasonModelOptions{
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Matchmaking\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Matchmaking\Model\RatingModel(
                    name:"rating-0001",
                    initialValue:1500,
                    volatility:100,
                    options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
                        metadata:"RATING_0001"
                    )
                ),
                new \Gs2Cdk\Matchmaking\Model\RatingModel(
                    name:"rating-0002",
                    initialValue:1500,
                    volatility:150,
                    options: new \Gs2Cdk\Matchmaking\Model\Options\RatingModelOptions(
                        metadata:"RATING_0002"
                    )
                )
            ],
            [
                new \Gs2Cdk\Matchmaking\Model\SeasonModel(
                    name:"season-0001",
                    maximumParticipants:50,
                    challengePeriodEventId:"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                ),
                new \Gs2Cdk\Matchmaking\Model\SeasonModel(
                    name:"season-0002",
                    maximumParticipants:100,
                    challengePeriodEventId:"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.matchmaking.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.matchmaking.model.RatingModel(
                    "rating-0001",
                    1500,
                    100,
                    new io.gs2.cdk.matchmaking.model.options.RatingModelOptions()
                        .withMetadata("RATING_0001")
                ),
                new io.gs2.cdk.matchmaking.model.RatingModel(
                    "rating-0002",
                    1500,
                    150,
                    new io.gs2.cdk.matchmaking.model.options.RatingModelOptions()
                        .withMetadata("RATING_0002")
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.matchmaking.model.SeasonModel(
                    "season-0001",
                    50,
                    "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                ),
                new io.gs2.cdk.matchmaking.model.SeasonModel(
                    "season-0002",
                    100,
                    "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Matchmaking.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Matchmaking.Model.RatingModel[] {
                new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
                    name: "rating-0001",
                    initialValue: 1500,
                    volatility: 100,
                    options: new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions
                    {
                        metadata = "RATING_0001"
                    }
                ),
                new Gs2Cdk.Gs2Matchmaking.Model.RatingModel(
                    name: "rating-0002",
                    initialValue: 1500,
                    volatility: 150,
                    options: new Gs2Cdk.Gs2Matchmaking.Model.Options.RatingModelOptions
                    {
                        metadata = "RATING_0002"
                    }
                )
            },
            new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel[] {
                new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel(
                    name: "season-0001",
                    maximumParticipants: 50,
                    challengePeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                ),
                new Gs2Cdk.Gs2Matchmaking.Model.SeasonModel(
                    name: "season-0002",
                    maximumParticipants: 100,
                    challengePeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

```

**TypeScript**
```typescript

import core from "@/gs2cdk/core";
import matchmaking from "@/gs2cdk/matchmaking";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new matchmaking.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new matchmaking.model.RatingModel(
                    "rating-0001",
                    1500,
                    100,
                    {
                        metadata: "RATING_0001"
                    }
                ),
                new matchmaking.model.RatingModel(
                    "rating-0002",
                    1500,
                    150,
                    {
                        metadata: "RATING_0002"
                    }
                )
            ],
            [
                new matchmaking.model.SeasonModel(
                    "season-0001",
                    50,
                    "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                ),
                new matchmaking.model.SeasonModel(
                    "season-0002",
                    100,
                    "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002"
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template

```

**Python**
```python

from gs2_cdk import Stack, core, matchmaking

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        matchmaking.Namespace(
            stack=self,
            name="namespace-0001",
            options=matchmaking.NamespaceOptions(
                enable_rating=True,
                enable_collaborate_season_rating=matchmaking.NamespaceEnableCollaborateSeasonRating.DISABLE,
                collaborate_season_rating_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:seasonRating:namespace-0001',
                collaborate_season_rating_ttl=60,
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        ).master_data(
            rating_models=[
                matchmaking.RatingModel(
                    name='rating-0001',
                    initial_value=1500,
                    volatility=100,
                    options=matchmaking.RatingModelOptions(
                        metadata = 'RATING_0001'
                    ),
                ),
                matchmaking.RatingModel(
                    name='rating-0002',
                    initial_value=1500,
                    volatility=150,
                    options=matchmaking.RatingModelOptions(
                        metadata = 'RATING_0002'
                    ),
                ),
            ],
            season_models=[
                matchmaking.SeasonModel(
                    name='season-0001',
                    maximum_participants=50,
                    challenge_period_event_id='grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001'
                ),
                matchmaking.SeasonModel(
                    name='season-0002',
                    maximum_participants=100,
                    challenge_period_event_id='grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0002'
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template

```


#### RatingModel

레이팅 모델<br>

GS2에서는 레이팅 알고리즘으로 Glicko-2를 채택하고 있습니다.<br>
Glicko-2에는 여러 파라미터가 있지만, GS2-Matchmaking에서는 이를 종합적으로 나타내는 변동성이라는 하나의 파라미터로 통합하고 있습니다.<br>
변동성은 변화의 크기를 나타내는 파라미터로, 값이 클수록 레이팅 값의 변동 폭이 커집니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| ratingModelId | string |  | ※ |  |  ~ 1024자 | 레이팅 모델GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 레이팅 모델 이름<br>레이팅 모델 고유의 이름. 영숫자 및 -(하이픈), _(밑줄), .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 128자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| initialValue | int |  |  | 1500 | 100 ~ 10000 | 레이트 값의 초기값<br>플레이어가 처음 레이팅이 적용된 매치메이킹에 참가할 때 부여되는 시작 레이트 값입니다.<br>기본값은 1500입니다. 모든 플레이어는 동일한 레이팅에서 시작하며, 대전 결과에 따라 조정됩니다. |
| volatility | int |  |  | 100 | 1 ~ 20000 | 레이팅의 변동성<br>각 대전 후 레이트 값이 얼마나 변동하는지를 제어하는 Glicko-2의 파라미터입니다.<br>값이 클수록 레이팅의 변동 폭이 커져 더 빠르게 레이팅이 조정됩니다.<br>값이 작을수록 레이팅이 안정되어 완만하게 변화합니다. 기본값은 100입니다. |

#### SeasonModel

시즌 모델<br>

시즌 매치메이킹에서, 일정 기간 동안 유효한 영속 개더링의 기간·최대 참가 인원수·티어 연동 설정을 정의하는 마스터 데이터입니다.<br>
GS2-Schedule을 통해 기간을 관리하며, 필요에 따라 GS2-Experience와 연동하여 동일한 티어 내에서 영속 개더링을 형성합니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| seasonModelId | string |  | ※ |  |  ~ 1024자 | 시즌 모델GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 시즌 모델 이름<br>시즌 모델 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 128자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| maximumParticipants | int |  | ✓ |  | 2 ~ 1000 | 최대 참가 인원수<br>하나의 시즌 개더링에 참가할 수 있는 플레이어의 최대 인원수입니다.<br>이 상한에 도달하면 시즌 개더링은 만원 상태가 되어 더 이상 플레이어가 참가할 수 없게 됩니다.<br>2에서 1000 사이의 범위로 지정합니다. |
| experienceModelId | string |  |  |  |  ~ 1024자 | 티어 관리용 경험치 모델 GRN<br>플레이어의 티어를 결정하기 위해 사용하는 GS2-Experience 경험치 모델의 GRN입니다.<br>이 경험치 모델에서의 플레이어 랭크가 매치메이킹의 티어로 사용되어, 비슷한 레벨의 플레이어끼리 그룹화됩니다.<br>지정하지 않으면 티어에 의한 그룹화가 비활성화되어, 레벨에 관계없이 모든 플레이어가 매칭됩니다. |
| challengePeriodEventId | string |  | ✓ |  |  ~ 1024자 | 챌린지 기간 이벤트 GRN<br>이 시즌의 유효 기간을 정의하는 GS2-Schedule 이벤트의 GRN입니다.<br>이 이벤트가 활성화되어 있는 동안에만 시즌 개더링의 생성·참가가 가능합니다.<br>이벤트 기간이 종료되면 시즌이 종료되어 새로운 매치메이킹이 불가능해집니다. |

---



