API Reference of GS2-Key SDK

Specification of models and API references for GS2-SDK for various programming languages

Model

Namespace

Namespace

A namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.

Therefore, you must create a namespace before you can start using each service.

TypeConditionRequiredDefaultValue LimitsDescription
namespaceIdstring
~ 1024 charsNamespace GRN
namestring
~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
logSettingLogSettingLog output settings
createdAtlong
NowDatetime of creation
Unix time, milliseconds
updatedAtlong
NowDatetime of last update
Unix time, milliseconds
revisionlong00 ~ 9223372036854775805Revision

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.

TypeConditionRequiredDefaultValue LimitsDescription
keyIdstring
~ 1024 charsencryption key GRN
namestring
~ 128 charsEncryption key name
descriptionstring~ 1024 charsDescription
createdAtlong
NowDatetime of creation
Unix time, milliseconds
updatedAtlong
NowDatetime of last update
Unix time, milliseconds
revisionlong00 ~ 9223372036854775805Revision

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 GitHub.

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

TypeConditionRequiredDefaultValue LimitsDescription
apiKeyIdstring
~ 1024 charsGitHub API key GRN
namestring
~ 128 charsGitHub API key name
descriptionstring~ 1024 charsDescription
encryptionKeyNamestring
~ 128 charsEncryption key name
createdAtlong
NowDatetime of creation
Unix time, milliseconds
updatedAtlong
NowDatetime of last update
Unix time, milliseconds
revisionlong00 ~ 9223372036854775805Revision

LogSetting

Log Export Settings

Manages log data export settings. This type holds the GS2-Log namespace identifier (Namespace ID) used to export log data. Specify the GS2-Log namespace where log data is collected and stored in the GRN format for the Log Namespace ID (loggingNamespaceId). Configuring this setting ensures that log data for API requests and responses occurring within the specified namespace is output to the target GS2-Log namespace. GS2-Log provides real-time logs that can be used for system monitoring, analysis, and debugging.

TypeConditionRequiredDefaultValue LimitsDescription
loggingNamespaceIdstring
~ 1024 charsGS2-Log namespace GRN to output logs

Methods

describeNamespaces

Get list of namespaces

Request

