GS2-Guild 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 distributed transactions are executed when processing guild operations. Supports auto-run, atomic commit, and async processing options. | ||||
| changeNotification | NotificationSetting | Guild Change Notification Push notification sent via GS2-Gateway when guild information (display name, attributes, join policy, etc.) is updated. Allows guild members to receive real-time updates about changes to their guild. | ||||
| joinNotification | NotificationSetting | Member Join Notification Push notification sent via GS2-Gateway when a new member joins the guild, either through direct join (open policy) or after approval of a join request. Enables existing members to be notified of new additions. | ||||
| leaveNotification | NotificationSetting | Member Leave Notification Push notification sent via GS2-Gateway when a member leaves or is removed from the guild. Covers both voluntary departures and expulsions by guild masters. | ||||
| changeMemberNotification | NotificationSetting | Member Change Notification Push notification sent via GS2-Gateway when a guild member’s information (role, metadata) is updated. Whether metadata changes trigger this notification can be controlled with changeMemberNotificationIgnoreChangeMetadata. | ||||
| changeMemberNotificationIgnoreChangeMetadata | bool? | false | Whether to ignore changes in metadata when issuing notifications when member metadata is updated | |||
| receiveRequestNotification | NotificationSetting | Receive Request Notification Push notification sent via GS2-Gateway when the guild receives a new join request from a user. Allows guild masters and authorized members to be notified of pending requests that require approval. | ||||
| removeRequestNotification | NotificationSetting | Remove Request Notification Push notification sent via GS2-Gateway when a guild join request is deleted, either by cancellation from the sender, rejection by the guild, or approval (which removes the request and adds the member). | ||||
| createGuildScript | ScriptSetting | Script to execute when creating a Guild Script Trigger Reference - createGuild | ||||
| updateGuildScript | ScriptSetting | Script to execute when update a guild Script Trigger Reference - updateGuild | ||||
| joinGuildScript | ScriptSetting | Script to execute when joining a guild Script Trigger Reference - joinGuild | ||||
| receiveJoinRequestScript | ScriptSetting | Script to execute when receiving a guild join request Script Trigger Reference - receiveJoinRequest | ||||
| leaveGuildScript | ScriptSetting | Script to execute when leaving a guild Script Trigger Reference - leaveGuild | ||||
| changeRoleScript | ScriptSetting | Script to execute when changing the role assigned to a member Script Trigger Reference - changeRole | ||||
| deleteGuildScript | ScriptSetting | Script to execute when deleting a guild Script Trigger Reference - deleteGuild | ||||
| logSetting | LogSetting | Log Output Setting Configuration for outputting log data of guild operations to GS2-Log. By specifying a GS2-Log namespace, API request and response logs for guild creation, joining, leaving, and role changes can be collected. |
GetAttr
Resource creation results that can be retrieved using the !GetAttr tag
| Type | Description | |
|---|---|---|
| Item | Namespace | Namespace created |
Implementation Example
Type: GS2::Guild::Namespace
Properties:
Name: namespace-0001
Description: null
TransactionSetting:
EnableAutoRun: true
QueueNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:queue:queue-0001
ChangeNotification: null
JoinNotification: null
LeaveNotification: null
ChangeMemberNotification: null
ChangeMemberNotificationIgnoreChangeMetadata: null
ReceiveRequestNotification: null
RemoveRequestNotification: null
CreateGuildScript: null
UpdateGuildScript: null
JoinGuildScript: null
ReceiveJoinRequestScript: null
LeaveGuildScript: null
ChangeRoleScript: null
DeleteGuildScript: 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/guild"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
guild.NewNamespace(
&SampleStack,
"namespace-0001",
guild.NamespaceOptions{
TransactionSetting: &core.TransactionSetting{
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\Guild\Model\Namespace_(
stack: $this,
name: "namespace-0001",
options: new \Gs2Cdk\Guild\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.guild.model.Namespace(
this,
"namespace-0001",
new io.gs2.cdk.guild.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.Gs2Guild.Model.Namespace(
stack: this,
name: "namespace-0001",
options: new Gs2Cdk.Gs2Guild.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 guild from "@/gs2cdk/guild";
class SampleStack extends core.Stack
{
public constructor() {
super();
new guild.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, guild
class SampleStack(Stack):
def __init__(self):
super().__init__()
guild.Namespace(
stack=self,
name='namespace-0001',
options=guild.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” |
NotificationSetting
Push Notification Settings
This is a setting for sending push notifications when an event occurs in a GS2 microservice. The push notification here refers to the processing via the WebSocket interface provided by GS2-Gateway, and is different from the push notification of a smartphone. For example, when a matchmaking is completed or a friend request is received, the GS2-Gateway can send a push notification via the WebSocket interface, and the game client can detect the change of the state.
GS2-Gateway’s push notifications can be used to forward notifications to mobile push notification services when the destination device is offline. By properly utilizing mobile push notifications, you can implement a flow in which players are notified even if they exit the game during matchmaking and later return to it.
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| gatewayNamespaceId | string | “grn:gs2:{region}:{ownerId}:gateway:default” | ~ 1024 chars | GS2-Gateway namespace to use for push notifications Specify the GS2-Gateway namespace ID in GRN format starting with “grn:gs2:”. | ||||||||
| enableTransferMobileNotification | bool? | false | Whether to forward the notification as a mobile push notification When this notification is sent and the destination device is offline, specify whether to forward it as a mobile push notification. | |||||||||
| sound | string | {enableTransferMobileNotification} == true | ~ 1024 chars | Sound file name to be used for mobile push notifications The sound file name specified here is used when sending mobile push notifications, and you can send notifications with a special sound. * Applicable only if enableTransferMobileNotification is true | ||||||||
| enable | String Enum enum { “Enabled”, “Disabled” } | “Enabled” | Whether to enable push notifications
|
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:”. |
CurrentGuildMaster
Currently active Guild Model master data
This master data describes the definitions of Guild 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 Master Data Reference of GS2-Guild 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 | CurrentGuildMaster | Updated master data of the currently active Guild Models |
Implementation Example
Type: GS2::Guild::CurrentGuildMaster
Properties:
NamespaceName: namespace-0001
Mode: direct
Settings: {
"version": "2024-04-25",
"guildModels": [
{
"name": "guild-0001",
"defaultMaximumMemberCount": 10,
"maximumMemberCount": 50,
"inactivityPeriodDays": 10,
"roles": [
{
"name": "master",
"policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
},
{
"name": "member",
"policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
}
],
"guildMasterRole": "master",
"guildMemberDefaultRole": "member",
"rejoinCoolTimeMinutes": 1440
},
{
"name": "guild-0002",
"defaultMaximumMemberCount": 20,
"maximumMemberCount": 40,
"inactivityPeriodDays": 10,
"roles": [
{
"name": "master",
"policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
},
{
"name": "member",
"policyDocument": "{\\"Version\\": \\"2016-04-01\\", \\"Statements\\": [{\\"Effect\\": \\"Allow\\", \\"Actions\\": [\\"Gs2Guild:UpdateGuild\\"], \\"Resources\\": [\\"*\\"]}]}"
}
],
"guildMasterRole": "master",
"guildMemberDefaultRole": "member",
"rejoinCoolTimeMinutes": 360
}
]
}
UploadToken: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/guild"
)
SampleStack := core.NewStack()
guild.NewNamespace(
&SampleStack,
"namespace-0001",
guild.NamespaceOptions{},
).MasterData(
[]guild.GuildModel{
guild.NewGuildModel(
"guild-0001",
10,
50,
10,
[]guild.RoleModel{
guild.NewRoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
guild.RoleModelOptions{},
),
guild.NewRoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
guild.RoleModelOptions{},
),
},
"master",
"member",
1440,
guild.GuildModelOptions{
},
),
guild.NewGuildModel(
"guild-0002",
20,
40,
10,
[]guild.RoleModel{
guild.NewRoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
guild.RoleModelOptions{},
),
guild.NewRoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
guild.RoleModelOptions{},
),
},
"master",
"member",
360,
guild.GuildModelOptions{
},
),
},
)
println(SampleStack.Yaml()) // Generate Templateclass SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
(new \Gs2Cdk\Guild\Model\Namespace_(
stack: $this,
name: "namespace-0001"
))->masterData(
[
new \Gs2Cdk\Guild\Model\GuildModel(
name:"guild-0001",
defaultMaximumMemberCount:10,
maximumMemberCount:50,
inactivityPeriodDays:10,
roles:[
new \Gs2Cdk\Guild\Model\RoleModel(
name: "master",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
),
new \Gs2Cdk\Guild\Model\RoleModel(
name: "member",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
),
],
guildMasterRole:"master",
guildMemberDefaultRole:"member",
rejoinCoolTimeMinutes:1440
),
new \Gs2Cdk\Guild\Model\GuildModel(
name:"guild-0002",
defaultMaximumMemberCount:20,
maximumMemberCount:40,
inactivityPeriodDays:10,
roles:[
new \Gs2Cdk\Guild\Model\RoleModel(
name: "master",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
),
new \Gs2Cdk\Guild\Model\RoleModel(
name: "member",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}",
),
],
guildMasterRole:"master",
guildMemberDefaultRole:"member",
rejoinCoolTimeMinutes:360
)
]
);
}
}
print((new SampleStack())->yaml()); // Generate Templateclass SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.guild.model.Namespace(
this,
"namespace-0001"
).masterData(
Arrays.asList(
new io.gs2.cdk.guild.model.GuildModel(
"guild-0001",
10,
50,
10,
Arrays.asList(
new io.gs2.cdk.guild.model.RoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new io.gs2.cdk.guild.model.RoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
)
),
"master",
"member",
1440
),
new io.gs2.cdk.guild.model.GuildModel(
"guild-0002",
20,
40,
10,
Arrays.asList(
new io.gs2.cdk.guild.model.RoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new io.gs2.cdk.guild.model.RoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
)
),
"master",
"member",
360
)
)
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Guild.Model.Namespace(
stack: this,
name: "namespace-0001"
).MasterData(
new Gs2Cdk.Gs2Guild.Model.GuildModel[] {
new Gs2Cdk.Gs2Guild.Model.GuildModel(
name: "guild-0001",
defaultMaximumMemberCount: 10,
maximumMemberCount: 50,
inactivityPeriodDays: 10,
roles: new Gs2Cdk.Gs2Guild.Model.RoleModel[]
{
new Gs2Cdk.Gs2Guild.Model.RoleModel(
name: "master",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new Gs2Cdk.Gs2Guild.Model.RoleModel(
name: "member",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
)
},
guildMasterRole: "master",
guildMemberDefaultRole: "member",
rejoinCoolTimeMinutes: 1440
),
new Gs2Cdk.Gs2Guild.Model.GuildModel(
name: "guild-0002",
defaultMaximumMemberCount: 20,
maximumMemberCount: 40,
inactivityPeriodDays: 10,
roles: new Gs2Cdk.Gs2Guild.Model.RoleModel[]
{
new Gs2Cdk.Gs2Guild.Model.RoleModel(
name: "master",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new Gs2Cdk.Gs2Guild.Model.RoleModel(
name: "member",
policyDocument: "{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
)
},
guildMasterRole: "master",
guildMemberDefaultRole: "member",
rejoinCoolTimeMinutes: 360
)
}
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import guild from "@/gs2cdk/guild";
class SampleStack extends core.Stack
{
public constructor() {
super();
new guild.model.Namespace(
this,
"namespace-0001",
).masterData(
[
new guild.model.GuildModel(
"guild-0001",
10,
50,
10,
[
new guild.model.RoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new guild.model.RoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
],
"master",
"member",
1440
),
new guild.model.GuildModel(
"guild-0002",
20,
40,
10,
[
new guild.model.RoleModel(
"master",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
new guild.model.RoleModel(
"member",
"{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}"
),
],
"master",
"member",
360
)
]
);
}
}
console.log(new SampleStack().yaml()); // Generate Templatefrom gs2_cdk import Stack, core, guild
class SampleStack(Stack):
def __init__(self):
super().__init__()
guild.Namespace(
stack=self,
name="namespace-0001",
).master_data(
guild_models=[
guild.GuildModel(
name='guild-0001',
default_maximum_member_count=10,
maximum_member_count=50,
inactivity_period_days=10,
roles=[
guild.RoleModel(
name='master',
policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',
),
guild.RoleModel(
name='member',
policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',
),
],
guild_master_role='master',
guild_member_default_role='member',
rejoin_cool_time_minutes=1440
),
guild.GuildModel(
name='guild-0002',
default_maximum_member_count=20,
maximum_member_count=40,
inactivity_period_days=10,
roles=[
guild.RoleModel(
name='master',
policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',
),
guild.RoleModel(
name='member',
policy_document='{\\\"Version\\\": \\\"2016-04-01\\\", \\\"Statements\\\": [{\\\"Effect\\\": \\\"Allow\\\", \\\"Actions\\\": [\\\"Gs2Guild:UpdateGuild\\\"], \\\"Resources\\\": [\\\"*\\\"]}]}',
),
],
guild_master_role='master',
guild_member_default_role='member',
rejoin_cool_time_minutes=360
),
],
)
print(SampleStack().yaml()) # Generate TemplateGuildModel
Guild Model
A Guild Model is an entity that sets the maximum number of people who can join the guild and the permission settings for each position within the guild.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| guildModelId | string | * | ~ 1024 chars | Guild Model GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Guild Model name Guild Model-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. | |||
| defaultMaximumMemberCount | int | ✓ | 1 ~ 2147483646 | Default Maximum Member Count The initial maximum number of members allowed when a new guild is created. This value is used as the starting currentMaximumMemberCount for new guilds. Can be increased later up to the maximumMemberCount limit through guild operations or acquire actions. | ||
| maximumMemberCount | int | ✓ | 1 ~ 2147483646 | Maximum Member Count The absolute upper limit for the number of members a guild can have. The guild’s currentMaximumMemberCount cannot exceed this value. This serves as a hard cap to prevent guilds from growing beyond the intended size. | ||
| inactivityPeriodDays | int | 7 | 1 ~ 365 | Inactivity Period Days The number of days of guild master inactivity after which a new guild master is automatically selected from the remaining guild members. This prevents guilds from becoming unmanageable when the guild master stops playing. | ||
| roles | List<RoleModel> | ✓ | 1 ~ 10 items | List of Role Models The list of role definitions available within guilds of this type. Must include at least the roles referenced by guildMasterRole and guildMemberDefaultRole. Each role defines a unique set of permissions via a policy document. Up to 10 roles can be defined. | ||
| guildMasterRole | string | ✓ | ~ 128 chars | Guild Master Role Name The name of the role assigned to guild masters. Must reference a role defined in the roles list. Guild masters typically have full permissions to manage the guild, including approving join requests, expelling members, changing roles, and updating guild settings. | ||
| guildMemberDefaultRole | string | ✓ | ~ 128 chars | Default Member Role Name The name of the role automatically assigned to new guild members when they join. Must reference a role defined in the roles list. This is the baseline permission set for regular members before any role changes by the guild master. | ||
| rejoinCoolTimeMinutes | int | 0 | 0 ~ 2147483646 | Rejoin Cool Time (Minutes) The cooldown period in minutes before a user can rejoin a guild after leaving. Set to 0 to allow immediate rejoining. This prevents abuse patterns where users repeatedly join and leave guilds. | ||
| maxConcurrentJoinGuilds | int | 1 ~ 10 | Maximum Concurrent Guild Memberships The maximum number of guilds of this type that a user can be a member of simultaneously. Allows for designs where players can belong to multiple guilds at the same time (e.g., a combat guild and a social guild). The value ranges from 1 to 10. | |||
| maxConcurrentGuildMasterCount | int | 1 ~ 100 | Maximum Concurrent Guild Master Count The maximum number of guild masters that can exist in a single guild at the same time. Allows for co-leadership designs where multiple players share guild master responsibilities and permissions. The value ranges from 1 to 100. |
RoleModel
Role Model
The role model defines the role within the guild and sets the permissions for each role.
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Role Model name Role Model-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. | |||
| policyDocument | string | ✓ | ~ 10240 chars | Policy Document A JSON-formatted policy document that defines the permissions for this role. Specifies which guild operations (such as accepting/rejecting join requests, expelling members, updating guild info, changing member roles) are allowed or denied for members assigned to this role. |