GS2-Deploy/CDK Reference of GS2-Lottery

Template format used to create GS2-Deploy stacks and examples of template output implementation in various languages using CDK

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
lotteryTriggerScriptIdstring~ 1024 charsGS2-Script scripts to be called when the lottery is executed
choicePrizeTableScriptIdstring~ 1024 charsGS2-Script script for dynamically determining lottery probability tables
logSettingLogSettingLog output settings

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Lottery::Namespace
Properties:
  Name: namespace-0001
  Description: null
  TransactionSetting: 
    EnableAutoRun: false
    QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
    KeyId: grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001
  LotteryTriggerScriptId: null
  ChoicePrizeTableScriptId: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
import "github.com/gs2io/gs2-golang-cdk/core"
import "github.com/gs2io/gs2-golang-cdk/lottery"
import "github.com/openlyinc/pointy"

SampleStack := core.NewStack()
lottery.NewNamespace(
    &SampleStack,
    "namespace-0001",
    lottery.NamespaceOptions{
        TransactionSetting: lottery.TransactionSetting{
            EnableAutoRun: pointy.Bool(false),
            QueueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
            KeyId: "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001",
        },
        LogSetting: lottery.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\Lottery\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Lottery\Model\Options\NamespaceOptions(
                transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
                    queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
                    options: new \Gs2Cdk\Core\Model\Options\TransactionSettingOptions(
                        keyId: "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
                    )
                ),
                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.lottery.model.Namespace(
                this,
                "namespace-0001",
                new io.gs2.cdk.lottery.model.options.NamespaceOptions()
                        .withtransactionSetting = new io.gs2.cdk.core.model.TransactionSetting(
                                queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001";,
                            new io.gs2.cdk.core.model.options.TransactionSettingOptions()
                                .withKeyId(
                                    "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001"
                                )
                        )
                        .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.Gs2Lottery.Model.Namespace(
            stack: this,
            name: "namespace-0001",
            options: new Gs2Cdk.Gs2Lottery.Model.Options.NamespaceOptions
            {
                transactionSetting = new Gs2Cdk.Core.Model.TransactionSetting(
                    options: new Gs2Cdk.Core.Model.TransactionSettingOptions
                    {
                        queueNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
                    }
                ),
                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 lottery from "@/gs2cdk/lottery";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            "namespace-0001",
            {
                transactionSetting: new core.TransactionSetting(
                    ,
                    "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001",
                    {
                        "grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-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, lottery

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            name='namespace-0001',
            options=lottery.NamespaceOptions(
                transaction_setting=core.TransactionSetting(
                    queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
                    options=core.TransactionSettingOptions(
                        key_id='grn:gs2:ap-northeast-1:YourOwnerId:key:namespace-0001:key:key-0001',
                    )
                ),
                log_setting=core.LogSetting(
                    logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
                ),
            ),
        )

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

CurrentLotteryMaster

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
ItemCurrentLotteryMasterUpdated, currently available lottery settings

Implementation Example

Type: GS2::Lottery::CurrentLotteryMaster
Properties:
  NamespaceName: namespace-0001
  Settings: {
    "version": "2019-02-21",
    "lotteryModels": [
      {
        "name": "gacha",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "GACHA",
        "prizeTableName": "gacha"
      },
      {
        "name": "gacha_ssr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SSR",
        "prizeTableName": "gacha-ssr"
      },
      {
        "name": "gacha_sr",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "SR",
        "prizeTableName": "gacha-sr"
      },
      {
        "name": "gacha_r",
        "mode": "normal",
        "method": "prize_table",
        "metadata": "R",
        "prizeTableName": "gacha-r"
      },
      {
        "name": "box",
        "mode": "box",
        "method": "prize_table",
        "metadata": "BOX",
        "prizeTableName": "box"
      }
    ],
    "prizeTables": [
      {
        "name": "gacha",
        "prizes": [
          {
            "prizeId": "prize-1",
            "type": "prize_table",
            "prizeTableName": "gacha-ssr",
            "weight": 5
          },
          {
            "prizeId": "prize-2",
            "type": "prize_table",
            "prizeTableName": "gacha-sr",
            "weight": 15
          },
          {
            "prizeId": "prize-3",
            "type": "prize_table",
            "prizeTableName": "gacha-r",
            "weight": 80
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-ssr",
        "prizes": [
          {
            "prizeId": "prize-4",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 1
          },
          {
            "prizeId": "prize-5",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 2
          },
          {
            "prizeId": "prize-6",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 3
          }
        ],
        "metadata": "SSR"
      },
      {
        "name": "gacha-sr",
        "prizes": [
          {
            "prizeId": "prize-7",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 10
          },
          {
            "prizeId": "prize-8",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-9",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 30
          }
        ],
        "metadata": "SR"
      },
      {
        "name": "gacha-r",
        "prizes": [
          {
            "prizeId": "prize-10",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 100
          },
          {
            "prizeId": "prize-11",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 200
          },
          {
            "prizeId": "prize-12",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 300
          }
        ],
        "metadata": "R"
      },
      {
        "name": "box",
        "prizes": [
          {
            "prizeId": "prize-13",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 30
          },
          {
            "prizeId": "prize-14",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 20
          },
          {
            "prizeId": "prize-15",
            "type": "action",
            "acquireActions": [
              {
                "action": "Gs2Money:DepositByUserId",
                "request": "{\"count\": 1}"
              }
            ],
            "weight": 10
          }
        ],
        "metadata": "BOX"
      }
    ]
  }
import "github.com/gs2io/gs2-golang-cdk/core"
import "github.com/gs2io/gs2-golang-cdk/lottery"
import "github.com/openlyinc/pointy"

SampleStack := core.NewStack()
        lottery.NewNamespace(
            &SampleStack,
            # omission
        ).MasterData(
            lottery_models=[
                lottery.LotteryModel(
                    name="gacha",
                    mode="normal",
                    method="prize_table",
                    options=lottery.LotteryModelOptions(
                        metadata="GACHA",
                        prize_table_name="gacha",
                    ),
                ),
                lottery.LotteryModel(
                    name="gacha_ssr",
                    mode="normal",
                    method="prize_table",
                    options=lottery.LotteryModelOptions(
                        metadata="SSR",
                        prize_table_name="gacha-ssr",
                    ),
                ),
                lottery.LotteryModel(
                    name="gacha_sr",
                    mode="normal",
                    method="prize_table",
                    options=lottery.LotteryModelOptions(
                        metadata="SR",
                        prize_table_name="gacha-sr",
                    ),
                ),
                lottery.LotteryModel(
                    name="gacha_r",
                    mode="normal",
                    method="prize_table",
                    options=lottery.LotteryModelOptions(
                        metadata="R",
                        prize_table_name="gacha-r",
                    ),
                ),
                lottery.LotteryModel(
                    name="box",
                    mode="box",
                    method="prize_table",
                    options=lottery.LotteryModelOptions(
                        metadata="BOX",
                        prize_table_name="box",
                    ),
                ),
            ],
            prize_tables=[
                lottery.PrizeTable(
                    name="gacha",
                    prizes=[]lottery.Prize{
                            lottery.Prize{
                                PrizeId: "prize-1",
                                Type: "prize_table",
                                PrizeTableName: "gacha-ssr",
                                Weight: 5,
                            },
                            lottery.Prize{
                                PrizeId: "prize-2",
                                Type: "prize_table",
                                PrizeTableName: "gacha-sr",
                                Weight: 15,
                            },
                            lottery.Prize{
                                PrizeId: "prize-3",
                                Type: "prize_table",
                                PrizeTableName: "gacha-r",
                                Weight: 80,
                            },
                        },
                    options=lottery.PrizeTableOptions(
                        metadata="SSR",
                    ),
                ),
                lottery.PrizeTable(
                    name="gacha-ssr",
                    prizes=[]lottery.Prize{
                            lottery.Prize{
                                PrizeId: "prize-4",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 1,
                            },
                            lottery.Prize{
                                PrizeId: "prize-5",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 2,
                            },
                            lottery.Prize{
                                PrizeId: "prize-6",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 3,
                            },
                        },
                    options=lottery.PrizeTableOptions(
                        metadata="SSR",
                    ),
                ),
                lottery.PrizeTable(
                    name="gacha-sr",
                    prizes=[]lottery.Prize{
                            lottery.Prize{
                                PrizeId: "prize-7",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 10,
                            },
                            lottery.Prize{
                                PrizeId: "prize-8",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 20,
                            },
                            lottery.Prize{
                                PrizeId: "prize-9",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 30,
                            },
                        },
                    options=lottery.PrizeTableOptions(
                        metadata="SR",
                    ),
                ),
                lottery.PrizeTable(
                    name="gacha-r",
                    prizes=[]lottery.Prize{
                            lottery.Prize{
                                PrizeId: "prize-10",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 100,
                            },
                            lottery.Prize{
                                PrizeId: "prize-11",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 200,
                            },
                            lottery.Prize{
                                PrizeId: "prize-12",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 300,
                            },
                        },
                    options=lottery.PrizeTableOptions(
                        metadata="R",
                    ),
                ),
                lottery.PrizeTable(
                    name="box",
                    prizes=[]lottery.Prize{
                            lottery.Prize{
                                PrizeId: "prize-13",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 30,
                            },
                            lottery.Prize{
                                PrizeId: "prize-14",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 20,
                            },
                            lottery.Prize{
                                PrizeId: "prize-15",
                                Type: "action",
                                AcquireActions: []Lottery.AcquireAction{    
                                    Lottery.AcquireAction{
                                    lottery.Prize{
                                        Action: "Gs2Money:DepositByUserId",
                                        Request: "{\"count\": 1}",
                                    }
                                },
                                Weight: 10,
                            },
                        },
                    options=lottery.PrizeTableOptions(
                        metadata="BOX",
                    ),
                ),
            ],
        )

println(SampleStack.Yaml())  // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Lottery\Model\Namespace_(
            stack: $this,
            // omission
        ))->masterData(
            [
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"GACHA",
                        prizeTableName:"gacha"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_ssr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SSR",
                        prizeTableName:"gacha-ssr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_sr",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"SR",
                        prizeTableName:"gacha-sr"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"gacha_r",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::NORMAL,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"R",
                        prizeTableName:"gacha-r"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\LotteryModel(
                    name:"box",
                    mode: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMode::BOX,
                    method: \Gs2Cdk\Lottery\Model\Enums\LotteryModelMethod::PRIZE_TABLE,
                    options: new \Gs2Cdk\Lottery\Model\Options\LotteryModelOptions(
                        metadata:"BOX",
                        prizeTableName:"box"
                    )
                )
            ],
            [
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-1",
                            type = "prize_table",
                            weight = 5,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                prizeTableName = "gacha-ssr",
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-2",
                            type = "prize_table",
                            weight = 15,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                prizeTableName = "gacha-sr",
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-3",
                            type = "prize_table",
                            weight = 80,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                prizeTableName = "gacha-r",
                            )
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-ssr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-4",
                            type = "action",
                            weight = 1,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-5",
                            type = "action",
                            weight = 2,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-6",
                            type = "action",
                            weight = 3,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SSR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-sr",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-7",
                            type = "action",
                            weight = 10,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-8",
                            type = "action",
                            weight = 20,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-9",
                            type = "action",
                            weight = 30,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"SR"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"gacha-r",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-10",
                            type = "action",
                            weight = 100,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-11",
                            type = "action",
                            weight = 200,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-12",
                            type = "action",
                            weight = 300,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"R"
                    )
                ),
                new \Gs2Cdk\Lottery\Model\PrizeTable(
                    name:"box",
                    prizes:[
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-13",
                            type = "action",
                            weight = 30,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-14",
                            type = "action",
                            weight = 20,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                        new \Gs2Cdk\Lottery\Model\Prize(
                            prizeId = "prize-15",
                            type = "action",
                            weight = 10,
                            option: new \Gs2Cdk\lottery\Model\Options\PrizeOptions(
                                acquireActions = [{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}],
                            )
                        ),
                    ],
                    options: new \Gs2Cdk\Lottery\Model\Options\PrizeTableOptions(
                        metadata:"BOX"
                    )
                )
            ]
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.lottery.model.Namespace(
            this,
            // omission
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha",
                    Normal,
                    PrizeTable,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                            .withMetadata("GACHA")
                            .withPrizeTableName("gacha")
                    }
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_ssr",
                    Normal,
                    PrizeTable,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                            .withMetadata("SSR")
                            .withPrizeTableName("gacha-ssr")
                    }
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_sr",
                    Normal,
                    PrizeTable,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                            .withMetadata("SR")
                            .withPrizeTableName("gacha-sr")
                    }
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "gacha_r",
                    Normal,
                    PrizeTable,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                            .withMetadata("R")
                            .withPrizeTableName("gacha-r")
                    }
                ),
                new io.gs2.cdk.lottery.model.LotteryModel(
                    "box",
                    Box,
                    PrizeTable,
                    new io.gs2.cdk.lottery.model.options.LotteryModelOptions()
                            .withMetadata("BOX")
                            .withPrizeTableName("box")
                    }
                )
            ),
            Arrays.asList(
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-1",
                            type = "prize_table",
                            weight = 5,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-ssr"),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-2",
                            type = "prize_table",
                            weight = 15,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-sr"),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-3",
                            type = "prize_table",
                            weight = 80,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withPrizeTableName("gacha-r"),
                            )
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                            .withMetadata("SSR")
                    }
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-ssr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-4",
                            type = "action",
                            weight = 1,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-5",
                            type = "action",
                            weight = 2,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-6",
                            type = "action",
                            weight = 3,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                            .withMetadata("SSR")
                    }
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-sr",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-7",
                            type = "action",
                            weight = 10,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-8",
                            type = "action",
                            weight = 20,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-9",
                            type = "action",
                            weight = 30,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                            .withMetadata("SR")
                    }
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "gacha-r",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-10",
                            type = "action",
                            weight = 100,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-11",
                            type = "action",
                            weight = 200,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-12",
                            type = "action",
                            weight = 300,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                            .withMetadata("R")
                    }
                ),
                new io.gs2.cdk.lottery.model.PrizeTable(
                    "box",
                    Arrays.asList(
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-13",
                            type = "action",
                            weight = 30,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-14",
                            type = "action",
                            weight = 20,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        ),
                        new io.gs2.cdk.lottery.model.Prize(
                            prizeId = "prize-15",
                            type = "action",
                            weight = 10,
                            option: new io.gs2.cdk.lottery.model.options.PrizeOptions()
                                .withAcquireActions([{'action': 'Gs2Money:DepositByUserId', 'request': '{"count": 1}'}]),
                            )
                        )
                    ),
                    new io.gs2.cdk.lottery.model.options.PrizeTableOptions()
                            .withMetadata("BOX")
                    }
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Lottery.Model.Namespace(
            stack: this,
            // omission
        ).MasterData(
            new [] {
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    "gacha",
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    new Gs2Cdk.Gs2Lottery.Model.LotteryModelOptions {
                        metadata = "GACHA",
                        prizeTableName = "gacha"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    "gacha_ssr",
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    new Gs2Cdk.Gs2Lottery.Model.LotteryModelOptions {
                        metadata = "SSR",
                        prizeTableName = "gacha-ssr"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    "gacha_sr",
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    new Gs2Cdk.Gs2Lottery.Model.LotteryModelOptions {
                        metadata = "SR",
                        prizeTableName = "gacha-sr"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    "gacha_r",
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Normal,
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    new Gs2Cdk.Gs2Lottery.Model.LotteryModelOptions {
                        metadata = "R",
                        prizeTableName = "gacha-r"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.LotteryModel(
                    "box",
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMode.Box,
                    Gs2Cdk.Gs2Lottery.Model.Enums.LotteryModelMethod.PrizeTable,
                    new Gs2Cdk.Gs2Lottery.Model.LotteryModelOptions {
                        metadata = "BOX",
                        prizeTableName = "box"
                    }
                );
            },
            new [] {
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    "gacha",
                    new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-1",
                            type: "prize_table",
                            prizeTableName: "gacha-ssr",
                            weight: 5
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-2",
                            type: "prize_table",
                            prizeTableName: "gacha-sr",
                            weight: 15
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-3",
                            type: "prize_table",
                            prizeTableName: "gacha-r",
                            weight: 80
                        )
                    },
                    new Gs2Cdk.Gs2Lottery.Model.PrizeTableOptions {
                        metadata = "SSR"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    "gacha-ssr",
                    new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-4",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 1
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-5",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 2
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-6",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 3
                        )
                    },
                    new Gs2Cdk.Gs2Lottery.Model.PrizeTableOptions {
                        metadata = "SSR"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    "gacha-sr",
                    new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-7",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 10
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-8",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 20
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-9",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 30
                        )
                    },
                    new Gs2Cdk.Gs2Lottery.Model.PrizeTableOptions {
                        metadata = "SR"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    "gacha-r",
                    new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-10",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 100
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-11",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 200
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-12",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 300
                        )
                    },
                    new Gs2Cdk.Gs2Lottery.Model.PrizeTableOptions {
                        metadata = "R"
                    }
                );,
                new Gs2Cdk.Gs2Lottery.Model.PrizeTable(
                    "box",
                    new Gs2Cdk.Gs2Lottery.Model.Prize[]
                    {
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-13",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 30
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-14",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 20
                        ),
                        new Gs2Cdk.Gs2Lottery.Model.Prize(
                            prizeId: "prize-15",
                            type: "action",
                            acquireActions: new Gs2Cdk.Core.Model.AcquireAction[] {
                                new Gs2Cdk.Core.Model.AcquireAction(
                                    action: "Gs2Money:DepositByUserId",
                                    request: "{\"count\": 1}"
                                )
                            },
                            weight: 10
                        )
                    },
                    new Gs2Cdk.Gs2Lottery.Model.PrizeTableOptions {
                        metadata = "BOX"
                    }
                );
            }
        )
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new lottery.model.Namespace(
            this,
            // omission
        ).masterData(
            [
                new lottery.model.LotteryModel(
                    "gacha",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "GACHA",
                        prizeTableName: "gacha"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_ssr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SSR",
                        prizeTableName: "gacha-ssr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_sr",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "SR",
                        prizeTableName: "gacha-sr"
                    }
                ),
                new lottery.model.LotteryModel(
                    "gacha_r",
                    lottery.model.LotteryModelMode.NORMAL,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "R",
                        prizeTableName: "gacha-r"
                    }
                ),
                new lottery.model.LotteryModel(
                    "box",
                    lottery.model.LotteryModelMode.BOX,
                    lottery.model.LotteryModelMethod.PRIZE_TABLE,
                    {
                        metadata: "BOX",
                        prizeTableName: "box"
                    }
                )
            ],
            [
                new lottery.model.PrizeTable(
                    "gacha",
                    [
                        new lottery.model.Prize(
                            "prize-1",
                            "prize_table",
                            "gacha-ssr",
                            5
                        ),
                        new lottery.model.Prize(
                            "prize-2",
                            "prize_table",
                            "gacha-sr",
                            15
                        ),
                        new lottery.model.Prize(
                            "prize-3",
                            "prize_table",
                            "gacha-r",
                            80
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-ssr",
                    [
                        new lottery.model.Prize(
                            "prize-4",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            1
                        ),
                        new lottery.model.Prize(
                            "prize-5",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            2
                        ),
                        new lottery.model.Prize(
                            "prize-6",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            3
                        ),
                    ],
                    {
                        metadata: "SSR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-sr",
                    [
                        new lottery.model.Prize(
                            "prize-7",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            10
                        ),
                        new lottery.model.Prize(
                            "prize-8",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            20
                        ),
                        new lottery.model.Prize(
                            "prize-9",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            30
                        ),
                    ],
                    {
                        metadata: "SR"
                    }
                ),
                new lottery.model.PrizeTable(
                    "gacha-r",
                    [
                        new lottery.model.Prize(
                            "prize-10",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            100
                        ),
                        new lottery.model.Prize(
                            "prize-11",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            200
                        ),
                        new lottery.model.Prize(
                            "prize-12",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            300
                        ),
                    ],
                    {
                        metadata: "R"
                    }
                ),
                new lottery.model.PrizeTable(
                    "box",
                    [
                        new lottery.model.Prize(
                            "prize-13",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            30
                        ),
                        new lottery.model.Prize(
                            "prize-14",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            20
                        ),
                        new lottery.model.Prize(
                            "prize-15",
                            "action",
                            new AcquireAction[
                                new AcquireAction(
                                    "Gs2Money:DepositByUserId",
                                    "{\"count\": 1}"
                                )
                            ],
                            10
                        ),
                    ],
                    {
                        metadata: "BOX"
                    }
                )
            ]
        );
    }
}

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

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        lottery.Namespace(
            stack=self,
            # omission
        ).master_data(
            lottery_models=[
                lottery.LotteryModel(
                    name='gacha',
                    mode='normal',
                    method='prize_table',
                    options=lottery.LotteryModelOptions(
                        metadata='GACHA',
                        prize_table_name='gacha',
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_ssr',
                    mode='normal',
                    method='prize_table',
                    options=lottery.LotteryModelOptions(
                        metadata='SSR',
                        prize_table_name='gacha-ssr',
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_sr',
                    mode='normal',
                    method='prize_table',
                    options=lottery.LotteryModelOptions(
                        metadata='SR',
                        prize_table_name='gacha-sr',
                    ),
                ),
                lottery.LotteryModel(
                    name='gacha_r',
                    mode='normal',
                    method='prize_table',
                    options=lottery.LotteryModelOptions(
                        metadata='R',
                        prize_table_name='gacha-r',
                    ),
                ),
                lottery.LotteryModel(
                    name='box',
                    mode='box',
                    method='prize_table',
                    options=lottery.LotteryModelOptions(
                        metadata='BOX',
                        prize_table_name='box',
                    ),
                ),
            ],
            prize_tables=[
                lottery.PrizeTable(
                    name='gacha',
                    prizes=[
                            lottery.Prize(
                                prize_id='prize-1',
                                type='prize_table',
                                prize_table_name='gacha-ssr',
                                weight=5
                            ),
                            lottery.Prize(
                                prize_id='prize-2',
                                type='prize_table',
                                prize_table_name='gacha-sr',
                                weight=15
                            ),
                            lottery.Prize(
                                prize_id='prize-3',
                                type='prize_table',
                                prize_table_name='gacha-r',
                                weight=80
                            ),
                        ],
                    options=lottery.PrizeTableOptions(
                        metadata='SSR',
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-ssr',
                    prizes=[
                            lottery.Prize(
                                prize_id='prize-4',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=1
                            ),
                            lottery.Prize(
                                prize_id='prize-5',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=2
                            ),
                            lottery.Prize(
                                prize_id='prize-6',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=3
                            ),
                        ],
                    options=lottery.PrizeTableOptions(
                        metadata='SSR',
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-sr',
                    prizes=[
                            lottery.Prize(
                                prize_id='prize-7',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=10
                            ),
                            lottery.Prize(
                                prize_id='prize-8',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=20
                            ),
                            lottery.Prize(
                                prize_id='prize-9',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=30
                            ),
                        ],
                    options=lottery.PrizeTableOptions(
                        metadata='SR',
                    ),
                ),
                lottery.PrizeTable(
                    name='gacha-r',
                    prizes=[
                            lottery.Prize(
                                prize_id='prize-10',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=100
                            ),
                            lottery.Prize(
                                prize_id='prize-11',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=200
                            ),
                            lottery.Prize(
                                prize_id='prize-12',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=300
                            ),
                        ],
                    options=lottery.PrizeTableOptions(
                        metadata='R',
                    ),
                ),
                lottery.PrizeTable(
                    name='box',
                    prizes=[
                            lottery.Prize(
                                prize_id='prize-13',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=30
                            ),
                            lottery.Prize(
                                prize_id='prize-14',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=20
                            ),
                            lottery.Prize(
                                prize_id='prize-15',
                                type='action',
                                acquire_actions=[
                                    lottery.AcquireAction(
                                        action='Gs2Money:DepositByUserId',
                                        request='{"count": 1}'
                                    )
                                ],
                                weight=10
                            ),
                        ],
                    options=lottery.PrizeTableOptions(
                        metadata='BOX',
                    ),
                ),
            ],
        )

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

Probability

Probability

TypeRequireDefaultLimitationDescription
prizeDrawnPrizeType of prize
ratefloat~ 1.0Emission probability (0.0-1.0)

Prize

Prize

TypeRequireDefaultLimitationDescription
prizeIdstringUUID~ 36 charsPrize ID
typeenum {
    “action”,
    “prize_table”
}
~ 128 charsType of prize
acquireActionsList<AcquireAction>{type} == “action”[]1 ~ 100 itemsList of Acquire Action
drawnLimitint{type} == “action”1 ~ 100000Maximum number of draws
limitFailOverPrizeIdstring{type} == “action” and {drawnLimit} > 0~ 32 charsPrize ID to be discharged instead when the maximum number of drawn has been reached.
prizeTableNamestring{type} == “prize_table”~ 128 charsName of prize table
weightint1 ~ 2147483646Emission Weight

Enumeration type definition to specify as type

Enumerator String DefinitionDescription
actionActions to acquire prizes
prize_tableFurther redrawing by specifying the lottery table

DrawnPrize

Types of prizes

TypeRequireDefaultLimitationDescription
prizeIdstring~ 36 charsPrize ID
acquireActionsList<AcquireAction>~ 100 itemsList of Acquire Actions

BoxItem

Item taken out of the lottery box

TypeRequireDefaultLimitationDescription
prizeIdstring~ 128 charsPrize Id
acquireActionsList<AcquireAction>[]~ 100 itemsList of Acquire Action
remainingint~ 2147483646Remaining quantity
initialint~ 2147483646Initial quantity

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

VerifyActionResult

Verify action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the verify task
verifyRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
verifyResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

ConsumeActionResult

Consume action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the consume action
consumeRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
consumeResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

AcquireActionResult

Acquire action execution result

TypeRequireDefaultLimitationDescription
actionenum {
}
~ 128 charsTypes of actions to be performed in the acquire action
acquireRequeststring~ 1048576 charsJSON of request
statusCodeint~ 999Status code
acquireResultstring~ 1048576 charsResult payload

Enumeration type definition to specify as action

Enumerator String DefinitionDescription

TransactionResult

Transaction execution results

Transaction execution results executed using server-side transaction auto-execution functionality

TypeRequireDefaultLimitationDescription
transactionIdstring36 ~ 36 charsTransaction ID
verifyResultsList<VerifyActionResult>~ 10 itemsList of verify action execution results
consumeResultsList<ConsumeActionResult>~ 10 itemsList of consume action execution results
acquireResultsList<AcquireActionResult>~ 100 itemsList of acquire action execution results

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

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

TransactionSetting

Transaction settings

TypeRequireDefaultLimitationDescription
enableAutoRunboolfalseWhether to automatically execute issued transactions on the server side
enableAtomicCommitbool{enableAutoRun} == truefalseWhether to commit the execution of transactions atomically
transactionUseDistributorbool{enableAtomicCommit} == truefalseWhether to execute transactions asynchronously
acquireActionUseJobQueuebool{enableAtomicCommit} == truefalseWhether to use GS2-JobQueue to execute the acquire action
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