GS2-Version 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
transactionSettingTransactionSettingTransaction Setting
Configuration for controlling how transactions are processed when executing version check operations.
assumeUserIdstring
~ 1024 charsGS2-Identifier user GRN to be promoted if the version check is passed
acceptVersionScriptScriptSettingScript to run when a version is accepted/approved
Script Trigger Reference - acceptVersion
checkVersionTriggerScriptIdstring~ 1024 charsGS2-Script script GRN to perform version checking process
logSettingLogSettingLog Output Setting
Specifies the GS2-Log namespace for outputting API request/response logs related to version checks and version approval operations.

GetAttr

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

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Version::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: null
  AssumeUserId: grn:gs2::YourOwnerId:identifier:user:user-0001
  AcceptVersionScript: null
  CheckVersionTriggerScriptId: 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/version"
)


SampleStack := core.NewStack()
version.NewNamespace(
    &SampleStack,
    "namespace-0001",
    "grn:gs2::YourOwnerId:identifier:user:user-0001",
    version.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\Version\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            assumeUserId: "grn:gs2::YourOwnerId:identifier:user:user-0001",
            options: new \Gs2Cdk\Version\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.version.model.Namespace(
                this,
                "namespace-0001",
                "grn:gs2::YourOwnerId:identifier:user:user-0001",
                new io.gs2.cdk.version.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.Gs2Version.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            assumeUserId: "grn:gs2::YourOwnerId:identifier:user:user-0001",
            options: new Gs2Cdk.Gs2Version.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 version from "@/gs2cdk/version";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new version.model.Namespace(
            this,
            "namespace-0001",
            "grn:gs2::YourOwnerId:identifier:user:user-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, version

class SampleStack(Stack):

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

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

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

ScriptSetting

Script Setting

In GS2, you can associate custom scripts with microservice events and execute them. This model holds the settings for triggering script execution.

There are two main ways to execute a script: synchronous execution and asynchronous execution. Because synchronous execution blocks processing until the script finishes executing, you can use the script result to stop the API execution or control the API response.

In contrast, asynchronous execution does not block processing until the script has finished executing. However, because the script result cannot be used to stop the API execution or modify the API response, Because asynchronous execution does not affect the API response flow, it is generally recommended.

There are two types of asynchronous execution methods: GS2-Script and Amazon EventBridge. By using Amazon EventBridge, you can write processing in languages other than Lua.

TypeConditionRequiredDefaultValue LimitsDescription
triggerScriptIdstring~ 1024 charsGS2-Script script GRN executed synchronously when the API is executed
Must be specified in GRN format starting with “grn:gs2:”.
doneTriggerTargetTypeString Enum
enum {
  “none”,
  “gs2_script”,
  “aws”
}
“none”How to execute asynchronous scripts
Specifies the type of script to use for asynchronous execution.
You can choose from “Do not use asynchronous execution (none)”, “Use GS2-Script (gs2_script)”, and “Use Amazon EventBridge (aws)”.
DefinitionDescription
“none”None
“gs2_script”GS2-Script
“aws”Amazon EventBridge
doneTriggerScriptIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-Script script GRN for asynchronous execution
Must be specified in GRN format starting with “grn:gs2:”.
* Applicable only if doneTriggerTargetType is “gs2_script”
doneTriggerQueueNamespaceIdstring{doneTriggerTargetType} == “gs2_script”~ 1024 charsGS2-JobQueue namespace GRN to execute asynchronous execution scripts
If you want to execute asynchronous execution scripts via GS2-JobQueue instead of executing them directly, specify the GS2-JobQueue namespace GRN.
There are not many cases where GS2-JobQueue is required, so you generally do not need to specify it unless you have a specific reason.
* Applicable only if doneTriggerTargetType is “gs2_script”

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:”.

CurrentVersionMaster

Currently active Version Model master data

This master data describes the definitions of Version Models currently active within the namespace. GS2 uses JSON format files for managing master data. By uploading these files, the master data settings are updated on the server.

To create JSON files, GS2 provides a master data editor within the management console. Additionally, you can create tools better suited for game operations and export 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
ItemCurrentVersionMasterUpdated master data of the currently active Version Models

Implementation Example

Type: GS2::Version::CurrentVersionMaster
Properties:
  NamespaceName: namespace-0001
  Mode: direct
  Settings: {
    "version": "2019-10-09",
    "versionModels": [
      {
        "name": "app",
        "scope": "passive",
        "type": "simple",
        "metadata": "APP",
        "warningVersion":
          {
            "major": 2,
            "minor": 2,
            "micro": 2
          },
        "errorVersion":
          {
            "major": 1,
            "minor": 1,
            "micro": 1
          }
      },
      {
        "name": "asset",
        "scope": "passive",
        "type": "simple",
        "metadata": "ASSET",
        "warningVersion":
          {
            "major": 3,
            "minor": 3,
            "micro": 3
          },
        "errorVersion":
          {
            "major": 2,
            "minor": 2,
            "micro": 2
          },
        "needSignature": true,
        "signatureKeyId": "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
      },
      {
        "name": "eula",
        "scope": "active",
        "type": "simple",
        "metadata": "EULA",
        "currentVersion":
          {
            "major": 2,
            "minor": 2,
            "micro": 2
          },
        "warningVersion":
          {
            "major": 4,
            "minor": 4,
            "micro": 4
          },
        "errorVersion":
          {
            "major": 3,
            "minor": 3,
            "micro": 3
          }
      }
    ]
  }
  UploadToken: null
import (
    "github.com/gs2io/gs2-golang-cdk/core"
    "github.com/gs2io/gs2-golang-cdk/version"
    "github.com/openlyinc/pointy"
)


SampleStack := core.NewStack()
version.NewNamespace(
    &SampleStack,
    "namespace-0001",
    "user-0001",
    version.NamespaceOptions{},
).MasterData(
    []version.VersionModel{
        version.NewVersionModel(
            "app",
            version.VersionModelScopePassive,
            version.VersionModelTypeSimple,
            version.VersionModelOptions{
                Metadata: pointy.String("APP"),
                WarningVersion: &version.Version{
                    Major: 2,
                    Minor: 2,
                    Micro: 2,
                },
                ErrorVersion: &version.Version{
                    Major: 1,
                    Minor: 1,
                    Micro: 1,
                },
            },
        ),
        version.NewVersionModel(
            "asset",
            version.VersionModelScopePassive,
            version.VersionModelTypeSimple,
            version.VersionModelOptions{
                Metadata: pointy.String("ASSET"),
                WarningVersion: &version.Version{
                    Major: 3,
                    Minor: 3,
                    Micro: 3,
                },
                ErrorVersion: &version.Version{
                    Major: 2,
                    Minor: 2,
                    Micro: 2,
                },
                NeedSignature: pointy.Bool(true),
                SignatureKeyId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"),
            },
        ),
        version.NewVersionModel(
            "eula",
            version.VersionModelScopeActive,
            version.VersionModelTypeSimple,
            version.VersionModelOptions{
                Metadata: pointy.String("EULA"),
                CurrentVersion: &version.Version{
                    Major: 2,
                    Minor: 2,
                    Micro: 2,
                },
                WarningVersion: &version.Version{
                    Major: 4,
                    Minor: 4,
                    Micro: 4,
                },
                ErrorVersion: &version.Version{
                    Major: 3,
                    Minor: 3,
                    Micro: 3,
                },
            },
        ),
    },
)

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Version\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            assumeUserId: "user-0001"
        ))->masterData(
            [
                new \Gs2Cdk\Version\Model\VersionModel(
                    name:"app",
                    scope: \Gs2Cdk\Version\Model\Enums\VersionModelScope::PASSIVE,
                    type: \Gs2Cdk\Version\Model\Enums\VersionModelType::SIMPLE,
                    options: new \Gs2Cdk\Version\Model\Options\VersionModelOptions(
                        metadata:"APP",
                        warningVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 2,
                            minor: 2,
                            micro: 2,
                        ),
                        errorVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 1,
                            minor: 1,
                            micro: 1,
                        )
                    )
                ),
                new \Gs2Cdk\Version\Model\VersionModel(
                    name:"asset",
                    scope: \Gs2Cdk\Version\Model\Enums\VersionModelScope::PASSIVE,
                    type: \Gs2Cdk\Version\Model\Enums\VersionModelType::SIMPLE,
                    options: new \Gs2Cdk\Version\Model\Options\VersionModelOptions(
                        metadata:"ASSET",
                        warningVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 3,
                            minor: 3,
                            micro: 3,
                        ),
                        errorVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 2,
                            minor: 2,
                            micro: 2,
                        ),
                        needSignature:true,
                        signatureKeyId:"grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
                    )
                ),
                new \Gs2Cdk\Version\Model\VersionModel(
                    name:"eula",
                    scope: \Gs2Cdk\Version\Model\Enums\VersionModelScope::ACTIVE,
                    type: \Gs2Cdk\Version\Model\Enums\VersionModelType::SIMPLE,
                    options: new \Gs2Cdk\Version\Model\Options\VersionModelOptions(
                        metadata:"EULA",
                        currentVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 2,
                            minor: 2,
                            micro: 2,
                        ),
                        warningVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 4,
                            minor: 4,
                            micro: 4,
                        ),
                        errorVersion:new \Gs2Cdk\Version\Model\Version(
                            major: 3,
                            minor: 3,
                            micro: 3,
                        )
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.version.model.Namespace(
            this,
            "namespace-0001",
            "user-0001"
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.version.model.VersionModel(
                    "app",
                    io.gs2.cdk.version.model.enums.VersionModelScope.PASSIVE,
                    io.gs2.cdk.version.model.enums.VersionModelType.SIMPLE,
                    new io.gs2.cdk.version.model.options.VersionModelOptions()
                        .withMetadata("APP")
                        .withWarningVersion(new io.gs2.cdk.version.model.Version(
                            2,
                            2,
                            2
                        ))
                        .withErrorVersion(new io.gs2.cdk.version.model.Version(
                            1,
                            1,
                            1
                        ))
                ),
                new io.gs2.cdk.version.model.VersionModel(
                    "asset",
                    io.gs2.cdk.version.model.enums.VersionModelScope.PASSIVE,
                    io.gs2.cdk.version.model.enums.VersionModelType.SIMPLE,
                    new io.gs2.cdk.version.model.options.VersionModelOptions()
                        .withMetadata("ASSET")
                        .withWarningVersion(new io.gs2.cdk.version.model.Version(
                            3,
                            3,
                            3
                        ))
                        .withErrorVersion(new io.gs2.cdk.version.model.Version(
                            2,
                            2,
                            2
                        ))
                        .withNeedSignature(true)
                        .withSignatureKeyId("grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001")
                ),
                new io.gs2.cdk.version.model.VersionModel(
                    "eula",
                    io.gs2.cdk.version.model.enums.VersionModelScope.ACTIVE,
                    io.gs2.cdk.version.model.enums.VersionModelType.SIMPLE,
                    new io.gs2.cdk.version.model.options.VersionModelOptions()
                        .withMetadata("EULA")
                        .withCurrentVersion(new io.gs2.cdk.version.model.Version(
                            2,
                            2,
                            2
                        ))
                        .withWarningVersion(new io.gs2.cdk.version.model.Version(
                            4,
                            4,
                            4
                        ))
                        .withErrorVersion(new io.gs2.cdk.version.model.Version(
                            3,
                            3,
                            3
                        ))
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Version.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            assumeUserId: "user-0001"
        ).MasterData(
            new Gs2Cdk.Gs2Version.Model.VersionModel[] {
                new Gs2Cdk.Gs2Version.Model.VersionModel(
                    name: "app",
                    scope: Gs2Cdk.Gs2Version.Model.Enums.VersionModelScope.Passive,
                    type: Gs2Cdk.Gs2Version.Model.Enums.VersionModelType.Simple,
                    options: new Gs2Cdk.Gs2Version.Model.Options.VersionModelOptions
                    {
                        metadata = "APP",
                        warningVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 2,
                            minor: 2,
                            micro: 2
                        ),
                        errorVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 1,
                            minor: 1,
                            micro: 1
                        )
                    }
                ),
                new Gs2Cdk.Gs2Version.Model.VersionModel(
                    name: "asset",
                    scope: Gs2Cdk.Gs2Version.Model.Enums.VersionModelScope.Passive,
                    type: Gs2Cdk.Gs2Version.Model.Enums.VersionModelType.Simple,
                    options: new Gs2Cdk.Gs2Version.Model.Options.VersionModelOptions
                    {
                        metadata = "ASSET",
                        warningVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 3,
                            minor: 3,
                            micro: 3
                        ),
                        errorVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 2,
                            minor: 2,
                            micro: 2
                        ),
                        needSignature = true,
                        signatureKeyId = "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
                    }
                ),
                new Gs2Cdk.Gs2Version.Model.VersionModel(
                    name: "eula",
                    scope: Gs2Cdk.Gs2Version.Model.Enums.VersionModelScope.Active,
                    type: Gs2Cdk.Gs2Version.Model.Enums.VersionModelType.Simple,
                    options: new Gs2Cdk.Gs2Version.Model.Options.VersionModelOptions
                    {
                        metadata = "EULA",
                        currentVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 2,
                            minor: 2,
                            micro: 2
                        ),
                        warningVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 4,
                            minor: 4,
                            micro: 4
                        ),
                        errorVersion = new Gs2Cdk.Gs2Version.Model.Version_(
                            major: 3,
                            minor: 3,
                            micro: 3
                        )
                    }
                )
            }
        );
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new version.model.Namespace(
            this,
            "namespace-0001",
            "user-0001",
        ).masterData(
            [
                new version.model.VersionModel(
                    "app",
                    version.model.VersionModelScope.PASSIVE,
                    version.model.VersionModelType.SIMPLE,
                    {
                        metadata: "APP",
                        warningVersion: new version.model.Version(
                            2,
                            2,
                            2
                        ),
                        errorVersion: new version.model.Version(
                            1,
                            1,
                            1
                        )
                    }
                ),
                new version.model.VersionModel(
                    "asset",
                    version.model.VersionModelScope.PASSIVE,
                    version.model.VersionModelType.SIMPLE,
                    {
                        metadata: "ASSET",
                        warningVersion: new version.model.Version(
                            3,
                            3,
                            3
                        ),
                        errorVersion: new version.model.Version(
                            2,
                            2,
                            2
                        ),
                        needSignature: true,
                        signatureKeyId: "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
                    }
                ),
                new version.model.VersionModel(
                    "eula",
                    version.model.VersionModelScope.ACTIVE,
                    version.model.VersionModelType.SIMPLE,
                    {
                        metadata: "EULA",
                        currentVersion: new version.model.Version(
                            2,
                            2,
                            2
                        ),
                        warningVersion: new version.model.Version(
                            4,
                            4,
                            4
                        ),
                        errorVersion: new version.model.Version(
                            3,
                            3,
                            3
                        )
                    }
                )
            ]
        );
    }
}

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

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        version.Namespace(
            stack=self,
            name="namespace-0001",
            assume_user_id="user-0001"
        ).master_data(
            version_models=[
                version.VersionModel(
                    name='app',
                    scope=version.VersionModelScope.PASSIVE,
                    type=version.VersionModelType.SIMPLE,
                    options=version.VersionModelOptions(
                        metadata = 'APP',
                        warning_version = version.Version(
                            major=2,
                            minor=2,
                            micro=2,        
                        ),
                        error_version = version.Version(
                            major=1,
                            minor=1,
                            micro=1,        
                        )
                    ),
                ),
                version.VersionModel(
                    name='asset',
                    scope=version.VersionModelScope.PASSIVE,
                    type=version.VersionModelType.SIMPLE,
                    options=version.VersionModelOptions(
                        metadata = 'ASSET',
                        warning_version = version.Version(
                            major=3,
                            minor=3,
                            micro=3,        
                        ),
                        error_version = version.Version(
                            major=2,
                            minor=2,
                            micro=2,        
                        ),
                        need_signature = True,
                        signature_key_id = 'grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001'
                    ),
                ),
                version.VersionModel(
                    name='eula',
                    scope=version.VersionModelScope.ACTIVE,
                    type=version.VersionModelType.SIMPLE,
                    options=version.VersionModelOptions(
                        metadata = 'EULA',
                        current_version = version.Version(
                            major=2,
                            minor=2,
                            micro=2,        
                        ),
                        warning_version = version.Version(
                            major=4,
                            minor=4,
                            micro=4,        
                        ),
                        error_version = version.Version(
                            major=3,
                            minor=3,
                            micro=3,        
                        )
                    ),
                ),
            ],
        )

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

