GS2-Showcase Deploy/CDK Reference
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
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | ✓ | Transaction Setting Configuration for controlling how transactions are processed when executing showcase operations. | |||
| buyScript | ScriptSetting | Script to run when attempting to execute a purchase Script Trigger Reference - buy | ||||
| logSetting | LogSetting | Log Output Setting Specifies the GS2-Log namespace for outputting API request/response logs related to showcase browsing and product purchases. |
GetAttr
Resource creation results that can be retrieved using the !GetAttr tag
| Type | Description | |
|---|---|---|
| Item | Namespace | Namespace created |
Implementation Example
Type: GS2::Showcase::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSetting:
EnableAutoRun: true
QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
BuyScript: null
LogSetting:
LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/showcase"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
showcase.NewNamespace(
&SampleStack,
"namespace-0001",
showcase.NamespaceOptions{
TransactionSetting: core.NewTransactionSetting(
core.TransactionSettingOptions{
QueueNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"),
},
),
LogSetting: &core.LogSetting{
LoggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Showcase\Model\Namespace_(
stack: $this,
name: "namespace-0001",
options: new \Gs2Cdk\Showcase\Model\Options\NamespaceOptions(
transactionSetting: new \Gs2Cdk\Core\Model\TransactionSetting(
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"
)
)
);
}
}
print((new SampleStack())->yaml()); // Generate Templateclass SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.showcase.model.Namespace(
this,
"namespace-0001",
new io.gs2.cdk.showcase.model.options.NamespaceOptions()
.withTransactionSetting(new io.gs2.cdk.core.model.TransactionSetting(
new io.gs2.cdk.core.model.options.TransactionSettingOptions()
.withQueueNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-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 Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Showcase.Model.Namespace(
stack: this,
name: "namespace-0001",
options: new Gs2Cdk.Gs2Showcase.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 Templateimport core from "@/gs2cdk/core";
import showcase from "@/gs2cdk/showcase";
class SampleStack extends core.Stack
{
public constructor() {
super();
new showcase.model.Namespace(
this,
"namespace-0001",
{
transactionSetting: new core.TransactionSetting(
{
queueNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001"
}
),
logSetting: new core.LogSetting(
"grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
)
}
);
}
}
console.log(new SampleStack().yaml()); // Generate Templatefrom gs2_cdk import Stack, core, showcase
class SampleStack(Stack):
def __init__(self):
super().__init__()
showcase.Namespace(
stack=self,
name='namespace-0001',
options=showcase.NamespaceOptions(
transaction_setting=core.TransactionSetting(
options=core.TransactionSettingOptions(
queue_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001',
)
),
log_setting=core.LogSetting(
logging_namespace_id='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001',
),
),
)
print(SampleStack().yaml()) # Generate TemplateTransactionSetting
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.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | Whether to automatically execute issued transactions on the server side | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | Whether to commit the execution of transactions atomically * Applicable only if enableAutoRun is true | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | Whether to execute transactions asynchronously * Applicable only if enableAtomicCommit is true | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | Whether to execute the commit processing of the script result asynchronously * Applicable only if transactionUseDistributor is true | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | Whether to use GS2-JobQueue to execute the acquire action * Applicable only if enableAtomicCommit is true | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor Namespace GRN used to execute transactions | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | GS2-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. Synchronous execution blocks processing until the script has finished executing. Instead, you can use the script’s execution results to halt API execution or control the API’s response content.
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, asynchronous execution does not affect the API response flow and 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.
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024 chars | GS2-Script script GRN
executed synchronously when the API is executed Must be specified in GRN format starting with “grn:gs2:”. | |||||||||||
| doneTriggerTargetType | String 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)”.
| |||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-Script script GRN
for asynchronous execution Must be specified in GRN format starting with “grn:gs2:”. * Applicable only if doneTriggerTargetType is “gs2_script” | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-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.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024 chars | GS2-Log namespace GRN
to output logs Must be specified in GRN format starting with “grn:gs2:”. |
CurrentShowcaseMaster
Currently active Showcase Model master data
This master data describes the definitions of Showcase 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.
Note
Please refer to GS2-Showcase Master Data Reference for the JSON file format.Request
Resource creation and update requests
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||||||||
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| settings | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Master Data * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token 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
| Type | Description | |
|---|---|---|
| Item | CurrentShowcaseMaster | Updated master data of the currently active Showcase |
Implementation Example
Type: GS2::Showcase::CurrentShowcaseMaster
Properties:
NamespaceName: namespace-0001
Mode: direct
Settings: {
"version": "2019-04-04",
"showcases": [
{
"name": "gem",
"displayItems": [
{
"type": "salesItem",
"salesItem": {
"name": "gem_3000",
"metadata": "GEM_3000",
"consumeActions": [
{
"action": "Gs2Money:RecordReceipt",
"request": {
"namespaceName": "namespace-0001",
"contentsId": "contentsId-0001",
"receipt": "#{receipt}",
"userId": "#{userId}"
}
}
],
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": {
"namespaceName": "namespace-0001",
"slot": 0,
"price": 100,
"count": 1,
"userId": "#{userId}"
}
}
]
}
},
{
"type": "salesItemGroup",
"salesPeriodEventId": "grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001",
"salesItemGroup": {
"name": "step_gem",
"metadata": "STEP_GEM",
"salesItems": [
{
"name": "step1_gem_1000",
"metadata": "STEP1_GEM_1000",
"consumeActions": [
{
"action": "Gs2Money:RecordReceipt",
"request": {
"namespaceName": "namespace-0001",
"contentsId": "contentsId-0001",
"receipt": "#{receipt}",
"userId": "#{userId}"
}
},
{
"action": "Gs2Limit:CountUpByUserId",
"request": {
"namespaceName": "namespace-0001",
"limitName": "limit-0001",
"counterName": "counter-0001",
"countUpValue": 1,
"maxValue": 100,
"userId": "#{userId}"
}
}
],
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": {
"namespaceName": "namespace-0001",
"slot": 0,
"price": 100,
"count": 1,
"userId": "#{userId}"
}
}
]
},
{
"name": "step2_gem_2000",
"metadata": "STEP1_GEM_2000",
"consumeActions": [
{
"action": "Gs2Money:RecordReceipt",
"request": {
"namespaceName": "namespace-0001",
"contentsId": "contentsId-0001",
"receipt": "#{receipt}",
"userId": "#{userId}"
}
},
{
"action": "Gs2Limit:CountUpByUserId",
"request": {
"namespaceName": "namespace-0001",
"limitName": "limit-0001",
"counterName": "counter-0001",
"countUpValue": 1,
"maxValue": 100,
"userId": "#{userId}"
}
}
],
"acquireActions": [
{
"action": "Gs2Money:DepositByUserId",
"request": {
"namespaceName": "namespace-0001",
"slot": 0,
"price": 100,
"count": 1,
"userId": "#{userId}"
}
}
]
}
]
}
}
],
"metadata": "GEM"
},
{
"name": "gacha",
"displayItems": [
{
"type": "salesItem",
"salesItem": {
"name": "single",
"metadata": "SINGLE",
"consumeActions": [
{
"action": "Gs2Money:WithdrawByUserId",
"request": {
"namespaceName": "namespace-0001",
"slot": 0,
"count": 1,
"paidOnly": false,
"userId": "#{userId}"
}
}
],
"acquireActions": [
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
}
]
}
},
{
"type": "salesItem",
"salesItem": {
"name": "10times",
"metadata": "10TIMES",
"consumeActions": [
{
"action": "Gs2Money:WithdrawByUserId",
"request": {
"namespaceName": "namespace-0001",
"slot": 0,
"count": 1,
"paidOnly": false,
"userId": "#{userId}"
}
}
],
"acquireActions": [
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expiresAt": 0,
"createNewItemSet": false,
"itemSetName": "",
"userId": "#{userId}"
}
}
]
}
}
],
"metadata": "GACHA"
}
],
"randomShowcases": []
}
UploadToken: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/showcase"
"github.com/gs2io/gs2-golang-cdk/money"
"github.com/gs2io/gs2-golang-cdk/limit"
"github.com/gs2io/gs2-golang-cdk/inventory"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
showcase.NewNamespace(
&SampleStack,
"namespace-0001",
showcase.NamespaceOptions{},
).MasterData(
[]showcase.Showcase{
showcase.NewShowcase(
"gem",
[]showcase.DisplayItem{
showcase.NewDisplayItem(
"",
showcase.DisplayItemTypeSalesItem,
showcase.DisplayItemOptions{
SalesItem: &showcase.SalesItem{
Name: "gem_3000",
AcquireActions: []core.AcquireAction{
money.DepositByUserId(
"namespace-0001",
0,
100,
1,
),
},
Metadata: pointy.String("GEM_3000"),
ConsumeActions: []core.ConsumeAction{
money.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
),
},
},
},
),
showcase.NewDisplayItem(
"",
showcase.DisplayItemTypeSalesItemGroup,
showcase.DisplayItemOptions{
SalesItemGroup: &showcase.SalesItemGroup{
Name: "step_gem",
SalesItems: []showcase.SalesItem{
showcase.NewSalesItem(
"step1_gem_1000",
[]core.AcquireAction{
money.DepositByUserId(
"namespace-0001",
0,
100,
1,
),
},
showcase.SalesItemOptions{
Metadata: pointy.String("STEP1_GEM_1000"),
ConsumeActions: []core.ConsumeAction{
money.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
),
limit.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
pointy.Int32(1),
pointy.Int32(100),
),
},
},
),
showcase.NewSalesItem(
"step2_gem_2000",
[]core.AcquireAction{
money.DepositByUserId(
"namespace-0001",
0,
100,
1,
),
},
showcase.SalesItemOptions{
Metadata: pointy.String("STEP1_GEM_2000"),
ConsumeActions: []core.ConsumeAction{
money.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
),
limit.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
pointy.Int32(1),
pointy.Int32(100),
),
},
},
),
},
Metadata: pointy.String("STEP_GEM"),
},
SalesPeriodEventId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001"),
},
),
},
showcase.ShowcaseOptions{
Metadata: pointy.String("GEM"),
},
),
showcase.NewShowcase(
"gacha",
[]showcase.DisplayItem{
showcase.NewDisplayItem(
"",
showcase.DisplayItemTypeSalesItem,
showcase.DisplayItemOptions{
SalesItem: &showcase.SalesItem{
Name: "single",
AcquireActions: []core.AcquireAction{
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
},
Metadata: pointy.String("SINGLE"),
ConsumeActions: []core.ConsumeAction{
money.WithdrawByUserId(
"namespace-0001",
0,
1,
pointy.Bool(false),
),
},
},
},
),
showcase.NewDisplayItem(
"",
showcase.DisplayItemTypeSalesItem,
showcase.DisplayItemOptions{
SalesItem: &showcase.SalesItem{
Name: "10times",
AcquireActions: []core.AcquireAction{
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
inventory.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
pointy.Int64(0),
pointy.Bool(false),
pointy.String(""),
),
},
Metadata: pointy.String("10TIMES"),
ConsumeActions: []core.ConsumeAction{
money.WithdrawByUserId(
"namespace-0001",
0,
1,
pointy.Bool(false),
),
},
},
},
),
},
showcase.ShowcaseOptions{
Metadata: pointy.String("GACHA"),
},
),
},
[]showcase.RandomShowcase{
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Showcase\Model\Namespace_(
stack: $this,
name: "namespace-0001"
))->masterData(
[
new \Gs2Cdk\Showcase\Model\Showcase(
name:"gem",
displayItems:[
new \Gs2Cdk\Showcase\Model\DisplayItem(
displayItemId: "",
type: \Gs2Cdk\Showcase\Model\Enums\DisplayItemType::SALES_ITEM,
options: new \Gs2Cdk\Showcase\Model\Options\DisplayItemOptions(
salesItem: new \Gs2Cdk\Showcase\Model\SalesItem(
name: "gem_3000",
acquireActions: [
new \Gs2Cdk\Money\StampSheet\DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemOptions(
metadata: "GEM_3000",
consumeActions: [
new \Gs2Cdk\Money\StampSheet\RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
),
],
),
),
),
),
new \Gs2Cdk\Showcase\Model\DisplayItem(
displayItemId: "",
type: \Gs2Cdk\Showcase\Model\Enums\DisplayItemType::SALES_ITEM_GROUP,
options: new \Gs2Cdk\Showcase\Model\Options\DisplayItemOptions(
salesItemGroup: new \Gs2Cdk\Showcase\Model\SalesItemGroup(
name: "step_gem",
salesItems: [
new \Gs2Cdk\Showcase\Model\SalesItem(
name: "step1_gem_1000",
acquireActions: [
new \Gs2Cdk\Money\StampSheet\DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemOptions(
metadata: "STEP1_GEM_1000",
consumeActions: [
new \Gs2Cdk\Money\StampSheet\RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
),
new \Gs2Cdk\Limit\StampSheet\CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
maxValue: 100,
userId: "#{userId}"
),
],
),
),
new \Gs2Cdk\Showcase\Model\SalesItem(
name: "step2_gem_2000",
acquireActions: [
new \Gs2Cdk\Money\StampSheet\DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemOptions(
metadata: "STEP1_GEM_2000",
consumeActions: [
new \Gs2Cdk\Money\StampSheet\RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
),
new \Gs2Cdk\Limit\StampSheet\CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
maxValue: 100,
userId: "#{userId}"
),
],
),
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemGroupOptions(
metadata: "STEP_GEM",
),
),
salesPeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001",
),
),
],
options: new \Gs2Cdk\Showcase\Model\Options\ShowcaseOptions(
metadata:"GEM"
)
),
new \Gs2Cdk\Showcase\Model\Showcase(
name:"gacha",
displayItems:[
new \Gs2Cdk\Showcase\Model\DisplayItem(
displayItemId: "",
type: \Gs2Cdk\Showcase\Model\Enums\DisplayItemType::SALES_ITEM,
options: new \Gs2Cdk\Showcase\Model\Options\DisplayItemOptions(
salesItem: new \Gs2Cdk\Showcase\Model\SalesItem(
name: "single",
acquireActions: [
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemOptions(
metadata: "SINGLE",
consumeActions: [
new \Gs2Cdk\Money\StampSheet\WithdrawByUserId(
namespaceName: "namespace-0001",
slot: 0,
count: 1,
paidOnly: false,
userId: "#{userId}"
),
],
),
),
),
),
new \Gs2Cdk\Showcase\Model\DisplayItem(
displayItemId: "",
type: \Gs2Cdk\Showcase\Model\Enums\DisplayItemType::SALES_ITEM,
options: new \Gs2Cdk\Showcase\Model\Options\DisplayItemOptions(
salesItem: new \Gs2Cdk\Showcase\Model\SalesItem(
name: "10times",
acquireActions: [
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
],
options: new \Gs2Cdk\Showcase\Model\Options\SalesItemOptions(
metadata: "10TIMES",
consumeActions: [
new \Gs2Cdk\Money\StampSheet\WithdrawByUserId(
namespaceName: "namespace-0001",
slot: 0,
count: 1,
paidOnly: false,
userId: "#{userId}"
),
],
),
),
),
),
],
options: new \Gs2Cdk\Showcase\Model\Options\ShowcaseOptions(
metadata:"GACHA"
)
)
],
[
]
);
}
}
print((new SampleStack())->yaml()); // Generate Templateclass SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.showcase.model.Namespace(
this,
"namespace-0001"
).masterData(
Arrays.asList(
new io.gs2.cdk.showcase.model.Showcase(
"gem",
Arrays.asList(
new io.gs2.cdk.showcase.model.DisplayItem(
"",
io.gs2.cdk.showcase.model.enums.DisplayItemType.SALES_ITEM,
new io.gs2.cdk.showcase.model.options.DisplayItemOptions()
.withSalesItem(new io.gs2.cdk.showcase.model.SalesItem(
"gem_3000",
Arrays.asList(
new io.gs2.cdk.money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100f,
1,
"#{userId}"
)
),
new io.gs2.cdk.showcase.model.options.SalesItemOptions()
.withMetadata("GEM_3000")
.withConsumeActions(Arrays.asList(
new io.gs2.cdk.money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
"#{userId}"
)
))
))
),
new io.gs2.cdk.showcase.model.DisplayItem(
"",
io.gs2.cdk.showcase.model.enums.DisplayItemType.SALES_ITEM_GROUP,
new io.gs2.cdk.showcase.model.options.DisplayItemOptions()
.withSalesItemGroup(new io.gs2.cdk.showcase.model.SalesItemGroup(
"step_gem",
Arrays.asList(
new io.gs2.cdk.showcase.model.SalesItem(
"step1_gem_1000",
Arrays.asList(
new io.gs2.cdk.money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100f,
1,
"#{userId}"
)
),
new io.gs2.cdk.showcase.model.options.SalesItemOptions()
.withMetadata("STEP1_GEM_1000")
.withConsumeActions(Arrays.asList(
new io.gs2.cdk.money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
"#{userId}"
),
new io.gs2.cdk.limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
100,
"#{userId}"
)
))
),
new io.gs2.cdk.showcase.model.SalesItem(
"step2_gem_2000",
Arrays.asList(
new io.gs2.cdk.money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100f,
1,
"#{userId}"
)
),
new io.gs2.cdk.showcase.model.options.SalesItemOptions()
.withMetadata("STEP1_GEM_2000")
.withConsumeActions(Arrays.asList(
new io.gs2.cdk.money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
"#{userId}"
),
new io.gs2.cdk.limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
100,
"#{userId}"
)
))
)
),
new io.gs2.cdk.showcase.model.options.SalesItemGroupOptions()
.withMetadata("STEP_GEM")
))
.withSalesPeriodEventId("grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001")
)
),
new io.gs2.cdk.showcase.model.options.ShowcaseOptions()
.withMetadata("GEM")
),
new io.gs2.cdk.showcase.model.Showcase(
"gacha",
Arrays.asList(
new io.gs2.cdk.showcase.model.DisplayItem(
"",
io.gs2.cdk.showcase.model.enums.DisplayItemType.SALES_ITEM,
new io.gs2.cdk.showcase.model.options.DisplayItemOptions()
.withSalesItem(new io.gs2.cdk.showcase.model.SalesItem(
"single",
Arrays.asList(
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
)
),
new io.gs2.cdk.showcase.model.options.SalesItemOptions()
.withMetadata("SINGLE")
.withConsumeActions(Arrays.asList(
new io.gs2.cdk.money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
"#{userId}"
)
))
))
),
new io.gs2.cdk.showcase.model.DisplayItem(
"",
io.gs2.cdk.showcase.model.enums.DisplayItemType.SALES_ITEM,
new io.gs2.cdk.showcase.model.options.DisplayItemOptions()
.withSalesItem(new io.gs2.cdk.showcase.model.SalesItem(
"10times",
Arrays.asList(
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
),
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
),
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
),
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
),
new io.gs2.cdk.inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1L,
0L,
false,
"",
"#{userId}"
)
),
new io.gs2.cdk.showcase.model.options.SalesItemOptions()
.withMetadata("10TIMES")
.withConsumeActions(Arrays.asList(
new io.gs2.cdk.money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
"#{userId}"
)
))
))
)
),
new io.gs2.cdk.showcase.model.options.ShowcaseOptions()
.withMetadata("GACHA")
)
),
Arrays.asList(
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Showcase.Model.Namespace(
stack: this,
name: "namespace-0001"
).MasterData(
new Gs2Cdk.Gs2Showcase.Model.Showcase[] {
new Gs2Cdk.Gs2Showcase.Model.Showcase(
name: "gem",
displayItems: new Gs2Cdk.Gs2Showcase.Model.DisplayItem[]
{
new Gs2Cdk.Gs2Showcase.Model.DisplayItem(
displayItemId: "",
type: Gs2Cdk.Gs2Showcase.Model.Enums.DisplayItemType.SalesItem,
options: new Gs2Cdk.Gs2Showcase.Model.Options.DisplayItemOptions
{
salesItem = new Gs2Cdk.Gs2Showcase.Model.SalesItem(
name: "gem_3000",
acquireActions: new Gs2Cdk.Core.Model.AcquireAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemOptions
{
metadata = "GEM_3000",
consumeActions = new Gs2Cdk.Core.Model.ConsumeAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
)
}
}
)
}
),
new Gs2Cdk.Gs2Showcase.Model.DisplayItem(
displayItemId: "",
type: Gs2Cdk.Gs2Showcase.Model.Enums.DisplayItemType.SalesItemGroup,
options: new Gs2Cdk.Gs2Showcase.Model.Options.DisplayItemOptions
{
salesItemGroup = new Gs2Cdk.Gs2Showcase.Model.SalesItemGroup(
name: "step_gem",
salesItems: new Gs2Cdk.Gs2Showcase.Model.SalesItem[]
{
new Gs2Cdk.Gs2Showcase.Model.SalesItem(
name: "step1_gem_1000",
acquireActions: new Gs2Cdk.Core.Model.AcquireAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemOptions
{
metadata = "STEP1_GEM_1000",
consumeActions = new Gs2Cdk.Core.Model.ConsumeAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Limit.StampSheet.CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
maxValue: 100,
userId: "#{userId}"
)
}
}
),
new Gs2Cdk.Gs2Showcase.Model.SalesItem(
name: "step2_gem_2000",
acquireActions: new Gs2Cdk.Core.Model.AcquireAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.DepositByUserId(
namespaceName: "namespace-0001",
slot: 0,
price: 100,
count: 1,
userId: "#{userId}"
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemOptions
{
metadata = "STEP1_GEM_2000",
consumeActions = new Gs2Cdk.Core.Model.ConsumeAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.RecordReceipt(
namespaceName: "namespace-0001",
contentsId: "contentsId-0001",
receipt: "#{receipt}",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Limit.StampSheet.CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
maxValue: 100,
userId: "#{userId}"
)
}
}
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemGroupOptions
{
metadata = "STEP_GEM"
}
),
salesPeriodEventId = "grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001"
}
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.ShowcaseOptions
{
metadata = "GEM"
}
),
new Gs2Cdk.Gs2Showcase.Model.Showcase(
name: "gacha",
displayItems: new Gs2Cdk.Gs2Showcase.Model.DisplayItem[]
{
new Gs2Cdk.Gs2Showcase.Model.DisplayItem(
displayItemId: "",
type: Gs2Cdk.Gs2Showcase.Model.Enums.DisplayItemType.SalesItem,
options: new Gs2Cdk.Gs2Showcase.Model.Options.DisplayItemOptions
{
salesItem = new Gs2Cdk.Gs2Showcase.Model.SalesItem(
name: "single",
acquireActions: new Gs2Cdk.Core.Model.AcquireAction[]
{
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemOptions
{
metadata = "SINGLE",
consumeActions = new Gs2Cdk.Core.Model.ConsumeAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.WithdrawByUserId(
namespaceName: "namespace-0001",
slot: 0,
count: 1,
paidOnly: false,
userId: "#{userId}"
)
}
}
)
}
),
new Gs2Cdk.Gs2Showcase.Model.DisplayItem(
displayItemId: "",
type: Gs2Cdk.Gs2Showcase.Model.Enums.DisplayItemType.SalesItem,
options: new Gs2Cdk.Gs2Showcase.Model.Options.DisplayItemOptions
{
salesItem = new Gs2Cdk.Gs2Showcase.Model.SalesItem(
name: "10times",
acquireActions: new Gs2Cdk.Core.Model.AcquireAction[]
{
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
expiresAt: 0,
createNewItemSet: false,
itemSetName: "",
userId: "#{userId}"
),
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.SalesItemOptions
{
metadata = "10TIMES",
consumeActions = new Gs2Cdk.Core.Model.ConsumeAction[]
{
new Gs2Cdk.Gs2Money.StampSheet.WithdrawByUserId(
namespaceName: "namespace-0001",
slot: 0,
count: 1,
paidOnly: false,
userId: "#{userId}"
)
}
}
)
}
)
},
options: new Gs2Cdk.Gs2Showcase.Model.Options.ShowcaseOptions
{
metadata = "GACHA"
}
)
},
new Gs2Cdk.Gs2Showcase.Model.RandomShowcase[] {
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import showcase from "@/gs2cdk/showcase";
import money from "@/gs2cdk/money";
import limit from "@/gs2cdk/limit";
import inventory from "@/gs2cdk/inventory";
class SampleStack extends core.Stack
{
public constructor() {
super();
new showcase.model.Namespace(
this,
"namespace-0001",
).masterData(
[
new showcase.model.Showcase(
"gem",
[
new showcase.model.DisplayItem(
"",
showcase.model.DisplayItemType.SALES_ITEM,
{
salesItem: new showcase.model.SalesItem(
"gem_3000",
[
new money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100,
1,
null,
"#{userId}"
),
],
{
metadata: "GEM_3000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
null,
"#{userId}"
),
]
}
)
}
),
new showcase.model.DisplayItem(
"",
showcase.model.DisplayItemType.SALES_ITEM_GROUP,
{
salesItemGroup: new showcase.model.SalesItemGroup(
"step_gem",
[
new showcase.model.SalesItem(
"step1_gem_1000",
[
new money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100,
1,
null,
"#{userId}"
),
],
{
metadata: "STEP1_GEM_1000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
null,
"#{userId}"
),
new limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
100,
null,
"#{userId}"
),
]
}
),
new showcase.model.SalesItem(
"step2_gem_2000",
[
new money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100,
1,
null,
"#{userId}"
),
],
{
metadata: "STEP1_GEM_2000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"#{receipt}",
null,
"#{userId}"
),
new limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
100,
null,
"#{userId}"
),
]
}
),
],
{
metadata: "STEP_GEM"
}
),
salesPeriodEventId: "grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001"
}
),
],
{
metadata: "GEM"
}
),
new showcase.model.Showcase(
"gacha",
[
new showcase.model.DisplayItem(
"",
showcase.model.DisplayItemType.SALES_ITEM,
{
salesItem: new showcase.model.SalesItem(
"single",
[
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
],
{
metadata: "SINGLE",
consumeActions: [
new money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
null,
"#{userId}"
),
]
}
)
}
),
new showcase.model.DisplayItem(
"",
showcase.model.DisplayItemType.SALES_ITEM,
{
salesItem: new showcase.model.SalesItem(
"10times",
[
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
0,
false,
"",
null,
"#{userId}"
),
],
{
metadata: "10TIMES",
consumeActions: [
new money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
null,
"#{userId}"
),
]
}
)
}
),
],
{
metadata: "GACHA"
}
)
],
[
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Templatefrom gs2_cdk import Stack, core, showcase, money
class SampleStack(Stack):
def __init__(self):
super().__init__()
showcase.Namespace(
stack=self,
name="namespace-0001",
).master_data(
showcases=[
showcase.Showcase(
name='gem',
display_items=[
showcase.DisplayItem(
display_item_id= "",
type=showcase.DisplayItemType.SALES_ITEM,
options=showcase.DisplayItemOptions(
sales_item=showcase.SalesItem(
name='gem_3000',
acquire_actions=[
money.DepositByUserId(
namespace_name='namespace-0001',
slot=0,
price=100,
count=1,
user_id='#{userId}'
),
],
options=showcase.SalesItemOptions(
metadata='GEM_3000',
consume_actions=[
money.RecordReceipt(
namespace_name='namespace-0001',
contents_id='contentsId-0001',
receipt='#{receipt}',
user_id='#{userId}'
),
],
),
),
),
),
showcase.DisplayItem(
display_item_id= "",
type=showcase.DisplayItemType.SALES_ITEM_GROUP,
options=showcase.DisplayItemOptions(
sales_item_group=showcase.SalesItemGroup(
name='step_gem',
sales_items=[
showcase.SalesItem(
name='step1_gem_1000',
acquire_actions=[
money.DepositByUserId(
namespace_name='namespace-0001',
slot=0,
price=100,
count=1,
user_id='#{userId}'
),
],
options=showcase.SalesItemOptions(
metadata='STEP1_GEM_1000',
consume_actions=[
money.RecordReceipt(
namespace_name='namespace-0001',
contents_id='contentsId-0001',
receipt='#{receipt}',
user_id='#{userId}'
),
limit.CountUpByUserId(
namespace_name='namespace-0001',
limit_name='limit-0001',
counter_name='counter-0001',
count_up_value=1,
max_value=100,
user_id='#{userId}'
),
],
),
),
showcase.SalesItem(
name='step2_gem_2000',
acquire_actions=[
money.DepositByUserId(
namespace_name='namespace-0001',
slot=0,
price=100,
count=1,
user_id='#{userId}'
),
],
options=showcase.SalesItemOptions(
metadata='STEP1_GEM_2000',
consume_actions=[
money.RecordReceipt(
namespace_name='namespace-0001',
contents_id='contentsId-0001',
receipt='#{receipt}',
user_id='#{userId}'
),
limit.CountUpByUserId(
namespace_name='namespace-0001',
limit_name='limit-0001',
counter_name='counter-0001',
count_up_value=1,
max_value=100,
user_id='#{userId}'
),
],
),
),
],
options=showcase.SalesItemGroupOptions(
metadata='STEP_GEM',
),
),
sales_period_event_id='grn:gs2:ap-northeast-1:YourOwnerId:schedule:schedule-0001:event:event-0001',
),
),
],
options=showcase.ShowcaseOptions(
metadata = 'GEM'
),
),
showcase.Showcase(
name='gacha',
display_items=[
showcase.DisplayItem(
display_item_id= "",
type=showcase.DisplayItemType.SALES_ITEM,
options=showcase.DisplayItemOptions(
sales_item=showcase.SalesItem(
name='single',
acquire_actions=[
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
],
options=showcase.SalesItemOptions(
metadata='SINGLE',
consume_actions=[
money.WithdrawByUserId(
namespace_name='namespace-0001',
slot=0,
count=1,
paid_only=False,
user_id='#{userId}'
),
],
),
),
),
),
showcase.DisplayItem(
display_item_id= "",
type=showcase.DisplayItemType.SALES_ITEM,
options=showcase.DisplayItemOptions(
sales_item=showcase.SalesItem(
name='10times',
acquire_actions=[
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
expires_at=0,
create_new_item_set=False,
item_set_name="",
user_id='#{userId}'
),
],
options=showcase.SalesItemOptions(
metadata='10TIMES',
consume_actions=[
money.WithdrawByUserId(
namespace_name='namespace-0001',
slot=0,
count=1,
paid_only=False,
user_id='#{userId}'
),
],
),
),
),
),
],
options=showcase.ShowcaseOptions(
metadata = 'GACHA'
),
),
],
random_showcases=[
],
)
print(SampleStack().yaml()) # Generate TemplateShowcase
Showcase
Showcase can be used to define products for display.
Additionally, the sales period for products on Showcase can be set.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| showcaseId | string | * | ~ 1024 chars | Showcase GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Showcase name Showcase-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| metadata | string | ~ 2048 chars | Metadata 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. | |||
| salesPeriodEventId | string | ~ 1024 chars | GS2-Schedule event GRN
with sales periods for Showcase Controls the overall sales period of this showcase. When specified, the entire showcase is only available during the associated GS2-Schedule event period. If the event is not active, the showcase returns empty. | |||
| displayItems | List<DisplayItem> | [] | 1 ~ 1000 items | List of Display Items The list of items displayed on this showcase. Each display item can be either a single sales item or a sales item group. Items with an expired or inactive sales period event are automatically filtered out when the showcase is retrieved. |
DisplayItem
Displayed Item
An item displayed on a showcase. Can reference either a single sales item or a sales item group. Each display item can have its own sales period controlled by a GS2-Schedule event, independently of the showcase-level sales period.
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| displayItemId | string | ✓ | UUID | ~ 128 chars | Displayed Item ID Maintains a unique name for displayed products. If omitted, the system automatically assigns a name in UUID (Universally Unique Identifier) format. | |||||||
| type | String Enum enum { “salesItem”, “salesItemGroup” } | ✓ | Type The type of item displayed. A “salesItem” is a single product with fixed price and rewards. A “salesItemGroup” contains multiple sales items evaluated in order, used for step-up pricing or limited purchase discounts.
| |||||||||
| salesItem | SalesItem | {type} == “salesItem” | ✓* | Sales Item * Required if type is “salesItem” | ||||||||
| salesItemGroup | SalesItemGroup | {type} == “salesItemGroup” | ✓* | Sales Item Group * Required if type is “salesItemGroup” | ||||||||
| salesPeriodEventId | string | ~ 1024 chars | GS2-Schedule event GRN
with sales periods for this display item Controls the sales period of this individual display item. When specified, the item is only shown on the showcase during the associated GS2-Schedule event period. This is independent of the showcase-level sales period. |
SalesItem
Product
Set the price required to purchase the product and the reward earned for the purchase of the product.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Sales Item name Sales Item-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| metadata | string | ~ 2048 chars | Metadata 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. | |||
| verifyActions | List<VerifyAction> | [] | 0 ~ 10 items | List of Verify Actions Precondition checks executed before the purchase. All verify actions must pass before consume and acquire actions are processed. Can be used to check purchase eligibility conditions. | ||
| consumeActions | List<ConsumeAction> | [] | 0 ~ 10 items | List of Consume Actions Actions that consume resources as the purchase price. Can include GS2-Limit CountUp actions to control purchase limits for sales item groups. | ||
| acquireActions | List<AcquireAction> | [] | 1 ~ 100 items | List of Acquire Actions Actions that grant resources as purchase rewards. Executed after all consume actions complete successfully. |
SalesItemGroup
Product Group
A product group is an entity for display on a showcase. Multiple products can belong to a Product Group. Products are evaluated in order, and the first product determined to be available for purchase is displayed on the Showcase. This can be used for products that are discounted only for the first time, or for a system in which the contents of products change depending on the number of times they are purchased, such as a step-up gacha.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Sales Item Group name Sales Item Group-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| metadata | string | ~ 2048 chars | Metadata 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. | |||
| salesItems | List<SalesItem> | [] | 2 ~ 10 items | Products to be included in the product group Ordered list of sales items in this group. The system evaluates each item from first to last using GS2-Limit counters to determine purchase availability. The first purchasable item is displayed; if none qualify, the last item in the list is used as a fallback. |
RandomShowcase
Random Showcase
Random Showcase is a display model featuring randomly selected products that rotate at specified intervals.
The products to be selected are randomly selected from the registered products in the product pool according to the specified quantity and the weight set for each product. By associating an event of GS2-Schedule with the random display shelf, you can set the sales period.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| randomShowcaseId | string | * | ~ 1024 chars | Random Showcase Model GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Random Showcase name Random Showcase-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| metadata | string | ~ 2048 chars | Metadata 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. | |||
| maximumNumberOfChoice | int | ✓ | 1 ~ 100 | Maximum number of products to be selected The number of products randomly drawn from the display item pool each rotation period. Items are drawn without replacement using weighted random selection, so the same item will not appear twice in one rotation. | ||
| displayItems | List<RandomDisplayItemModel> | [] | 1 ~ 100 items | List of Display Items subject to selection The pool of candidate items from which products are randomly drawn. Each item has a weight that determines its relative selection probability and a stock count that limits how many times it can appear across rotations. | ||
| baseTimestamp | long | ✓ | Base time for re-drawing the products on display The reference timestamp used to calculate rotation boundaries. Product re-draws occur at regular intervals (resetIntervalHours) starting from this base time. Must be set to a past timestamp. | |||
| resetIntervalHours | int | ✓ | 1 ~ 168 | Interval (hours) between re-drawing the products on display The number of hours between each product rotation. When the interval elapses (relative to baseTimestamp), the displayed products are re-drawn with a new random seed. Can be set from 1 to 168 hours (1 week). | ||
| salesPeriodEventId | string | ~ 1024 chars | GS2-Schedule event GRN
with sales periods for display shelves Controls the overall sales period of this random showcase. When specified, the showcase is only available during the associated GS2-Schedule event period. |
RandomDisplayItemModel
Items that can be displayed in a Random Showcase
You can set the probability of selecting items for the display shelf.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | UUID | ~ 128 chars | Random Displayed Item ID Maintains a unique name for randomly displayed products. If omitted, the system automatically assigns a name in UUID (Universally Unique Identifier) format. | |
| metadata | string | ~ 2048 chars | Metadata 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. | |||
| verifyActions | List<VerifyAction> | [] | 0 ~ 10 items | List of Verify Actions Precondition checks executed before purchasing this random display item. All verify actions must pass before consume and acquire actions are processed. | ||
| consumeActions | List<ConsumeAction> | [] | 0 ~ 10 items | List of Consume Actions Actions that consume resources as the purchase price for this random display item. Executed as consume actions in the transaction. | ||
| acquireActions | List<AcquireAction> | [] | 1 ~ 100 items | List of Acquire Actions Actions that grant resources as purchase rewards for this random display item. Executed as acquire actions in the transaction. | ||
| stock | int | ✓ | 1 ~ 2147483646 | Stock The maximum number of times this item can be drawn across all rotations. Once stock reaches zero, the item is excluded from future draws. Stock is consumed when the item is selected during a rotation draw. | ||
| weight | int | ✓ | 1 ~ 2147483646 | Draw Weight The relative probability weight for this item in the random selection. Higher weights increase the chance of being drawn. The actual selection probability is calculated as this item’s weight divided by the sum of all eligible items’ weights. |
ConsumeAction
Consume Action
VerifyAction
Verify Action
AcquireAction
Acquire Action