TypeConditionRequiredDefaultValue LimitsDescription
namePrefixstring~ 64 charsFilter by namespace name prefix
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint
301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<Namespace>List of Namespace
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

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 {
        NamePrefix: nil,
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withNamePrefix(null)
            ->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()
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Key.Request.DescribeNamespacesRequest()
        .WithNamePrefix(null)
        .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()
            .withNamePrefix(null)
            .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_name_prefix(None)
            .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({
    namePrefix=nil,
    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;
client = gs2('key')

api_result_handler = client.describe_namespaces_async({
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

Create a new namespace

Request

TypeConditionRequiredDefaultValue LimitsDescription
namestring
~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceNamespace created

Implementation Example

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("namespace-0001"),
        Description: nil,
        LogSetting: &key.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->createNamespace(
        (new CreateNamespaceRequest())
            ->withName("namespace-0001")
            ->withDescription(null)
            ->withLogSetting((new \Gs2\Key\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.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("namespace-0001")
            .withDescription(null)
            .withLogSetting(new io.gs2.key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
    new Gs2.Gs2Key.Request.CreateNamespaceRequest()
        .WithName("namespace-0001")
        .WithDescription(null)
        .WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.createNamespace(
        new Gs2Key.CreateNamespaceRequest()
            .withName("namespace-0001")
            .withDescription(null)
            .withLogSetting(new Gs2Key.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.create_namespace(
        key.CreateNamespaceRequest()
            .with_name('namespace-0001')
            .with_description(None)
            .with_log_setting(
                key.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

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

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

result = api_result.result
item = result.item;
client = gs2('key')

api_result_handler = client.create_namespace_async({
    name="namespace-0001",
    description=nil,
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getNamespaceStatus

Get namespace status

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name

Result

TypeDescription
statusstring

Implementation Example

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("namespace-0001"),
    }
)
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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->getNamespaceStatus(
        (new GetNamespaceStatusRequest())
            ->withNamespaceName("namespace-0001")
    );
    $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("namespace-0001")
    );
    String status = result.getStatus();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
    new Gs2.Gs2Key.Request.GetNamespaceStatusRequest()
        .WithNamespaceName("namespace-0001"),
    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("namespace-0001")
    );
    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('namespace-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_namespace_status({
    namespaceName="namespace-0001",
})

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

result = api_result.result
status = result.status;
client = gs2('key')

api_result_handler = client.get_namespace_status_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
status = result.status;

getNamespace

Get namespace

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name

Result

TypeDescription
itemNamespaceNamespace

Implementation Example

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("namespace-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\GetNamespaceRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->getNamespace(
        (new GetNamespaceRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
    new Gs2.Gs2Key.Request.GetNamespaceRequest()
        .WithNamespaceName("namespace-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.getNamespace(
        new Gs2Key.GetNamespaceRequest()
            .withNamespaceName("namespace-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_namespace(
        key.GetNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_namespace({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('key')

api_result_handler = client.get_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateNamespace

Update namespace

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
logSettingLogSettingLog output settings

Result

TypeDescription
itemNamespaceUpdated namespace

Implementation Example

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("namespace-0001"),
        Description: pointy.String("description1"),
        LogSetting: &key.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->updateNamespace(
        (new UpdateNamespaceRequest())
            ->withNamespaceName("namespace-0001")
            ->withDescription("description1")
            ->withLogSetting((new \Gs2\Key\Model\LogSetting())
                ->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.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("namespace-0001")
            .withDescription("description1")
            .withLogSetting(new io.gs2.key.model.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
    new Gs2.Gs2Key.Request.UpdateNamespaceRequest()
        .WithNamespaceName("namespace-0001")
        .WithDescription("description1")
        .WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.updateNamespace(
        new Gs2Key.UpdateNamespaceRequest()
            .withNamespaceName("namespace-0001")
            .withDescription("description1")
            .withLogSetting(new Gs2Key.LogSetting()
                .withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-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.update_namespace(
        key.UpdateNamespaceRequest()
            .with_namespace_name('namespace-0001')
            .with_description('description1')
            .with_log_setting(
                key.LogSetting()
                    .with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

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

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

result = api_result.result
item = result.item;
client = gs2('key')

api_result_handler = client.update_namespace_async({
    namespaceName="namespace-0001",
    description="description1",
    logSetting={
        loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
    },
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

deleteNamespace

Delete namespace

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name

Result

TypeDescription
itemNamespaceUpdated namespace

Implementation Example

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("namespace-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\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->deleteNamespace(
        (new DeleteNamespaceRequest())
            ->withNamespaceName("namespace-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.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("namespace-0001")
    );
    Namespace item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
    new Gs2.Gs2Key.Request.DeleteNamespaceRequest()
        .WithNamespaceName("namespace-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.deleteNamespace(
        new Gs2Key.DeleteNamespaceRequest()
            .withNamespaceName("namespace-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_namespace(
        key.DeleteNamespaceRequest()
            .with_namespace_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.delete_namespace({
    namespaceName="namespace-0001",
})

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

result = api_result.result
item = result.item;
client = gs2('key')

api_result_handler = client.delete_namespace_async({
    namespaceName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getServiceVersion

Get version of microservice

Request

TypeConditionRequiredDefaultValue LimitsDescription

Result

TypeDescription
itemstringVersion

Implementation Example

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.GetServiceVersion(
    &key.GetServiceVersionRequest {
    }
)
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\GetServiceVersionRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->getServiceVersion(
        (new GetServiceVersionRequest())
    );
    $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.GetServiceVersionRequest;
import io.gs2.key.result.GetServiceVersionResult;

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

try {
    GetServiceVersionResult result = client.getServiceVersion(
        new GetServiceVersionRequest()
    );
    String item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
    new Gs2.Gs2Key.Request.GetServiceVersionRequest(),
    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.getServiceVersion(
        new Gs2Key.GetServiceVersionRequest()
    );
    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_service_version(
        key.GetServiceVersionRequest()
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_service_version({
})

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

result = api_result.result
item = result.item;
client = gs2('key')

api_result_handler = client.get_service_version_async({
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

describeKeys

Get list of encryption keys

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
namePrefixstring~ 64 charsFilter by encryption key name prefix
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint
301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<Key>List of Encryption key
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

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("namespace-0001"),
        NamePrefix: nil,
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->describeKeys(
        (new DescribeKeysRequest())
            ->withNamespaceName("namespace-0001")
            ->withNamePrefix(null)
            ->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("namespace-0001")
            .withNamePrefix(null)
            .withPageToken(null)
            .withLimit(null)
    );
    List<Key> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeKeysResult> asyncResult = null;
yield return client.DescribeKeys(
    new Gs2.Gs2Key.Request.DescribeKeysRequest()
        .WithNamespaceName("namespace-0001")
        .WithNamePrefix(null)
        .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("namespace-0001")
            .withNamePrefix(null)
            .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('namespace-0001')
            .with_name_prefix(None)
            .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="namespace-0001",
    namePrefix=nil,
    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;
client = gs2('key')

api_result_handler = client.describe_keys_async({
    namespaceName="namespace-0001",
    namePrefix=nil,
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

Create new encryption key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
namestring
~ 128 charsEncryption key name
descriptionstring~ 1024 charsDescription

Result

TypeDescription
itemKeyCreated encryption key

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->createKey(
        (new CreateKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withName("key-0001")
            .withDescription(null)
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateKeyResult> asyncResult = null;
yield return client.CreateKey(
    new Gs2.Gs2Key.Request.CreateKeyRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.create_key_async({
    namespaceName="namespace-0001",
    name="key-0001",
    description=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateKey

Update encryption key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
keyNamestring
~ 128 charsEncryption key name
descriptionstring~ 1024 charsDescription

Result

TypeDescription
itemKeyUpdated encryption key

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->updateKey(
        (new UpdateKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withKeyName("key-0001")
            .withDescription("description1")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateKeyResult> asyncResult = null;
yield return client.UpdateKey(
    new Gs2.Gs2Key.Request.UpdateKeyRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.update_key_async({
    namespaceName="namespace-0001",
    keyName="key-0001",
    description="description1",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getKey

Get encryption key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
keyNamestring
~ 128 charsEncryption key name

Result

TypeDescription
itemKeyEncryption key

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->getKey(
        (new GetKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withKeyName("key-0001")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetKeyResult> asyncResult = null;
yield return client.GetKey(
    new Gs2.Gs2Key.Request.GetKeyRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_key({
    namespaceName="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.get_key_async({
    namespaceName="namespace-0001",
    keyName="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

deleteKey

Delete encryption key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
keyNamestring
~ 128 charsEncryption key name

Result

TypeDescription
itemKeyDeleted encryption key

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->deleteKey(
        (new DeleteKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withKeyName("key-0001")
    );
    Key item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DeleteKeyResult> asyncResult = null;
yield return client.DeleteKey(
    new Gs2.Gs2Key.Request.DeleteKeyRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .with_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.delete_key({
    namespaceName="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.delete_key_async({
    namespaceName="namespace-0001",
    keyName="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

encrypt

Encrypt data

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
keyNamestring
~ 128 charsEncryption key name
datastring
~ 524288 chars

Result

TypeDescription
datastringEncrypted Data

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->encrypt(
        (new EncryptRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    String data = result.getData();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.EncryptResult> asyncResult = null;
yield return client.Encrypt(
    new Gs2.Gs2Key.Request.EncryptRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.encrypt_async({
    namespaceName="namespace-0001",
    keyName="key-0001",
    data="hoge",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
data = result.data;

decrypt

Decrypt data

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
keyNamestring
~ 128 charsEncryption key name
datastring
~ 524288 chars

Result

TypeDescription
datastringdecrypted data

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->decrypt(
        (new DecryptRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withKeyName("key-0001")
            .withData("hoge")
    );
    String data = result.getData();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DecryptResult> asyncResult = null;
yield return client.Decrypt(
    new Gs2.Gs2Key.Request.DecryptRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.decrypt_async({
    namespaceName="namespace-0001",
    keyName="key-0001",
    data="hoge",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
data = result.data;

describeGitHubApiKeys

Get list of GitHub API keys

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint
301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<GitHubApiKey>List of GitHub API Keys
nextPageTokenstringPage token to retrieve the rest of the listing

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->describeGitHubApiKeys(
        (new DescribeGitHubApiKeysRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<GitHubApiKey> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DescribeGitHubApiKeysResult> asyncResult = null;
yield return client.DescribeGitHubApiKeys(
    new Gs2.Gs2Key.Request.DescribeGitHubApiKeysRequest()
        .WithNamespaceName("namespace-0001")
        .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("namespace-0001")
            .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('namespace-0001')
            .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="namespace-0001",
    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;
client = gs2('key')

api_result_handler = client.describe_git_hub_api_keys_async({
    namespaceName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

Create a new API key for GitHub

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
namestring
~ 128 charsGitHub API key name
descriptionstring~ 1024 charsDescription
encryptionKeyNamestring
~ 128 charsEncryption key name

Result

TypeDescription
itemGitHubApiKeyThe GitHub API key you created

Implementation Example

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("namespace-0001"),
        Name: pointy.String("api-key-0001"),
        Description: nil,
        ApiKey: pointy.String("secret-0001"),
        EncryptionKeyName: 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\CreateGitHubApiKeyRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->createGitHubApiKey(
        (new CreateGitHubApiKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->withName("api-key-0001")
            ->withDescription(null)
            ->withApiKey("secret-0001")
            ->withEncryptionKeyName("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.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("namespace-0001")
            .withName("api-key-0001")
            .withDescription(null)
            .withApiKey("secret-0001")
            .withEncryptionKeyName("key-0001")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.CreateGitHubApiKeyResult> asyncResult = null;
yield return client.CreateGitHubApiKey(
    new Gs2.Gs2Key.Request.CreateGitHubApiKeyRequest()
        .WithNamespaceName("namespace-0001")
        .WithName("api-key-0001")
        .WithDescription(null)
        .WithApiKey("secret-0001")
        .WithEncryptionKeyName("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.createGitHubApiKey(
        new Gs2Key.CreateGitHubApiKeyRequest()
            .withNamespaceName("namespace-0001")
            .withName("api-key-0001")
            .withDescription(null)
            .withApiKey("secret-0001")
            .withEncryptionKeyName("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.create_git_hub_api_key(
        key.CreateGitHubApiKeyRequest()
            .with_namespace_name('namespace-0001')
            .with_name('api-key-0001')
            .with_description(None)
            .with_api_key('secret-0001')
            .with_encryption_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.create_git_hub_api_key({
    namespaceName="namespace-0001",
    name="api-key-0001",
    description=nil,
    apiKey="secret-0001",
    encryptionKeyName="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;
client = gs2('key')

api_result_handler = client.create_git_hub_api_key_async({
    namespaceName="namespace-0001",
    name="api-key-0001",
    description=nil,
    apiKey="secret-0001",
    encryptionKeyName="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

updateGitHubApiKey

Update GitHub API key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
apiKeyNamestring
~ 128 charsGitHub API key name
descriptionstring~ 1024 charsDescription
encryptionKeyNamestring
~ 128 charsEncryption key name

Result

TypeDescription
itemGitHubApiKeyUpdated GitHub API key

Implementation Example

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("namespace-0001"),
        ApiKeyName: pointy.String("api-key-0001"),
        Description: pointy.String("description1"),
        ApiKey: pointy.String("secret-0004"),
        EncryptionKeyName: 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\UpdateGitHubApiKeyRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->updateGitHubApiKey(
        (new UpdateGitHubApiKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->withApiKeyName("api-key-0001")
            ->withDescription("description1")
            ->withApiKey("secret-0004")
            ->withEncryptionKeyName("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.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("namespace-0001")
            .withApiKeyName("api-key-0001")
            .withDescription("description1")
            .withApiKey("secret-0004")
            .withEncryptionKeyName("key-0001")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.UpdateGitHubApiKeyResult> asyncResult = null;
yield return client.UpdateGitHubApiKey(
    new Gs2.Gs2Key.Request.UpdateGitHubApiKeyRequest()
        .WithNamespaceName("namespace-0001")
        .WithApiKeyName("api-key-0001")
        .WithDescription("description1")
        .WithApiKey("secret-0004")
        .WithEncryptionKeyName("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.updateGitHubApiKey(
        new Gs2Key.UpdateGitHubApiKeyRequest()
            .withNamespaceName("namespace-0001")
            .withApiKeyName("api-key-0001")
            .withDescription("description1")
            .withApiKey("secret-0004")
            .withEncryptionKeyName("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.update_git_hub_api_key(
        key.UpdateGitHubApiKeyRequest()
            .with_namespace_name('namespace-0001')
            .with_api_key_name('api-key-0001')
            .with_description('description1')
            .with_api_key('secret-0004')
            .with_encryption_key_name('key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.update_git_hub_api_key({
    namespaceName="namespace-0001",
    apiKeyName="api-key-0001",
    description="description1",
    apiKey="secret-0004",
    encryptionKeyName="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;
client = gs2('key')

api_result_handler = client.update_git_hub_api_key_async({
    namespaceName="namespace-0001",
    apiKeyName="api-key-0001",
    description="description1",
    apiKey="secret-0004",
    encryptionKeyName="key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

getGitHubApiKey

Get GitHub API key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
apiKeyNamestring
~ 128 charsGitHub API key name

Result

TypeDescription
itemGitHubApiKeyGitHub API key

Implementation Example

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("namespace-0001"),
        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 Gs2KeyRestClient(
    $session
);

try {
    $result = $client->getGitHubApiKey(
        (new GetGitHubApiKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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("namespace-0001")
            .withApiKeyName("api-key-0001")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.GetGitHubApiKeyResult> asyncResult = null;
yield return client.GetGitHubApiKey(
    new Gs2.Gs2Key.Request.GetGitHubApiKeyRequest()
        .WithNamespaceName("namespace-0001")
        .WithApiKeyName("api-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.getGitHubApiKey(
        new Gs2Key.GetGitHubApiKeyRequest()
            .withNamespaceName("namespace-0001")
            .withApiKeyName("api-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_git_hub_api_key(
        key.GetGitHubApiKeyRequest()
            .with_namespace_name('namespace-0001')
            .with_api_key_name('api-key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.get_git_hub_api_key({
    namespaceName="namespace-0001",
    apiKeyName="api-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;
client = gs2('key')

api_result_handler = client.get_git_hub_api_key_async({
    namespaceName="namespace-0001",
    apiKeyName="api-key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

deleteGitHubApiKey

Delete GitHub API key

Request

TypeConditionRequiredDefaultValue LimitsDescription
namespaceNamestring
~ 128 charsNamespace name
apiKeyNamestring
~ 128 charsGitHub API key name

Result

TypeDescription
itemGitHubApiKeyDeleted GitHub API key

Implementation Example

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.DeleteGitHubApiKey(
    &key.DeleteGitHubApiKeyRequest {
        NamespaceName: pointy.String("namespace-0001"),
        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\DeleteGitHubApiKeyRequest;

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

$session->open();

$client = new Gs2KeyRestClient(
    $session
);

try {
    $result = $client->deleteGitHubApiKey(
        (new DeleteGitHubApiKeyRequest())
            ->withNamespaceName("namespace-0001")
            ->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.DeleteGitHubApiKeyRequest;
import io.gs2.key.result.DeleteGitHubApiKeyResult;

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

try {
    DeleteGitHubApiKeyResult result = client.deleteGitHubApiKey(
        new DeleteGitHubApiKeyRequest()
            .withNamespaceName("namespace-0001")
            .withApiKeyName("api-key-0001")
    );
    GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2KeyRestClient(session);

AsyncResult<Gs2.Gs2Key.Result.DeleteGitHubApiKeyResult> asyncResult = null;
yield return client.DeleteGitHubApiKey(
    new Gs2.Gs2Key.Request.DeleteGitHubApiKeyRequest()
        .WithNamespaceName("namespace-0001")
        .WithApiKeyName("api-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.deleteGitHubApiKey(
        new Gs2Key.DeleteGitHubApiKeyRequest()
            .withNamespaceName("namespace-0001")
            .withApiKeyName("api-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_git_hub_api_key(
        key.DeleteGitHubApiKeyRequest()
            .with_namespace_name('namespace-0001')
            .with_api_key_name('api-key-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)
client = gs2('key')

api_result = client.delete_git_hub_api_key({
    namespaceName="namespace-0001",
    apiKeyName="api-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;
client = gs2('key')

api_result_handler = client.delete_git_hub_api_key_async({
    namespaceName="namespace-0001",
    apiKeyName="api-key-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;