VersionModel

Version Model

You can set a warning version that accepts login but notifies you that you can upgrade, and an error version that does not accept login.

You can specify whether or not to have the client declare the current version with or without a signature. If you select signed, the client will not be able to declare a false version.

TypeConditionRequiredDefaultValue LimitsDescription
versionModelIdstring
*
~ 1024 charsVersion Model GRN
* Set automatically by the server
namestring
~ 128 charsVersion Model name
Version Model-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.).
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.
scopeString Enum
enum {
  “passive”,
  “active”
}
Type of version value used for judgment
Determines how the version value is obtained for checking. “passive” means the client declares its current version at check time, while “active” means the system uses a version the user has explicitly approved in the past (such as agreeing to terms of service).
DefinitionDescription
“passive”Sent by Client
“active”Version explicitly approved in the past
typeString Enum
enum {
  “simple”,
  “schedule”
}
“simple”Version Check Mode
Selects the version checking strategy. “simple” uses fixed warning and error version thresholds, while “schedule” allows different version thresholds to be activated at different times using GS2-Schedule events.
DefinitionDescription
“simple”Simple
“schedule”Schedule Change
currentVersionVersion{type} == “simple” and {scope} == “active”
✓*
Current Version
The latest version available for this version model. Used only with “active” scope in “simple” mode to inform users of the current version when they approve or review version updates.
* Required if type is “simple” and scope is “active”
warningVersionVersion{type} == “simple”
✓*
Version that prompts for version upgrade
The minimum version threshold for showing an upgrade notification. If the client’s version is below this value, login is still allowed but the user is prompted to upgrade. Comparison is performed hierarchically: major, then minor, then micro.
* Required if type is “simple”
errorVersionVersion{type} == “simple”
✓*
Version that is determined to be an error by the version check
The minimum version threshold for allowing login. If the client’s version is below this value, the version check results in an error and login is blocked. Comparison is performed hierarchically: major, then minor, then micro.
* Required if type is “simple”
scheduleVersionsList<ScheduleVersion>{type} == “schedule”0 ~ 10 itemsList of Version check content that switches over time series
A list of version check configurations that activate at different times based on GS2-Schedule events. This allows gradual version enforcement, such as showing warnings before making an update mandatory.
* Applicable only if type is “schedule”
needSignaturebool{scope} == “passive”
✓*
Whether the version value to be determined requires signature verification
When enabled, the client must provide a cryptographic signature along with the version declaration. This prevents clients from falsely reporting a higher version to bypass version checks. Only applicable when scope is “passive”.
* Required if scope is “passive”
signatureKeyIdstring{needSignature}
✓*
~ 1024 charsEncryption Key GRN
* Required if needSignature is “true”
approveRequirementString Enum
enum {
  “required”,
  “optional”
}
{scope} == “active”“required”Requirement for approval
Controls whether user approval is mandatory or optional for this version model. When “required”, the version check fails if the user has not approved the current version. When “optional”, the version check passes regardless of approval status. Only applicable when scope is “active”.
DefinitionDescription
“required”Approval required
“optional”Approval optional
* Applicable only if scope is “active”

