GS2-Deploy/CDK Reference of GS2-Key

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~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
logSettingLogSettingLog output settings

GetAttr

TypeDescription
ItemNamespaceNamespace created

Implementation Example

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(
                        loggingNamespaceId = "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(
                    LoggingNamespaceId = "grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"
                )
            }
        );
    }
}

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

Key

Encryption key

The GRN of the encryption key to be created here must be specified when encryption processing is required by GS2. The contents of the specific encryption key will not be disclosed outside of GS2, and encryption and decryption can be performed securely.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
namestring~ 128 charsEncryption key name
descriptionstring~ 1024 charsDescription

GetAttr

TypeDescription
ItemKeyCreated encryption key

Implementation Example

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 Key

GS2 has several interfaces for uploading files such as master data and GS2-Deploy template files. For these interfaces, instead of uploading data, GS2 provides an interface to reflect settings from a specific branch or tag in a specific repository on GitHun.

This interface stores the GitHub API key needed to use this interface.

TypeRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
namestring~ 128 charsGitHub API key name
descriptionstring~ 1024 charsDescription
apiKeystring~ 1024 charsAPI Key
encryptionKeyNamestring~ 128 charsEncryption key name

GetAttr

TypeDescription
ItemGitHubApiKeyThe GitHub API key you created

Implementation Example

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

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