GS2-Key
GS2 SDK Reference
GS2 SDK Reference
Models
Namespace
Namespace
Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project.
Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.
Therefore, it is necessary to create a namespace before starting to use each service.
Type | Description | |
---|---|---|
namespaceId | string | Namespace GRN |
name | string | Namespace name |
description | string | description of Namespace |
logSetting | LogSetting | Log output settings |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
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.
Type | Description | |
---|---|---|
keyId | string | encryption key GRN |
name | string | Encryption key name |
description | string | description of Namespace |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
GitHubApiKey
GitHub API Key
GS2 has several interfaces for uploading files such as master data and GS2-Deploy template files.
For these interfaces, instead of uploading data, GS2 provides an interface to reflect settings from a specific branch or tag in a specific repository on GitHun.
This interface stores the GitHub API key needed to use this interface.
Type | Description | |
---|---|---|
apiKeyId | string | GitHub API key GRN |
name | string | GitHub API key name |
description | string | description of Namespace |
encryptionKeyName | string | Name of the encryption key used to encrypt the API key |
createdAt | long | Datetime of creation |
updatedAt | long | Datetime of last update |
LogSetting
Type | Description | |
---|---|---|
loggingNamespaceId | string | Namespace GRN |
Methods
describeNamespaces
describeNamespaces
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&key.DescribeNamespacesRequest {
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeNamespacesRequest;
import io.gs2.key.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeNamespacesRequest;
using Gs2.Gs2Key.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Key.Request.DescribeNamespacesRequest()
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Key.DescribeNamespacesRequest()
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.describe_namespaces(
key.DescribeNamespacesRequest()
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of namespaces
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | Namespace[] | List of Namespace |
nextPageToken | string | Page token to retrieve the rest of the listing |
createNamespace
createNamespace
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&key.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
LogSetting: &key.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName(self::namespace1)
->withDescription(null)
->withLogSetting((new \Gs2\Key\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateNamespaceRequest;
import io.gs2.key.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new io.gs2.key.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateNamespaceRequest;
using Gs2.Gs2Key.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Key.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Key.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withLogSetting(new Gs2Key.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.create_namespace(
key.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_log_setting(
key.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.create_namespace({
name='namespace1',
description=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Create a new namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
name | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace created |
getNamespaceStatus
getNamespaceStatus
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&key.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName(self::namespace1)
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetNamespaceStatusRequest;
import io.gs2.key.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Key.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Key.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Key.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.get_namespace_status(
key.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.get_namespace_status({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
Get namespace status
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
status | string |
getNamespace
getNamespace
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&key.GetNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetNamespaceRequest;
import io.gs2.key.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetNamespaceRequest;
using Gs2.Gs2Key.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Key.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Key.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.get_namespace(
key.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.get_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Namespace |
updateNamespace
updateNamespace
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&key.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
LogSetting: &key.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
},
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName(self::namespace1)
->withDescription("description1")
->withLogSetting((new \Gs2\Key\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:\namespace1"))
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateNamespaceRequest;
import io.gs2.key.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new io.gs2.key.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateNamespaceRequest;
using Gs2.Gs2Key.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Key.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithLogSetting(new Gs2.Gs2Key.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Key.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withLogSetting(new Gs2Key.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.update_namespace(
key.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_log_setting(
key.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.update_namespace({
namespaceName='namespace1',
description='description1',
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
description | string | ~ 1024 chars | description of Namespace | ||
logSetting | LogSetting | Log output settings |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
deleteNamespace
deleteNamespace
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&key.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName(self::namespace1)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DeleteNamespaceRequest;
import io.gs2.key.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DeleteNamespaceRequest;
using Gs2.Gs2Key.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Key.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Key.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.delete_namespace(
key.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.delete_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete namespace
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name |
Result
Type | Description | |
---|---|---|
item | Namespace | Updated namespace |
describeKeys
describeKeys
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.DescribeKeys(
&key.DescribeKeysRequest {
NamespaceName: pointy.String("namespace1"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeKeysRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeKeys(
(new DescribeKeysRequest())
->withNamespaceName(self::namespace1)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeKeysRequest;
import io.gs2.key.result.DescribeKeysResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DescribeKeysResult result = client.describeKeys(
new DescribeKeysRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<Key> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeKeysRequest;
using Gs2.Gs2Key.Result.DescribeKeysResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DescribeKeysResult> asyncResult = null;
yield return client.DescribeKeys(
new Gs2.Gs2Key.Request.DescribeKeysRequest()
.WithNamespaceName("namespace1")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.describeKeys(
new Gs2Key.DescribeKeysRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.describe_keys(
key.DescribeKeysRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.describe_keys({
namespaceName='namespace1',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of encryption keys
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | Key[] | List of Encryption key |
nextPageToken | string | Page token to retrieve the rest of the listing |
createKey
createKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.CreateKey(
&key.CreateKeyRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("key-0001"),
Description: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createKey(
(new CreateKeyRequest())
->withNamespaceName(self::namespace1)
->withName("key-0001")
->withDescription(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateKeyRequest;
import io.gs2.key.result.CreateKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
CreateKeyResult result = client.createKey(
new CreateKeyRequest()
.withNamespaceName("namespace1")
.withName("key-0001")
.withDescription(null)
);
Key item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateKeyRequest;
using Gs2.Gs2Key.Result.CreateKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.CreateKeyResult> asyncResult = null;
yield return client.CreateKey(
new Gs2.Gs2Key.Request.CreateKeyRequest()
.WithNamespaceName("namespace1")
.WithName("key-0001")
.WithDescription(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.createKey(
new Gs2Key.CreateKeyRequest()
.withNamespaceName("namespace1")
.withName("key-0001")
.withDescription(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.create_key(
key.CreateKeyRequest()
.with_namespace_name(self.hash1)
.with_name('key-0001')
.with_description(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.create_key({
namespaceName='namespace1',
name='key-0001',
description=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Create new encryption key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
name | string | ✓ | ~ 128 chars | Encryption key name | |
description | string | ~ 1024 chars | description of Namespace |
Result
Type | Description | |
---|---|---|
item | Key | Created encryption key |
updateKey
updateKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.UpdateKey(
&key.UpdateKeyRequest {
NamespaceName: pointy.String("namespace1"),
KeyName: pointy.String("key-0001"),
Description: pointy.String("description1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateKey(
(new UpdateKeyRequest())
->withNamespaceName(self::namespace1)
->withKeyName("key-0001")
->withDescription("description1")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateKeyRequest;
import io.gs2.key.result.UpdateKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
UpdateKeyResult result = client.updateKey(
new UpdateKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withDescription("description1")
);
Key item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateKeyRequest;
using Gs2.Gs2Key.Result.UpdateKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.UpdateKeyResult> asyncResult = null;
yield return client.UpdateKey(
new Gs2.Gs2Key.Request.UpdateKeyRequest()
.WithNamespaceName("namespace1")
.WithKeyName("key-0001")
.WithDescription("description1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.updateKey(
new Gs2Key.UpdateKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withDescription("description1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.update_key(
key.UpdateKeyRequest()
.with_namespace_name(self.hash1)
.with_key_name('key-0001')
.with_description('description1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.update_key({
namespaceName='namespace1',
keyName='key-0001',
description='description1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update encryption key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
keyName | string | ✓ | ~ 128 chars | Encryption key name | |
description | string | ~ 1024 chars | description of Namespace |
Result
Type | Description | |
---|---|---|
item | Key | Updated encryption key |
getKey
getKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.GetKey(
&key.GetKeyRequest {
NamespaceName: pointy.String("namespace1"),
KeyName: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getKey(
(new GetKeyRequest())
->withNamespaceName(self::namespace1)
->withKeyName("key-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetKeyRequest;
import io.gs2.key.result.GetKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
GetKeyResult result = client.getKey(
new GetKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
);
Key item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetKeyRequest;
using Gs2.Gs2Key.Result.GetKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.GetKeyResult> asyncResult = null;
yield return client.GetKey(
new Gs2.Gs2Key.Request.GetKeyRequest()
.WithNamespaceName("namespace1")
.WithKeyName("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.getKey(
new Gs2Key.GetKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.get_key(
key.GetKeyRequest()
.with_namespace_name(self.hash1)
.with_key_name('key-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.get_key({
namespaceName='namespace1',
keyName='key-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Get encryption key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
keyName | string | ✓ | ~ 128 chars | Encryption key name |
Result
Type | Description | |
---|---|---|
item | Key | Encryption key |
deleteKey
deleteKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.DeleteKey(
&key.DeleteKeyRequest {
NamespaceName: pointy.String("namespace1"),
KeyName: pointy.String("key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DeleteKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteKey(
(new DeleteKeyRequest())
->withNamespaceName(self::namespace1)
->withKeyName("key-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DeleteKeyRequest;
import io.gs2.key.result.DeleteKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DeleteKeyResult result = client.deleteKey(
new DeleteKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
);
Key item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DeleteKeyRequest;
using Gs2.Gs2Key.Result.DeleteKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DeleteKeyResult> asyncResult = null;
yield return client.DeleteKey(
new Gs2.Gs2Key.Request.DeleteKeyRequest()
.WithNamespaceName("namespace1")
.WithKeyName("key-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.deleteKey(
new Gs2Key.DeleteKeyRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.delete_key(
key.DeleteKeyRequest()
.with_namespace_name(self.hash1)
.with_key_name('key-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.delete_key({
namespaceName='namespace1',
keyName='key-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Delete encryption key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
keyName | string | ✓ | ~ 128 chars | Encryption key name |
Result
Type | Description | |
---|---|---|
item | Key | Deleted encryption key |
encrypt
encrypt
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.Encrypt(
&key.EncryptRequest {
NamespaceName: pointy.String("namespace1"),
KeyName: pointy.String("key-0001"),
Data: pointy.String("hoge"),
}
)
if err != nil {
panic("error occurred")
}
data := result.Data
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\EncryptRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->encrypt(
(new EncryptRequest())
->withNamespaceName(self::namespace1)
->withKeyName("key-0001")
->withData("hoge")
);
$data = $result->getData();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.EncryptRequest;
import io.gs2.key.result.EncryptResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
EncryptResult result = client.encrypt(
new EncryptRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withData("hoge")
);
String data = result.getData();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.EncryptRequest;
using Gs2.Gs2Key.Result.EncryptResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.EncryptResult> asyncResult = null;
yield return client.Encrypt(
new Gs2.Gs2Key.Request.EncryptRequest()
.WithNamespaceName("namespace1")
.WithKeyName("key-0001")
.WithData("hoge"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var data = result.Data;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.encrypt(
new Gs2Key.EncryptRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withData("hoge")
);
const data = result.getData();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.encrypt(
key.EncryptRequest()
.with_namespace_name(self.hash1)
.with_key_name('key-0001')
.with_data('hoge')
)
data = result.data
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.encrypt({
namespaceName='namespace1',
keyName='key-0001',
data='hoge',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
data = result.data;
Encrypt data
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
keyName | string | ✓ | ~ 128 chars | Encryption key name | |
data | string | ✓ | ~ 1048576 chars |
Result
Type | Description | |
---|---|---|
data | string | Encrypted Data |
decrypt
decrypt
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.Decrypt(
&key.DecryptRequest {
NamespaceName: pointy.String("namespace1"),
KeyName: pointy.String("key-0001"),
Data: pointy.String("hoge"),
}
)
if err != nil {
panic("error occurred")
}
data := result.Data
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DecryptRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->decrypt(
(new DecryptRequest())
->withNamespaceName(self::namespace1)
->withKeyName("key-0001")
->withData("hoge")
);
$data = $result->getData();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DecryptRequest;
import io.gs2.key.result.DecryptResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DecryptResult result = client.decrypt(
new DecryptRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withData("hoge")
);
String data = result.getData();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DecryptRequest;
using Gs2.Gs2Key.Result.DecryptResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DecryptResult> asyncResult = null;
yield return client.Decrypt(
new Gs2.Gs2Key.Request.DecryptRequest()
.WithNamespaceName("namespace1")
.WithKeyName("key-0001")
.WithData("hoge"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var data = result.Data;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.decrypt(
new Gs2Key.DecryptRequest()
.withNamespaceName("namespace1")
.withKeyName("key-0001")
.withData("hoge")
);
const data = result.getData();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.decrypt(
key.DecryptRequest()
.with_namespace_name(self.hash1)
.with_key_name('key-0001')
.with_data('hoge')
)
data = result.data
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.decrypt({
namespaceName='namespace1',
keyName='key-0001',
data='hoge',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
data = result.data;
Decrypt data
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
keyName | string | ✓ | ~ 128 chars | Encryption key name | |
data | string | ✓ | ~ 1048576 chars |
Result
Type | Description | |
---|---|---|
data | string | decrypted data |
describeGitHubApiKeys
describeGitHubApiKeys
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.DescribeGitHubApiKeys(
&key.DescribeGitHubApiKeysRequest {
NamespaceName: pointy.String("namespace1"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DescribeGitHubApiKeysRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeGitHubApiKeys(
(new DescribeGitHubApiKeysRequest())
->withNamespaceName(self::namespace1)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.DescribeGitHubApiKeysRequest;
import io.gs2.key.result.DescribeGitHubApiKeysResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
DescribeGitHubApiKeysResult result = client.describeGitHubApiKeys(
new DescribeGitHubApiKeysRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
List<GitHubApiKey> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DescribeGitHubApiKeysRequest;
using Gs2.Gs2Key.Result.DescribeGitHubApiKeysResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DescribeGitHubApiKeysResult> asyncResult = null;
yield return client.DescribeGitHubApiKeys(
new Gs2.Gs2Key.Request.DescribeGitHubApiKeysRequest()
.WithNamespaceName("namespace1")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.describeGitHubApiKeys(
new Gs2Key.DescribeGitHubApiKeysRequest()
.withNamespaceName("namespace1")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.describe_git_hub_api_keys(
key.DescribeGitHubApiKeysRequest()
.with_namespace_name(self.hash1)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.describe_git_hub_api_keys({
namespaceName='namespace1',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
Get list of GitHub API keys
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | ||
limit | int | ✓ | 30 | 1 ~ 1000 | Number of data acquired |
Result
Type | Description | |
---|---|---|
items | GitHubApiKey[] | List of GitHub API Keys |
nextPageToken | string | Page token to retrieve the rest of the listing |
createGitHubApiKey
createGitHubApiKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.CreateGitHubApiKey(
&key.CreateGitHubApiKeyRequest {
NamespaceName: pointy.String("namespace1"),
Name: pointy.String("api-key-0001"),
Description: nil,
ApiKey: pointy.String("secret-0001"),
EncryptionKeyName: pointy.String("$key1.name"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\CreateGitHubApiKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->createGitHubApiKey(
(new CreateGitHubApiKeyRequest())
->withNamespaceName(self::namespace1)
->withName("api-key-0001")
->withDescription(null)
->withApiKey("secret-0001")
->withEncryptionKeyName(self::$key1.name)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.CreateGitHubApiKeyRequest;
import io.gs2.key.result.CreateGitHubApiKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
CreateGitHubApiKeyResult result = client.createGitHubApiKey(
new CreateGitHubApiKeyRequest()
.withNamespaceName("namespace1")
.withName("api-key-0001")
.withDescription(null)
.withApiKey("secret-0001")
.withEncryptionKeyName("$key1.name")
);
GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.CreateGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.CreateGitHubApiKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.CreateGitHubApiKeyResult> asyncResult = null;
yield return client.CreateGitHubApiKey(
new Gs2.Gs2Key.Request.CreateGitHubApiKeyRequest()
.WithNamespaceName("namespace1")
.WithName("api-key-0001")
.WithDescription(null)
.WithApiKey("secret-0001")
.WithEncryptionKeyName("$key1.name"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.createGitHubApiKey(
new Gs2Key.CreateGitHubApiKeyRequest()
.withNamespaceName("namespace1")
.withName("api-key-0001")
.withDescription(null)
.withApiKey("secret-0001")
.withEncryptionKeyName("$key1.name")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.create_git_hub_api_key(
key.CreateGitHubApiKeyRequest()
.with_namespace_name(self.hash1)
.with_name('api-key-0001')
.with_description(None)
.with_api_key('secret-0001')
.with_encryption_key_name(self.key1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.create_git_hub_api_key({
namespaceName='namespace1',
name='api-key-0001',
description=nil,
apiKey='secret-0001',
encryptionKeyName='$key1.name',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Create a new API key for GitHub
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
name | string | ✓ | ~ 128 chars | GitHub API key name | |
description | string | ~ 1024 chars | description of Namespace | ||
encryptionKeyName | string | ✓ | ~ 128 chars | Name of the encryption key used to encrypt the API key |
Result
Type | Description | |
---|---|---|
item | GitHubApiKey | The GitHub API key you created |
updateGitHubApiKey
updateGitHubApiKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.UpdateGitHubApiKey(
&key.UpdateGitHubApiKeyRequest {
NamespaceName: pointy.String("namespace1"),
ApiKeyName: pointy.String("api-key-0001"),
Description: pointy.String("description1"),
ApiKey: pointy.String("secret-0004"),
EncryptionKeyName: pointy.String("$key1.name"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\UpdateGitHubApiKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->updateGitHubApiKey(
(new UpdateGitHubApiKeyRequest())
->withNamespaceName(self::namespace1)
->withApiKeyName("api-key-0001")
->withDescription("description1")
->withApiKey("secret-0004")
->withEncryptionKeyName(self::$key1.name)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.UpdateGitHubApiKeyRequest;
import io.gs2.key.result.UpdateGitHubApiKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
UpdateGitHubApiKeyResult result = client.updateGitHubApiKey(
new UpdateGitHubApiKeyRequest()
.withNamespaceName("namespace1")
.withApiKeyName("api-key-0001")
.withDescription("description1")
.withApiKey("secret-0004")
.withEncryptionKeyName("$key1.name")
);
GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.UpdateGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.UpdateGitHubApiKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.UpdateGitHubApiKeyResult> asyncResult = null;
yield return client.UpdateGitHubApiKey(
new Gs2.Gs2Key.Request.UpdateGitHubApiKeyRequest()
.WithNamespaceName("namespace1")
.WithApiKeyName("api-key-0001")
.WithDescription("description1")
.WithApiKey("secret-0004")
.WithEncryptionKeyName("$key1.name"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Key from '@/gs2/key';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Key.Gs2KeyRestClient(session);
try {
const result = await client.updateGitHubApiKey(
new Gs2Key.UpdateGitHubApiKeyRequest()
.withNamespaceName("namespace1")
.withApiKeyName("api-key-0001")
.withDescription("description1")
.withApiKey("secret-0004")
.withEncryptionKeyName("$key1.name")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import key
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = key.Gs2KeyRestClient(session)
try:
result = client.update_git_hub_api_key(
key.UpdateGitHubApiKeyRequest()
.with_namespace_name(self.hash1)
.with_api_key_name('api-key-0001')
.with_description('description1')
.with_api_key('secret-0004')
.with_encryption_key_name(self.key1.name)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('key')
api_result = client.update_git_hub_api_key({
namespaceName='namespace1',
apiKeyName='api-key-0001',
description='description1',
apiKey='secret-0004',
encryptionKeyName='$key1.name',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
Update GitHub API key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
apiKeyName | string | ✓ | ~ 128 chars | GitHub API key name | |
description | string | ~ 1024 chars | description of Namespace | ||
encryptionKeyName | string | ✓ | ~ 128 chars | Name of the encryption key used to encrypt the API key |
Result
Type | Description | |
---|---|---|
item | GitHubApiKey | Updated GitHub API key |
getGitHubApiKey
getGitHubApiKey
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/key"
import "github.com/openlyinc/pointy"
session := core.Gs2RestSession{
Credential: &core.BasicGs2Credential{
ClientId: "your client id",
ClientSecret: "your client secret",
},
Region: core.ApNortheast1,
}
if err := session.Connect(); err != nil {
panic("error occurred")
}
client := key.Gs2KeyRestClient{
Session: &session,
}
result, err := client.GetGitHubApiKey(
&key.GetGitHubApiKeyRequest {
NamespaceName: pointy.String("namespace1"),
ApiKeyName: pointy.String("api-key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\GetGitHubApiKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getGitHubApiKey(
(new GetGitHubApiKeyRequest())
->withNamespaceName(self::namespace1)
->withApiKeyName("api-key-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.GetGitHubApiKeyRequest;
import io.gs2.key.result.GetGitHubApiKeyResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2KeyRestClient client = new Gs2KeyRestClient(session);
try {
GetGitHubApiKeyResult result = client.getGitHubApiKey(
new GetGitHubApiKeyRequest()
.withNamespaceName("namespace1")
.withApiKeyName("api-key-0001")
);
GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.GetGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.GetGitHubApiKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.GetGitHubApiKeyResult> asyncResult = null;
yield return client.GetGitHubApiKey(
new Gs2.Gs2Key.Request.GetGitHubApiKeyRequest()
.WithNamespaceName("namespace1")
.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("namespace1")
.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(self.hash1)
.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='namespace1',
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;
Get GitHub API key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
apiKeyName | string | ✓ | ~ 128 chars | GitHub API key name |
Result
Type | Description | |
---|---|---|
item | GitHubApiKey | GitHub API key |
deleteGitHubApiKey
deleteGitHubApiKey
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("namespace1"),
ApiKeyName: pointy.String("api-key-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Key\Gs2KeyRestClient;
use Gs2\Key\Request\DeleteGitHubApiKeyRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteGitHubApiKey(
(new DeleteGitHubApiKeyRequest())
->withNamespaceName(self::namespace1)
->withApiKeyName("api-key-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.key.rest.Gs2KeyRestClient;
import io.gs2.key.request.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("namespace1")
.withApiKeyName("api-key-0001")
);
GitHubApiKey item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Key.Gs2KeyRestClient;
using Gs2.Gs2Key.Request.DeleteGitHubApiKeyRequest;
using Gs2.Gs2Key.Result.DeleteGitHubApiKeyResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2KeyRestClient(session);
AsyncResult<Gs2.Gs2Key.Result.DeleteGitHubApiKeyResult> asyncResult = null;
yield return client.DeleteGitHubApiKey(
new Gs2.Gs2Key.Request.DeleteGitHubApiKeyRequest()
.WithNamespaceName("namespace1")
.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("namespace1")
.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(self.hash1)
.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='namespace1',
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;
Delete GitHub API key
Request
Type | Require | Default | Limitation | Description | |
---|---|---|---|---|---|
namespaceName | string | ✓ | ~ 32 chars | Namespace name | |
apiKeyName | string | ✓ | ~ 128 chars | GitHub API key name |
Result
Type | Description | |
---|---|---|
item | GitHubApiKey | Deleted GitHub API key |