Version

Version

Represents a version number with a three-level hierarchy (major, minor, micro). Version comparison is performed hierarchically: major version is compared first, then minor, then micro. Used to define warning and error thresholds for version checking.

TypeConditionRequiredDefaultValue LimitsDescription
majorint
0 ~ 2147483646Major version
The highest priority component in version comparison. A difference in major version takes precedence over minor and micro versions.
minorint
0 ~ 2147483646Minor version
The second priority component in version comparison. Compared only when the major versions are equal.
microint
0 ~ 2147483646Micro version
The lowest priority component in version comparison. Compared only when both major and minor versions are equal.

ScheduleVersion

Version that switches in chronological order

Defines a set of version thresholds (current, warning, error) that become active during a specific time period controlled by a GS2-Schedule event. Multiple schedule versions can be configured to implement gradual version enforcement, such as warning users before blocking outdated clients.

TypeConditionRequiredDefaultValue LimitsDescription
currentVersionVersion
Current Version
The latest version available during this schedule period. Used with “active” scope to inform users of the current version when approving updates.
warningVersionVersion
Version that prompts for version upgrade
The minimum version threshold for showing an upgrade notification during this schedule period. Login is allowed but the user is prompted to upgrade.
errorVersionVersion
Version that is determined to be an error by the version check
The minimum version threshold for allowing login during this schedule period. If the client’s version is below this value, the version check results in an error and login is blocked.
scheduleEventIdstring~ 1024 charsGS2-Schedule event GRN that enables version check
Specifies the GS2-Schedule event that controls when this set of version thresholds is active. The version check configuration defined here only applies during the period when the specified event is active.