Documentation index for AI agents

GS2-SeasonRating Deploy/CDK 레퍼런스

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

엔티티

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

Namespace

네임스페이스

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

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

Request

리소스 생성·갱신 요청

타입활성화 조건필수기본값값 제한설명
namestring
~ 128자네임스페이스 이름
네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다.
descriptionstring~ 1024자설명문
transactionSettingTransactionSetting
트랜잭션 설정
시즌 레이팅 결과 적용 시 사용되는 트랜잭션 처리 설정입니다.
logSettingLogSetting로그 출력 설정
투표용지 발행, 투표 제출, 레이팅 계산 등 시즌 레이팅 조작에 대한 로그 출력 설정입니다.
설정한 경우, 조작 로그가 지정한 GS2-Log 네임스페이스로 출력됩니다.

GetAttr

!GetAttr 태그로 취득 가능한 리소스 생성 결과

타입설명
ItemNamespace생성한 네임스페이스

구현 예제

Type: GS2::SeasonRating::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  LogSetting:
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/seasonRating"
)


SampleStack := core.NewStack()
seasonRating.NewNamespace(
    &SampleStack,
    "namespace-0001",
    seasonRating.NamespaceOptions{
        LogSetting: &core.LogSetting{
            LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
        },
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\SeasonRating\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\SeasonRating\Model\Options\NamespaceOptions(
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            )
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.seasonRating.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.seasonRating.model.options.NamespaceOptions()
                        .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
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2SeasonRating.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2SeasonRating.Model.Options.NamespaceOptions
            {
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import seasonRating from "@/gs2cdk/seasonRating";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new seasonRating.model.Namespace(
            this,
            "namespace-0001",
            {
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, season_rating

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        season_rating.Namespace(
            stack=self,
            name='namespace-0001',
            options=season_rating.NamespaceOptions(
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

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

TransactionSetting

트랜잭션 설정

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

타입활성화 조건필수기본값값 제한설명
enableAtomicCommitboolfalse트랜잭션의 실행을 원자적으로 커밋할지 여부
transactionUseDistributorbool{enableAtomicCommit} == truefalse트랜잭션을 비동기 처리로 실행할지 여부
※ enableAtomicCommit이(가) true 이면 활성화
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalse스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부
※ transactionUseDistributor이(가) true 이면 활성화
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalse입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부
※ enableAtomicCommit이(가) true 이면 활성화
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024자트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024자트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스 GRN

LogSetting

로그 출력 설정

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

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

CurrentSeasonModelMaster

현재 활성화된 시즌 모델의 마스터 데이터

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

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

Request

리소스 생성·갱신 요청

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

GetAttr

!GetAttr 태그로 취득 가능한 리소스 생성 결과

타입설명
ItemCurrentSeasonModelMaster갱신된 현재 활성화된 시즌 모델의 마스터 데이터

구현 예제

Type: GS2::SeasonRating::CurrentSeasonModelMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2024-02-23",
    "seasonModels": [
      {
        "name": "season1",
        "tiers": [
          {
            "raiseRankBonus": 0,
            "entryFee": 0,
            "minimumChangePoint": -10,
            "maximumChangePoint": 20
          },
          {
            "raiseRankBonus": 30,
            "entryFee": 10,
            "minimumChangePoint": -10,
            "maximumChangePoint": 30
          },
          {
            "raiseRankBonus": 60,
            "entryFee": 20,
            "minimumChangePoint": -20,
            "maximumChangePoint": 50
          },
          {
            "raiseRankBonus": 60,
            "entryFee": 30,
            "minimumChangePoint": -30,
            "maximumChangePoint": 60
          }
        ],
        "experienceModelId": "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
        "challengePeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
      }
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/seasonRating"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
seasonRating.NewNamespace(
    &SampleStack,
    "namespace-0001",
    seasonRating.NamespaceOptions{},
).MasterData(
    []seasonRating.SeasonModel{
        seasonRating.NewSeasonModel(
            "season1",
            []seasonRating.TierModel{
                seasonRating.NewTierModel(
                    0,
                    0,
                    -10,
                    20,
                    seasonRating.TierModelOptions{},
                ),
                seasonRating.NewTierModel(
                    30,
                    10,
                    -10,
                    30,
                    seasonRating.TierModelOptions{},
                ),
                seasonRating.NewTierModel(
                    60,
                    20,
                    -20,
                    50,
                    seasonRating.TierModelOptions{},
                ),
                seasonRating.NewTierModel(
                    60,
                    30,
                    -30,
                    60,
                    seasonRating.TierModelOptions{},
                ),
            },
            "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
            seasonRating.SeasonModelOptions{
                ChallengePeriodEventId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"),
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\SeasonRating\Model\Namespace_(
            stack: $this,
            name: "namespace-0001"
        ))->masterData(
            [
                new \Gs2Cdk\SeasonRating\Model\SeasonModel(
                    name:"season1",
                    tiers:[
                        new \Gs2Cdk\SeasonRating\Model\TierModel(
                            raiseRankBonus: 0,
                            entryFee: 0,
                            minimumChangePoint: -10,
                            maximumChangePoint: 20,
                        ),
                        new \Gs2Cdk\SeasonRating\Model\TierModel(
                            raiseRankBonus: 30,
                            entryFee: 10,
                            minimumChangePoint: -10,
                            maximumChangePoint: 30,
                        ),
                        new \Gs2Cdk\SeasonRating\Model\TierModel(
                            raiseRankBonus: 60,
                            entryFee: 20,
                            minimumChangePoint: -20,
                            maximumChangePoint: 50,
                        ),
                        new \Gs2Cdk\SeasonRating\Model\TierModel(
                            raiseRankBonus: 60,
                            entryFee: 30,
                            minimumChangePoint: -30,
                            maximumChangePoint: 60,
                        ),
                    ],
                    experienceModelId:"grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    options: new \Gs2Cdk\SeasonRating\Model\Options\SeasonModelOptions(
                        challengePeriodEventId:"grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.seasonRating.model.Namespace(
            this,
            "namespace-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.seasonRating.model.SeasonModel(
                    "season1",
                    Arrays.asList(
                        new io.gs2.cdk.seasonRating.model.TierModel(
                            0,
                            0,
                            -10,
                            20
                        ),
                        new io.gs2.cdk.seasonRating.model.TierModel(
                            30,
                            10,
                            -10,
                            30
                        ),
                        new io.gs2.cdk.seasonRating.model.TierModel(
                            60,
                            20,
                            -20,
                            50
                        ),
                        new io.gs2.cdk.seasonRating.model.TierModel(
                            60,
                            30,
                            -30,
                            60
                        )
                    ),
                    "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    new io.gs2.cdk.seasonRating.model.options.SeasonModelOptions()
                        .withChallengePeriodEventId("grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001")
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2SeasonRating.Model.Namespace(
            stack: this,
            name: "namespace-0001"
        ).MasterData(
            new Gs2Cdk.Gs2SeasonRating.Model.SeasonModel[] {
                new Gs2Cdk.Gs2SeasonRating.Model.SeasonModel(
                    name: "season1",
                    tiers: new Gs2Cdk.Gs2SeasonRating.Model.TierModel[]
                    {
                        new Gs2Cdk.Gs2SeasonRating.Model.TierModel(
                            raiseRankBonus: 0,
                            entryFee: 0,
                            minimumChangePoint: -10,
                            maximumChangePoint: 20
                        ),
                        new Gs2Cdk.Gs2SeasonRating.Model.TierModel(
                            raiseRankBonus: 30,
                            entryFee: 10,
                            minimumChangePoint: -10,
                            maximumChangePoint: 30
                        ),
                        new Gs2Cdk.Gs2SeasonRating.Model.TierModel(
                            raiseRankBonus: 60,
                            entryFee: 20,
                            minimumChangePoint: -20,
                            maximumChangePoint: 50
                        ),
                        new Gs2Cdk.Gs2SeasonRating.Model.TierModel(
                            raiseRankBonus: 60,
                            entryFee: 30,
                            minimumChangePoint: -30,
                            maximumChangePoint: 60
                        )
                    },
                    experienceModelId: "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    options: new Gs2Cdk.Gs2SeasonRating.Model.Options.SeasonModelOptions
                    {
                        challengePeriodEventId = "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                    }
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import core from "@/gs2cdk/core";
import seasonRating from "@/gs2cdk/seasonRating";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new seasonRating.model.Namespace(
            this,
            "namespace-0001",
        ).masterData(
            [
                new seasonRating.model.SeasonModel(
                    "season1",
                    [
                        new seasonRating.model.TierModel(
                            0,
                            0,
                            -10,
                            20
                        ),
                        new seasonRating.model.TierModel(
                            30,
                            10,
                            -10,
                            30
                        ),
                        new seasonRating.model.TierModel(
                            60,
                            20,
                            -20,
                            50
                        ),
                        new seasonRating.model.TierModel(
                            60,
                            30,
                            -30,
                            60
                        ),
                    ],
                    "grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level",
                    {
                        challengePeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001"
                    }
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
from gs2_cdk import Stack, core, season_rating

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        season_rating.Namespace(
            stack=self,
            name="namespace-0001",
        ).master_data(
            season_models=[
                season_rating.SeasonModel(
                    name='season1',
                    tiers=[
                        season_rating.TierModel(
                            raise_rank_bonus=0,
                            entry_fee=0,
                            minimum_change_point=-10,
                            maximum_change_point=20,
                        ),
                        season_rating.TierModel(
                            raise_rank_bonus=30,
                            entry_fee=10,
                            minimum_change_point=-10,
                            maximum_change_point=30,
                        ),
                        season_rating.TierModel(
                            raise_rank_bonus=60,
                            entry_fee=20,
                            minimum_change_point=-20,
                            maximum_change_point=50,
                        ),
                        season_rating.TierModel(
                            raise_rank_bonus=60,
                            entry_fee=30,
                            minimum_change_point=-30,
                            maximum_change_point=60,
                        ),
                    ],
                    experience_model_id='grn:gs2:ap-northeast-1:YourOwnerId:experience:namespace-0001:model:level',
                    options=season_rating.SeasonModelOptions(
                        challenge_period_event_id = 'grn:gs2:ap-northeast-1:YourOwnerId:schedule:namespace-0001:event:event-0001'
                    ),
                ),
            ],
        )

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

SeasonModel

시즌 모델

시즌 기간 동안 적용되는 티어 구조와 포인트 변동 규칙을 정의하는 마스터 데이터입니다.
각 티어별 포인트 변동 범위·참가료·랭크업 보너스를 설정하고, 포인트 관리에 사용할 Experience 모델을 지정합니다.
실제 포인트 및 티어의 사용자 데이터는 GS2-Experience에 의해 관리됩니다.

타입활성화 조건필수기본값값 제한설명
seasonModelIdstring
~ 1024자시즌 모델 GRN
※ 서버가 자동으로 설정
namestring
~ 128자시즌 모델 이름
시즌 모델 고유의 이름. 영숫자와 -(하이픈) _(밑줄) .(마침표)로 지정합니다.
metadatastring~ 128자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
tiersList<TierModel>
1 ~ 100 items티어 모델 목록
시즌의 랭킹 사다리를 구성하는 티어 정의의 순서가 있는 목록.
각 티어는 고유한 포인트 변동 규칙(참가료, 최소/최대 변동량, 승급 보너스)을 정의합니다.
플레이어는 GS2-Experience에서 관리되는 누적 포인트에 따라 티어를 진행합니다.
최소 1개 티어, 최대 100개 티어.
experienceModelIdstring
~ 1024자경험치 모델 ID
시즌 포인트와 티어 진행 관리에 사용되는 GS2-Experience 경험치 모델의 GRN.
경험치 모델의 랭크 임계값이 티어 경계를 결정하며, 경험치 값은 플레이어의 현재 시즌 포인트를 나타냅니다.
대전 결과에 따른 포인트 변동은 이 경험치 모델에 적용됩니다.
challengePeriodEventIdstring~ 1024자챌린지 기간 이벤트 ID
시즌이 대전 가능한 기간을 정의하는 GS2-Schedule 이벤트의 GRN.
설정한 경우, 참조된 이벤트가 활성 상태인 동안에만 플레이어가 대전에 참가할 수 있습니다.
설정하지 않은 경우, 시즌에 기간 제한이 없습니다.

TierModel

티어 모델

티어 모델은 시즌 내 각 티어의 포인트 변동 규칙을 정의하는 모델입니다.
순위에 따른 포인트 변동 범위, 참가료, 승급 시 보너스를 설정합니다.
포인트의 실제 데이터는 GS2-Experience에 의해 관리되지만, 그 증감 로직은 TierModel의 설정에 따라 결정됩니다.

타입활성화 조건필수기본값값 제한설명
metadatastring~ 128자메타데이터
메타데이터에는 임의의 값을 설정할 수 있습니다.
이 값들은 GS2의 동작에는 영향을 주지 않으므로, 게임 내에서 사용하는 정보를 저장하는 용도로 사용할 수 있습니다.
raiseRankBonusint
0 ~ 10000랭크 승급 보너스
플레이어가 이 티어로 승급했을 때 가산되는 보너스 포인트로, 즉각적인 강등을 방지하는 완충 역할을 합니다.
예를 들어 100으로 설정하면, 승급 기준점보다 100포인트 많은 상태로 새 티어를 시작합니다.
유효 범위: 0~10000.
entryFeeint
0 ~ 10000참가료
대전 시작 전 플레이어로부터 차감되는 참가 비용으로서의 포인트.
이 참가료는 대전 결과와 관계없이 항상 차감되며, 경쟁 플레이에 리스크 요소를 만듭니다.
유효 범위: 0~10000.
minimumChangePointint
-99999999 ~ -1최소 변동 포인트
한 번의 대전 결과로 발생할 수 있는 최소(가장 음수인) 포인트 변동량으로, 일반적으로 최악의 패배 시 값을 나타냅니다.
음수 값이어야 합니다. 패배한 플레이어의 실제 포인트 변동은 이 값과 0 사이가 됩니다.
유효 범위: -99999999~-1.
maximumChangePointint
1 ~ 99999999최대 변동 포인트
한 번의 대전 결과로 발생할 수 있는 최대(가장 양수인) 포인트 변동량으로, 일반적으로 최고의 승리 시 값을 나타냅니다.
양수 값이어야 합니다. 승리한 플레이어의 실제 포인트 변동은 0과 이 값 사이가 됩니다.
유효 범위: 1~99999999.