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.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 128 chars | Namespace name | |
description | string | ~ 1024 chars | Description | ||
transactionSetting | TransactionSetting | ✓ | Transaction settings | ||
logSetting | LogSetting | Log output settings |
GetAttr
Type | Description | |
---|---|---|
Item | Namespace | Namespace 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.
Note
Please refer to Master Data Reference of GS2-Ranking2 for the JSON file format.Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 128 chars | Namespace name | |
settings | string | ✓ | ~ 5242880 chars | Master data |
GetAttr
Type | Description | |
---|---|---|
Item | CurrentRankingMaster | Updated 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
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
rankingName | string | ✓ | ~ 128 chars | Ranking Name | |
userId | string | ✓ | ~ 128 chars | User Id | |
targetUserId | string | ✓ | ~ 128 chars | Subscribe 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.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
thresholdRank | int | ✓ | 1 ~ 1001 | Rank threshold | |
metadata | string | ~ 1024 chars | metadata | ||
acquireActions | List<AcquireAction> | [] | ~ 100 items | List of actions to be performed when rewards are received |
TransactionSetting
Transaction settings
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
enableAutoRun | bool | ✓ | true | Automatically run issued transactions on the server side, or | |
distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor namespace used for transaction execution |
queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | Namespace 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.
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
loggingNamespaceId | string | ✓ | ~ 1024 chars | Namespace GRN |
GitHubCheckoutSetting
Setup to check out master data from GitHub
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | |
repositoryName | string | ✓ | ~ 1024 chars | Repository Name | |
sourcePath | string | ✓ | ~ 1024 chars | Source code file path | |
referenceType | enum { “commit_hash”, “branch”, “tag” } | ✓ | ~ 128 chars | Source of code | |
commitHash | string | {referenceType} == “commit_hash” | ~ 1024 chars | Commit hash | |
branchName | string | {referenceType} == “branch” | ~ 1024 chars | Branch Name | |
tagName | string | {referenceType} == “tag” | ~ 1024 chars | Tag Name |
Enumeration type definition to specify as referenceType
Enumerator String Definition | Description |
---|---|
commit_hash | Commit hash |
branch | Branch |
tag | Tag |
AcquireAction
Acquire Action
Config
Configration
Set values to be applied to transaction variables
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
key | string | ✓ | ~ 64 chars | Name | |
value | string | ~ 51200 chars | Value |