GS2-Identifier GS2-Deploy/CDK リファレンス
GS2-Deployのスタックを作成する際に使用するテンプレートのフォーマットと、CDKによる各種言語のテンプレート出力の実装例
エンティティ
Deploy処理で操作する対象リソース
User
GS2-Identifier ユーザー
プロジェクトにアクセス可能なゲーム開発者を表すエンティティです。
ユーザーにはプログラムからアクセスするためのクレデンシャルや、
ユーザーの権限に基づいてマネージメントコンソールにログインし、プロジェクトを管理できるパスワードを登録できます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 1024文字 | ユーザー GRN | ||
| name | string | ✓ | ~ 128文字 | ユーザー名 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| createdAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| updatedAt | long | ✓ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | User | 作成したユーザ |
実装例
Type: GS2::Identifier::User
Properties:
Name: user-0001
Description: nullimport (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/identifier"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
identifier.NewUser(
&SampleStack,
"user-0001",
identifier.UserOptions{},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Identifier\Model\User(
stack: $this,
name: "user-0001"
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.identifier.model.User(
this,
"user-0001"
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Identifier.Model.User(
stack: this,
name: "user-0001"
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
class SampleStack extends core.Stack
{
public constructor() {
super();
new identifier.model.User(
this,
"user-0001"
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, identifier
class SampleStack(Stack):
def __init__(self):
super().__init__()
identifier.User(
stack=self,
name='user-0001',
)
print(SampleStack().yaml()) # Generate TemplateSecurityPolicy
セキュリティーポリシー
ユーザが利用できるAPIの種類やアクセスできるリソースの制限を定義します。
アクセス制限のルールはポリシードキュメントというJSON形式の定義データを使用します。
ポリシードキュメントの仕様については 開発資料内のポリシードキュメントについての解説ページを参照してください。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| securityPolicyId | string | ✓ | ~ 1024文字 | セキュリティポリシー GRN | ||
| name | string | ✓ | ~ 128文字 | セキュリティポリシー名 | ||
| description | string | ~ 1024文字 | 説明文 | |||
| policy | string | ✓ | ~ 524288文字 | ポリシードキュメント | ||
| createdAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| updatedAt | long | ✓ | 現在時刻 | 最終更新日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | SecurityPolicy | 作成したセキュリティポリシー |
実装例
Type: GS2::Identifier::SecurityPolicy
Properties:
Name: policy-0001
Description: null
Policy: {}import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/identifier"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
identifier.NewSecurityPolicy(
&SampleStack,
"policy-0001",
identifier.NewPolicy(
[]identifier.Statement{},
),
identifier.SecurityPolicyOptions{},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Identifier\Model\SecurityPolicy(
stack: $this,
name: "policy-0001",
policy: new \Gs2Cdk\Identifier\Model\Policy([])
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.identifier.model.SecurityPolicy(
this,
"policy-0001",
null
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Identifier.Model.SecurityPolicy(
stack: this,
name: "policy-0001",
policy: null
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
import Policy from "@/gs2cdk/identifier/model/Policy";
import Statement from "@/gs2cdk/identifier/model/Statement";
class SampleStack extends core.Stack
{
public constructor() {
super();
new identifier.model.SecurityPolicy(
this,
"policy-0001",
new Policy(
[
Statement.allowAll()
]
)
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, identifier
class SampleStack(Stack):
def __init__(self):
super().__init__()
identifier.SecurityPolicy(
stack=self,
name='policy-0001',
policy=None,
)
print(SampleStack().yaml()) # Generate TemplateIdentifier
クレデンシャル
GS2のAPIにアクセスするために必要となるAPIキーです。
クレデンシャルはクライアントIDとクライアントシークレットからなり、クレデンシャルを使用したアクセスは、クレデンシャルの所有者となるユーザの権限に基づいてアクセス制限が施されます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| clientId | string | ✓ | UUID | ~ 256文字 | クライアントID | |
| userName | string | ✓ | ~ 128文字 | ユーザー名 | ||
| clientSecret | string | ✓ | UUID | ~ 100文字 | クライアントシークレット | |
| createdAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | Identifier | 作成したクレデンシャル |
| ClientSecret | string | クライアントシークレット |
実装例
Type: GS2::Identifier::Identifier
Properties:
UserName: user-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/identifier"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
identifier.NewIdentifier(
&SampleStack,
"user-0001",
identifier.IdentifierOptions{},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Identifier\Model\Identifier(
stack: $this,
userName: "user-0001"
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.identifier.model.Identifier(
this,
"user-0001"
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Identifier.Model.Identifier(
stack: this,
userName: "user-0001"
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
class SampleStack extends core.Stack
{
public constructor() {
super();
new identifier.model.Identifier(
this,
"user-0001"
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, identifier
class SampleStack(Stack):
def __init__(self):
super().__init__()
identifier.Identifier(
stack=self,
user_name='user-0001',
)
print(SampleStack().yaml()) # Generate TemplatePassword
パスワード
マネージメントコンソールにユーザの権限に基づいてログインするためのパスワード。
パスワードを設定することで、1つのプロジェクトに異なるアカウントからログインでき、なおかつアクセスできる情報に制限をかけることができます。
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| passwordId | string | ✓ | ~ 1024文字 | パスワード GRN | ||||||||
| userId | string | ✓ | ~ 1024文字 | ユーザー GRN | ||||||||
| userName | string | ✓ | ~ 128文字 | ユーザー名 | ||||||||
| enableTwoFactorAuthentication | 文字列列挙型 enum { “RFC6238”, “Disable” } | ✓ | “Disable” | ~ 128文字 | 二要素認証
| |||||||
| twoFactorAuthenticationSetting | TwoFactorAuthenticationSetting | {enableTwoFactorAuthentication} == “RFC6238” | 二要素認証設定 ※ enableTwoFactorAuthentication が “RFC6238” であれば 有効 | |||||||||
| createdAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Item | Password | 作成したパスワード |
実装例
Type: GS2::Identifier::Password
Properties:
UserName: user-0001
Password: password-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/identifier"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
identifier.NewPassword(
&SampleStack,
"user-0001",
"password-0001",
identifier.PasswordOptions{},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Identifier\Model\Password(
stack: $this,
userName: "user-0001",
password: "password-0001"
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.identifier.model.Password(
this,
"user-0001",
"password-0001"
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Identifier.Model.Password(
stack: this,
userName: "user-0001",
password: "password-0001"
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
class SampleStack extends core.Stack
{
public constructor() {
super();
new identifier.model.Password(
this,
"user-0001",
"password-0001"
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, identifier
class SampleStack(Stack):
def __init__(self):
super().__init__()
identifier.Password(
stack=self,
user_name='user-0001',
password='password-0001',
)
print(SampleStack().yaml()) # Generate TemplateTwoFactorAuthenticationSetting
二要素認証設定
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| status | 文字列列挙型 enum { “Verifying”, “Enable” } | ✓ | “Verifying” | ~ 128文字 | ステータス
|
AttachSecurityPolicy
アタッチされたセキュリティポリシー
| 型 | 有効化条件 | 必須 | デフォルト | 値の制限 | 説明 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 1024文字 | ユーザー GRN | ||
| securityPolicyIds | List<string> | [] | 0 ~ 100 items | セキュリティポリシー のGRNのリスト | ||
| attachedAt | long | ✓ | 現在時刻 | 作成日時 UNIX 時間・ミリ秒 サーバー側で自動的に設定 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | リビジョン |
GetAttr
!GetAttrタグで取得可能なリソースの生成結果
| 型 | 説明 | |
|---|---|---|
| Items | SecurityPolicy[] | 新しくユーザーに割り当てたセキュリティポリシーのリスト |
実装例
Type: GS2::Identifier::AttachSecurityPolicy
Properties:
UserName: user-0001
SecurityPolicyId: securityPolicyId-0001import (
"github.com/gs2io/gs2-golang-cdk/core"
"github.com/gs2io/gs2-golang-cdk/identifier"
"github.com/openlyinc/pointy"
)
SampleStack := core.NewStack()
identifier.NewAttachSecurityPolicy(
&SampleStack,
"user-0001",
"securityPolicyId-0001",
identifier.AttachSecurityPolicyOptions{},
)
println(SampleStack.Yaml()) // Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
function __construct() {
parent::__construct();
new \Gs2Cdk\Identifier\Model\AttachSecurityPolicy(
stack: $this,
userName: "user-0001",
securityPolicyId: "securityPolicyId-0001"
);
}
}
print((new SampleStack())->yaml()); // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
public SampleStack() {
super();
new io.gs2.cdk.identifier.model.AttachSecurityPolicy(
this,
"user-0001",
"securityPolicyId-0001"
);
}
}
System.out.println(new SampleStack().yaml()); // Generate Templatepublic class SampleStack : Gs2Cdk.Core.Model.Stack
{
public SampleStack() {
new Gs2Cdk.Gs2Identifier.Model.AttachSecurityPolicy(
stack: this,
userName: "user-0001",
securityPolicyId: "securityPolicyId-0001"
);
}
}
Debug.Log(new SampleStack().Yaml()); // Generate Templateimport core from "@/gs2cdk/core";
import identifier from "@/gs2cdk/identifier";
class SampleStack extends core.Stack
{
public constructor() {
super();
new identifier.model.AttachSecurityPolicy(
this,
"user-0001",
"securityPolicyId-0001"
);
}
}
console.log(new SampleStack().yaml()); // Generate Template
from gs2_cdk import Stack, core, identifier
class SampleStack(Stack):
def __init__(self):
super().__init__()
identifier.AttachSecurityPolicy(
stack=self,
user_name='user-0001',
security_policy_id='securityPolicyId-0001',
)
print(SampleStack().yaml()) # Generate Template