GS2-Enchant Deploy/CDK Reference

The template format used when creating stacks with GS2-Deploy, and implementation examples of template output in various languages using CDK

Entities

Resources targeted by the Deploy operation

Namespace

Namespace

A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a namespace before you can start using each service.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
descriptionstring~ 1024 charsDescription
transactionSettingTransactionSetting
Transaction Setting
logSettingLogSettingLog Output Setting

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Enchant::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: 
    EnableAutoRun: true
    QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001

TransactionSetting

Transaction Setting

Transaction Setting controls how transactions are executed, including their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, asynchronous execution using GS2-Distributor, batch application of script results, and asynchronous Acquire Actions via GS2-JobQueue enables robust transaction management tailored to game logic.

TypeConditionRequiredDefaultValue LimitsDescription
enableAutoRunboolfalseWhether to automatically execute issued transactions on the server side
enableAtomicCommitbool{enableAutoRun} == truefalseWhether to commit the execution of transactions atomically
* Applicable only if enableAutoRun is true
transactionUseDistributorbool{enableAtomicCommit} == truefalseWhether to execute transactions asynchronously
* Applicable only if enableAtomicCommit is true
commitScriptResultInUseDistributorbool{transactionUseDistributor} == truefalseWhether to execute the commit processing of the script result asynchronously
* Applicable only if transactionUseDistributor is true
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalseWhether to use GS2-JobQueue to execute the acquire action
* Applicable only if enableAtomicCommit is true
distributorNamespaceIdstring“grn:gs2:{region}:{ownerId}:distributor:default”~ 1024 charsGS2-Distributor Namespace GRN used to execute transactions
queueNamespaceIdstring“grn:gs2:{region}:{ownerId}:queue:default”~ 1024 charsGS2-JobQueue Namespace GRN used to execute transactions

LogSetting

Log Output Setting

Log Output Setting defines how log data is exported. This type holds the GS2-Log namespace identifier (Namespace ID) used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, debugging, and other operational purposes.

TypeConditionRequiredDefaultValue LimitsDescription
loggingNamespaceIdstring
~ 1024 charsGS2-Log namespace GRN to output logs
Must be specified in GRN format starting with “grn:gs2:”.

CurrentParameterMaster

Currently active Parameter Model master data

This master data describes the definitions of Parameter Models currently active within the namespace. GS2 uses JSON format files for master data management. By uploading the file, the settings can actually be reflected on the server.

To create JSON files, we provide a master data editor within the management console. Additionally, you can utilize the service by creating tools more suited to game operations and exporting JSON files in the appropriate format.

Request

Resource creation and update requests

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
modeString Enum
enum {
  “direct”,
  “preUpload”
}
“direct”Update mode
DefinitionDescription
“direct”Directly update master data
“preUpload”Upload master data and then update
settingsstring{mode} == “direct”
✓*
~ 5242880 charsMaster Data
* Required if mode is “direct”
uploadTokenstring{mode} == “preUpload”
✓*
~ 1024 charsToken obtained by pre-upload
Used to apply the uploaded master data.
* Required if mode is “preUpload”

GetAttr

Resource creation results that can be retrieved using the !GetAttr tag

TypeDescription
ItemCurrentParameterMasterUpdated master data of the currently active Parameter Models

Implementation Example

