GS2-Deploy/CDK Reference of GS2-Schedule

Entities

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeRequireDefaultLimitationDescription
namestring~ 32 charsNamespace name
descriptionstring~ 1024 charsDescription
logSettingLogSettingLog output settings

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

Type: GS2::Schedule::Namespace
Properties:
  Name: namespace1
  Description: null
  LogSetting: 
    LoggingNamespaceId: grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001
from gs2_cdk import Stack, core, schedule

class SampleStack(Stack):

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

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Schedule\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Schedule\Model\Options\NamespaceOptions(
                logSetting: new \Gs2Cdk\Core\Model\LogSetting(
                    loggingNamespaceId: "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
                ),
            ),
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.schedule.model.Namespace(
            this,
            "namespace-0001",
            new io.gs2.cdk.schedule.model.options.NamespaceOptions() {
                {
                    logSetting = new io.gs2.cdk.core.model.LogSetting(
                        "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                    );
                }
            }
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import schedule from "@/gs2cdk/schedule";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new schedule.model.Namespace(
            this,
            "namespace-0001",
            {
                logSetting: new core.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Schedule.Model.Namespace(
            this,
            "namespace-0001",
            new Gs2Cdk.Gs2Schedule.Model.Options.NamespaceOptions {
                logSetting = new Gs2Cdk.Core.Model.LogSetting(
                    "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                ),
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

CurrentEventMaster

Currently available master data

GS2 uses JSON format files for master data management. By uploading the file, you can actually reflect the settings on the server.

We provide a master data editor on the management console as a way to create JSON files, but you can also create JSON files using the The service can also be used by creating a tool more appropriate for game management and exporting a JSON file in the appropriate format.

Please refer to the documentation for the format of the JSON file.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 32 charsNamespace name
settingsstring~ 5242880 charsMaster data

GetAttr

TypeDescription
ItemCurrentEventMasterUpdated and currently available event schedule master

Implementation Example

Type: GS2::Schedule::CurrentEventMaster
Properties:
  NamespaceName: namespace1
  Settings: {
    "version": "2019-03-31",
    "events": [
      {
        "name": "event-0001",
        "metadata": "EVENT_0001",
        "scheduleType": "absolute",
        "absoluteBegin": 10000,
        "absoluteEnd": 20000
      },
      {
        "name": "event-0002",
        "metadata": "EVENT_0002",
        "scheduleType": "relative",
        "relativeTriggerName": "trigger-0001"
      },
      {
        "name": "daily-0001",
        "metadata": "EVENT_0003",
        "scheduleType": "absolute",
        "absoluteBegin": 1569369600000,
        "absoluteEnd": 1569456000000,
        "repeatType": "daily",
        "repeatBeginHour": 1,
        "repeatEndHour": 2
      },
      {
        "name": "daily-0002",
        "metadata": "EVENT_0004",
        "scheduleType": "absolute",
        "absoluteBegin": 1569369600000,
        "absoluteEnd": 1569456000000,
        "repeatType": "daily",
        "repeatBeginHour": 3,
        "repeatEndHour": 1
      },
      {
        "name": "weekly-0001",
        "metadata": "EVENT_0005",
        "scheduleType": "absolute",
        "absoluteBegin": 1569888000000,
        "absoluteEnd": 1570406400000,
        "repeatType": "weekly",
        "repeatBeginDayOfWeek": "tuesday",
        "repeatEndDayOfWeek": "wednesday",
        "repeatBeginHour": 1,
        "repeatEndHour": 2
      },
      {
        "name": "weekly-0002",
        "metadata": "EVENT_0006",
        "scheduleType": "absolute",
        "absoluteBegin": 1569888000000,
        "absoluteEnd": 1570406400000,
        "repeatType": "weekly",
        "repeatBeginDayOfWeek": "wednesday",
        "repeatEndDayOfWeek": "tuesday",
        "repeatBeginHour": 3,
        "repeatEndHour": 1
      },
      {
        "name": "monthly-0001",
        "metadata": "EVENT_0007",
        "scheduleType": "absolute",
        "absoluteBegin": 1570406400000,
        "absoluteEnd": 1575158400000,
        "repeatType": "monthly",
        "repeatBeginDayOfMonth": 10,
        "repeatEndDayOfMonth": 15,
        "repeatBeginHour": 1,
        "repeatEndHour": 2
      },
      {
        "name": "monthly-0002",
        "metadata": "EVENT_0008",
        "scheduleType": "absolute",
        "absoluteBegin": 1570406400000,
        "absoluteEnd": 1575158400000,
        "repeatType": "monthly",
        "repeatBeginDayOfMonth": 16,
        "repeatEndDayOfMonth": 9,
        "repeatBeginHour": 3,
        "repeatEndHour": 0
      }
    ]
  }
from gs2_cdk import Stack, core, schedule

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        schedule.Namespace(
            stack=self,
            # omission
        ).master_data(
            [
                schedule.Event(
                    name='event-0001',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0001',
                        absolute_begin=10000,
                        absolute_end=20000,
                    ),
                ),
                schedule.Event(
                    name='event-0002',
                    schedule_type='relative',
                    options=schedule.EventOptions(
                        metadata='EVENT_0002',
                        relative_trigger_name='trigger-0001',
                    ),
                ),
                schedule.Event(
                    name='daily-0001',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0003',
                        absolute_begin=1569369600000,
                        absolute_end=1569456000000,
                    ),
                ),
                schedule.Event(
                    name='daily-0002',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0004',
                        absolute_begin=1569369600000,
                        absolute_end=1569456000000,
                    ),
                ),
                schedule.Event(
                    name='weekly-0001',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0005',
                        absolute_begin=1569888000000,
                        absolute_end=1570406400000,
                    ),
                ),
                schedule.Event(
                    name='weekly-0002',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0006',
                        absolute_begin=1569888000000,
                        absolute_end=1570406400000,
                    ),
                ),
                schedule.Event(
                    name='monthly-0001',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0007',
                        absolute_begin=1570406400000,
                        absolute_end=1575158400000,
                    ),
                ),
                schedule.Event(
                    name='monthly-0002',
                    schedule_type='absolute',
                    options=schedule.EventOptions(
                        metadata='EVENT_0008',
                        absolute_begin=1570406400000,
                        absolute_end=1575158400000,
                    ),
                ),
            ],
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        (new \Gs2Cdk\Schedule\Model\Namespace_(
            stack: $this,
            // omission
        ))->masterData(
            [
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"event-0001",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0001",
                        absoluteBegin:10000,
                        absoluteEnd:20000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"event-0002",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::RELATIVE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0002",
                        relativeTriggerName:"trigger-0001",
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"daily-0001",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0003",
                        absoluteBegin:1569369600000,
                        absoluteEnd:1569456000000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"daily-0002",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0004",
                        absoluteBegin:1569369600000,
                        absoluteEnd:1569456000000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"weekly-0001",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0005",
                        absoluteBegin:1569888000000,
                        absoluteEnd:1570406400000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"weekly-0002",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0006",
                        absoluteBegin:1569888000000,
                        absoluteEnd:1570406400000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"monthly-0001",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0007",
                        absoluteBegin:1570406400000,
                        absoluteEnd:1575158400000,
                    ),
                ),
                new \Gs2Cdk\Schedule\Model\Event(
                    name:"monthly-0002",
                    scheduleType: \Gs2Cdk\Schedule\Model\Enums\CurrentEventMasterScheduleType::ABSOLUTE
                    options: new \Gs2Cdk\Schedule\Model\Options\EventOptions(
                        metadata:"EVENT_0008",
                        absoluteBegin:1570406400000,
                        absoluteEnd:1575158400000,
                    ),
                ),
            ],
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.schedule.model.Namespace(
            this,
            // omission
        ).masterData(
            Arrays.asList(
                new io.gs2.cdk.schedule.model.Event(
                    "event-0001",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0001";
                            absoluteBegin: 10000L;
                            absoluteEnd: 20000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "event-0002",
                    Relative,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0002";
                            relativeTriggerName: "trigger-0001";
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "daily-0001",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0003";
                            absoluteBegin: 1569369600000L;
                            absoluteEnd: 1569456000000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "daily-0002",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0004";
                            absoluteBegin: 1569369600000L;
                            absoluteEnd: 1569456000000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "weekly-0001",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0005";
                            absoluteBegin: 1569888000000L;
                            absoluteEnd: 1570406400000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "weekly-0002",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0006";
                            absoluteBegin: 1569888000000L;
                            absoluteEnd: 1570406400000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "monthly-0001",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0007";
                            absoluteBegin: 1570406400000L;
                            absoluteEnd: 1575158400000L;
                        }
                    }
                ),
                new io.gs2.cdk.schedule.model.Event(
                    "monthly-0002",
                    Absolute,
                    new io.gs2.cdk.schedule.model.options.EventOptions() {
                        {
                            metadata: "EVENT_0008";
                            absoluteBegin: 1570406400000L;
                            absoluteEnd: 1575158400000L;
                        }
                    }
                )
            )
        );
    }
}

