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

# GS2-Guild Deploy/CDK 레퍼런스

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




## 엔티티

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

### Namespace

네임스페이스<br>

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

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

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | 트랜잭션 설정<br>길드 조작 시 분산 트랜잭션의 실행 방식을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다. |
| changeNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 길드 변경 통지<br>길드 정보(표시 이름, 속성, 가입 정책 등)가 갱신되었을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 길드 멤버가 길드의 변경 사항에 대해 실시간으로 알림을 받을 수 있습니다. |
| joinNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 멤버 가입 통지<br>새로운 멤버가 길드에 가입했을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 자유 가입 및 참가 신청 승인 양쪽 모두에 대응합니다. 기존 멤버가 신규 가입을 통지받을 수 있게 됩니다. |
| leaveNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 멤버 탈퇴 통지<br>멤버가 길드에서 탈퇴하거나 제명되었을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 자발적인 탈퇴와 길드 마스터에 의한 추방 양쪽 모두에 대응합니다. |
| changeMemberNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 멤버 변경 통지<br>길드 멤버의 정보(롤, 메타데이터)가 갱신되었을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 메타데이터 변경으로 이 통지가 발생할지 여부는 changeMemberNotificationIgnoreChangeMetadata로 제어할 수 있습니다. |
| changeMemberNotificationIgnoreChangeMetadata | bool? |  | | false |  | 멤버의 정보가 갱신되었을 때 통지를 발행할 때 메타데이터 변경을 무시할지 여부 |
| receiveRequestNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 신청 수신 통지<br>길드가 사용자로부터 새로운 참가 신청을 수신했을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 길드 마스터 및 권한을 가진 멤버가 승인이 필요한 보류 신청을 통지받을 수 있게 됩니다. |
| removeRequestNotification | [NotificationSetting](#notificationsetting) |  | |  |  | 신청 삭제 통지<br>길드 참가 신청이 삭제되었을 때 GS2-Gateway를 통해 전송되는 푸시 통지입니다. 발신자에 의한 취소, 길드에 의한 거부, 또는 승인(신청 삭제 및 멤버 추가) 중 하나에 대응합니다. |
| createGuildScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드를 생성할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`createGuild`](../script/#createguild) |
| updateGuildScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드를 갱신할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`updateGuild`](../script/#updateguild) |
| joinGuildScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드에 가입할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`joinGuild`](../script/#joinguild) |
| receiveJoinRequestScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드에 참가 신청을 접수했을 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`receiveJoinRequest`](../script/#receivejoinrequest) |
| leaveGuildScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드를 탈퇴할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`leaveGuild`](../script/#leaveguild) |
| changeRoleScript | [ScriptSetting](#scriptsetting) |  | |  |  | 멤버에게 할당된 롤을 변경할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`changeRole`](../script/#changerole) |
| deleteGuildScript | [ScriptSetting](#scriptsetting) |  | |  |  | 길드를 삭제할 때 실행할 스크립트 설정<br>Script 트리거 레퍼런스 - [`deleteGuild`](../script/#deleteguild) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | 로그 출력 설정<br>길드 조작의 로그 데이터를 GS2-Log 로 출력하기 위한 설정입니다. GS2-Log 의 네임스페이스를 지정하면 길드 생성, 참가, 탈퇴, 역할 변경의 API 요청·응답 로그를 수집할 수 있습니다. |

#### GetAttr

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

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

#### 구현 예제




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

Type: GS2::Guild::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: 
    EnableAutoRun: true
    QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
  ChangeNotification: null
  JoinNotification: null
  LeaveNotification: null
  ChangeMemberNotification: null
  ChangeMemberNotificationIgnoreChangeMetadata: null
  ReceiveRequestNotification: null
  RemoveRequestNotification: null
  CreateGuildScript: null
  UpdateGuildScript: null
  JoinGuildScript: null
  ReceiveJoinRequestScript: null
  LeaveGuildScript: null
  ChangeRoleScript: null
  DeleteGuildScript: 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/guild"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
guild.NewNamespace(
    &SampleStack,
    "namespace-0001",
    guild.NamespaceOptions{
        TransactionSetting: &core.TransactionSetting{
            QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
        },
        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\Guild\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Guild\Model\Options\NamespaceOptions(
                transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
                    new \Gs2Cdk\Core\Model\TransactionSettingOptions(
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    )
                ),
                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.guild.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.guild.model.options.NamespaceOptions()
                        .withTransactionSetting(new io.gs2.cdk.core.model.TransactionSetting(
                            new io.gs2.cdk.core.model.options.TransactionSettingOptions()
                                .withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001")
                        ))
                        .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.Gs2Guild.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Guild.Model.Options.NamespaceOptions
            {
                transactionSetting = new Gs2Cdk.Core.Model.TransactionSetting(
                    options: new Gs2Cdk.Core.Model.TransactionSettingOptions
                    {
                        queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    }
                ),
                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 guild from "@/gs2cdk/guild";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new guild.model.Namespace(
            this,
            "namespace-0001",
            {
                transactionSetting: new core.TransactionSetting(
                    {
                        queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    }
                ),
                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, guild

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        guild.Namespace(
            stack=self,
            name='namespace-0001',
            options=guild.NamespaceOptions(
                transaction_setting=core.TransactionSetting(
                    options=core.TransactionSettingOptions(
                        queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
                    )
                ),
                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로 지정해야 합니다. |

---

### CurrentGuildMaster

현재 활성화되어 있는 길드 모델의 마스터 데이터<br>

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

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

JSON 파일 형식에 대해서는 [GS2-Guild 마스터 데이터 레퍼런스](api_reference/guild/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 | [CurrentGuildMaster](../sdk#currentguildmaster) | 갱신된 현재 활성화된 길드 모델의 마스터 데이터

#### 구현 예제




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

Type: GS2::Guild::CurrentGuildMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2024-04-25",
    "guildModels": [
      {
        "name": "guild-0001",
        "defaultMaximumMemberCount": 10,
        "maximumMemberCount": 50,
        "inactivityPeriodDays": 10,
        "roles": [
          {
            "name": "master",
            "policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
          },
          {
            "name": "member",
            "policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
          }
        ],
        "guildMasterRole": "master",
        "guildMemberDefaultRole": "member",
        "rejoinCoolTimeMinutes": 1440
      },
      {
        "name": "guild-0002",
        "defaultMaximumMemberCount": 20,
        "maximumMemberCount": 40,
        "inactivityPeriodDays": 10,
        "roles": [
          {
            "name": "master",
            "policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
          },
          {
            "name": "member",
            "policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
          }
        ],
        "guildMasterRole": "master",
        "guildMemberDefaultRole": "member",
        "rejoinCoolTimeMinutes": 360
      }
    ]
  }
  UploadToken: null

```

**Go**
```go

import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/guild"
)


SampleStack := core.NewStack()
guild.NewNamespace(
    &SampleStack,
    "namespace-0001",
    guild.NamespaceOptions{},
).MasterData(
    []guild.GuildModel{
        guild.NewGuildModel(
            "guild-0001",
            10,
            50,
            10,
            []guild.RoleModel{
                guild.NewRoleModel(
                    "master",
                    "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                    guild.RoleModelOptions{},
                ),
                guild.NewRoleModel(
                    "member",
                    "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                    guild.RoleModelOptions{},
                ),
            },
            "master",
            "member",
            1440,
            guild.GuildModelOptions{
            },
        ),
        guild.NewGuildModel(
            "guild-0002",
            20,
            40,
            10,
            []guild.RoleModel{
                guild.NewRoleModel(
                    "master",
                    "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                    guild.RoleModelOptions{},
                ),
                guild.NewRoleModel(
                    "member",
                    "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                    guild.RoleModelOptions{},
                ),
            },
            "master",
            "member",
            360,
            guild.GuildModelOptions{
            },
        ),
    },
)

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

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Guild\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Guild\Model\GuildModel(
                    name:"guild-0001",
                    defaultMaximumMemberCount:10,
                    maximumMemberCount:50,
                    inactivityPeriodDays:10,
                    roles:[
                        new \Gs2Cdk\Guild\Model\RoleModel(
                            name: "master",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                        ),
                        new \Gs2Cdk\Guild\Model\RoleModel(
                            name: "member",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                        ),
                    ],
                    guildMasterRole:"master",
                    guildMemberDefaultRole:"member",
                    rejoinCoolTimeMinutes:1440
                ),
                new \Gs2Cdk\Guild\Model\GuildModel(
                    name:"guild-0002",
                    defaultMaximumMemberCount:20,
                    maximumMemberCount:40,
                    inactivityPeriodDays:10,
                    roles:[
                        new \Gs2Cdk\Guild\Model\RoleModel(
                            name: "master",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                        ),
                        new \Gs2Cdk\Guild\Model\RoleModel(
                            name: "member",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
                        ),
                    ],
                    guildMasterRole:"master",
                    guildMemberDefaultRole:"member",
                    rejoinCoolTimeMinutes:360
                )
            ]
        );
    }
}

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

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.guild.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.guild.model.GuildModel(
                    "guild-0001",
                    10,
                    50,
                    10,
                    Arrays.asList(
                        new io.gs2.cdk.guild.model.RoleModel(
                            "master",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new io.gs2.cdk.guild.model.RoleModel(
                            "member",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        )
                    ),
                    "master",
                    "member",
                    1440
                ),
                new io.gs2.cdk.guild.model.GuildModel(
                    "guild-0002",
                    20,
                    40,
                    10,
                    Arrays.asList(
                        new io.gs2.cdk.guild.model.RoleModel(
                            "master",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new io.gs2.cdk.guild.model.RoleModel(
                            "member",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        )
                    ),
                    "master",
                    "member",
                    360
                )
            )
        );
    }
}

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

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Guild.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Guild.Model.GuildModel[] {
                new Gs2Cdk.Gs2Guild.Model.GuildModel(
                    name: "guild-0001",
                    defaultMaximumMemberCount: 10,
                    maximumMemberCount: 50,
                    inactivityPeriodDays: 10,
                    roles: new Gs2Cdk.Gs2Guild.Model.RoleModel[]
                    {
                        new Gs2Cdk.Gs2Guild.Model.RoleModel(
                            name: "master",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new Gs2Cdk.Gs2Guild.Model.RoleModel(
                            name: "member",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        )
                    },
                    guildMasterRole: "master",
                    guildMemberDefaultRole: "member",
                    rejoinCoolTimeMinutes: 1440
                ),
                new Gs2Cdk.Gs2Guild.Model.GuildModel(
                    name: "guild-0002",
                    defaultMaximumMemberCount: 20,
                    maximumMemberCount: 40,
                    inactivityPeriodDays: 10,
                    roles: new Gs2Cdk.Gs2Guild.Model.RoleModel[]
                    {
                        new Gs2Cdk.Gs2Guild.Model.RoleModel(
                            name: "master",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new Gs2Cdk.Gs2Guild.Model.RoleModel(
                            name: "member",
                            policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        )
                    },
                    guildMasterRole: "master",
                    guildMemberDefaultRole: "member",
                    rejoinCoolTimeMinutes: 360
                )
            }
        );
    }
}

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

```

**TypeScript**
```typescript

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new guild.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new guild.model.GuildModel(
                    "guild-0001",
                    10,
                    50,
                    10,
                    [
                        new guild.model.RoleModel(
                            "master",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new guild.model.RoleModel(
                            "member",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                    ],
                    "master",
                    "member",
                    1440
                ),
                new guild.model.GuildModel(
                    "guild-0002",
                    20,
                    40,
                    10,
                    [
                        new guild.model.RoleModel(
                            "master",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                        new guild.model.RoleModel(
                            "member",
                            "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
                        ),
                    ],
                    "master",
                    "member",
                    360
                )
            ]
        );
    }
}

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

```

**Python**
```python

from gs2_cdk import Stack, core, guild

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        guild.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            guild_models=[
                guild.GuildModel(
                    name='guild-0001',
                    default_maximum_member_count=10,
                    maximum_member_count=50,
                    inactivity_period_days=10,
                    roles=[
                        guild.RoleModel(
                            name='master',
                            policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',        
                        ),
                        guild.RoleModel(
                            name='member',
                            policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',        
                        ),
                    ],
                    guild_master_role='master',
                    guild_member_default_role='member',
                    rejoin_cool_time_minutes=1440
                ),
                guild.GuildModel(
                    name='guild-0002',
                    default_maximum_member_count=20,
                    maximum_member_count=40,
                    inactivity_period_days=10,
                    roles=[
                        guild.RoleModel(
                            name='master',
                            policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',        
                        ),
                        guild.RoleModel(
                            name='member',
                            policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',        
                        ),
                    ],
                    guild_master_role='master',
                    guild_member_default_role='member',
                    rejoin_cool_time_minutes=360
                ),
            ],
        )

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

```


#### GuildModel

길드 모델<br>

길드 모델이란 길드에 가입 가능한 최대 인원수 설정 및 길드 내 직책별 권한 설정을 가지는 엔티티입니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| guildModelId | string |  | ※ |  |  ~ 1024자 | 길드 모델 GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 길드 모델 이름<br>길드 모델 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 2048자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| defaultMaximumMemberCount | int |  | ✓ |  | 1 ~ 2147483646 | 기본 최대 멤버 수<br>새 길드가 생성될 때 허용되는 초기 최대 멤버 수입니다. 이 값은 신규 길드의 currentMaximumMemberCount 초기값으로 사용됩니다. 길드 조작이나 입수 액션을 통해 나중에 maximumMemberCount 상한까지 늘릴 수 있습니다. |
| maximumMemberCount | int |  | ✓ |  | 1 ~ 2147483646 | 최대 멤버 수 상한<br>길드가 가질 수 있는 멤버 수의 절대적인 상한입니다. 길드의 currentMaximumMemberCount는 이 값을 초과할 수 없습니다. 길드가 의도된 규모를 넘어 성장하는 것을 방지하는 하드 캡으로 작동합니다. |
| inactivityPeriodDays | int |  |  | 7 | 1 ~ 365 | 무활동 기간(일수)<br>길드 마스터의 무활동이 이 일수를 초과한 경우, 남은 길드 멤버 중에서 새로운 길드 마스터가 자동으로 선출됩니다. 길드 마스터가 플레이를 중단했을 때 길드가 관리 불능 상태가 되는 것을 방지합니다. |
| roles | [List&lt;RoleModel&gt;](#rolemodel) |  | ✓ |  | 1 ~ 10 items | 롤 모델 리스트<br>이 타입의 길드 내에서 이용 가능한 롤 정의 리스트입니다. guildMasterRole 및 guildMemberDefaultRole에서 참조되는 롤을 최소한 포함해야 합니다. 각 롤은 정책 문서를 통해 고유한 권한 집합을 정의합니다. 최대 10개의 롤을 정의할 수 있습니다. |
| guildMasterRole | string |  | ✓ |  |  ~ 128자 | 길드 마스터 롤 이름<br>길드 마스터에게 할당되는 롤의 이름입니다. roles 리스트에 정의된 롤을 참조해야 합니다. 길드 마스터는 일반적으로 참가 신청 승인, 멤버 추방, 롤 변경, 길드 설정 갱신 등 길드를 관리하는 모든 권한을 가집니다. |
| guildMemberDefaultRole | string |  | ✓ |  |  ~ 128자 | 기본 멤버 롤 이름<br>새로운 길드 멤버가 가입할 때 자동으로 할당되는 롤의 이름입니다. roles 리스트에 정의된 롤을 참조해야 합니다. 이는 길드 마스터에 의한 롤 변경 이전, 일반 멤버의 기본 권한 집합입니다. |
| rejoinCoolTimeMinutes | int |  |  | 0 | 0 ~ 2147483646 | 재가입 쿨타임(분)<br>사용자가 길드를 탈퇴한 후 다시 길드에 가입할 수 있게 되기까지의 쿨다운 기간(분)입니다. 0으로 설정하면 즉시 재가입이 가능합니다. 사용자가 길드에 반복적으로 가입·탈퇴하는 악용 패턴을 방지합니다. |
| maxConcurrentJoinGuilds | int |  |  |  | 1 ~ 10 | 동시 가입 가능 길드 최대 수<br>사용자가 이 타입의 길드에 동시에 멤버로 가입할 수 있는 최대 수입니다. 플레이어가 여러 길드에 동시에 소속될 수 있는 디자인(예: 전투 길드와 소셜 길드)을 가능하게 합니다. 값은 1에서 10 사이입니다. |
| maxConcurrentGuildMasterCount | int |  |  |  | 1 ~ 100 | 동시 존재 가능 길드 마스터 최대 수<br>하나의 길드에 동시에 존재할 수 있는 길드 마스터의 최대 인원수입니다. 여러 플레이어가 길드 마스터의 책임과 권한을 공유하는 공동 리더십 디자인을 가능하게 합니다. 값은 1에서 100 사이입니다. |

#### RoleModel

롤 모델<br>

롤 모델은 길드 내에서의 역할을 정의하고, 각 역할별로 실행할 수 있는 처리에 관한 권한을 설정합니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓ |  |  ~ 128자 | 롤 모델 이름<br>롤 모델 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| metadata | string |  |  |  |  ~ 2048자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| policyDocument | string |  | ✓ |  |  ~ 10240자 | 정책 문서<br>이 역할의 권한을 정의하는 JSON 형식의 정책 문서입니다. 이 역할에 할당된 멤버에 대해 어떤 길드 조작(참가 요청 승인/거부, 멤버 추방, 길드 정보 업데이트, 멤버 역할 변경 등)이 허용되거나 거부되는지를 지정합니다. |

---



