GS2-Key SDK API リファレンス

モデル

Namespace

ネームスペース

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

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

有効化条件必須デフォルト値の制限説明
namespaceIdstring~ 1024文字ネームスペースGRN
namestring~ 32文字ネームスペース名
descriptionstring~ 1024文字説明文
logSettingLogSettingログの出力設定
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

Key

暗号鍵

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

有効化条件必須デフォルト値の制限説明
keyIdstring~ 1024文字暗号鍵GRN
namestring~ 128文字暗号鍵名
descriptionstring~ 1024文字説明文
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

GitHubApiKey

GitHub APIキー

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

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

有効化条件必須デフォルト値の制限説明
apiKeyIdstring~ 1024文字GitHub のAPIキーGRN
namestring~ 128文字GitHub APIキー名
descriptionstring~ 1024文字説明文
encryptionKeyNamestring~ 128文字暗号鍵名
createdAtlong作成日時
updatedAtlong最終更新日時
revisionlong0~ 9223372036854775805リビジョン

LogSetting

ログの書き出し設定

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

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

メソッド

describeNamespaces

ネームスペースの一覧を取得

Request

有効化条件必須デフォルト値の制限説明
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Namespace>ネームスペースのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &key.DescribeNamespacesRequest {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeNamespacesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeNamespacesRequest;
import io.gs2.key.result.DescribeNamespacesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DescribeNamespacesResult result = client.describeNamespaces(
        new DescribeNamespacesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeNamespacesRequest;
using Gs2.Gs2Key.Result.DescribeNamespacesResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Key.Request.DescribeNamespacesRequest()
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.describeNamespaces(
        new Gs2Key.DescribeNamespacesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.describe_namespaces(
        key.DescribeNamespacesRequest()
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.describe_namespaces({
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createNamespace

ネームスペースを新規作成

Request

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

Result

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

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &key.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        LogSetting: &key.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName(self::namespace1)
            ->withDescription(null)
            ->withLogSetting((new \Gs2\Key\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateNamespaceRequest;
import io.gs2.key.result.CreateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    CreateNamespaceResult result = client.createNamespace(
        new CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withLogSetting(new io.gs2.key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateNamespaceRequest;
using Gs2.Gs2Key.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Key.Request.CreateNamespaceRequest()
        .WithName("namespace1")
        .WithDescription(null)
        .WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.createNamespace(
        new Gs2Key.CreateNamespaceRequest()
            .withName("namespace1")
            .withDescription(null)
            .withLogSetting(new Gs2Key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.create_namespace(
        key.CreateNamespaceRequest()
            .with_name(self.hash1)
            .with_description(None)
            .with_log_setting(
                key.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.create_namespace({
    name="namespace1",
    description=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

getNamespaceStatus

ネームスペースの状態を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
statusstring

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &key.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetNamespaceStatusRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName(self::namespace1)
    );
    $status = $result->getStatus();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetNamespaceStatusRequest;
import io.gs2.key.result.GetNamespaceStatusResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    GetNamespaceStatusResult result = client.getNamespaceStatus(
        new GetNamespaceStatusRequest()
            .withNamespaceName("namespace1")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Key.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Key.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.getNamespaceStatus(
        new Gs2Key.GetNamespaceStatusRequest()
            .withNamespaceName("namespace1")
    );
    const status = result.getStatus();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.get_namespace_status(
        key.GetNamespaceStatusRequest()
            .with_namespace_name(self.hash1)
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_namespace_status({
    namespaceName="namespace1",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
status = result.status;

getNamespace

ネームスペースを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemNamespaceネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &key.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetNamespaceRequest;
import io.gs2.key.result.GetNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    GetNamespaceResult result = client.getNamespace(
        new GetNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetNamespaceRequest;
using Gs2.Gs2Key.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Key.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.getNamespace(
        new Gs2Key.GetNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.get_namespace(
        key.GetNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_namespace({
    namespaceName="namespace1",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

updateNamespace

ネームスペースを更新

Request

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

Result

説明
itemNamespace更新したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &key.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        LogSetting: &key.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName(self::namespace1)
            ->withDescription("description1")
            ->withLogSetting((new \Gs2\Key\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateNamespaceRequest;
import io.gs2.key.result.UpdateNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    UpdateNamespaceResult result = client.updateNamespace(
        new UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withLogSetting(new io.gs2.key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateNamespaceRequest;
using Gs2.Gs2Key.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Key.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace1")
        .WithDescription("description1")
        .WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.updateNamespace(
        new Gs2Key.UpdateNamespaceRequest()
            .withNamespaceName("namespace1")
            .withDescription("description1")
            .withLogSetting(new Gs2Key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.update_namespace(
        key.UpdateNamespaceRequest()
            .with_namespace_name(self.hash1)
            .with_description('description1')
            .with_log_setting(
                key.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.update_namespace({
    namespaceName="namespace1",
    description="description1",
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1",
    },
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

deleteNamespace

ネームスペースを削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名

Result

説明
itemNamespace更新したネームスペース

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &key.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DeleteNamespaceRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName(self::namespace1)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DeleteNamespaceRequest;
import io.gs2.key.result.DeleteNamespaceResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DeleteNamespaceResult result = client.deleteNamespace(
        new DeleteNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DeleteNamespaceRequest;
using Gs2.Gs2Key.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Key.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.deleteNamespace(
        new Gs2Key.DeleteNamespaceRequest()
            .withNamespaceName("namespace1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.delete_namespace(
        key.DeleteNamespaceRequest()
            .with_namespace_name(self.hash1)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.delete_namespace({
    namespaceName="namespace1",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

describeKeys

暗号鍵の一覧を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<Key>暗号鍵のリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.DescribeKeys(
    &key.DescribeKeysRequest {
        NamespaceName: pointy.String("namespace1"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeKeysRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeKeys(
        (new DescribeKeysRequest())
            ->withNamespaceName(self::namespace1)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeKeysRequest;
import io.gs2.key.result.DescribeKeysResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DescribeKeysResult result = client.describeKeys(
        new DescribeKeysRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Key> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeKeysRequest;
using Gs2.Gs2Key.Result.DescribeKeysResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeKeysResult> asyncResult = null;
yield return client.DescribeKeys(
    new Gs2.Gs2Key.Request.DescribeKeysRequest()
        .WithNamespaceName("namespace1")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.describeKeys(
        new Gs2Key.DescribeKeysRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.describe_keys(
        key.DescribeKeysRequest()
            .with_namespace_name(self.hash1)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.describe_keys({
    namespaceName="namespace1",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createKey

暗号鍵を新規作成

Request

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

Result

説明
itemKey作成した暗号鍵

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.CreateKey(
    &key.CreateKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("key-0001"),
        Description: nil,
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createKey(
        (new CreateKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("key-0001")
            ->withDescription(null)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateKeyRequest;
import io.gs2.key.result.CreateKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    CreateKeyResult result = client.createKey(
        new CreateKeyRequest()
            .withNamespaceName("namespace1")
            .withName("key-0001")
            .withDescription(null)
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateKeyRequest;
using Gs2.Gs2Key.Result.CreateKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateKeyResult> asyncResult = null;
yield return client.CreateKey(
    new Gs2.Gs2Key.Request.CreateKeyRequest()
        .WithNamespaceName("namespace1")
        .WithName("key-0001")
        .WithDescription(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.createKey(
        new Gs2Key.CreateKeyRequest()
            .withNamespaceName("namespace1")
            .withName("key-0001")
            .withDescription(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.create_key(
        key.CreateKeyRequest()
            .with_namespace_name(self.hash1)
            .with_name('key-0001')
            .with_description(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.create_key({
    namespaceName="namespace1",
    name="key-0001",
    description=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

updateKey

暗号鍵を更新

Request

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

Result

説明
itemKey更新した暗号鍵

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.UpdateKey(
    &key.UpdateKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        KeyName: pointy.String("key-0001"),
        Description: pointy.String("description1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateKey(
        (new UpdateKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withKeyName("key-0001")
            ->withDescription("description1")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateKeyRequest;
import io.gs2.key.result.UpdateKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    UpdateKeyResult result = client.updateKey(
        new UpdateKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withDescription("description1")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateKeyRequest;
using Gs2.Gs2Key.Result.UpdateKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateKeyResult> asyncResult = null;
yield return client.UpdateKey(
    new Gs2.Gs2Key.Request.UpdateKeyRequest()
        .WithNamespaceName("namespace1")
        .WithKeyName("key-0001")
        .WithDescription("description1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.updateKey(
        new Gs2Key.UpdateKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withDescription("description1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.update_key(
        key.UpdateKeyRequest()
            .with_namespace_name(self.hash1)
            .with_key_name('key-0001')
            .with_description('description1')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.update_key({
    namespaceName="namespace1",
    keyName="key-0001",
    description="description1",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

getKey

暗号鍵を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
keyNamestring~ 128文字暗号鍵名

Result

説明
itemKey暗号鍵

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.GetKey(
    &key.GetKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        KeyName: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getKey(
        (new GetKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withKeyName("key-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetKeyRequest;
import io.gs2.key.result.GetKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    GetKeyResult result = client.getKey(
        new GetKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetKeyRequest;
using Gs2.Gs2Key.Result.GetKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetKeyResult> asyncResult = null;
yield return client.GetKey(
    new Gs2.Gs2Key.Request.GetKeyRequest()
        .WithNamespaceName("namespace1")
        .WithKeyName("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.getKey(
        new Gs2Key.GetKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.get_key(
        key.GetKeyRequest()
            .with_namespace_name(self.hash1)
            .with_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_key({
    namespaceName="namespace1",
    keyName="key-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

deleteKey

暗号鍵を削除

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
keyNamestring~ 128文字暗号鍵名

Result

説明
itemKey削除した暗号鍵

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.DeleteKey(
    &key.DeleteKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        KeyName: pointy.String("key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DeleteKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteKey(
        (new DeleteKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withKeyName("key-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DeleteKeyRequest;
import io.gs2.key.result.DeleteKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DeleteKeyResult result = client.deleteKey(
        new DeleteKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DeleteKeyRequest;
using Gs2.Gs2Key.Result.DeleteKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DeleteKeyResult> asyncResult = null;
yield return client.DeleteKey(
    new Gs2.Gs2Key.Request.DeleteKeyRequest()
        .WithNamespaceName("namespace1")
        .WithKeyName("key-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.deleteKey(
        new Gs2Key.DeleteKeyRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.delete_key(
        key.DeleteKeyRequest()
            .with_namespace_name(self.hash1)
            .with_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.delete_key({
    namespaceName="namespace1",
    keyName="key-0001",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

encrypt

データを暗号化

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
keyNamestring~ 128文字暗号鍵名
datastring~ 1048576文字

Result

説明
datastring暗号化済みデータ

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.Encrypt(
    &key.EncryptRequest {
        NamespaceName: pointy.String("namespace1"),
        KeyName: pointy.String("key-0001"),
        Data: pointy.String("hoge"),
    }
)
if err != nil {
    panic("error occurred")
}
data := result.Data
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\EncryptRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->encrypt(
        (new EncryptRequest())
            ->withNamespaceName(self::namespace1)
            ->withKeyName("key-0001")
            ->withData("hoge")
    );
    $data = $result->getData();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.EncryptRequest;
import io.gs2.key.result.EncryptResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    EncryptResult result = client.encrypt(
        new EncryptRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    String data = result.getData();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.EncryptRequest;
using Gs2.Gs2Key.Result.EncryptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.EncryptResult> asyncResult = null;
yield return client.Encrypt(
    new Gs2.Gs2Key.Request.EncryptRequest()
        .WithNamespaceName("namespace1")
        .WithKeyName("key-0001")
        .WithData("hoge"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var data = result.Data;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.encrypt(
        new Gs2Key.EncryptRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    const data = result.getData();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.encrypt(
        key.EncryptRequest()
            .with_namespace_name(self.hash1)
            .with_key_name('key-0001')
            .with_data('hoge')
    )
    data = result.data
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.encrypt({
    namespaceName="namespace1",
    keyName="key-0001",
    data="hoge",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
data = result.data;

decrypt

データを復号

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
keyNamestring~ 128文字暗号鍵名
datastring~ 1048576文字

Result

説明
datastring復号済みデータ

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.Decrypt(
    &key.DecryptRequest {
        NamespaceName: pointy.String("namespace1"),
        KeyName: pointy.String("key-0001"),
        Data: pointy.String("hoge"),
    }
)
if err != nil {
    panic("error occurred")
}
data := result.Data
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DecryptRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->decrypt(
        (new DecryptRequest())
            ->withNamespaceName(self::namespace1)
            ->withKeyName("key-0001")
            ->withData("hoge")
    );
    $data = $result->getData();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DecryptRequest;
import io.gs2.key.result.DecryptResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DecryptResult result = client.decrypt(
        new DecryptRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    String data = result.getData();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DecryptRequest;
using Gs2.Gs2Key.Result.DecryptResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DecryptResult> asyncResult = null;
yield return client.Decrypt(
    new Gs2.Gs2Key.Request.DecryptRequest()
        .WithNamespaceName("namespace1")
        .WithKeyName("key-0001")
        .WithData("hoge"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var data = result.Data;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.decrypt(
        new Gs2Key.DecryptRequest()
            .withNamespaceName("namespace1")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    const data = result.getData();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.decrypt(
        key.DecryptRequest()
            .with_namespace_name(self.hash1)
            .with_key_name('key-0001')
            .with_data('hoge')
    )
    data = result.data
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.decrypt({
    namespaceName="namespace1",
    keyName="key-0001",
    data="hoge",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
data = result.data;

describeGitHubApiKeys

GitHub のAPIキーの一覧を取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
pageTokenstring~ 1024文字データの取得を開始する位置を指定するトークン
limitint301 ~ 1000データの取得件数

Result

説明
itemsList<GitHubApiKey>GitHub のAPIキーのリスト
nextPageTokenstringリストの続きを取得するためのページトークン

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.DescribeGitHubApiKeys(
    &key.DescribeGitHubApiKeysRequest {
        NamespaceName: pointy.String("namespace1"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeGitHubApiKeysRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeGitHubApiKeys(
        (new DescribeGitHubApiKeysRequest())
            ->withNamespaceName(self::namespace1)
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeGitHubApiKeysRequest;
import io.gs2.key.result.DescribeGitHubApiKeysResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    DescribeGitHubApiKeysResult result = client.describeGitHubApiKeys(
        new DescribeGitHubApiKeysRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    List<GitHubApiKey> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeGitHubApiKeysRequest;
using Gs2.Gs2Key.Result.DescribeGitHubApiKeysResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeGitHubApiKeysResult> asyncResult = null;
yield return client.DescribeGitHubApiKeys(
    new Gs2.Gs2Key.Request.DescribeGitHubApiKeysRequest()
        .WithNamespaceName("namespace1")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.describeGitHubApiKeys(
        new Gs2Key.DescribeGitHubApiKeysRequest()
            .withNamespaceName("namespace1")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.describe_git_hub_api_keys(
        key.DescribeGitHubApiKeysRequest()
            .with_namespace_name(self.hash1)
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.describe_git_hub_api_keys({
    namespaceName="namespace1",
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createGitHubApiKey

GitHub のAPIキーを新規作成

Request

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

Result

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

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.CreateGitHubApiKey(
    &key.CreateGitHubApiKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        Name: pointy.String("api-key-0001"),
        Description: nil,
        ApiKey: pointy.String("secret-0001"),
        EncryptionKeyName: pointy.String("$key1.name"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateGitHubApiKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createGitHubApiKey(
        (new CreateGitHubApiKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withName("api-key-0001")
            ->withDescription(null)
            ->withApiKey("secret-0001")
            ->withEncryptionKeyName(self::$key1.name)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateGitHubApiKeyRequest;
import io.gs2.key.result.CreateGitHubApiKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    CreateGitHubApiKeyResult result = client.createGitHubApiKey(
        new CreateGitHubApiKeyRequest()
            .withNamespaceName("namespace1")
            .withName("api-key-0001")
            .withDescription(null)
            .withApiKey("secret-0001")
            .withEncryptionKeyName("$key1.name")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.CreateGitHubApiKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateGitHubApiKeyResult> asyncResult = null;
yield return client.CreateGitHubApiKey(
    new Gs2.Gs2Key.Request.CreateGitHubApiKeyRequest()
        .WithNamespaceName("namespace1")
        .WithName("api-key-0001")
        .WithDescription(null)
        .WithApiKey("secret-0001")
        .WithEncryptionKeyName("$key1.name"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.createGitHubApiKey(
        new Gs2Key.CreateGitHubApiKeyRequest()
            .withNamespaceName("namespace1")
            .withName("api-key-0001")
            .withDescription(null)
            .withApiKey("secret-0001")
            .withEncryptionKeyName("$key1.name")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.create_git_hub_api_key(
        key.CreateGitHubApiKeyRequest()
            .with_namespace_name(self.hash1)
            .with_name('api-key-0001')
            .with_description(None)
            .with_api_key('secret-0001')
            .with_encryption_key_name(self.key1.name)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.create_git_hub_api_key({
    namespaceName="namespace1",
    name="api-key-0001",
    description=nil,
    apiKey="secret-0001",
    encryptionKeyName="$key1.name",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

updateGitHubApiKey

GitHub のAPIキーを更新

Request

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

Result

説明
itemGitHubApiKey更新したGitHub のAPIキー

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.UpdateGitHubApiKey(
    &key.UpdateGitHubApiKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        ApiKeyName: pointy.String("api-key-0001"),
        Description: pointy.String("description1"),
        ApiKey: pointy.String("secret-0004"),
        EncryptionKeyName: pointy.String("$key1.name"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateGitHubApiKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateGitHubApiKey(
        (new UpdateGitHubApiKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withApiKeyName("api-key-0001")
            ->withDescription("description1")
            ->withApiKey("secret-0004")
            ->withEncryptionKeyName(self::$key1.name)
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateGitHubApiKeyRequest;
import io.gs2.key.result.UpdateGitHubApiKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    UpdateGitHubApiKeyResult result = client.updateGitHubApiKey(
        new UpdateGitHubApiKeyRequest()
            .withNamespaceName("namespace1")
            .withApiKeyName("api-key-0001")
            .withDescription("description1")
            .withApiKey("secret-0004")
            .withEncryptionKeyName("$key1.name")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.UpdateGitHubApiKeyResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateGitHubApiKeyResult> asyncResult = null;
yield return client.UpdateGitHubApiKey(
    new Gs2.Gs2Key.Request.UpdateGitHubApiKeyRequest()
        .WithNamespaceName("namespace1")
        .WithApiKeyName("api-key-0001")
        .WithDescription("description1")
        .WithApiKey("secret-0004")
        .WithEncryptionKeyName("$key1.name"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);

try {
    const result = await client.updateGitHubApiKey(
        new Gs2Key.UpdateGitHubApiKeyRequest()
            .withNamespaceName("namespace1")
            .withApiKeyName("api-key-0001")
            .withDescription("description1")
            .withApiKey("secret-0004")
            .withEncryptionKeyName("$key1.name")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import key

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)

try:
    result = client.update_git_hub_api_key(
        key.UpdateGitHubApiKeyRequest()
            .with_namespace_name(self.hash1)
            .with_api_key_name('api-key-0001')
            .with_description('description1')
            .with_api_key('secret-0004')
            .with_encryption_key_name(self.key1.name)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.update_git_hub_api_key({
    namespaceName="namespace1",
    apiKeyName="api-key-0001",
    description="description1",
    apiKey="secret-0004",
    encryptionKeyName="$key1.name",
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

getGitHubApiKey

GitHub のAPIキーを取得

Request

有効化条件必須デフォルト値の制限説明
namespaceNamestring~ 32文字ネームスペース名
apiKeyNamestring~ 128文字GitHub APIキー名

Result

説明
itemGitHubApiKeyGitHub のAPIキー

実装例

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"

session := core.Gs2RestSession{
    Credential: &core.BasicGs2Credential{
        ClientId: "your client id",
        ClientSecret: "your client secret",
    },
    Region: core.ApNortheast1,
}

if err := session.Connect(); err != nil {
    panic("error occurred")
}

client := key.Gs2KeyRestClient{
    Session: &session,
}
result, err := client.GetGitHubApiKey(
    &key.GetGitHubApiKeyRequest {
        NamespaceName: pointy.String("namespace1"),
        ApiKeyName: pointy.String("api-key-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetGitHubApiKeyRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getGitHubApiKey(
        (new GetGitHubApiKeyRequest())
            ->withNamespaceName(self::namespace1)
            ->withApiKeyName("api-key-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetGitHubApiKeyRequest;
import io.gs2.key.result.GetGitHubApiKeyResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);

try {
    GetGitHubApiKeyResult result = client.getGitHubApiKey(
        new GetGitHubApiKeyRequest()
            .withNamespaceName("namespace1")
            .withApiKeyName("api-key-0001")
    );
    GitHubApiKey item =