Type: GS2::Enchant::CurrentParameterMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2023-07-18",
    "balanceParameterModels": [
      {
        "name": "balance-0001",
        "totalValue": 100,
        "initialValueStrategy": "average",
        "parameters": [
          {
            "name": "parameter-0001",
            "metadata": "PARAMETER_0001"
          },
          {
            "name": "parameter-0002",
            "metadata": "PARAMETER_0002"
          },
          {
            "name": "parameter-0003",
            "metadata": "PARAMETER_0003"
          }
        ],
        "metadata": "BALANCE_0001"
      },
      {
        "name": "balance-0002",
        "totalValue": 200,
        "initialValueStrategy": "lottery",
        "parameters": [
          {
            "name": "parameter-0001",
            "metadata": "PARAMETER_0001"
          },
          {
            "name": "parameter-0002",
            "metadata": "PARAMETER_0002"
          },
          {
            "name": "parameter-0003",
            "metadata": "PARAMETER_0003"
          },
          {
            "name": "parameter-0004",
            "metadata": "PARAMETER_0004"
          }
        ],
        "metadata": "BALANCE_0002"
      },
      {
        "name": "balance-0003",
        "totalValue": 500,
        "initialValueStrategy": "average",
        "parameters": [
          {
            "name": "parameter-0001",
            "metadata": "PARAMETER_0001"
          },
          {
            "name": "parameter-0002",
            "metadata": "PARAMETER_0002"
          }
        ],
        "metadata": "BALANCE_0003"
      }
    ],
    "rarityParameterModels": [
      {
        "name": "rarity-0001",
        "maximumParameterCount": 5,
        "parameterCounts": [
          {
            "count": 0,
            "weight": 1
          },
          {
            "count": 1,
            "weight": 2
          },
          {
            "count": 2,
            "weight": 3
          }
        ],
        "parameters": [
          {
            "name": "parameter-0001",
            "metadata": "PARAMETER_0001",
            "resourceName": "resource-0001",
            "resourceValue": 10,
            "weight": 1
          },
          {
            "name": "parameter-0002",
            "metadata": "PARAMETER_0002",
            "resourceName": "resource-0002",
            "resourceValue": 20,
            "weight": 2
          },
          {
            "name": "parameter-0003",
            "metadata": "PARAMETER_0003",
            "resourceName": "resource-0003",
            "resourceValue": 30,
            "weight": 3
          }
        ],
        "metadata": "RARITY_0001"
      },
      {
        "name": "rarity-0002",
        "maximumParameterCount": 10,
        "parameterCounts": [
          {
            "count": 1,
            "weight": 10
          },
          {
            "count": 2,
            "weight": 20
          },
          {
            "count": 3,
            "weight": 30
          }
        ],
        "parameters": [
          {
            "name": "parameter-1001",
            "metadata": "PARAMETER_1001",
            "resourceName": "resource-1001",
            "resourceValue": 100,
            "weight": 10
          },
          {
            "name": "parameter-1002",
            "metadata": "PARAMETER_1002",
            "resourceName": "resource-1002",
            "resourceValue": 200,
            "weight": 20
          },
          {
            "name": "parameter-1003",
            "metadata": "PARAMETER_1003",
            "resourceName": "resource-1003",
            "resourceValue": 300,
            "weight": 30
          }
        ],
        "metadata": "RARITY_0002"
      },
      {
        "name": "rarity-0003",
        "maximumParameterCount": 3,
        "parameterCounts": [
          {
            "count": 2,
            "weight": 5
          },
          {
            "count": 3,
            "weight": 10
          },
          {
            "count": 4,
            "weight": 15
          }
        ],
        "parameters": [
          {
            "name": "parameter-2001",
            "metadata": "PARAMETER_2001",
            "resourceName": "resource-2001",
            "resourceValue": 1000,
            "weight": 2
          },
          {
            "name": "parameter-2002",
            "metadata": "PARAMETER_2002",
            "resourceName": "resource-2002",
            "resourceValue": 2000,
            "weight": 4
          },
          {
            "name": "parameter-2003",
            "metadata": "PARAMETER_2003",
            "resourceName": "resource-2003",
            "resourceValue": 3000,
            "weight": 6
          },
          {
            "name": "parameter-0004",
            "metadata": "PARAMETER_0004",
            "resourceName": "resource-2004",
            "resourceValue": 4000,
            "weight": 8
          }
        ],
        "metadata": "RARITY_0003"
      }
    ]
  }
  UploadToken: null

BalanceParameterModel

Balance Parameter Model

Defines the drawing conditions for balance parameters.

TypeConditionRequiredDefaultValue LimitsDescription
balanceParameterModelIdstring
*
~ 1024 charsBalance Parameter Model GRN
* Set automatically by the server
namestring
~ 128 charsBalance Parameter Model name
Balance Parameter Model-specific name. Specified using alphanumeric characters, hyphen (-), underscore (_), and period (.).
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
totalValuelong
0 ~ 9223372036854775805Total value
initialValueStrategyString Enum
enum {
  “average”,
  “lottery”
}
“average”Initial value setting policy
DefinitionDescription
“average”Average
“lottery”Lottery
parametersList<BalanceParameterValueModel>
1 ~ 10 itemsBalance parameter value model list

BalanceParameterValueModel

Balance Parameter Value Model

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 64 charsName
metadatastring~ 512 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.

RarityParameterModel

Rarity Parameter Model

Defines the drawing conditions for rarity parameters.

TypeConditionRequiredDefaultValue LimitsDescription
rarityParameterModelIdstring
*
~ 1024 charsRarity Parameter Model GRN
* Set automatically by the server
namestring
~ 128 charsRarity Parameter Model name
Rarity Parameter Model-specific name. Specified using alphanumeric characters, hyphen (-), underscore (_), and period (.).
metadatastring~ 2048 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
maximumParameterCountint
1 ~ 10Maximum number of parameters to be given
parameterCountsList<RarityParameterCountModel>
1 ~ 10 itemsRarity parameter count model list
parametersList<RarityParameterValueModel>
1 ~ 1000 itemsRarity parameter value model list

RarityParameterCountModel

Model of the number of rarity parameters granted

TypeConditionRequiredDefaultValue LimitsDescription
countint
0 ~ 10Value
weightint
1 ~ 2147483646Draw Weight

RarityParameterValueModel

Rarity Parameter Value Model

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 64 charsName
metadatastring~ 512 charsMetadata
Arbitrary values can be set in the metadata.
Since they do not affect GS2’s behavior, they can be used to store information used in the game.
resourceNamestring
~ 64 charsParameter Resource Name for Game(Not used for GS2)
resourceValuelong
0 ~ 9223372036854775805Parameter Resource Value for Game(Not used for GS2)
weightint
1 ~ 2147483646Draw Weight