GS2-Identifier GS2-Deploy/CDK リファレンス

GS2-Deployのスタックを作成する際に使用するテンプレートのフォーマットと、CDKによる各種言語のテンプレート出力の実装例

エンティティ

Deploy処理で操作する対象リソース

User

GS2-Identifier ユーザー

プロジェクトにアクセス可能なゲーム開発者を表すエンティティです。

ユーザーにはプログラムからアクセスするためのクレデンシャルや、
ユーザーの権限に基づいてマネージメントコンソールにログインし、プロジェクトを管理できるパスワードを登録できます。

有効化条件必須デフォルト値の制限説明
userIdstring
~ 1024文字ユーザー GRN
namestring
~ 128文字ユーザー名
descriptionstring~ 1024文字説明文
createdAtlong
現在時刻作成日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
updatedAtlong
現在時刻最終更新日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
revisionlong00 ~ 9223372036854775805リビジョン

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

説明
ItemUser作成したユーザ

実装例

Type: GS2::Identifier::User
Properties:
  Name: user-0001
  Description: null
import (
    "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 Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.User(
            stack: this,
            name: "user-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import 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 Template

SecurityPolicy

セキュリティーポリシー

ユーザが利用できるAPIの種類やアクセスできるリソースの制限を定義します。
アクセス制限のルールはポリシードキュメントというJSON形式の定義データを使用します。
ポリシードキュメントの仕様については 開発資料内のポリシードキュメントについての解説ページを参照してください。

有効化条件必須デフォルト値の制限説明
securityPolicyIdstring
~ 1024文字セキュリティポリシー GRN
namestring
~ 128文字セキュリティポリシー名
descriptionstring~ 1024文字説明文
policystring
~ 524288文字ポリシードキュメント
createdAtlong
現在時刻作成日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
updatedAtlong
現在時刻最終更新日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

説明
ItemSecurityPolicy作成したセキュリティポリシー

実装例

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 Template
public 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 Template
import 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 Template

Identifier

クレデンシャル

GS2のAPIにアクセスするために必要となるAPIキーです。
クレデンシャルはクライアントIDとクライアントシークレットからなり、クレデンシャルを使用したアクセスは、クレデンシャルの所有者となるユーザの権限に基づいてアクセス制限が施されます。

有効化条件必須デフォルト値の制限説明
clientIdstring
UUID~ 256文字クライアントID
userNamestring
~ 128文字ユーザー名
clientSecretstring
UUID~ 100文字クライアントシークレット
createdAtlong
現在時刻作成日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
revisionlong00 ~ 9223372036854775805リビジョン

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

説明
ItemIdentifier作成したクレデンシャル
ClientSecretstringクライアントシークレット

実装例

Type: GS2::Identifier::Identifier
Properties:
  UserName: user-0001
import (
    "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 Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Identifier.Model.Identifier(
            stack: this,
            userName: "user-0001"
        );
    }
}

Debug.Log(new SampleStack().Yaml());  // Generate Template
import 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 Template

Password

パスワード

マネージメントコンソールにユーザの権限に基づいてログインするためのパスワード。
パスワードを設定することで、1つのプロジェクトに異なるアカウントからログインでき、なおかつアクセスできる情報に制限をかけることができます。

有効化条件必須デフォルト値の制限説明
passwordIdstring
~ 1024文字パスワード GRN
userIdstring
~ 1024文字ユーザー GRN
userNamestring
~ 128文字ユーザー名
enableTwoFactorAuthentication文字列列挙型
enum {
  “RFC6238”,
  “Disable”
}
“Disable”~ 128文字二要素認証
定義説明
“RFC6238”有効
“Disable”無効
twoFactorAuthenticationSettingTwoFactorAuthenticationSetting{enableTwoFactorAuthentication} == “RFC6238”二要素認証設定
※ enableTwoFactorAuthentication が “RFC6238” であれば 有効
createdAtlong
現在時刻作成日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
revisionlong00 ~ 9223372036854775805リビジョン

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

説明
ItemPassword作成したパスワード

実装例

Type: GS2::Identifier::Password
Properties:
  UserName: user-0001
  Password: password-0001
import (
    "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 Template
public 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 Template
import 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 Template

TwoFactorAuthenticationSetting

二要素認証設定

有効化条件必須デフォルト値の制限説明
status文字列列挙型
enum {
  “Verifying”,
  “Enable”
}
“Verifying”~ 128文字ステータス
定義説明
“Verifying”検証中
“Enable”有効

AttachSecurityPolicy

アタッチされたセキュリティポリシー

有効化条件必須デフォルト値の制限説明
userIdstring
~ 1024文字ユーザー GRN
securityPolicyIdsList<string>[]0 ~ 100 itemsセキュリティポリシー のGRNのリスト
attachedAtlong
現在時刻作成日時
UNIX 時間・ミリ秒
サーバー側で自動的に設定
revisionlong00 ~ 9223372036854775805リビジョン

GetAttr

!GetAttrタグで取得可能なリソースの生成結果

説明
ItemsSecurityPolicy[]新しくユーザーに割り当てたセキュリティポリシーのリスト

実装例

Type: GS2::Identifier::AttachSecurityPolicy
Properties:
  UserName: user-0001
  SecurityPolicyId: securityPolicyId-0001
import (
    "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 Template
public 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 Template
import 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