GS2-Deploy/CDK Reference of GS2-Ranking2

Entities

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeRequireDefaultLimitationDescription
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSettingTransaction settings
logSettingLogSettingLog output settings

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Ranking2::Namespace
Properties:
  Name: namespace1
  Description: null
  TransactionSetting: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1
from gs2_cdk import Stack, core, ranking2

class SampleStack(Stack):

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

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Ranking2\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Ranking2\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.ranking2.model.Namespace(
            this,
            "namespace-0001",
            new io.gs2.cdk.ranking2.model.options.NamespaceOptions() {
                {
                    logSetting = new io.gs2.cdk.core.model.LogSetting(
                        loggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                    );
                }
            }
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import ranking2 from "@/gs2cdk/ranking2";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new ranking2.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
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Ranking2.Model.Namespace(
            this,
            "namespace-0001",
            new Gs2Cdk.Gs2Ranking2.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

CurrentRankingMaster

Currently available master data

GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.

We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
settingsstring~ 5242880 charsMaster data

GetAttr

TypeDescription
ItemCurrentRankingMasterUpdated and currently available ranking settings

Implementation Example

Type: GS2::Ranking2::CurrentRankingMaster
Properties:
  NamespaceName: namespace1
  Settings: {
    "version": "2024-05-30",
    "globalRankingModels": [
      {
        "name": "ranking-0001",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "orderDirection": "desc"
      }
    ],
    "clusterRankingModels": [
      {
        "name": "ranking-0001",
        "clusterType": "Raw",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "clusterType": "Gs2Guild::Guild",
        "orderDirection": "desc"
      }
    ],
    "subscribeRankingModels": [
      {
        "name": "ranking-0001",
        "orderDirection": "asc"
      },
      {
        "name": "ranking-0002",
        "orderDirection": "desc"
      }
    ]
  }
from gs2_cdk import Stack, core, ranking2

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        ranking2.Namespace(
            stack=self,
            # omission
        ).master_data(
            global_ranking_models=[
                ranking2.GlobalRankingModel(
                    name='ranking-0001',
                    order_direction='asc',
                ),
                ranking2.GlobalRankingModel(
                    name='ranking-0002',
                    order_direction='desc',
                ),
            ],
            cluster_ranking_models=[
                ranking2.ClusterRankingModel(
                    name='ranking-0001',
                    cluster_type='Raw',
                    order_direction='asc',
                ),
                ranking2.ClusterRankingModel(
                    name='ranking-0002',
                    cluster_type='Gs2Guild::Guild',
                    order_direction='desc',
                ),
            ],
            subscribe_ranking_models=[
                ranking2.SubscribeRankingModel(
                    name='ranking-0001',
                    order_direction='asc',
                ),
                ranking2.SubscribeRankingModel(
                    name='ranking-0002',
                    order_direction='desc',
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Ranking2\Model\Namespace_(
            stack: $this,
            // omission
        ))->masterData(
            [
                new \Gs2Cdk\Ranking2\Model\GlobalRankingModel(
                    name:"ranking-0001",
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelOrderDirection::ASC
                ),
                new \Gs2Cdk\Ranking2\Model\GlobalRankingModel(
                    name:"ranking-0002",
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\GlobalRankingModelOrderDirection::DESC
                )
            ],
            [
                new \Gs2Cdk\Ranking2\Model\ClusterRankingModel(
                    name:"ranking-0001",
                    clusterType: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelClusterType::RAW,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelOrderDirection::ASC
                ),
                new \Gs2Cdk\Ranking2\Model\ClusterRankingModel(
                    name:"ranking-0002",
                    clusterType: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelClusterType::GS2_GUILD::_GUILD,
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\ClusterRankingModelOrderDirection::DESC
                )
            ],
            [
                new \Gs2Cdk\Ranking2\Model\SubscribeRankingModel(
                    name:"ranking-0001",
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\SubscribeRankingModelOrderDirection::ASC
                ),
                new \Gs2Cdk\Ranking2\Model\SubscribeRankingModel(
                    name:"ranking-0002",
                    orderDirection: \Gs2Cdk\Ranking2\Model\Enums\SubscribeRankingModelOrderDirection::DESC
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.ranking2.model.Namespace(
            this,
            // omission
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.GlobalRankingModel(
                    "ranking-0001",
                    Asc
                ),
                new io.gs2.cdk.ranking2.model.GlobalRankingModel(
                    "ranking-0002",
                    Desc
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.ClusterRankingModel(
                    "ranking-0001",
                    Raw,
                    Asc
                ),
                new io.gs2.cdk.ranking2.model.ClusterRankingModel(
                    "ranking-0002",
                    Gs2Guild::Guild,
                    Desc
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.ranking2.model.SubscribeRankingModel(
                    "ranking-0001",
                    Asc
                ),
                new io.gs2.cdk.ranking2.model.SubscribeRankingModel(
                    "ranking-0002",
                    Desc
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import ranking2 from "@/gs2cdk/ranking2";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new ranking2.model.Namespace(
            this,
            // omission
        ).masterData(
            [
                new ranking2.model.GlobalRankingModel(
                    "ranking-0001",
                    ranking2.model.GlobalRankingModelOrderDirection.ASC
                ),
                new ranking2.model.GlobalRankingModel(
                    "ranking-0002",
                    ranking2.model.GlobalRankingModelOrderDirection.DESC
                )
            ],
            [
                new ranking2.model.ClusterRankingModel(
                    "ranking-0001",
                    ranking2.model.ClusterRankingModelClusterType.RAW,
                    ranking2.model.ClusterRankingModelOrderDirection.ASC
                ),
                new ranking2.model.ClusterRankingModel(
                    "ranking-0002",
                    ranking2.model.ClusterRankingModelClusterType.GS2_GUILD::_GUILD,
                    ranking2.model.ClusterRankingModelOrderDirection.DESC
                )
            ],
            [
                new ranking2.model.SubscribeRankingModel(
                    "ranking-0001",
                    ranking2.model.SubscribeRankingModelOrderDirection.ASC
                ),
                new ranking2.model.SubscribeRankingModel(
                    "ranking-0002",
                    ranking2.model.SubscribeRankingModelOrderDirection.DESC
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Ranking2.Model.Namespace(
            this,
            // omission
        ).MasterData(
            new [] {
                new Gs2Cdk.Gs2Ranking2.Model.GlobalRankingModel(
                    "ranking-0001",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelOrderDirection.Asc
                ),
                new Gs2Cdk.Gs2Ranking2.Model.GlobalRankingModel(
                    "ranking-0002",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.GlobalRankingModelOrderDirection.Desc
                )
            },
            new [] {
                new Gs2Cdk.Gs2Ranking2.Model.ClusterRankingModel(
                    "ranking-0001",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelClusterType.Raw,
                    Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelOrderDirection.Asc
                ),
                new Gs2Cdk.Gs2Ranking2.Model.ClusterRankingModel(
                    "ranking-0002",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelClusterType.Gs2Guild::Guild,
                    Gs2Cdk.Gs2Ranking2.Model.Enums.ClusterRankingModelOrderDirection.Desc
                )
            },
            new [] {
                new Gs2Cdk.Gs2Ranking2.Model.SubscribeRankingModel(
                    "ranking-0001",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.SubscribeRankingModelOrderDirection.Asc
                ),
                new Gs2Cdk.Gs2Ranking2.Model.SubscribeRankingModel(
                    "ranking-0002",
                    Gs2Cdk.Gs2Ranking2.Model.Enums.SubscribeRankingModelOrderDirection.Desc
                )
            }
        );
    }
}

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

SubscribeUser

Subscribe Information

TypeRequireDefaultLimitationDescription
rankingNamestring~ 128 charsRanking Name
userIdstring~ 128 charsUser Id
targetUserIdstring~ 128 charsSubscribe Target User ID

RankingReward

Ranking Reward Model

Set the rewards that can be received during the reference period when the score registration period is set in the ranking. If the repeat setting is enabled, the most recently ended period ranking will be the target for receiving rewards.

TypeRequireDefaultLimitationDescription
thresholdRankint1 ~ 1001Rank threshold
metadatastring~ 1024 charsmetadata
acquireActionsList<AcquireAction>[]~ 100 itemsList of actions to be performed when rewards are received

TransactionSetting

Transaction settings

TypeRequireDefaultLimitationDescription
enableAutoRunbooltrueAutomatically run issued transactions on the server side, or
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor namespace used for transaction execution
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsNamespace in GS2-JobQueue used to run the transaction

LogSetting

Log setting

This type manages log output settings. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.

TypeRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN

GitHubCheckoutSetting

Setup to check out master data from GitHub

TypeRequireDefaultLimitationDescription
apiKeyIdstring~ 1024 charsGitHub API key GRN
repositoryNamestring~ 1024 charsRepository Name
sourcePathstring~ 1024 charsSource code file path
referenceTypeenum {
    “commit_hash”,
    “branch”,
    “tag”
}
~ 128 charsSource of code
commitHashstring{referenceType} == “commit_hash”~ 1024 charsCommit hash
branchNamestring{referenceType} == “branch”~ 1024 charsBranch Name
tagNamestring{referenceType} == “tag”~ 1024 charsTag Name

Enumeration type definition to specify as referenceType

Enumerator String DefinitionDescription
commit_hashCommit hash
branchBranch
tagTag

AcquireAction

Acquire Action

TypeRequireDefaultLimitationDescription
actionenum {
"Gs2AdReward:AcquirePointByUserId",
"Gs2Dictionary:AddEntriesByUserId",
"Gs2Enchant:ReDrawBalanceParameterStatusByUserId",
"Gs2Enchant:SetBalanceParameterStatusByUserId",
"Gs2Enchant:ReDrawRarityParameterStatusByUserId",
"Gs2Enchant:AddRarityParameterStatusByUserId",
"Gs2Enchant:SetRarityParameterStatusByUserId",
"Gs2Enhance:DirectEnhanceByUserId",
"Gs2Enhance:UnleashByUserId",
"Gs2Enhance:CreateProgressByUserId",
"Gs2Exchange:ExchangeByUserId",
"Gs2Exchange:IncrementalExchangeByUserId",
"Gs2Exchange:CreateAwaitByUserId",
"Gs2Exchange:AcquireForceByUserId",
"Gs2Exchange:SkipByUserId",
"Gs2Experience:AddExperienceByUserId",
"Gs2Experience:SetExperienceByUserId",
"Gs2Experience:AddRankCapByUserId",
"Gs2Experience:SetRankCapByUserId",
"Gs2Experience:MultiplyAcquireActionsByUserId",
"Gs2Formation:AddMoldCapacityByUserId",
"Gs2Formation:SetMoldCapacityByUserId",
"Gs2Formation:AcquireActionsToFormProperties",
"Gs2Formation:SetFormByUserId",
"Gs2Formation:AcquireActionsToPropertyFormProperties",
"Gs2Friend:UpdateProfileByUserId",
"Gs2Grade:AddGradeByUserId",
"Gs2Grade:ApplyRankCapByUserId",
"Gs2Grade:MultiplyAcquireActionsByUserId",
"Gs2Guild:IncreaseMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Guild:SetMaximumCurrentMaximumMemberCountByGuildName",
"Gs2Idle:IncreaseMaximumIdleMinutesByUserId",
"Gs2Idle:SetMaximumIdleMinutesByUserId",
"Gs2Idle:ReceiveByUserId",
"Gs2Inbox:SendMessageByUserId",
"Gs2Inventory:AddCapacityByUserId",
"Gs2Inventory:SetCapacityByUserId",
"Gs2Inventory:AcquireItemSetByUserId",
"Gs2Inventory:AcquireItemSetWithGradeByUserId",
"Gs2Inventory:AddReferenceOfByUserId",
"Gs2Inventory:DeleteReferenceOfByUserId",
"Gs2Inventory:AcquireSimpleItemsByUserId",
"Gs2Inventory:SetSimpleItemsByUserId",
"Gs2Inventory:AcquireBigItemByUserId",
"Gs2Inventory:SetBigItemByUserId",
"Gs2JobQueue:PushByUserId",
"Gs2Limit:CountDownByUserId",
"Gs2Limit:DeleteCounterByUserId",
"Gs2LoginReward:DeleteReceiveStatusByUserId",
"Gs2LoginReward:UnmarkReceivedByUserId",
"Gs2Lottery:DrawByUserId",
"Gs2Lottery:ResetBoxByUserId",
"Gs2Mission:RevertReceiveByUserId",
"Gs2Mission:IncreaseCounterByUserId",
"Gs2Mission:SetCounterByUserId",
"Gs2Money:DepositByUserId",
"Gs2Money:RevertRecordReceipt",
"Gs2Money2:DepositByUserId",
"Gs2Quest:CreateProgressByUserId",
"Gs2Schedule:TriggerByUserId",
"Gs2Script:InvokeScript",
"Gs2SerialKey:RevertUseByUserId",
"Gs2SerialKey:IssueOnce",
"Gs2Showcase:DecrementPurchaseCountByUserId",
"Gs2Showcase:ForceReDrawByUserId",
"Gs2SkillTree:MarkReleaseByUserId",
"Gs2Stamina:RecoverStaminaByUserId",
"Gs2Stamina:RaiseMaxValueByUserId",
"Gs2Stamina:SetMaxValueByUserId",
"Gs2Stamina:SetRecoverIntervalByUserId",
"Gs2Stamina:SetRecoverValueByUserId",
"Gs2StateMachine:StartStateMachineByUserId",
}
~ 128 charsTypes of actions to be performed in the acquire action
requeststring~ 1048576 charsJSON of request

Config

Configration

Set values to be applied to transaction variables

TypeRequireDefaultLimitationDescription
keystring~ 64 charsName
valuestring~ 51200 charsValue