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

# GS2-Account Deploy/CDK 레퍼런스

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




## 엔티티

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

### Namespace

네임스페이스<br>

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

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

#### Request

리소스 생성・갱신 요청

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓|  |  ~ 128자 | 네임스페이스 이름<br>네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
| description | string |  | |  |  ~ 1024자 | 설명문 |
| transactionSetting | [TransactionSetting](#transactionsetting) |  | |  |  | 트랜잭션 설정 |
| changePasswordIfTakeOver | bool |  | | false |  | 계정 인계 시 비밀번호를 변경할지 여부<br>계정 인계 시 비밀번호를 변경할지 여부를 지정합니다.<br>이 설정을 통해 계정 인계를 실행한 후 인계 이전 디바이스로부터의 로그인을 제한할 수 있습니다. |
| differentUserIdForLoginAndDataRetention | bool |  | | false |  | 로그인에 사용하는 사용자 ID와 데이터의 보유에 사용하는 사용자 ID를 다르게 함<br>로그인용 사용자 ID와 데이터 보유용 사용자 ID를 분리할지 여부를 지정합니다.<br>이 설정을 통해 플랫폼 제공업체가 규정하는 개인정보 보호 요건을 적은 작업량으로 충족할 수 있습니다.<br><br>※이 파라미터는 네임스페이스 생성 시에만 설정할 수 있습니다. |
| createAccountScript | [ScriptSetting](#scriptsetting) |  | |  |  | 계정을 신규 생성했을 때 실행할 스크립트의 설정<br>계정 생성의 커스텀 로직을 구현하는 데 사용됩니다.<br>Script 트리거 레퍼런스 - [`createAccount`](../script/#createaccount) |
| authenticationScript | [ScriptSetting](#scriptsetting) |  | |  |  | 인증했을 때 실행할 스크립트의 설정<br>인증 프로세스를 커스터마이즈하는 데 도움이 됩니다.<br>Script 트리거 레퍼런스 - [`authentication`](../script/#authentication) |
| createTakeOverScript | [ScriptSetting](#scriptsetting) |  | |  |  | 인계 정보를 등록했을 때 실행할 스크립트의 설정<br>인계 정보를 처음 등록했을 때 보상을 지급하기 위해 GS2-Mission의 카운터를 증가시키는 등의 커스텀 로직을 추가하는 데 사용됩니다.<br>Script 트리거 레퍼런스 - [`createTakeOver`](../script/#createtakeover) |
| doTakeOverScript | [ScriptSetting](#scriptsetting) |  | |  |  | 인계를 실행했을 때 실행할 스크립트의 설정<br>인계 처리의 추가 로직을 구현하는 데 도움이 됩니다.<br>Script 트리거 레퍼런스 - [`doTakeOver`](../script/#dotakeover) |
| banScript | [ScriptSetting](#scriptsetting) |  | |  |  | 계정 BAN 상태를 추가했을 때 실행할 스크립트의 설정<br>Script 트리거 레퍼런스 - [`ban`](../script/#ban) |
| unBanScript | [ScriptSetting](#scriptsetting) |  | |  |  | 계정 BAN 상태를 해제했을 때 실행할 스크립트의 설정<br>Script 트리거 레퍼런스 - [`unBan`](../script/#unban) |
| logSetting | [LogSetting](#logsetting) |  | |  |  | 로그 출력 설정<br>로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 기록하는 데 사용되는 GS2-Log 네임스페이스 정보를 보유합니다. |

#### GetAttr

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

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

#### 구현 예제




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

Type: GS2::Account::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  ChangePasswordIfTakeOver: false
  DifferentUserIdForLoginAndDataRetention: null
  CreateAccountScript: null
  AuthenticationScript: null
  CreateTakeOverScript: null
  DoTakeOverScript: null
  BanScript: null
  UnBanScript: 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/account"
)


SampleStack := core.NewStack()
account.NewNamespace(
    &SampleStack,
    "namespace-0001",
    account.NamespaceOptions{
        ChangePasswordIfTakeOver: false,
        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\Account\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Account\Model\Options\NamespaceOptions(
                changePasswordIfTakeOver: false,
                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.account.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.account.model.options.NamespaceOptions()
                        .withChangePasswordIfTakeOver(false)
                        .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.Gs2Account.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Account.Model.Options.NamespaceOptions
            {
                changePasswordIfTakeOver = false,
                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 account from "@/gs2cdk/account";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new account.model.Namespace(
            this,
            "namespace-0001",
            {
                changePasswordIfTakeOver: false,
                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, account

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        account.Namespace(
            stack=self,
            name='namespace-0001',
            options=account.NamespaceOptions(
                change_password_if_take_over=False,
                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" 이면 활성화 |

#### 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-Account 마스터 데이터 레퍼런스](api_reference/account/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::Account::CurrentModelMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2024-07-30",
    "takeOverTypeModels": [
      {
        "type": 0,
        "openIdConnectSetting":
          {
            "configurationPath": "https://accounts.google.com/.well-known/openid-configuration",
            "clientId": "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
            "clientSecret": "secret"
          },
        "metadata": "Google"
      },
      {
        "type": 1,
        "openIdConnectSetting":
          {
            "configurationPath": "https://appleid.apple.com/.well-known/openid-configuration",
            "clientId": "io.gs2.sample.auth",
            "appleTeamId": "9LX9LA85H8",
            "appleKeyId": "P937MLY6Z7",
            "applePrivateKeyPem": "-----BEGIN PRIVATE KEY-----\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\n-----END PRIVATE KEY-----"
          },
        "metadata": "Apple"
      }
    ]
  }
  UploadToken: null

```

**Go**
```go

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


SampleStack := core.NewStack()
account.NewNamespace(
    &SampleStack,
    "namespace-0001",
    account.NamespaceOptions{},
).MasterData(
    []account.TakeOverTypeModel{
        account.NewTakeOverTypeModel(
            0,
            account.NewOpenIdConnectSetting(
                "https://accounts.google.com/.well-known/openid-configuration",
                "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
                account.OpenIdConnectSettingOptions{
                    ClientSecret: pointy.String("secret"),
                },
            ),
            account.TakeOverTypeModelOptions{
                Metadata: pointy.String("Google"),
            },
        ),
        account.NewTakeOverTypeModel(
            1,
            account.NewOpenIdConnectSetting(
                "https://appleid.apple.com/.well-known/openid-configuration",
                "io.gs2.sample.auth",
                account.OpenIdConnectSettingOptions{
                    AppleTeamId: pointy.String("9LX9LA85H8"),
                    AppleKeyId: pointy.String("P937MLY6Z7"),
                    ApplePrivateKeyPem: pointy.String("-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----"),
                },
            ),
            account.TakeOverTypeModelOptions{
                Metadata: pointy.String("Apple"),
            },
        ),
    },
)

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

```

**PHP**
```php

class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Account\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Account\Model\TakeOverTypeModel(
                    type:0,
                    openIdConnectSetting:new \Gs2Cdk\Account\Model\OpenIdConnectSetting(
                        configurationPath: "https://accounts.google.com/.well-known/openid-configuration",
                        clientId: "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
                        options: new \Gs2Cdk\Account\Model\Options\OpenIdConnectSettingOptions(
                            clientSecret: "secret",
                        ),
                    ),
                    options: new \Gs2Cdk\Account\Model\Options\TakeOverTypeModelOptions(
                        metadata:"Google"
                    )
                ),
                new \Gs2Cdk\Account\Model\TakeOverTypeModel(
                    type:1,
                    openIdConnectSetting:new \Gs2Cdk\Account\Model\OpenIdConnectSetting(
                        configurationPath: "https://appleid.apple.com/.well-known/openid-configuration",
                        clientId: "io.gs2.sample.auth",
                        options: new \Gs2Cdk\Account\Model\Options\OpenIdConnectSettingOptions(
                            appleTeamId: "9LX9LA85H8",
                            appleKeyId: "P937MLY6Z7",
                            applePrivateKeyPem: "-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----",
                        ),
                    ),
                    options: new \Gs2Cdk\Account\Model\Options\TakeOverTypeModelOptions(
                        metadata:"Apple"
                    )
                )
            ]
        );
    }
}

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

```

**Java**
```java

class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.account.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.account.model.TakeOverTypeModel(
                    0,
                    new io.gs2.cdk.account.model.OpenIdConnectSetting(
                        "https://accounts.google.com/.well-known/openid-configuration",
                        "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
                        new io.gs2.cdk.account.model.options.OpenIdConnectSettingOptions()
                            .withClientSecret("secret")
                    ),
                    new io.gs2.cdk.account.model.options.TakeOverTypeModelOptions()
                        .withMetadata("Google")
                ),
                new io.gs2.cdk.account.model.TakeOverTypeModel(
                    1,
                    new io.gs2.cdk.account.model.OpenIdConnectSetting(
                        "https://appleid.apple.com/.well-known/openid-configuration",
                        "io.gs2.sample.auth",
                        new io.gs2.cdk.account.model.options.OpenIdConnectSettingOptions()
                            .withAppleTeamId("9LX9LA85H8")
                            .withAppleKeyId("P937MLY6Z7")
                            .withApplePrivateKeyPem("-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----")
                    ),
                    new io.gs2.cdk.account.model.options.TakeOverTypeModelOptions()
                        .withMetadata("Apple")
                )
            )
        );
    }
}

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

```

**C#**
```csharp

public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Account.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Account.Model.TakeOverTypeModel[] {
                new Gs2Cdk.Gs2Account.Model.TakeOverTypeModel(
                    type: 0,
                    openIdConnectSetting: new Gs2Cdk.Gs2Account.Model.OpenIdConnectSetting(
                        configurationPath: "https://accounts.google.com/.well-known/openid-configuration",
                        clientId: "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
                        options: new Gs2Cdk.Gs2Account.Model.Options.OpenIdConnectSettingOptions
                        {
                            clientSecret = "secret"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Account.Model.Options.TakeOverTypeModelOptions
                    {
                        metadata = "Google"
                    }
                ),
                new Gs2Cdk.Gs2Account.Model.TakeOverTypeModel(
                    type: 1,
                    openIdConnectSetting: new Gs2Cdk.Gs2Account.Model.OpenIdConnectSetting(
                        configurationPath: "https://appleid.apple.com/.well-known/openid-configuration",
                        clientId: "io.gs2.sample.auth",
                        options: new Gs2Cdk.Gs2Account.Model.Options.OpenIdConnectSettingOptions
                        {
                            appleTeamId = "9LX9LA85H8",
                            appleKeyId = "P937MLY6Z7",
                            applePrivateKeyPem = "-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----"
                        }
                    ),
                    options: new Gs2Cdk.Gs2Account.Model.Options.TakeOverTypeModelOptions
                    {
                        metadata = "Apple"
                    }
                )
            }
        );
    }
}

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

```

**TypeScript**
```typescript

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new account.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new account.model.TakeOverTypeModel(
                    0,
                    new account.model.OpenIdConnectSetting(
                        "https://accounts.google.com/.well-known/openid-configuration",
                        "695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com",
                        {
                            clientSecret: "secret"
                        }
                    ),
                    {
                        metadata: "Google"
                    }
                ),
                new account.model.TakeOverTypeModel(
                    1,
                    new account.model.OpenIdConnectSetting(
                        "https://appleid.apple.com/.well-known/openid-configuration",
                        "io.gs2.sample.auth",
                        {
                            appleTeamId: "9LX9LA85H8",
                            appleKeyId: "P937MLY6Z7",
                            applePrivateKeyPem: "-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----"
                        }
                    ),
                    {
                        metadata: "Apple"
                    }
                )
            ]
        );
    }
}

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

```

**Python**
```python

from gs2_cdk import Stack, core, account

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        account.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            take_over_type_models=[
                account.TakeOverTypeModel(
                    type=0,
                    open_id_connect_setting=account.OpenIdConnectSetting(
                        configuration_path='https://accounts.google.com/.well-known/openid-configuration',
                        client_id='695893071400-qelt0dsu8tkotl13psnq5d1ko7kki4sl.apps.googleusercontent.com',
                        options=account.OpenIdConnectSettingOptions(
                            client_secret='secret',
                        ),
                    ),
                    options=account.TakeOverTypeModelOptions(
                        metadata = 'Google'
                    ),
                ),
                account.TakeOverTypeModel(
                    type=1,
                    open_id_connect_setting=account.OpenIdConnectSetting(
                        configuration_path='https://appleid.apple.com/.well-known/openid-configuration',
                        client_id='io.gs2.sample.auth',
                        options=account.OpenIdConnectSettingOptions(
                            apple_team_id='9LX9LA85H8',
                            apple_key_id='P937MLY6Z7',
                            apple_private_key_pem='-----BEGIN PRIVATE KEY-----\\nAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\n-----END PRIVATE KEY-----',
                        ),
                    ),
                    options=account.TakeOverTypeModelOptions(
                        metadata = 'Apple'
                    ),
                ),
            ],
        )

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

