NAV
go python java php typescript csharp GS2-Script

GS2-Identifier

GS2-SDK のリファレンス

モデル

User

プロジェクトにアクセス可能なゲーム開発者を表すエンティティです。

ユーザーにはプログラムからアクセスするためのクレデンシャルや、 ユーザーの権限に基づいてマネージメントコンソールにログインし、プロジェクトを管理できるパスワードを登録できます。

説明
userId string ユーザGRN
name string ユーザー名
description string 説明文
createdAt long 作成日時
updatedAt long 最終更新日時

SecurityPolicy

ユーザが利用できるAPIの種類やアクセスできるリソースの制限を定義します。 アクセス制限のルールはポリシードキュメントというJSON形式の定義データを使用します。 ポリシードキュメントの仕様については 開発資料内のポリシードキュメントについての解説ページを参照してください。

説明
securityPolicyId string セキュリティポリシーGRN
name string セキュリティポリシー名
description string 説明文
policy string ポリシードキュメント
createdAt long 作成日時
updatedAt long 最終更新日時

Identifier

GS2のAPIにアクセスするために必要となるクレデンシャルです。 クレデンシャルはクライアントIDとクライアントシークレットからなり、クレデンシャルを使用したアクセスは、クレデンシャルの所有者となるユーザの権限に基づいてアクセス制限が施されます。

説明
clientId string クライアントID
userName string ユーザー名
clientSecret string クライアントシークレット
createdAt long 作成日時

Password

マネージメントコンソールにユーザの権限に基づいてログインするためのパスワード。 パスワードを設定することで、1つのプロジェクトに異なるアカウントからログインでき、なおかつアクセスできる情報に制限をかけることができます。

説明
userId string ユーザGRN
userName string ユーザー名
createdAt long 作成日時

AttachSecurityPolicy

説明
userId string ユーザGRN
securityPolicyIds string[] セキュリティポリシー のGRNのリスト
attachedAt long 作成日時

ProjectToken

説明
token string プロジェクトトークン

メソッド

describeUsers