System.out.println(new SampleStack().yaml());  // Generate Template
import core from "@/gs2cdk/core";
import schedule from "@/gs2cdk/schedule";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new schedule.model.Namespace(
            this,
            // omission
        ).masterData(
            [
                new schedule.model.Event(
                    "event-0001",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0001",
                        absoluteBegin: 10000,
                        absoluteEnd: 20000
                    }
                ),
                new schedule.model.Event(
                    "event-0002",
                    schedule.model.CurrentEventMasterScheduleType.RELATIVE,
                    {
                        metadata: "EVENT_0002",
                        relativeTriggerName: "trigger-0001"
                    }
                ),
                new schedule.model.Event(
                    "daily-0001",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0003",
                        absoluteBegin: 1569369600000,
                        absoluteEnd: 1569456000000
                    }
                ),
                new schedule.model.Event(
                    "daily-0002",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0004",
                        absoluteBegin: 1569369600000,
                        absoluteEnd: 1569456000000
                    }
                ),
                new schedule.model.Event(
                    "weekly-0001",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0005",
                        absoluteBegin: 1569888000000,
                        absoluteEnd: 1570406400000
                    }
                ),
                new schedule.model.Event(
                    "weekly-0002",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0006",
                        absoluteBegin: 1569888000000,
                        absoluteEnd: 1570406400000
                    }
                ),
                new schedule.model.Event(
                    "monthly-0001",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0007",
                        absoluteBegin: 1570406400000,
                        absoluteEnd: 1575158400000
                    }
                ),
                new schedule.model.Event(
                    "monthly-0002",
                    schedule.model.CurrentEventMasterScheduleType.ABSOLUTE,
                    {
                        metadata: "EVENT_0008",
                        absoluteBegin: 1570406400000,
                        absoluteEnd: 1575158400000
                    }
                )
            ]
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Schedule.Model.Namespace(
            this,
            // omission
        ).MasterData(
            new [] {
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "event-0001",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0001",
                        absoluteBegin = 10000L,
                        absoluteEnd = 20000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "event-0002",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Relative,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0002",
                        relativeTriggerName = "trigger-0001",
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "daily-0001",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0003",
                        absoluteBegin = 1569369600000L,
                        absoluteEnd = 1569456000000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "daily-0002",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0004",
                        absoluteBegin = 1569369600000L,
                        absoluteEnd = 1569456000000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "weekly-0001",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0005",
                        absoluteBegin = 1569888000000L,
                        absoluteEnd = 1570406400000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "weekly-0002",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0006",
                        absoluteBegin = 1569888000000L,
                        absoluteEnd = 1570406400000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "monthly-0001",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0007",
                        absoluteBegin = 1570406400000L,
                        absoluteEnd = 1575158400000L,
                    }
                ),
                new Gs2Cdk.Gs2Schedule.Model.Event(
                    "monthly-0002",
                    Gs2Cdk.Gs2Schedule.Model.Enums.CurrentEventMasterScheduleType.Absolute,
                    new Gs2Cdk.Gs2Schedule.Model.Options.EventOptions {
                        metadata = "EVENT_0008",
                        absoluteBegin = 1570406400000L,
                        absoluteEnd = 1575158400000L,
                    }
                )
            }
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template