```


#### TakeOverTypeModel

인계 정보 타입 모델<br>

인계 정보를 정의하는 모델입니다.<br>

인계 정보란 디바이스 기종 변경이나 플랫폼 간 계정 이동·공유 시에 사용하는 정보입니다.<br>
개인을 식별하는 고유한 문자열과 비밀번호로 구성되며, 그 올바른 조합을 입력함으로써 Account(익명 계정)를 취득할 수 있습니다.<br>

하나의 Account에 대해 여러 개의 인계 정보를 설정할 수 있습니다.<br>
여러 개의 인계 정보를 설정하려면 각각 다른 슬롯을 지정해야 합니다.<br>
슬롯은 0~1024를 지정할 수 있으므로 최대 1,025종류의 인계 정보를 설정할 수 있습니다.<br>

구체적인 예로는 0에는 Sign in with Apple의 계정 정보를, 1에는 Google 계정 정보를 저장하는 등의 방식이 상정되어 있습니다.<br>
어디까지나 이 인계 정보는 데이터 홀더이며, 소셜 계정과의 인증 메커니즘은 별도로 준비해야 합니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| takeOverTypeModelId | string |  | ※ |  |  ~ 1024자 | 인계 정보 타입 모델 GRN<br>※ 서버가 자동으로 설정 |
| type | int |  | ✓ |  | 0 ~ 1024 | 슬롯 번호<br>0부터 1024까지의 범위로 지정되며, 서로 다른 인계 정보를 구분합니다. |
| metadata | string |  |  |  |  ~ 2048자 | 메타데이터<br>메타데이터에는 임의의 값을 설정할 수 있습니다.<br>이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다. |
| openIdConnectSetting | [OpenIdConnectSetting](#openidconnectsetting) |  | ✓ |  |  | OpenID Connect 설정<br>OpenID Connect 준수 Identity Provider(IdP)와 연동하기 위한 설정입니다. 디스커버리 URL, 클라이언트 인증 정보, Apple Sign In 파라미터 등 플랫폼별 설정이 포함됩니다. |

#### OpenIdConnectSetting

OpenID Connect 설정<br>

OpenID Connect 준수 IdP의 설정을 등록함으로써 계정의 인계 정보로 IdP 연동을 이용할 수 있게 됩니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| configurationPath | string |  | ✓ |  |  ~ 1024자 | OpenID Connect 설정 URL<br>OpenID Connect 제공자의 디스커버리 엔드포인트 URL입니다. well-known 형식(예: https\://example.com/.well-known/openid-configuration)을 따라야 합니다. |
| clientId | string |  | ✓ |  |  ~ 1024자 | 클라이언트 ID<br>IdP에 등록된 애플리케이션의 클라이언트 ID입니다. |
| clientSecret | string | {configurationPath} != "https\://appleid.apple.com/.well-known/openid-configuration" | ✓※ |  |  ~ 1024자 | 클라이언트 시크릿<br>※ configurationPath가 "https\://appleid.apple.com/.well-known/openid-configuration" 이외의 다른 IdP 연동인 경우 필수 |
| appleTeamId | string | {configurationPath} == "https\://appleid.apple.com/.well-known/openid-configuration" | ✓※ |  |  ~ 1024자 | Apple Developer 팀 ID<br>Apple Developer 계정의 팀 ID입니다. Sign in with Apple 인증에 필요합니다.<br>※ configurationPath이(가) "https\://appleid.apple.com/.well-known/openid-configuration" 이면 필수 |
| appleKeyId | string | {configurationPath} == "https\://appleid.apple.com/.well-known/openid-configuration" | ✓※ |  |  ~ 1024자 | Apple에 등록된 키 ID<br>Sign in with Apple용으로 Apple Developer 계정에 등록된 키 ID입니다.<br>※ configurationPath이(가) "https\://appleid.apple.com/.well-known/openid-configuration" 이면 필수 |
| applePrivateKeyPem | string | {configurationPath} == "https\://appleid.apple.com/.well-known/openid-configuration" | ✓※ |  |  ~ 10240자 | Apple로부터 받은 비밀 키<br>Apple Developer 포털에서 다운로드한 PEM 형식의 비밀 키입니다. Sign in with Apple 인증에 필요합니다.<br>※ configurationPath이(가) "https\://appleid.apple.com/.well-known/openid-configuration" 이면 필수 |
| doneEndpointUrl | string |  |  |  |  ~ 1024자 | 인증 완료 시 이동하는 URL<br>지정하지 않으면 /authorization/done으로 이동합니다.<br>쿼리 스트링에 id_token이 부여됩니다. |
| additionalScopeValues | [List&lt;ScopeValue&gt;](#scopevalue) |  |  | [] | 0 ~ 10 items | OpenID Connect에서 획득하는 추가 스코프<br>기본 OpenID Connect 스코프 외에 IdP에 요청하는 추가 OAuth 스코프입니다. 인증 시 추가 사용자 정보를 취득할 수 있습니다. |
| additionalReturnValues | List&lt;string&gt; |  |  | [] | 0 ~ 10 items | OpenID Connect에서 획득하는 추가 반환값<br>ID 토큰 또는 UserInfo 응답에서 반환값에 포함할 추가 클레임 이름입니다. 지정된 클레임이 추출되어 표준 인증 결과와 함께 반환됩니다. |

#### ScopeValue

스코프 값<br>

OpenID Connect 인증 시 취득되는 추가 OAuth 스코프 값을 나타내는 키-값 쌍입니다. 표준 OpenID Connect 클레임 외에 IdP로부터 취득한 추가 데이터를 저장하는 데 사용됩니다.

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| key | string |  | ✓ |  |  ~ 64자 | 이름<br>인증 시 IdP에 요청한 스코프 이름입니다. |
| value | string |  |  |  |  ~ 51200자 | 값<br>해당 스코프에 대해 IdP로부터 반환된 값입니다. |

---