describeUsers

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DescribeUsers(
    &identifier.DescribeUsersRequest {
        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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DescribeUsersRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeUsers(
        (new DescribeUsersRequest())
            ->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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DescribeUsersRequest;
import io.gs2.identifier.result.DescribeUsersResult;

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

try {
    DescribeUsersResult result = client.describeUsers(
        new DescribeUsersRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<User> 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DescribeUsersRequest;
using Gs2.Gs2Identifier.Result.DescribeUsersResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeUsers(
    new DescribeUsersRequest()
        .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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.describeUsers(
        new Gs2Identifier.DescribeUsersRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.describe_users(
        identifier.DescribeUsersRequest()
            .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('identifier')

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

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

ユーザの一覧を取得します

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items User[] ユーザのリスト
nextPageToken string リストの続きを取得するためのページトークン

createUser

createUser

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.CreateUser(
    &identifier.CreateUserRequest {
        Name: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\CreateUserRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createUser(
        (new CreateUserRequest())
            ->withName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.CreateUserRequest;
import io.gs2.identifier.result.CreateUserResult;

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

try {
    CreateUserResult result = client.createUser(
        new CreateUserRequest()
            .withName("user-0001")
            .withDescription(null)
    );
    User 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.CreateUserRequest;
using Gs2.Gs2Identifier.Result.CreateUserResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createUser(
    new CreateUserRequest()
        .withName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.createUser(
        new Gs2Identifier.CreateUserRequest()
            .withName("user-0001")
            .withDescription(null)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.create_user(
        identifier.CreateUserRequest()
            .with_name('user-0001')
            .with_description(None)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.create_user({
    name='user-0001',
    description=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ユーザを新規作成します

Request

必須 デフォルト 値の制限 説明
name string ~ 128文字 ユーザー名
description string ~ 1024文字 説明文

Result

説明
item User 作成したユーザ

updateUser

updateUser

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.UpdateUser(
    &identifier.UpdateUserRequest {
        UserName: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\UpdateUserRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateUser(
        (new UpdateUserRequest())
            ->withUserName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.UpdateUserRequest;
import io.gs2.identifier.result.UpdateUserResult;

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

try {
    UpdateUserResult result = client.updateUser(
        new UpdateUserRequest()
            .withUserName("user-0001")
            .withDescription("description1")
    );
    User 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.UpdateUserRequest;
using Gs2.Gs2Identifier.Result.UpdateUserResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateUser(
    new UpdateUserRequest()
        .withUserName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.updateUser(
        new Gs2Identifier.UpdateUserRequest()
            .withUserName("user-0001")
            .withDescription("description1")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.update_user(
        identifier.UpdateUserRequest()
            .with_user_name('user-0001')
            .with_description('description1')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.update_user({
    userName='user-0001',
    description='description1',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ユーザを更新します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
description string ~ 1024文字 説明文

Result

説明
item User 更新後のユーザ

getUser

getUser

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.GetUser(
    &identifier.GetUserRequest {
        UserName: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\GetUserRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getUser(
        (new GetUserRequest())
            ->withUserName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.GetUserRequest;
import io.gs2.identifier.result.GetUserResult;

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

try {
    GetUserResult result = client.getUser(
        new GetUserRequest()
            .withUserName("user-0001")
    );
    User 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.GetUserRequest;
using Gs2.Gs2Identifier.Result.GetUserResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getUser(
    new GetUserRequest()
        .withUserName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.getUser(
        new Gs2Identifier.GetUserRequest()
            .withUserName("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.get_user(
        identifier.GetUserRequest()
            .with_user_name('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.get_user({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

ユーザを取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明
item User ユーザ

deleteUser

deleteUser

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DeleteUser(
    &identifier.DeleteUserRequest {
        UserName: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DeleteUserRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteUser(
        (new DeleteUserRequest())
            ->withUserName("user-0001")
    );
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DeleteUserRequest;
import io.gs2.identifier.result.DeleteUserResult;

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

try {
    DeleteUserResult result = client.deleteUser(
        new DeleteUserRequest()
            .withUserName("user-0001")
    );
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DeleteUserRequest;
using Gs2.Gs2Identifier.Result.DeleteUserResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteUser(
    new DeleteUserRequest()
        .withUserName("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.deleteUser(
        new Gs2Identifier.DeleteUserRequest()
            .withUserName("user-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.delete_user(
        identifier.DeleteUserRequest()
            .with_user_name('user-0001')
    )
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.delete_user({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

ユーザを削除します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明

describeSecurityPolicies

describeSecurityPolicies

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DescribeSecurityPolicies(
    &identifier.DescribeSecurityPoliciesRequest {
        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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DescribeSecurityPoliciesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeSecurityPolicies(
        (new DescribeSecurityPoliciesRequest())
            ->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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DescribeSecurityPoliciesRequest;
import io.gs2.identifier.result.DescribeSecurityPoliciesResult;

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

try {
    DescribeSecurityPoliciesResult result = client.describeSecurityPolicies(
        new DescribeSecurityPoliciesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<SecurityPolicy> 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DescribeSecurityPoliciesRequest;
using Gs2.Gs2Identifier.Result.DescribeSecurityPoliciesResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeSecurityPolicies(
    new DescribeSecurityPoliciesRequest()
        .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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.describeSecurityPolicies(
        new Gs2Identifier.DescribeSecurityPoliciesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.describe_security_policies(
        identifier.DescribeSecurityPoliciesRequest()
            .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('identifier')

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

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

セキュリティポリシーの一覧を取得します

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items SecurityPolicy[] セキュリティポリシーのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeCommonSecurityPolicies

describeCommonSecurityPolicies

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DescribeCommonSecurityPolicies(
    &identifier.DescribeCommonSecurityPoliciesRequest {
        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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DescribeCommonSecurityPoliciesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeCommonSecurityPolicies(
        (new DescribeCommonSecurityPoliciesRequest())
            ->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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DescribeCommonSecurityPoliciesRequest;
import io.gs2.identifier.result.DescribeCommonSecurityPoliciesResult;

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

try {
    DescribeCommonSecurityPoliciesResult result = client.describeCommonSecurityPolicies(
        new DescribeCommonSecurityPoliciesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    List<SecurityPolicy> 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DescribeCommonSecurityPoliciesRequest;
using Gs2.Gs2Identifier.Result.DescribeCommonSecurityPoliciesResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeCommonSecurityPolicies(
    new DescribeCommonSecurityPoliciesRequest()
        .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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.describeCommonSecurityPolicies(
        new Gs2Identifier.DescribeCommonSecurityPoliciesRequest()
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.describe_common_security_policies(
        identifier.DescribeCommonSecurityPoliciesRequest()
            .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('identifier')

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

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

オーナーIDを指定してセキュリティポリシーの一覧を取得します

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items SecurityPolicy[] セキュリティポリシーのリスト
nextPageToken string リストの続きを取得するためのページトークン

createSecurityPolicy

createSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.CreateSecurityPolicy(
    &identifier.CreateSecurityPolicyRequest {
        Name: pointy.String("policy-0001"),
        Description: nil,
        Policy: pointy.String("{}"),
    }
)
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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\CreateSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createSecurityPolicy(
        (new CreateSecurityPolicyRequest())
            ->withName("policy-0001")
            ->withDescription(null)
            ->withPolicy("{}")
    );
    $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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.CreateSecurityPolicyRequest;
import io.gs2.identifier.result.CreateSecurityPolicyResult;

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

try {
    CreateSecurityPolicyResult result = client.createSecurityPolicy(
        new CreateSecurityPolicyRequest()
            .withName("policy-0001")
            .withDescription(null)
            .withPolicy("{}")
    );
    SecurityPolicy 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.CreateSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.CreateSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createSecurityPolicy(
    new CreateSecurityPolicyRequest()
        .withName("policy-0001")
        .withDescription(null)
        .withPolicy("{}"),
    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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.createSecurityPolicy(
        new Gs2Identifier.CreateSecurityPolicyRequest()
            .withName("policy-0001")
            .withDescription(null)
            .withPolicy("{}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.create_security_policy(
        identifier.CreateSecurityPolicyRequest()
            .with_name('policy-0001')
            .with_description(None)
            .with_policy('{}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.create_security_policy({
    name='policy-0001',
    description=nil,
    policy='{}',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

セキュリティポリシーを新規作成します

Request

必須 デフォルト 値の制限 説明
name string ~ 128文字 セキュリティポリシー名
description string ~ 1024文字 説明文
policy string ~ 5242880文字 ポリシードキュメント

Result

説明
item SecurityPolicy 作成したセキュリティポリシー

updateSecurityPolicy

updateSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.UpdateSecurityPolicy(
    &identifier.UpdateSecurityPolicyRequest {
        SecurityPolicyName: pointy.String("policy-0001"),
        Description: pointy.String("description1"),
        Policy: pointy.String("{\"hoge\": \"fuga\"}"),
    }
)
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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\UpdateSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateSecurityPolicy(
        (new UpdateSecurityPolicyRequest())
            ->withSecurityPolicyName("policy-0001")
            ->withDescription("description1")
            ->withPolicy("{\"hoge\": \"fuga\"}")
    );
    $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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.UpdateSecurityPolicyRequest;
import io.gs2.identifier.result.UpdateSecurityPolicyResult;

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

try {
    UpdateSecurityPolicyResult result = client.updateSecurityPolicy(
        new UpdateSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
            .withDescription("description1")
            .withPolicy("{\"hoge\": \"fuga\"}")
    );
    SecurityPolicy 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.UpdateSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.UpdateSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateSecurityPolicy(
    new UpdateSecurityPolicyRequest()
        .withSecurityPolicyName("policy-0001")
        .withDescription("description1")
        .withPolicy("{\"hoge\": \"fuga\"}"),
    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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.updateSecurityPolicy(
        new Gs2Identifier.UpdateSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
            .withDescription("description1")
            .withPolicy("{\"hoge\": \"fuga\"}")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.update_security_policy(
        identifier.UpdateSecurityPolicyRequest()
            .with_security_policy_name('policy-0001')
            .with_description('description1')
            .with_policy('{"hoge": "fuga"}')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.update_security_policy({
    securityPolicyName='policy-0001',
    description='description1',
    policy='{"hoge": "fuga"}',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

セキュリティポリシーを更新します

Request

必須 デフォルト 値の制限 説明
securityPolicyName string ~ 128文字 セキュリティポリシー名
description string ~ 1024文字 説明文
policy string ~ 5242880文字 ポリシードキュメント

Result

説明
item SecurityPolicy 更新後のセキュリティポリシー

getSecurityPolicy

getSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.GetSecurityPolicy(
    &identifier.GetSecurityPolicyRequest {
        SecurityPolicyName: pointy.String("policy-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\GetSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getSecurityPolicy(
        (new GetSecurityPolicyRequest())
            ->withSecurityPolicyName("policy-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.GetSecurityPolicyRequest;
import io.gs2.identifier.result.GetSecurityPolicyResult;

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

try {
    GetSecurityPolicyResult result = client.getSecurityPolicy(
        new GetSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
    );
    SecurityPolicy 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.GetSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.GetSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getSecurityPolicy(
    new GetSecurityPolicyRequest()
        .withSecurityPolicyName("policy-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.getSecurityPolicy(
        new Gs2Identifier.GetSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.get_security_policy(
        identifier.GetSecurityPolicyRequest()
            .with_security_policy_name('policy-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.get_security_policy({
    securityPolicyName='policy-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

セキュリティポリシーを取得します

Request

必須 デフォルト 値の制限 説明
securityPolicyName string ~ 128文字 セキュリティポリシー名

Result

説明
item SecurityPolicy セキュリティポリシー

deleteSecurityPolicy

deleteSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DeleteSecurityPolicy(
    &identifier.DeleteSecurityPolicyRequest {
        SecurityPolicyName: pointy.String("policy-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DeleteSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteSecurityPolicy(
        (new DeleteSecurityPolicyRequest())
            ->withSecurityPolicyName("policy-0001")
    );
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DeleteSecurityPolicyRequest;
import io.gs2.identifier.result.DeleteSecurityPolicyResult;

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

try {
    DeleteSecurityPolicyResult result = client.deleteSecurityPolicy(
        new DeleteSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
    );
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DeleteSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.DeleteSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteSecurityPolicy(
    new DeleteSecurityPolicyRequest()
        .withSecurityPolicyName("policy-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.deleteSecurityPolicy(
        new Gs2Identifier.DeleteSecurityPolicyRequest()
            .withSecurityPolicyName("policy-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.delete_security_policy(
        identifier.DeleteSecurityPolicyRequest()
            .with_security_policy_name('policy-0001')
    )
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.delete_security_policy({
    securityPolicyName='policy-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

セキュリティポリシーを削除します

Request

必須 デフォルト 値の制限 説明
securityPolicyName string ~ 128文字 セキュリティポリシー名

Result

説明

describeIdentifiers

describeIdentifiers

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DescribeIdentifiers(
    &identifier.DescribeIdentifiersRequest {
        UserName: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DescribeIdentifiersRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeIdentifiers(
        (new DescribeIdentifiersRequest())
            ->withUserName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DescribeIdentifiersRequest;
import io.gs2.identifier.result.DescribeIdentifiersResult;

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

try {
    DescribeIdentifiersResult result = client.describeIdentifiers(
        new DescribeIdentifiersRequest()
            .withUserName("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Identifier> 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DescribeIdentifiersRequest;
using Gs2.Gs2Identifier.Result.DescribeIdentifiersResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeIdentifiers(
    new DescribeIdentifiersRequest()
        .withUserName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.describeIdentifiers(
        new Gs2Identifier.DescribeIdentifiersRequest()
            .withUserName("user-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 identifier

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

try:
    result = client.describe_identifiers(
        identifier.DescribeIdentifiersRequest()
            .with_user_name('user-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('identifier')

api_result = client.describe_identifiers({
    userName='user-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

クレデンシャルの一覧を取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Identifier[] クレデンシャルのリスト
nextPageToken string リストの続きを取得するためのページトークン

createIdentifier

createIdentifier

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.CreateIdentifier(
    &identifier.CreateIdentifierRequest {
        UserName: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
clientSecret := result.ClientSecret
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\CreateIdentifierRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createIdentifier(
        (new CreateIdentifierRequest())
            ->withUserName("user-0001")
    );
    $item = $result->getItem();
    $clientSecret = $result->getClientSecret();
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.CreateIdentifierRequest;
import io.gs2.identifier.result.CreateIdentifierResult;

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

try {
    CreateIdentifierResult result = client.createIdentifier(
        new CreateIdentifierRequest()
            .withUserName("user-0001")
    );
    Identifier item = result.getItem();
    String clientSecret = result.getClientSecret();
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.CreateIdentifierRequest;
using Gs2.Gs2Identifier.Result.CreateIdentifierResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createIdentifier(
    new CreateIdentifierRequest()
        .withUserName("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var clientSecret = result.ClientSecret;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.createIdentifier(
        new Gs2Identifier.CreateIdentifierRequest()
            .withUserName("user-0001")
    );
    const item = result.getItem();
    const clientSecret = result.getClientSecret();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.create_identifier(
        identifier.CreateIdentifierRequest()
            .with_user_name('user-0001')
    )
    item = result.item
    client_secret = result.client_secret
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.create_identifier({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;
clientSecret = result.clientSecret;

クレデンシャルを新規作成します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明
item Identifier 作成したクレデンシャル
clientSecret string クライアントシークレット

getIdentifier

getIdentifier

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.GetIdentifier(
    &identifier.GetIdentifierRequest {
        UserName: pointy.String("user-0001"),
        ClientId: pointy.String("$identifier1.clientId"),
    }
)
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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\GetIdentifierRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getIdentifier(
        (new GetIdentifierRequest())
            ->withUserName("user-0001")
            ->withClientId(self::$identifier1.clientId)
    );
    $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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.GetIdentifierRequest;
import io.gs2.identifier.result.GetIdentifierResult;

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

try {
    GetIdentifierResult result = client.getIdentifier(
        new GetIdentifierRequest()
            .withUserName("user-0001")
            .withClientId("$identifier1.clientId")
    );
    Identifier 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.GetIdentifierRequest;
using Gs2.Gs2Identifier.Result.GetIdentifierResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getIdentifier(
    new GetIdentifierRequest()
        .withUserName("user-0001")
        .withClientId("$identifier1.clientId"),
    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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.getIdentifier(
        new Gs2Identifier.GetIdentifierRequest()
            .withUserName("user-0001")
            .withClientId("$identifier1.clientId")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.get_identifier(
        identifier.GetIdentifierRequest()
            .with_user_name('user-0001')
            .with_client_id(self.identifier1.client_id)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.get_identifier({
    userName='user-0001',
    clientId='$identifier1.clientId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

クレデンシャルを取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
clientId string UUID ~ 100文字 クライアントID

Result

説明
item Identifier クレデンシャル

deleteIdentifier

deleteIdentifier

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DeleteIdentifier(
    &identifier.DeleteIdentifierRequest {
        UserName: pointy.String("user-0001"),
        ClientId: pointy.String("$identifier1.clientId"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DeleteIdentifierRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteIdentifier(
        (new DeleteIdentifierRequest())
            ->withUserName("user-0001")
            ->withClientId(self::$identifier1.clientId)
    );
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DeleteIdentifierRequest;
import io.gs2.identifier.result.DeleteIdentifierResult;

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

try {
    DeleteIdentifierResult result = client.deleteIdentifier(
        new DeleteIdentifierRequest()
            .withUserName("user-0001")
            .withClientId("$identifier1.clientId")
    );
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DeleteIdentifierRequest;
using Gs2.Gs2Identifier.Result.DeleteIdentifierResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteIdentifier(
    new DeleteIdentifierRequest()
        .withUserName("user-0001")
        .withClientId("$identifier1.clientId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.deleteIdentifier(
        new Gs2Identifier.DeleteIdentifierRequest()
            .withUserName("user-0001")
            .withClientId("$identifier1.clientId")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.delete_identifier(
        identifier.DeleteIdentifierRequest()
            .with_user_name('user-0001')
            .with_client_id(self.identifier1.client_id)
    )
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.delete_identifier({
    userName='user-0001',
    clientId='$identifier1.clientId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

クレデンシャルを削除します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
clientId string UUID ~ 100文字 クライアントID

Result

説明

describePasswords

describePasswords

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DescribePasswords(
    &identifier.DescribePasswordsRequest {
        UserName: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DescribePasswordsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describePasswords(
        (new DescribePasswordsRequest())
            ->withUserName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DescribePasswordsRequest;
import io.gs2.identifier.result.DescribePasswordsResult;

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

try {
    DescribePasswordsResult result = client.describePasswords(
        new DescribePasswordsRequest()
            .withUserName("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Password> 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DescribePasswordsRequest;
using Gs2.Gs2Identifier.Result.DescribePasswordsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describePasswords(
    new DescribePasswordsRequest()
        .withUserName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.describePasswords(
        new Gs2Identifier.DescribePasswordsRequest()
            .withUserName("user-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 identifier

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

try:
    result = client.describe_passwords(
        identifier.DescribePasswordsRequest()
            .with_user_name('user-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('identifier')

api_result = client.describe_passwords({
    userName='user-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

パスワードの一覧を取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Password[] パスワードのリスト
nextPageToken string リストの続きを取得するためのページトークン

createPassword

createPassword

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.CreatePassword(
    &identifier.CreatePasswordRequest {
        UserName: pointy.String("user-0001"),
        Password: pointy.String("password-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\CreatePasswordRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createPassword(
        (new CreatePasswordRequest())
            ->withUserName("user-0001")
            ->withPassword("password-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.CreatePasswordRequest;
import io.gs2.identifier.result.CreatePasswordResult;

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

try {
    CreatePasswordResult result = client.createPassword(
        new CreatePasswordRequest()
            .withUserName("user-0001")
            .withPassword("password-0001")
    );
    Password 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.CreatePasswordRequest;
using Gs2.Gs2Identifier.Result.CreatePasswordResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createPassword(
    new CreatePasswordRequest()
        .withUserName("user-0001")
        .withPassword("password-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.createPassword(
        new Gs2Identifier.CreatePasswordRequest()
            .withUserName("user-0001")
            .withPassword("password-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.create_password(
        identifier.CreatePasswordRequest()
            .with_user_name('user-0001')
            .with_password('password-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.create_password({
    userName='user-0001',
    password='password-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

パスワードを新規作成します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明
item Password 作成したパスワード

getPassword

getPassword

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.GetPassword(
    &identifier.GetPasswordRequest {
        UserName: pointy.String("user-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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\GetPasswordRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getPassword(
        (new GetPasswordRequest())
            ->withUserName("user-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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.GetPasswordRequest;
import io.gs2.identifier.result.GetPasswordResult;

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

try {
    GetPasswordResult result = client.getPassword(
        new GetPasswordRequest()
            .withUserName("user-0001")
    );
    Password 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.GetPasswordRequest;
using Gs2.Gs2Identifier.Result.GetPasswordResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getPassword(
    new GetPasswordRequest()
        .withUserName("user-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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.getPassword(
        new Gs2Identifier.GetPasswordRequest()
            .withUserName("user-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.get_password(
        identifier.GetPasswordRequest()
            .with_user_name('user-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.get_password({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

パスワードを取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明
item Password パスワード

deletePassword

deletePassword

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DeletePassword(
    &identifier.DeletePasswordRequest {
        UserName: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DeletePasswordRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deletePassword(
        (new DeletePasswordRequest())
            ->withUserName("user-0001")
    );
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DeletePasswordRequest;
import io.gs2.identifier.result.DeletePasswordResult;

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

try {
    DeletePasswordResult result = client.deletePassword(
        new DeletePasswordRequest()
            .withUserName("user-0001")
    );
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DeletePasswordRequest;
using Gs2.Gs2Identifier.Result.DeletePasswordResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deletePassword(
    new DeletePasswordRequest()
        .withUserName("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.deletePassword(
        new Gs2Identifier.DeletePasswordRequest()
            .withUserName("user-0001")
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.delete_password(
        identifier.DeletePasswordRequest()
            .with_user_name('user-0001')
    )
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.delete_password({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

パスワードを削除します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明

getHasSecurityPolicy

getHasSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.GetHasSecurityPolicy(
    &identifier.GetHasSecurityPolicyRequest {
        UserName: pointy.String("user-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\GetHasSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getHasSecurityPolicy(
        (new GetHasSecurityPolicyRequest())
            ->withUserName("user-0001")
    );
    $items = $result->getItems();
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.GetHasSecurityPolicyRequest;
import io.gs2.identifier.result.GetHasSecurityPolicyResult;

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

try {
    GetHasSecurityPolicyResult result = client.getHasSecurityPolicy(
        new GetHasSecurityPolicyRequest()
            .withUserName("user-0001")
    );
    List<SecurityPolicy> items = result.getItems();
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.GetHasSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.GetHasSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getHasSecurityPolicy(
    new GetHasSecurityPolicyRequest()
        .withUserName("user-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.getHasSecurityPolicy(
        new Gs2Identifier.GetHasSecurityPolicyRequest()
            .withUserName("user-0001")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.get_has_security_policy(
        identifier.GetHasSecurityPolicyRequest()
            .with_user_name('user-0001')
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.get_has_security_policy({
    userName='user-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

割り当てられたセキュリティポリシーの一覧を取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名

Result

説明
items SecurityPolicy[] セキュリティポリシーのリスト

attachSecurityPolicy

attachSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.AttachSecurityPolicy(
    &identifier.AttachSecurityPolicyRequest {
        UserName: pointy.String("user-0001"),
        SecurityPolicyId: pointy.String("$securityPolicy1.securityPolicyId"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\AttachSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->attachSecurityPolicy(
        (new AttachSecurityPolicyRequest())
            ->withUserName("user-0001")
            ->withSecurityPolicyId(self::$securityPolicy1.securityPolicyId)
    );
    $items = $result->getItems();
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.AttachSecurityPolicyRequest;
import io.gs2.identifier.result.AttachSecurityPolicyResult;

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

try {
    AttachSecurityPolicyResult result = client.attachSecurityPolicy(
        new AttachSecurityPolicyRequest()
            .withUserName("user-0001")
            .withSecurityPolicyId("$securityPolicy1.securityPolicyId")
    );
    List<SecurityPolicy> items = result.getItems();
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.AttachSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.AttachSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.attachSecurityPolicy(
    new AttachSecurityPolicyRequest()
        .withUserName("user-0001")
        .withSecurityPolicyId("$securityPolicy1.securityPolicyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.attachSecurityPolicy(
        new Gs2Identifier.AttachSecurityPolicyRequest()
            .withUserName("user-0001")
            .withSecurityPolicyId("$securityPolicy1.securityPolicyId")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.attach_security_policy(
        identifier.AttachSecurityPolicyRequest()
            .with_user_name('user-0001')
            .with_security_policy_id(self.security_policy1.security_policy_id)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.attach_security_policy({
    userName='user-0001',
    securityPolicyId='$securityPolicy1.securityPolicyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

割り当てられたセキュリティポリシーを新しくユーザーに割り当てます

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
securityPolicyId string ~ 1024文字 割り当てるセキュリティポリシーのGRN

Result

説明
items SecurityPolicy[] 新しくユーザーに割り当てたセキュリティポリシーのリスト

detachSecurityPolicy

detachSecurityPolicy

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.DetachSecurityPolicy(
    &identifier.DetachSecurityPolicyRequest {
        UserName: pointy.String("user-0001"),
        SecurityPolicyId: pointy.String("$securityPolicy1.securityPolicyId"),
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\DetachSecurityPolicyRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->detachSecurityPolicy(
        (new DetachSecurityPolicyRequest())
            ->withUserName("user-0001")
            ->withSecurityPolicyId(self::$securityPolicy1.securityPolicyId)
    );
    $items = $result->getItems();
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.DetachSecurityPolicyRequest;
import io.gs2.identifier.result.DetachSecurityPolicyResult;

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

try {
    DetachSecurityPolicyResult result = client.detachSecurityPolicy(
        new DetachSecurityPolicyRequest()
            .withUserName("user-0001")
            .withSecurityPolicyId("$securityPolicy1.securityPolicyId")
    );
    List<SecurityPolicy> items = result.getItems();
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.DetachSecurityPolicyRequest;
using Gs2.Gs2Identifier.Result.DetachSecurityPolicyResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.detachSecurityPolicy(
    new DetachSecurityPolicyRequest()
        .withUserName("user-0001")
        .withSecurityPolicyId("$securityPolicy1.securityPolicyId"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.detachSecurityPolicy(
        new Gs2Identifier.DetachSecurityPolicyRequest()
            .withUserName("user-0001")
            .withSecurityPolicyId("$securityPolicy1.securityPolicyId")
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.detach_security_policy(
        identifier.DetachSecurityPolicyRequest()
            .with_user_name('user-0001')
            .with_security_policy_id(self.security_policy1.security_policy_id)
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.detach_security_policy({
    userName='user-0001',
    securityPolicyId='$securityPolicy1.securityPolicyId',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;

割り当てられたセキュリティポリシーをユーザーから外します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 ユーザー名
securityPolicyId string ~ 1024文字 剥奪するセキュリティポリシーのGRN

Result

説明
items SecurityPolicy[] 剥奪したあとユーザーに引き続き割り当てられているセキュリティポリシーのリスト

login

login

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.Login(
    &identifier.LoginRequest {
        ClientId: pointy.String("client-0001"),
        ClientSecret: pointy.String("secret-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
accessToken := result.AccessToken
tokenType := result.TokenType
expiresIn := result.ExpiresIn
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\LoginRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->login(
        (new LoginRequest())
            ->withClientId("client-0001")
            ->withClientSecret("secret-0001")
    );
    $accessToken = $result->getAccessToken();
    $tokenType = $result->getTokenType();
    $expiresIn = $result->getExpiresIn();
} 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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.LoginRequest;
import io.gs2.identifier.result.LoginResult;

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

try {
    LoginResult result = client.login(
        new LoginRequest()
            .withClientId("client-0001")
            .withClientSecret("secret-0001")
    );
    String accessToken = result.getAccessToken();
    String tokenType = result.getTokenType();
    int expiresIn = result.getExpiresIn();
} 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.LoginRequest;
using Gs2.Gs2Identifier.Result.LoginResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.login(
    new LoginRequest()
        .withClientId("client-0001")
        .withClientSecret("secret-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var accessToken = result.AccessToken;
var tokenType = result.TokenType;
var expiresIn = result.ExpiresIn;
import Gs2Core from '@/gs2/core';
import * as Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.login(
        new Gs2Identifier.LoginRequest()
            .withClientId("client-0001")
            .withClientSecret("secret-0001")
    );
    const accessToken = result.getAccessToken();
    const tokenType = result.getTokenType();
    const expiresIn = result.getExpiresIn();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.login(
        identifier.LoginRequest()
            .with_client_id('client-0001')
            .with_client_secret('secret-0001')
    )
    access_token = result.access_token
    token_type = result.token_type
    expires_in = result.expires_in
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.login({
    clientId='client-0001',
    clientSecret='secret-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
accessToken = result.accessToken;
tokenType = result.tokenType;
expiresIn = result.expiresIn;

プロジェクトトークン を取得します

Request

必須 デフォルト 値の制限 説明
client_id string UUID ~ 100文字 クライアントID
client_secret string UUID ~ 100文字 クライアントシークレット

Result

説明
access_token string プロジェクトトークン
token_type string Bearer
expires_in int 有効期間(秒)

loginByUser

loginByUser

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/identifier"
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 := identifier.Gs2IdentifierRestClient{
    Session: &session,
}
result, err := client.LoginByUser(
    &identifier.LoginByUserRequest {
        UserName: pointy.String("user-name"),
        Password: pointy.String("password"),
    }
)
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\Identifier\Gs2IdentifierRestClient;
use Gs2\Identifier\Request\LoginByUserRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->loginByUser(
        (new LoginByUserRequest())
            ->withUserName("user-name")
            ->withPassword("password")
    );
    $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.identifier.rest.Gs2IdentifierRestClient;
import io.gs2.identifier.request.LoginByUserRequest;
import io.gs2.identifier.result.LoginByUserResult;

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

try {
    LoginByUserResult result = client.loginByUser(
        new LoginByUserRequest()
            .withUserName("user-name")
            .withPassword("password")
    );
    ProjectToken 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.Gs2Identifier.Gs2IdentifierRestClient;
using Gs2.Gs2Identifier.Request.LoginByUserRequest;
using Gs2.Gs2Identifier.Result.LoginByUserResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.loginByUser(
    new LoginByUserRequest()
        .withUserName("user-name")
        .withPassword("password"),
    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 Gs2Identifier from '@/gs2/identifier';

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

try {
    const result = await client.loginByUser(
        new Gs2Identifier.LoginByUserRequest()
            .withUserName("user-name")
            .withPassword("password")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import identifier

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

try:
    result = client.login_by_user(
        identifier.LoginByUserRequest()
            .with_user_name('user-name')
            .with_password('password')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('identifier')

api_result = client.login_by_user({
    userName='user-name',
    password='password',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

プロジェクトトークン を取得します

Request

必須 デフォルト 値の制限 説明
userName string ~ 128文字 GS2-Identifier のユーザ名
password string ~ 256文字 GS2-Identifier のユーザのパスワード

Result

説明
item ProjectToken プロジェクトトークン