NAV
go python java php typescript csharp GS2-Script

GS2-Lock

GS2-SDK のリファレンス

モデル

Namespace

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

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

説明
namespaceId string ネームスペースGRN
name string ネームスペース名
description string 説明文
logSetting LogSetting ログの出力設定
createdAt long 作成日時
updatedAt long 最終更新日時

Mutex

GS2 の提供するミューテックスは再入可能ロックの一種です。

ロックを取得する際にはトランザクションIDを指定し、同一トランザクションIDを指定した場合にのみ再度ロックを取得できます。 参照カウンタを持つため、解放するときには同回数のアンロック処理が必要です。

説明
mutexId string ミューテックスGRN
userId string ユーザーID
propertyId string プロパティID
transactionId string ロックを取得したトランザクションID
createdAt long 作成日時

LogSetting

説明
loggingNamespaceId string ネームスペースGRN

メソッド

describeNamespaces

describeNamespaces

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.DescribeNamespaces(
    &lock.DescribeNamespacesRequest {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\DescribeNamespacesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeNamespaces(
    new DescribeNamespacesRequest()
        .withPageToken(null)
        .withLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

api_result = client.describe_namespaces({
    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 Namespace[] ネームスペースのリスト
nextPageToken string リストの続きを取得するためのページトークン

createNamespace

createNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.CreateNamespace(
    &lock.CreateNamespaceRequest {
        Name: pointy.String("namespace1"),
        Description: nil,
        LogSetting: &lock.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\CreateNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createNamespace(
    new CreateNamespaceRequest()
        .withName("namespace1")
        .withDescription(null)
        .withLogSetting(new Gs2.Gs2Lock.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

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

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

result = api_result.result
item = result.item;

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

Request

必須 デフォルト 値の制限 説明
name string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 作成したネームスペース

getNamespaceStatus

getNamespaceStatus

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.GetNamespaceStatus(
    &lock.GetNamespaceStatusRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
status := result.Status
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\GetNamespaceStatusRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespaceStatus(
    new GetNamespaceStatusRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

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

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

result = api_result.result
status = result.status;

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

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
status string

getNamespace

getNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.GetNamespace(
    &lock.GetNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\GetNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getNamespace(
    new GetNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

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

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

result = api_result.result
item = result.item;

ネームスペースを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item Namespace ネームスペース

updateNamespace

updateNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.UpdateNamespace(
    &lock.UpdateNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
        Description: pointy.String("description1"),
        LogSetting: &lock.LogSetting{
            LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1"),
        },
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\UpdateNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateNamespace(
    new UpdateNamespaceRequest()
        .withNamespaceName("namespace1")
        .withDescription("description1")
        .withLogSetting(new Gs2.Gs2Lock.Model.LogSetting()
            .WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1")),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

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

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

result = api_result.result
item = result.item;

ネームスペースを更新

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
description string ~ 1024文字 説明文
logSetting LogSetting ログの出力設定

Result

説明
item Namespace 更新したネームスペース

deleteNamespace

deleteNamespace

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.DeleteNamespace(
    &lock.DeleteNamespaceRequest {
        NamespaceName: pointy.String("namespace1"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\DeleteNamespaceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

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

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

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

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteNamespace(
    new DeleteNamespaceRequest()
        .withNamespaceName("namespace1"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2Lock from '@/gs2/lock';

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

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

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

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

client = gs2('lock')

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

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

result = api_result.result
item = result.item;

ネームスペースを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名

Result

説明
item Namespace 削除したネームスペース

describeMutexes

describeMutexes

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.DescribeMutexes(
    &lock.DescribeMutexesRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\DescribeMutexesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeMutexes(
        (new DescribeMutexesRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.DescribeMutexesRequest;
import io.gs2.lock.result.DescribeMutexesResult;

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

try {
    DescribeMutexesResult result = client.describeMutexes(
        new DescribeMutexesRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Mutex> 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.DescribeMutexesRequest;
using Gs2.Gs2Lock.Result.DescribeMutexesResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeMutexes(
    new DescribeMutexesRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.describeMutexes(
        new Gs2Lock.DescribeMutexesRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_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 lock

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

try:
    result = client.describe_mutexes(
        lock.DescribeMutexesRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_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('lock')

api_result = client.describe_mutexes({
    namespaceName='namespace1',
    accessToken='$access_token_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

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

Result

説明
items Mutex[] ミューテックスのリスト
nextPageToken string リストの続きを取得するためのページトークン

describeMutexesByUserId

describeMutexesByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.DescribeMutexesByUserId(
    &lock.DescribeMutexesByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: 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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\DescribeMutexesByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeMutexesByUserId(
        (new DescribeMutexesByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.DescribeMutexesByUserIdRequest;
import io.gs2.lock.result.DescribeMutexesByUserIdResult;

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

try {
    DescribeMutexesByUserIdResult result = client.describeMutexesByUserId(
        new DescribeMutexesByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Mutex> 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.DescribeMutexesByUserIdRequest;
using Gs2.Gs2Lock.Result.DescribeMutexesByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeMutexesByUserId(
    new DescribeMutexesByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.describeMutexesByUserId(
        new Gs2Lock.DescribeMutexesByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("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 lock

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

try:
    result = client.describe_mutexes_by_user_id(
        lock.DescribeMutexesByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('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('lock')

api_result = client.describe_mutexes_by_user_id({
    namespaceName='namespace1',
    userId='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

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

Result

説明
items Mutex[] ミューテックスのリスト
nextPageToken string リストの続きを取得するためのページトークン

lock

lock

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.Lock(
    &lock.LockRequest {
        NamespaceName: pointy.String("namespace1"),
        PropertyId: pointy.String("property-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        TransactionId: pointy.String("transaction-0001"),
        Ttl: pointy.Int64(100000),
    }
)
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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\LockRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->lock(
        (new LockRequest())
            ->withNamespaceName(self::namespace1)
            ->withPropertyId("property-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withTransactionId("transaction-0001")
            ->withTtl(100000)
    );
    $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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.LockRequest;
import io.gs2.lock.result.LockResult;

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

try {
    LockResult result = client.lock(
        new LockRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withAccessToken("$access_token_0001")
            .withTransactionId("transaction-0001")
            .withTtl(100000L)
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.LockRequest;
using Gs2.Gs2Lock.Result.LockResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.lock(
    new LockRequest()
        .withNamespaceName("namespace1")
        .withPropertyId("property-0001")
        .withAccessToken("$access_token_0001")
        .withTransactionId("transaction-0001")
        .withTtl(100000L),
    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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.lock(
        new Gs2Lock.LockRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withAccessToken("$access_token_0001")
            .withTransactionId("transaction-0001")
            .withTtl(100000)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.lock(
        lock.LockRequest()
            .with_namespace_name(self.hash1)
            .with_property_id('property-0001')
            .with_access_token(self.access_token_0001)
            .with_transaction_id('transaction-0001')
            .with_ttl(100000)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.lock({
    namespaceName='namespace1',
    propertyId='property-0001',
    accessToken='$access_token_0001',
    transactionId='transaction-0001',
    ttl=100000,
});

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

result = api_result.result
item = result.item;

ミューテックスを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
propertyId string ~ 1024文字 プロパティID
accessToken string ~ 128文字 ユーザーID
transactionId string ~ 256文字 ロックを取得したトランザクションID
ttl long ~ 9223372036854775807 ロックを取得する期限(秒)

Result

説明
item Mutex ミューテックス

lockByUserId

lockByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.LockByUserId(
    &lock.LockByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        PropertyId: pointy.String("property-0001"),
        UserId: pointy.String("user-0001"),
        TransactionId: pointy.String("transaction-0001"),
        Ttl: pointy.Int64(10),
    }
)
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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\LockByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->lockByUserId(
        (new LockByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withPropertyId("property-0001")
            ->withUserId("user-0001")
            ->withTransactionId("transaction-0001")
            ->withTtl(10)
    );
    $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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.LockByUserIdRequest;
import io.gs2.lock.result.LockByUserIdResult;

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

try {
    LockByUserIdResult result = client.lockByUserId(
        new LockByUserIdRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withUserId("user-0001")
            .withTransactionId("transaction-0001")
            .withTtl(10L)
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.LockByUserIdRequest;
using Gs2.Gs2Lock.Result.LockByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.lockByUserId(
    new LockByUserIdRequest()
        .withNamespaceName("namespace1")
        .withPropertyId("property-0001")
        .withUserId("user-0001")
        .withTransactionId("transaction-0001")
        .withTtl(10L),
    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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.lockByUserId(
        new Gs2Lock.LockByUserIdRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withUserId("user-0001")
            .withTransactionId("transaction-0001")
            .withTtl(10)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.lock_by_user_id(
        lock.LockByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_property_id('property-0001')
            .with_user_id('user-0001')
            .with_transaction_id('transaction-0001')
            .with_ttl(10)
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.lock_by_user_id({
    namespaceName='namespace1',
    propertyId='property-0001',
    userId='user-0001',
    transactionId='transaction-0001',
    ttl=10,
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してミューテックスを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 ネームスペース名
propertyId string ~ 1024文字 プロパティID
userId string ~ 128文字 ユーザーID
transactionId string ~ 256文字 ロックを取得したトランザクションID
ttl long ~ 9223372036854775807 ロックを取得する期限(秒)

Result

説明
item Mutex ミューテックス

unlock

unlock

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.Unlock(
    &lock.UnlockRequest {
        NamespaceName: pointy.String("namespace1"),
        PropertyId: pointy.String("property-0001"),
        AccessToken: pointy.String("$access_token_0001"),
        TransactionId: pointy.String("transaction-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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\UnlockRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->unlock(
        (new UnlockRequest())
            ->withNamespaceName(self::namespace1)
            ->withPropertyId("property-0001")
            ->withAccessToken(self::$accessToken0001)
            ->withTransactionId("transaction-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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.UnlockRequest;
import io.gs2.lock.result.UnlockResult;

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

try {
    UnlockResult result = client.unlock(
        new UnlockRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withAccessToken("$access_token_0001")
            .withTransactionId("transaction-0001")
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.UnlockRequest;
using Gs2.Gs2Lock.Result.UnlockResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.unlock(
    new UnlockRequest()
        .withNamespaceName("namespace1")
        .withPropertyId("property-0001")
        .withAccessToken("$access_token_0001")
        .withTransactionId("transaction-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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.unlock(
        new Gs2Lock.UnlockRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withAccessToken("$access_token_0001")
            .withTransactionId("transaction-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.unlock(
        lock.UnlockRequest()
            .with_namespace_name(self.hash1)
            .with_property_id('property-0001')
            .with_access_token(self.access_token_0001)
            .with_transaction_id('transaction-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.unlock({
    namespaceName='namespace1',
    propertyId='property-0001',
    accessToken='$access_token_0001',
    transactionId='transaction-0001',
});

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

result = api_result.result
item = result.item;

ミューテックスを解放

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 カテゴリー名
propertyId string ~ 1024文字 プロパティID
accessToken string ~ 128文字 ユーザーID
transactionId string ~ 256文字 ロックを取得したトランザクションID

Result

説明
item Mutex ミューテックス

unlockByUserId

unlockByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.UnlockByUserId(
    &lock.UnlockByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        PropertyId: pointy.String("property-0001"),
        UserId: pointy.String("user-0001"),
        TransactionId: pointy.String("transaction-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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\UnlockByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->unlockByUserId(
        (new UnlockByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withPropertyId("property-0001")
            ->withUserId("user-0001")
            ->withTransactionId("transaction-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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.UnlockByUserIdRequest;
import io.gs2.lock.result.UnlockByUserIdResult;

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

try {
    UnlockByUserIdResult result = client.unlockByUserId(
        new UnlockByUserIdRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withUserId("user-0001")
            .withTransactionId("transaction-0001")
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.UnlockByUserIdRequest;
using Gs2.Gs2Lock.Result.UnlockByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.unlockByUserId(
    new UnlockByUserIdRequest()
        .withNamespaceName("namespace1")
        .withPropertyId("property-0001")
        .withUserId("user-0001")
        .withTransactionId("transaction-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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.unlockByUserId(
        new Gs2Lock.UnlockByUserIdRequest()
            .withNamespaceName("namespace1")
            .withPropertyId("property-0001")
            .withUserId("user-0001")
            .withTransactionId("transaction-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.unlock_by_user_id(
        lock.UnlockByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_property_id('property-0001')
            .with_user_id('user-0001')
            .with_transaction_id('transaction-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.unlock_by_user_id({
    namespaceName='namespace1',
    propertyId='property-0001',
    userId='user-0001',
    transactionId='transaction-0001',
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してミューテックスを解放

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 カテゴリー名
propertyId string ~ 1024文字 プロパティID
userId string ~ 128文字 ユーザーID
transactionId string ~ 256文字 ロックを取得したトランザクションID

Result

説明
item Mutex ミューテックス

getMutex

getMutex

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.GetMutex(
    &lock.GetMutexRequest {
        NamespaceName: pointy.String("namespace1"),
        AccessToken: pointy.String("$access_token_0001"),
        PropertyId: pointy.String("property-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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\GetMutexRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getMutex(
        (new GetMutexRequest())
            ->withNamespaceName(self::namespace1)
            ->withAccessToken(self::$accessToken0001)
            ->withPropertyId("property-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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.GetMutexRequest;
import io.gs2.lock.result.GetMutexResult;

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

try {
    GetMutexResult result = client.getMutex(
        new GetMutexRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPropertyId("property-0001")
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.GetMutexRequest;
using Gs2.Gs2Lock.Result.GetMutexResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getMutex(
    new GetMutexRequest()
        .withNamespaceName("namespace1")
        .withAccessToken("$access_token_0001")
        .withPropertyId("property-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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.getMutex(
        new Gs2Lock.GetMutexRequest()
            .withNamespaceName("namespace1")
            .withAccessToken("$access_token_0001")
            .withPropertyId("property-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.get_mutex(
        lock.GetMutexRequest()
            .with_namespace_name(self.hash1)
            .with_access_token(self.access_token_0001)
            .with_property_id('property-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.get_mutex({
    namespaceName='namespace1',
    accessToken='$access_token_0001',
    propertyId='property-0001',
});

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

result = api_result.result
item = result.item;

ミューテックスを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 カテゴリー名
accessToken string ~ 128文字 ユーザーID
propertyId string ~ 1024文字 プロパティID

Result

説明
item Mutex ミューテックス

getMutexByUserId

getMutexByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.GetMutexByUserId(
    &lock.GetMutexByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        PropertyId: pointy.String("property-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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\GetMutexByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->getMutexByUserId(
        (new GetMutexByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withPropertyId("property-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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.GetMutexByUserIdRequest;
import io.gs2.lock.result.GetMutexByUserIdResult;

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

try {
    GetMutexByUserIdResult result = client.getMutexByUserId(
        new GetMutexByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPropertyId("property-0001")
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.GetMutexByUserIdRequest;
using Gs2.Gs2Lock.Result.GetMutexByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getMutexByUserId(
    new GetMutexByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withPropertyId("property-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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.getMutexByUserId(
        new Gs2Lock.GetMutexByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPropertyId("property-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.get_mutex_by_user_id(
        lock.GetMutexByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_property_id('property-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.get_mutex_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    propertyId='property-0001',
});

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

result = api_result.result
item = result.item;

ユーザIDを指定してミューテックスを取得

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 カテゴリー名
userId string ~ 128文字 ユーザーID
propertyId string ~ 1024文字 プロパティID

Result

説明
item Mutex ミューテックス

deleteMutexByUserId

deleteMutexByUserId

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/lock"
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 := lock.Gs2LockRestClient{
    Session: &session,
}
result, err := client.DeleteMutexByUserId(
    &lock.DeleteMutexByUserIdRequest {
        NamespaceName: pointy.String("namespace1"),
        UserId: pointy.String("user-0001"),
        PropertyId: pointy.String("property-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\Lock\Gs2LockRestClient;
use Gs2\Lock\Request\DeleteMutexByUserIdRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $session
);

try {
    $result = $client->deleteMutexByUserId(
        (new DeleteMutexByUserIdRequest())
            ->withNamespaceName(self::namespace1)
            ->withUserId("user-0001")
            ->withPropertyId("property-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.lock.rest.Gs2LockRestClient;
import io.gs2.lock.request.DeleteMutexByUserIdRequest;
import io.gs2.lock.result.DeleteMutexByUserIdResult;

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

try {
    DeleteMutexByUserIdResult result = client.deleteMutexByUserId(
        new DeleteMutexByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPropertyId("property-0001")
    );
    Mutex 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.Gs2Lock.Gs2LockRestClient;
using Gs2.Gs2Lock.Request.DeleteMutexByUserIdRequest;
using Gs2.Gs2Lock.Result.DeleteMutexByUserIdResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteMutexByUserId(
    new DeleteMutexByUserIdRequest()
        .withNamespaceName("namespace1")
        .withUserId("user-0001")
        .withPropertyId("property-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 Gs2Lock from '@/gs2/lock';

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

try {
    const result = await client.deleteMutexByUserId(
        new Gs2Lock.DeleteMutexByUserIdRequest()
            .withNamespaceName("namespace1")
            .withUserId("user-0001")
            .withPropertyId("property-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import lock

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

try:
    result = client.delete_mutex_by_user_id(
        lock.DeleteMutexByUserIdRequest()
            .with_namespace_name(self.hash1)
            .with_user_id('user-0001')
            .with_property_id('property-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)

client = gs2('lock')

api_result = client.delete_mutex_by_user_id({
    namespaceName='namespace1',
    userId='user-0001',
    propertyId='property-0001',
});

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

result = api_result.result
item = result.item;

ミューテックスを削除

Request

必須 デフォルト 値の制限 説明
namespaceName string ~ 32文字 カテゴリー名
userId string ~ 128文字 ユーザーID
propertyId string ~ 1024文字 プロパティID

Result

説明
item Mutex ミューテックス