GS2-Deploy/CDK Reference of GS2-Showcase
Entities
Namespace
Namespace
A namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. 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.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name | ||
| description | string | ~ 1024 chars | Description | |||
| transactionSetting | TransactionSetting | ✓ | Transaction settings | |||
| buyScript | ScriptSetting | Script to run when attempting to execute a purchase | ||||
| logSetting | LogSetting | Log output settings |
GetAttr
Generation results of resources that can be obtained with 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/gs2io/gs2-golang-cdk/money"
"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 Template
class 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 Template
class 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 Template
from 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 TemplateCurrentShowcaseMaster
Currently Available Master Data
GS2 uses JSON format files for managing master data. By uploading these files, the settings are applied to the server.
To create JSON files, GS2 provides a master data editor within the management console. Additionally, you can create tools better suited for operating your game and export JSON files in the appropriate format.
Note
Please refer to Master Data Reference of GS2-Showcase for the JSON file format.| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name | ||||||||
| mode | String Enum enum { “direct”, “preUpload” } | ✓ | “direct” | ~ 128 chars | Update mode
| |||||||
| settings | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Master Data * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token used to reflect results after upload * Required if mode is “preUpload” |
GetAttr
Generation results of resources that can be obtained with the !GetAttr tag
| Type | Description | |
|---|---|---|
| Item | CurrentShowcaseMaster | Updated and currently available showcase master |
Implementation Example
Type: GS2::Showcase::CurrentShowcaseMaster
Properties:
NamespaceName: namespace-0001
Mode: null
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": "",
"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": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Limit:CountUpByUserId",
"request": {
"namespaceName": "namespace-0001",
"limitName": "limit-0001",
"counterName": "counter-0001",
"countUpValue": 1,
"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": "",
"userId": "#{userId}"
}
},
{
"action": "Gs2Limit:CountUpByUserId",
"request": {
"namespaceName": "namespace-0001",
"limitName": "limit-0001",
"counterName": "counter-0001",
"countUpValue": 1,
"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,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
}
]
}
},
{
"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,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
},
{
"action": "Gs2Inventory:AcquireItemSetByUserId",
"request": {
"namespaceName": "namespace-0001",
"inventoryName": "inventory-0001",
"itemName": "item-0001",
"acquireCount": 1,
"expireAt": null,
"createNewItemSet": false,
"itemSetName": null
}
}
]
}
}
],
"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/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{
Metadata: pointy.String("GEM_3000"),
ConsumeActions: []core.ConsumeAction{
money.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"",
),
},
},
},
),
showcase.NewDisplayItem(
"",
showcase.DisplayItemTypeSalesItemGroup,
showcase.DisplayItemOptions{
SalesItemGroup: &showcase.SalesItemGroup{
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{
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{
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 Template
class 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: "",
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: "",
userId: "#{userId}"
),
new \Gs2Cdk\Limit\StampSheet\CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
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: "",
userId: "#{userId}"
),
new \Gs2Cdk\Limit\StampSheet\CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
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,
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,
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new \Gs2Cdk\Inventory\StampSheet\AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
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 Template
class 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",
"",
"#{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",
"",
"#{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",
"",
"#{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: "",
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: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Limit.StampSheet.CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
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: "",
userId: "#{userId}"
),
new Gs2Cdk.Gs2Limit.StampSheet.CountUpByUserId(
namespaceName: "namespace-0001",
limitName: "limit-0001",
counterName: "counter-0001",
countUpValue: 1,
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,
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,
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
userId: "#{userId}"
),
new Gs2Cdk.Gs2Inventory.StampSheet.AcquireItemSetByUserId(
namespaceName: "namespace-0001",
inventoryName: "inventory-0001",
itemName: "item-0001",
acquireCount: 1,
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";
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,
"#{userId}"
),
],
{
metadata: "GEM_3000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"",
"#{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,
"#{userId}"
),
],
{
metadata: "STEP1_GEM_1000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"",
"#{userId}"
),
new limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
null,
null,
"#{userId}"
),
]
}
),
new showcase.model.SalesItem(
"step2_gem_2000",
[
new money.stampSheet.DepositByUserId(
"namespace-0001",
0,
100,
1,
"#{userId}"
),
],
{
metadata: "STEP1_GEM_2000",
consumeActions: [
new money.stampSheet.RecordReceipt(
"namespace-0001",
"contentsId-0001",
"",
"#{userId}"
),
new limit.stampSheet.CountUpByUserId(
"namespace-0001",
"limit-0001",
"counter-0001",
1,
null,
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,
null,
null,
"#{userId}"
),
],
{
metadata: "SINGLE",
consumeActions: [
new money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
"#{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,
null,
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
null,
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
null,
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
null,
null,
"#{userId}"
),
new inventory.stampSheet.AcquireItemSetByUserId(
"namespace-0001",
"inventory-0001",
"item-0001",
1,
null,
null,
"#{userId}"
),
],
{
metadata: "10TIMES",
consumeActions: [
new money.stampSheet.WithdrawByUserId(
"namespace-0001",
0,
1,
false,
"#{userId}"
),
]
}
)
}
),
],
{
metadata: "GACHA"
}
)
],
[
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, showcase
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="",
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="",
user_id='#{userId}'
),
limit.CountUpByUserId(
namespace_name='namespace-0001',
limit_name='limit-0001',
counter_name='counter-0001',
count_up_value=1,
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="",
user_id='#{userId}'
),
limit.CountUpByUserId(
namespace_name='namespace-0001',
limit_name='limit-0001',
counter_name='counter-0001',
count_up_value=1,
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,
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,
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
user_id='#{userId}'
),
inventory.AcquireItemSetByUserId(
namespace_name='namespace-0001',
inventory_name='inventory-0001',
item_name='item-0001',
acquire_count=1,
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 TemplatePurchaseCount
Number of product purchases
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Number of product purchases name | ||
| count | int | ✓ | 1 ~ 2147483646 | Purchase count |
RandomDisplayItem
Random displayable items on the Random Showcase
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| showcaseName | string | ✓ | ~ 128 chars | Random Displayed Item Name | ||
| 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 | |||
| verifyActions | List<VerifyAction> | [] | 0 ~ 10 items | List of Verify Action | ||
| consumeActions | List<ConsumeAction> | [] | 0 ~ 10 items | List of Consume Action | ||
| acquireActions | List<AcquireAction> | ✓ | [] | 1 ~ 100 items | List of Acquire Action | |
| currentPurchaseCount | int | ✓ | 1 ~ 2147483646 | Current purchase count | ||
| maximumPurchaseCount | int | ✓ | 1 ~ 2147483646 | Maximum purchase count |
ConsumeAction
Consume Action
VerifyAction
Verify Action
AcquireAction
Acquire Action
Config
Configuration
Set values to be applied to transaction variables
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| key | string | ✓ | ~ 64 chars | Name | ||
| value | string | ~ 51200 chars | Value |
VerifyActionResult
Verify action execution result
ConsumeActionResult
Consume action execution result
AcquireActionResult
Acquire action execution result
TransactionResult
Transaction execution results
Transaction execution results executed using server-side transaction auto-execution functionality
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| transactionId | string | ✓ | 36 ~ 36 chars | Transaction ID | ||
| verifyResults | List<VerifyActionResult> | 0 ~ 10 items | List of verify action execution results | |||
| consumeResults | List<ConsumeActionResult> | [] | 0 ~ 10 items | List of consume action execution results | ||
| acquireResults | List<AcquireActionResult> | [] | 0 ~ 100 items | List of acquire action execution results | ||
| hasError | bool | ✓ | false | Whether an error occurred during transaction execution |
LogSetting
Log Export Settings
Manages log data export settings. 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, and debugging.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024 chars | GS2-Log namespace GRN to output logs |
TransactionSetting
Transaction settings
Transaction settings control how transactions are executed, their consistency, asynchronous processing, and conflict avoidance mechanisms. Combining features like AutoRun, AtomicCommit, Distributor, batch application of script results, and asynchronous acquisition actions via 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 * Required if enableAutoRun is true | |
| transactionUseDistributor | bool | {enableAtomicCommit} == true | ✓* | false | Whether to execute transactions asynchronously * Required if enableAtomicCommit is true | |
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | ✓* | false | Whether to execute the commit processing of the script result asynchronously * Required if transactionUseDistributor is true | |
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | ✓* | false | Whether to use GS2-JobQueue to execute the acquire action * Required if enableAtomicCommit is true | |
| distributorNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024 chars | GS2-Distributor namespace used for transaction execution | |
| queueNamespaceId | string | ✓ | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024 chars | Namespace in GS2-JobQueue used to run the transaction |
ScriptSetting
Script settings
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 execution result to stop the execution of the API or to tamper with the result of the API.
In contrast, asynchronous execution does not block processing until the script has finished executing. Since the script result cannot be used to stop the API execution or modify the API response, asynchronous execution does not affect the API’s response flow. For this reason, asynchronous execution 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 | Script GRN to be executed during processing Must be specified in GRN format starting with “grn:gs2:”. | |||||||||||
| doneTriggerTargetType | String Enum enum { “none”, “gs2_script”, “aws” } | ✓ | “none” | ~ 128 chars | Notification of Completion
| |||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | Script GRN to be executed upon completion Must be specified in GRN format starting with “grn:gs2:”. * Enabled if doneTriggerTargetType is “gs2_script” | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024 chars | GS2-JobQueue namespace GRN to execute asynchronous execution scripts Used when you want to know the completion of the done script. * Enabled if doneTriggerTargetType is “gs2_script” |
GitHubCheckoutSetting
Setup to check out master data from GitHub
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apiKeyId | string | ✓ | ~ 1024 chars | GitHub API key GRN | ||||||||||
| repositoryName | string | ✓ | ~ 1024 chars | Repository Name | ||||||||||
| sourcePath | string | ✓ | ~ 1024 chars | Master data (JSON) file path | ||||||||||
| referenceType | String Enum enum { “commit_hash”, “branch”, “tag” } | ✓ | ~ 128 chars | Source of code
| ||||||||||
| commitHash | string | {referenceType} == “commit_hash” | ✓* | ~ 1024 chars | Commit hash * Required if referenceType is “commit_hash” | |||||||||
| branchName | string | {referenceType} == “branch” | ✓* | ~ 1024 chars | Branch Name * Required if referenceType is “branch” | |||||||||
| tagName | string | {referenceType} == “tag” | ✓* | ~ 1024 chars | Tag Name * Required if referenceType is “tag” |
RandomDisplayItemModel
Random displayable items on the 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 | |||
| verifyActions | List<VerifyAction> | [] | 0 ~ 10 items | List of Verify Action | ||
| consumeActions | List<ConsumeAction> | [] | 0 ~ 10 items | List of Consumption Action | ||
| acquireActions | List<AcquireAction> | ✓ | [] | 1 ~ 100 items | List of Acquire Action | |
| stock | int | ✓ | 1 ~ 2147483646 | Stock | ||
| weight | int | ✓ | 1 ~ 2147483646 | Emission Weight |
DisplayItemMaster
Displayed Item Master Data
| 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” } | ✓ | ~ 128 chars | Type
| ||||||||
| salesItemName | string | {type} == “salesItem” | ✓* | ~ 128 chars | Name of the product to be displayed * Required if type is “salesItem” | |||||||
| salesItemGroupName | string | {type} == “salesItemGroup” | ✓* | ~ 128 chars | Name of the product group to be displayed * Required if type is “salesItemGroup” | |||||||
| salesPeriodEventId | string | ~ 1024 chars | Product group to be displayed | |||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |