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

エンティティ

Namespace

ネームスペース

ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。 GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。

そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。

必須デフォルト値の制限説明
namestring~ 32文字ネームスペース名
descriptionstring~ 1024文字説明文
logSettingLogSettingログの出力設定

GetAttr

説明
ItemNamespace作成したネームスペース

実装例

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

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        key.Namespace(
            stack=self,
            name="namespace-0001",
            options=key.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\Key\Model\Namespace_(
            stack: $this,
            name: "namespace-0001",
            options: new \Gs2Cdk\Key\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.key.model.Namespace(
            this,
            "namespace-0001",
            new io.gs2.cdk.key.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 key from "@/gs2cdk/key";

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new key.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.Gs2Key.Model.Namespace(
            this,
            "namespace-0001",
            new Gs2Cdk.Gs2Key.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

Key

暗号鍵

GS2 で暗号化処理が必要な場合にここで作成する暗号鍵のGRNを指定する必要があります。 具体的な暗号鍵の内容は GS2 の外に出ることはなく、安全に暗号化・復号処理を行えます。

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
namestring~ 128文字暗号鍵名
descriptionstring~ 1024文字説明文

GetAttr

説明
ItemKey作成した暗号鍵

実装例

Type: GS2::Key::Key
Properties:
  NamespaceName: namespace1
  Name: key-0001
  Description: null
from gs2_cdk import Stack, core, key

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        key.Key(
            stack=self,
            namespace_name="namespace-0001",
            name='key-0001',
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Key\Model\Key(
            stack: $this,
            namespaceName: "namespace-0001",
            name: "key-0001",
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.key.model.Key(
            this,
            "namespace-0001",
            "key-0001"
        );
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new key.model.Key(
            this,
            "namespace-0001",
            "key-0001"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Key.Model.Key(
            this,
            "namespace-0001",
            "key-0001"
        );
    }
}

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

GitHubApiKey

GitHub APIキー

GS2 ではマスターデータや GS2-Deploy のテンプレートファイルなどファイルをアップロードするインターフェースが複数あります。 このようなインターフェースに対して、データをアップロードするのではなく、GitHunの特定のリポジトリの特定のブランチやタグから設定を反映するインターフェースが用意されています。

このインターフェースを利用するにあたって必要となる GitHub の APIキー を格納します。

必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
namestring~ 128文字GitHub APIキー名
descriptionstring~ 1024文字説明文
apiKeystring~ 1024文字APIキー
encryptionKeyNamestring~ 128文字暗号鍵名

GetAttr

説明
ItemGitHubApiKey作成したGitHub のAPIキー

実装例

Type: GS2::Key::GitHubApiKey
Properties:
  NamespaceName: namespace1
  Name: api-key-0001
  Description: null
  ApiKey: secret-0001
  EncryptionKeyName: $key1.name
from gs2_cdk import Stack, core, key

class SampleStack(Stack):

    def __init__(self):
        super().__init__()
        key.GitHubApiKey(
            stack=self,
            namespace_name="namespace-0001",
            name='api-key-0001',
            api_key='secret-0001',
            encryption_key_name=self.key1.name,
        )

print(SampleStack().yaml())  # Generate Template
class SampleStack extends \Gs2Cdk\Core\Model\Stack
{
    function __construct() {
        parent::__construct();
        new \Gs2Cdk\Key\Model\GitHubApiKey(
            stack: $this,
            namespaceName: "namespace-0001",
            name: "api-key-0001",
            apiKey: "secret-0001",
            encryptionKeyName: self::$key1.name,
        );
    }
}

print((new SampleStack())->yaml());  // Generate Template
class SampleStack extends io.gs2.cdk.core.model.Stack
{
    public SampleStack() {
        super();
        new io.gs2.cdk.key.model.GitHubApiKey(
            this,
            "namespace-0001",
            "api-key-0001",
            "secret-0001",
            "$key1.name"
        );
    }
}

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

class SampleStack extends core.Stack
{
    public constructor() {
        super();
        new key.model.GitHubApiKey(
            this,
            "namespace-0001",
            "api-key-0001",
            "secret-0001",
            "$key1.name"
        );
    }
}

console.log(new SampleStack().yaml());  // Generate Template
public class SampleStack : Gs2Cdk.Core.Model.Stack
{
    public SampleStack() {
        new Gs2Cdk.Gs2Key.Model.GitHubApiKey(
            this,
            "namespace-0001",
            "api-key-0001",
            "secret-0001",
            "$key1.name"
        );
    }
}

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

LogSetting

ログの書き出し設定

ログデータの書き出し設定を管理します。この型は、ログデータを書き出すために使用されるログ名前空間の識別子(Namespace ID)を保持します。 ログ名前空間IDは、ログデータを集約し、保存する対象の GS2-Log の名前空間を指定します。 この設定を通じて、この名前空間以下のAPIリクエスト・レスポンスログデータが対象の GS2-Log へ出力されるようになります。 GS2-Log にはリアルタイムでログが提供され、システムの監視や分析、デバッグなどに利用できます。

必須デフォルト値の制限説明
loggingNamespaceIdstring~ 1024文字ネームスペースGRN