RepeatSetting

Repeat Setting

There are two types of event durations: absolute and relative.

TypeRequireDefaultLimitationDescription
repeatTypeenum [
“always”,
“daily”,
“weekly”,
“monthly”
]
“always”~ 128 charsType of repetition
beginDayOfMonthint{repeatType} == “monthly”1 ~ 31Event repeat start date (If the value exceeds the days of the month, it is treated as the last day.)
endDayOfMonthint{repeatType} == “monthly”1 ~ 31Event repeat end date (If the value exceeds the days of the month, it is treated as the last day.)
beginDayOfWeekenum [
“sunday”,
“monday”,
“tuesday”,
“wednesday”,
“thursday”,
“friday”,
“saturday”
]
{repeatType} == “weekly”~ 128 charsRepeat start day of event
endDayOfWeekenum [
“sunday”,
“monday”,
“tuesday”,
“wednesday”,
“thursday”,
“friday”,
“saturday”
]
{repeatType} == “weekly”~ 128 charsRepeat event end day of the week
beginHourint{repeatType} in [“daily”, “weekly”, “monthly”]~ 23Event repetition start time (in hours)
endHourint{repeatType} in [“daily”, “weekly”, “monthly”]~ 24Event repetition end time (in hours)

RepeatSchedule

TypeRequireDefaultLimitationDescription
repeatCountint~ 2147483646Number of times to repeat
currentRepeatStartAtlongStart date and time of repeating event
currentRepeatEndAtlongEnd date and time of repeating event
lastRepeatEndAtlongEnd date and time of last event
nextRepeatStartAtlongStart date and time of next event

GitHubCheckoutSetting

Setup to check out master data from GitHub

TypeRequireDefaultLimitationDescription
apiKeyIdstring~ 1024 charsGitHub API key GRN
repositoryNamestring~ 1024 charsRepository Name
sourcePathstring~ 1024 charsSource code file path
referenceTypeenum [
“commit_hash”,
“branch”,
“tag”
]
~ 128 charsSource of code
commitHashstring{referenceType} == “commit_hash”~ 1024 charsCommit hash
branchNamestring{referenceType} == “branch”~ 1024 charsBranch Name
tagNamestring{referenceType} == “tag”~ 1024 charsTag Name

LogSetting

Log setting

This type manages log output settings. This type holds the identifier of the log namespace used to output log data. The log namespace ID specifies the GS2-Log namespace to aggregate and store the log data. Through this setting, API request and response log data under this namespace will be output to the target GS2-Log. GS2-Log provides logs in real time, which can be used for system monitoring, analysis, debugging, etc.

TypeRequireDefaultLimitationDescription
loggingNamespaceIdstring~ 1024 charsNamespace GRN