GS2-JobQueue SDK API リファレンス
モデル
Namespace
ネームスペース
ネームスペースは一つのプロジェクトで同じサービスを異なる用途で複数利用できるようにするための仕組みです。
GS2 のサービスは基本的にネームスペースというレイヤーがあり、ネームスペースが異なれば同じサービスでもまったく別のデータ空間として取り扱われます。
そのため、各サービスの利用を開始するにあたってネームスペースを作成する必要があります。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceId | string | ✓ | | ~ 1024文字 | ネームスペースGRN |
name | string | ✓ | | ~ 32文字 | ネームスペース名 |
description | string | | | ~ 1024文字 | 説明文 |
enableAutoRun | bool | ✓ | false | | 登録されたジョブをサーバーサイドで自動的に実行するか |
runNotification | NotificationSetting | {enableAutoRun} | | | ジョブキューのジョブが実行されたときののプッシュ通知 |
pushNotification | NotificationSetting | !{enableAutoRun} | | | ジョブキューにジョブが登録されたときののプッシュ通知 |
logSetting | LogSetting | | | | ログの出力設定 |
createdAt | long | ✓ | | | 作成日時 |
updatedAt | long | ✓ | | | 最終更新日時 |
Job
ジョブ
ジョブキューとは直ちに処理を完了せず、処理を遅延実行するための仕組みです。
例えば、キャラクターを入手したときに直ちに実行しなければならない処理としては所持品にキャラクターを格納することです。
一方で、直ちに処理しなければならないわけではない処理として、図鑑に登録する
という処理があります。
こういった直ちに処理するまでもない処理をジョブキューを経由して処理するようにすることで、障害に強い設計にすることができます。
なぜなら、図鑑サービスが何らかの障害によって止まっていたとしても、図鑑に登録されない状態でゲームを継続することができます。
ジョブキューに詰まれた処理は失敗しても、障害が解消した後でリトライすることで結果的に正しい状態にできます。
GS2 ではこのような 結果整合
処理を推奨しており、様々な場面でジョブキューを利用した遅延処理が行われます。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
jobId | string | ✓ | | ~ 1024文字 | ジョブGRN |
name | string | ✓ | UUID | ~ 36文字 | ジョブの名前 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
scriptId | string | ✓ | | ~ 1024文字 | スクリプトGRN |
args | string | ✓ | | ~ 5242880文字 | 引数 |
currentRetryCount | int | ✓ | 0 | ~ 100 | 現在のリトライ回数 |
maxTryCount | int | ✓ | 3 | 1 ~ 100 | 最大試行回数 |
createdAt | long | ✓ | | | 作成日時 |
updatedAt | long | ✓ | | | 最終更新日時 |
JobResult
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
jobResultId | string | ✓ | | ~ 1024文字 | ジョブ実行結果GRN |
jobId | string | ✓ | | ~ 1024文字 | ジョブGRN |
scriptId | string | | | ~ 1024文字 | スクリプトGRN |
args | string | | | ~ 5242880文字 | 引数 |
tryNumber | int | ✓ | | ~ 10000 | 試行回数 |
statusCode | int | ✓ | | ~ 1000 | ステータスコード |
result | string | ✓ | | ~ 5242880文字 | レスポンスの内容 |
tryAt | long | ✓ | | | 作成日時 |
DeadLetterJob
デッドレタージョブ
デッドレタージョブは最大リトライ回数試行したものの、成功しなかったジョブです。
本来はゲームプレイヤーが入手しているべき報酬で付与できなかったものが記録されていると思われます。
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
deadLetterJobId | string | ✓ | | ~ 1024文字 | デッドレタージョブGRN |
name | string | ✓ | | ~ 128文字 | ジョブの名前 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
scriptId | string | ✓ | | ~ 1024文字 | スクリプトGRN |
args | string | ✓ | | ~ 5242880文字 | 引数 |
result | List<JobResultBody> | | | | ジョブ実行結果のリスト |
createdAt | long | ✓ | | | 作成日時 |
updatedAt | long | ✓ | | | 最終更新日時 |
NotificationSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
gatewayNamespaceId | string | ✓ | | ~ 1024文字 | ネームスペースGRN |
enableTransferMobileNotification | bool? | | | | モバイルプッシュ通知へ転送するか |
sound | string | | | ~ 1024文字 | モバイルプッシュ通知で使用するサウンドファイル名 |
LogSetting
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
loggingNamespaceId | string | ✓ | | ~ 1024文字 | ネームスペースGRN |
JobEntry
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
scriptId | string | ✓ | | ~ 1024文字 | スクリプトGRN |
args | string | ✓ | “{}” | ~ 131072文字 | 引数 |
maxTryCount | int | ✓ | 3 | ~ 100 | 最大試行回数 |
JobResultBody
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
tryNumber | int | ✓ | | 1 ~ 10000 | 試行回数 |
statusCode | int | ✓ | | ~ 1000 | ステータスコード |
result | string | ✓ | | ~ 5242880文字 | レスポンスの内容 |
tryAt | long | ✓ | | | 作成日時 |
メソッド
describeNamespaces
ネームスペースの一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
pageToken | string | | | ~ 1024文字 | データの取得を開始する位置を指定するトークン |
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&job_queue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DescribeNamespacesRequest;
import io.gs2.jobQueue.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DescribeNamespacesRequest;
using Gs2.Gs2JobQueue.Result.DescribeNamespacesResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2JobQueue.Request.DescribeNamespacesRequest()
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2JobQueue.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 job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.describe_namespaces(
job_queue.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('jobQueue')
api_result = client.describe_namespaces({
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
createNamespace
ネームスペースを新規作成
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
name | string | ✓ | | ~ 32文字 | ネームスペース名 |
description | string | | | ~ 1024文字 | 説明文 |
enableAutoRun | bool | ✓ | false | | 登録されたジョブをサーバーサイドで自動的に実行するか |
pushNotification | NotificationSetting | !{enableAutoRun} | | | ジョブキューにジョブが登録されたときののプッシュ通知 |
runNotification | NotificationSetting | {enableAutoRun} | | | ジョブキューのジョブが実行されたときののプッシュ通知 |
logSetting | LogSetting | | | | ログの出力設定 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&job_queue.CreateNamespaceRequest {
Name: pointy.String("namespace1"),
Description: nil,
EnableAutoRun: nil,
PushNotification: nil,
RunNotification: nil,
LogSetting: &jobQueue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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)
->withEnableAutoRun(null)
->withPushNotification(null)
->withRunNotification(null)
->withLogSetting((new \Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.CreateNamespaceRequest;
import io.gs2.jobQueue.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAutoRun(null)
.withPushNotification(null)
.withRunNotification(null)
.withLogSetting(new io.gs2.jobQueue.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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.CreateNamespaceRequest;
using Gs2.Gs2JobQueue.Result.CreateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2JobQueue.Request.CreateNamespaceRequest()
.WithName("namespace1")
.WithDescription(null)
.WithEnableAutoRun(null)
.WithPushNotification(null)
.WithRunNotification(null)
.WithLogSetting(new Gs2.Gs2JobQueue.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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.createNamespace(
new Gs2JobQueue.CreateNamespaceRequest()
.withName("namespace1")
.withDescription(null)
.withEnableAutoRun(null)
.withPushNotification(null)
.withRunNotification(null)
.withLogSetting(new Gs2JobQueue.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 job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.create_namespace(
job_queue.CreateNamespaceRequest()
.with_name(self.hash1)
.with_description(None)
.with_enable_auto_run(None)
.with_push_notification(None)
.with_run_notification(None)
.with_log_setting(
job_queue.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('jobQueue')
api_result = client.create_namespace({
name='namespace1',
description=nil,
enableAutoRun=nil,
pushNotification=nil,
runNotification=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getNamespaceStatus
ネームスペースの状態を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&job_queue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetNamespaceStatusRequest;
import io.gs2.jobQueue.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetNamespaceStatusRequest;
using Gs2.Gs2JobQueue.Result.GetNamespaceStatusResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2JobQueue.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2JobQueue.GetNamespaceStatusRequest()
.withNamespaceName("namespace1")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_namespace_status(
job_queue.GetNamespaceStatusRequest()
.with_namespace_name(self.hash1)
)
status = result.status
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_namespace_status({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
status = result.status;
getNamespace
ネームスペースを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&job_queue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetNamespaceRequest;
import io.gs2.jobQueue.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetNamespaceRequest;
using Gs2.Gs2JobQueue.Result.GetNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2JobQueue.Request.GetNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getNamespace(
new Gs2JobQueue.GetNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_namespace(
job_queue.GetNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
updateNamespace
ネームスペースを更新
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
description | string | | | ~ 1024文字 | 説明文 |
enableAutoRun | bool | ✓ | false | | 登録されたジョブをサーバーサイドで自動的に実行するか |
pushNotification | NotificationSetting | !{enableAutoRun} | | | ジョブキューにジョブが登録されたときののプッシュ通知 |
runNotification | NotificationSetting | {enableAutoRun} | | | ジョブキューのジョブが実行されたときののプッシュ通知 |
logSetting | LogSetting | | | | ログの出力設定 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&job_queue.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace1"),
Description: pointy.String("description1"),
EnableAutoRun: nil,
PushNotification: nil,
RunNotification: nil,
LogSetting: &jobQueue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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")
->withEnableAutoRun(null)
->withPushNotification(null)
->withRunNotification(null)
->withLogSetting((new \Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.UpdateNamespaceRequest;
import io.gs2.jobQueue.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAutoRun(null)
.withPushNotification(null)
.withRunNotification(null)
.withLogSetting(new io.gs2.jobQueue.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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.UpdateNamespaceRequest;
using Gs2.Gs2JobQueue.Result.UpdateNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2JobQueue.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace1")
.WithDescription("description1")
.WithEnableAutoRun(null)
.WithPushNotification(null)
.WithRunNotification(null)
.WithLogSetting(new Gs2.Gs2JobQueue.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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2JobQueue.UpdateNamespaceRequest()
.withNamespaceName("namespace1")
.withDescription("description1")
.withEnableAutoRun(null)
.withPushNotification(null)
.withRunNotification(null)
.withLogSetting(new Gs2JobQueue.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 job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.update_namespace(
job_queue.UpdateNamespaceRequest()
.with_namespace_name(self.hash1)
.with_description('description1')
.with_enable_auto_run(None)
.with_push_notification(None)
.with_run_notification(None)
.with_log_setting(
job_queue.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('jobQueue')
api_result = client.update_namespace({
namespaceName='namespace1',
description='description1',
enableAutoRun=nil,
pushNotification=nil,
runNotification=nil,
logSetting={
loggingNamespaceId='grn:gs2:ap-northeast-1:YourOwnerId:log:namespace1',
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteNamespace
ネームスペースを削除
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&job_queue.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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DeleteNamespaceRequest;
import io.gs2.jobQueue.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DeleteNamespaceRequest;
using Gs2.Gs2JobQueue.Result.DeleteNamespaceResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2JobQueue.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace1"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2JobQueue.DeleteNamespaceRequest()
.withNamespaceName("namespace1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.delete_namespace(
job_queue.DeleteNamespaceRequest()
.with_namespace_name(self.hash1)
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.delete_namespace({
namespaceName='namespace1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeJobsByUserId
ジョブの一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
pageToken | string | | | ~ 1024文字 | データの取得を開始する位置を指定するトークン |
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
| 型 | 説明 |
---|
items | List<Job> | ジョブのリスト |
nextPageToken | string | リストの続きを取得するためのページトークン |
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DescribeJobsByUserId(
&job_queue.DescribeJobsByUserIdRequest {
NamespaceName: nil,
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\DescribeJobsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeJobsByUserId(
(new DescribeJobsByUserIdRequest())
->withNamespaceName(null)
->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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DescribeJobsByUserIdRequest;
import io.gs2.jobQueue.result.DescribeJobsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
DescribeJobsByUserIdResult result = client.describeJobsByUserId(
new DescribeJobsByUserIdRequest()
.withNamespaceName(null)
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
);
List<Job> 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DescribeJobsByUserIdRequest;
using Gs2.Gs2JobQueue.Result.DescribeJobsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DescribeJobsByUserIdResult> asyncResult = null;
yield return client.DescribeJobsByUserId(
new Gs2.Gs2JobQueue.Request.DescribeJobsByUserIdRequest()
.WithNamespaceName(null)
.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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.describeJobsByUserId(
new Gs2JobQueue.DescribeJobsByUserIdRequest()
.withNamespaceName(null)
.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 job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.describe_jobs_by_user_id(
job_queue.DescribeJobsByUserIdRequest()
.with_namespace_name(None)
.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('jobQueue')
api_result = client.describe_jobs_by_user_id({
namespaceName=nil,
userId='user-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
getJobByUserId
ジョブを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
jobName | string | ✓ | UUID | ~ 36文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetJobByUserId(
&job_queue.GetJobByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
JobName: pointy.String("job1"),
}
)
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\GetJobByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getJobByUserId(
(new GetJobByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withJobName("job1")
);
$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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetJobByUserIdRequest;
import io.gs2.jobQueue.result.GetJobByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
GetJobByUserIdResult result = client.getJobByUserId(
new GetJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job1")
);
Job 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetJobByUserIdRequest;
using Gs2.Gs2JobQueue.Result.GetJobByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetJobByUserIdResult> asyncResult = null;
yield return client.GetJobByUserId(
new Gs2.Gs2JobQueue.Request.GetJobByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithJobName("job1"),
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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getJobByUserId(
new Gs2JobQueue.GetJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_job_by_user_id(
job_queue.GetJobByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_job_name('job1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_job_by_user_id({
namespaceName='namespace1',
userId='user-0001',
jobName='job1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
pushByUserId
ユーザIDを指定してジョブを登録
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
jobs | List<JobEntry> | | | | 追加するジョブの一覧 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.PushByUserId(
&job_queue.PushByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
Jobs: []jobQueue.JobEntry{
jobQueue.JobEntry{
ScriptId: pointy.String("script-0001"),
Args: pointy.String("{\"hoge\": \"fuga\"}"),
},
jobQueue.JobEntry{
ScriptId: pointy.String("script-0001"),
Args: pointy.String("{\"piyo\": \"piyopiyo\"}"),
},
},
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
autoRun := result.AutoRun
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\PushByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->pushByUserId(
(new PushByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withJobs([ (new \Gs2\JobQueue\Model\JobEntry())
->withScriptId("script-0001")
->withArgs("{\"hoge\": \"fuga\"}"),
(new \Gs2\JobQueue\Model\JobEntry())
->withScriptId("script-0001")
->withArgs("{\"piyo\": \"piyopiyo\"}"),
])
);
$items = $result->getItems();
$autoRun = $result->getAutoRun();
} 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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.PushByUserIdRequest;
import io.gs2.jobQueue.result.PushByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
PushByUserIdResult result = client.pushByUserId(
new PushByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobs(Arrays.asList(
new io.gs2.jobQueue.model.JobEntry()
.withScriptId("script-0001")
.withArgs("{\"hoge\": \"fuga\"}"),
new io.gs2.jobQueue.model.JobEntry()
.withScriptId("script-0001")
.withArgs("{\"piyo\": \"piyopiyo\"}")
))
);
List<Job> items = result.getItems();
boolean autoRun = result.getAutoRun();
} 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.PushByUserIdRequest;
using Gs2.Gs2JobQueue.Result.PushByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.PushByUserIdResult> asyncResult = null;
yield return client.PushByUserId(
new Gs2.Gs2JobQueue.Request.PushByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithJobs(new Gs2.Gs2JobQueue.Model.JobEntry[] {
new Gs2.Gs2JobQueue.Model.JobEntry()
.WithScriptId("script-0001")
.WithArgs("{\"hoge\": \"fuga\"}"),
new Gs2.Gs2JobQueue.Model.JobEntry()
.WithScriptId("script-0001")
.WithArgs("{\"piyo\": \"piyopiyo\"}")
}),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var autoRun = result.AutoRun;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.pushByUserId(
new Gs2JobQueue.PushByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobs([
new Gs2JobQueue.model.JobEntry()
.withScriptId("script-0001")
.withArgs("{\"hoge\": \"fuga\"}"),
new Gs2JobQueue.model.JobEntry()
.withScriptId("script-0001")
.withArgs("{\"piyo\": \"piyopiyo\"}")
])
);
const items = result.getItems();
const autoRun = result.getAutoRun();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.push_by_user_id(
job_queue.PushByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_jobs([ job_queue.JobEntry()
.with_script_id('script-0001')
.with_args('{"hoge": "fuga"}'),
job_queue.JobEntry()
.with_script_id('script-0001')
.with_args('{"piyo": "piyopiyo"}'),
])
)
items = result.items
auto_run = result.auto_run
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.push_by_user_id({
namespaceName='namespace1',
userId='user-0001',
jobs={
{
scriptId='script-0001',
args='{"hoge": "fuga"}',
},
{
scriptId='script-0001',
args='{"piyo": "piyopiyo"}',
}
},
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
autoRun = result.autoRun;
run
ジョブを実行
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.Run(
&job_queue.RunRequest {
NamespaceName: pointy.String("namespace2"),
AccessToken: pointy.String("$access_token_0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
result := result.Result
isLastJob := result.IsLastJob
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\RunRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->run(
(new RunRequest())
->withNamespaceName(self::namespace2)
->withAccessToken(self::$accessToken0001)
);
$item = $result->getItem();
$result = $result->getResult();
$isLastJob = $result->getIsLastJob();
} 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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.RunRequest;
import io.gs2.jobQueue.result.RunResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
RunResult result = client.run(
new RunRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_0001")
);
Job item = result.getItem();
JobResultBody result = result.getResult();
boolean isLastJob = result.getIsLastJob();
} 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.RunRequest;
using Gs2.Gs2JobQueue.Result.RunResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.RunResult> asyncResult = null;
yield return client.Run(
new Gs2.Gs2JobQueue.Request.RunRequest()
.WithNamespaceName("namespace2")
.WithAccessToken("$access_token_0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var result = result.Result;
var isLastJob = result.IsLastJob;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.run(
new Gs2JobQueue.RunRequest()
.withNamespaceName("namespace2")
.withAccessToken("$access_token_0001")
);
const item = result.getItem();
const result = result.getResult();
const isLastJob = result.getIsLastJob();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.run(
job_queue.RunRequest()
.with_namespace_name(self.hash2)
.with_access_token(self.access_token_0001)
)
item = result.item
result = result.result
is_last_job = result.is_last_job
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.run({
namespaceName='namespace2',
accessToken='$access_token_0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
result = result.result;
isLastJob = result.isLastJob;
runByUserId
ユーザIDを指定してジョブを実行
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.RunByUserId(
&job_queue.RunByUserIdRequest {
NamespaceName: pointy.String("namespace2"),
UserId: pointy.String("user-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
result := result.Result
isLastJob := result.IsLastJob
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\RunByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->runByUserId(
(new RunByUserIdRequest())
->withNamespaceName(self::namespace2)
->withUserId("user-0001")
);
$item = $result->getItem();
$result = $result->getResult();
$isLastJob = $result->getIsLastJob();
} 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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.RunByUserIdRequest;
import io.gs2.jobQueue.result.RunByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
RunByUserIdResult result = client.runByUserId(
new RunByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
);
Job item = result.getItem();
JobResultBody result = result.getResult();
boolean isLastJob = result.getIsLastJob();
} 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.RunByUserIdRequest;
using Gs2.Gs2JobQueue.Result.RunByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.RunByUserIdResult> asyncResult = null;
yield return client.RunByUserId(
new Gs2.Gs2JobQueue.Request.RunByUserIdRequest()
.WithNamespaceName("namespace2")
.WithUserId("user-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var result = result.Result;
var isLastJob = result.IsLastJob;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.runByUserId(
new Gs2JobQueue.RunByUserIdRequest()
.withNamespaceName("namespace2")
.withUserId("user-0001")
);
const item = result.getItem();
const result = result.getResult();
const isLastJob = result.getIsLastJob();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.run_by_user_id(
job_queue.RunByUserIdRequest()
.with_namespace_name(self.hash2)
.with_user_id('user-0001')
)
item = result.item
result = result.result
is_last_job = result.is_last_job
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.run_by_user_id({
namespaceName='namespace2',
userId='user-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
result = result.result;
isLastJob = result.isLastJob;
deleteJobByUserId
ユーザーIDを指定してジョブを削除
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
jobName | string | ✓ | UUID | ~ 36文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DeleteJobByUserId(
&job_queue.DeleteJobByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
JobName: pointy.String("job1"),
}
)
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\DeleteJobByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteJobByUserId(
(new DeleteJobByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withJobName("job1")
);
$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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DeleteJobByUserIdRequest;
import io.gs2.jobQueue.result.DeleteJobByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
DeleteJobByUserIdResult result = client.deleteJobByUserId(
new DeleteJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job1")
);
Job 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DeleteJobByUserIdRequest;
using Gs2.Gs2JobQueue.Result.DeleteJobByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DeleteJobByUserIdResult> asyncResult = null;
yield return client.DeleteJobByUserId(
new Gs2.Gs2JobQueue.Request.DeleteJobByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithJobName("job1"),
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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.deleteJobByUserId(
new Gs2JobQueue.DeleteJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.delete_job_by_user_id(
job_queue.DeleteJobByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_job_name('job1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.delete_job_by_user_id({
namespaceName='namespace1',
userId='user-0001',
jobName='job1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
pushByStampSheet
スタンプシートを使用してジョブを登録
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
stampSheet | string | ✓ | | ~ 5242880文字 | スタンプシート |
keyId | string | ✓ | | ~ 1024文字 | 暗号鍵GRN |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.PushByStampSheet(
&job_queue.PushByStampSheetRequest {
StampSheet: pointy.String("$stampSheet"),
KeyId: pointy.String("$key1.keyId"),
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
autoRun := result.AutoRun
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\PushByStampSheetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->pushByStampSheet(
(new PushByStampSheetRequest())
->withStampSheet(self::$stampSheet)
->withKeyId(self::$key1.keyId)
);
$items = $result->getItems();
$autoRun = $result->getAutoRun();
} 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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.PushByStampSheetRequest;
import io.gs2.jobQueue.result.PushByStampSheetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
PushByStampSheetResult result = client.pushByStampSheet(
new PushByStampSheetRequest()
.withStampSheet("$stampSheet")
.withKeyId("$key1.keyId")
);
List<Job> items = result.getItems();
boolean autoRun = result.getAutoRun();
} 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.PushByStampSheetRequest;
using Gs2.Gs2JobQueue.Result.PushByStampSheetResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.PushByStampSheetResult> asyncResult = null;
yield return client.PushByStampSheet(
new Gs2.Gs2JobQueue.Request.PushByStampSheetRequest()
.WithStampSheet("$stampSheet")
.WithKeyId("$key1.keyId"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var autoRun = result.AutoRun;
import Gs2Core from '@/gs2/core';
import * as Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.pushByStampSheet(
new Gs2JobQueue.PushByStampSheetRequest()
.withStampSheet("$stampSheet")
.withKeyId("$key1.keyId")
);
const items = result.getItems();
const autoRun = result.getAutoRun();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.push_by_stamp_sheet(
job_queue.PushByStampSheetRequest()
.with_stamp_sheet(self.stamp_sheet)
.with_key_id(self.key1.key_id)
)
items = result.items
auto_run = result.auto_run
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.push_by_stamp_sheet({
stampSheet='$stampSheet',
keyId='$key1.keyId',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
autoRun = result.autoRun;
getJobResult
ジョブの実行結果を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
accessToken | string | ✓ | | ~ 128文字 | ユーザーID |
jobName | string | ✓ | UUID | ~ 36文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetJobResult(
&job_queue.GetJobResultRequest {
NamespaceName: pointy.String("namespace1"),
AccessToken: pointy.String("$access_token_0001"),
JobName: pointy.String("job-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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\GetJobResultRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getJobResult(
(new GetJobResultRequest())
->withNamespaceName(self::namespace1)
->withAccessToken(self::$accessToken0001)
->withJobName("job-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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetJobResultRequest;
import io.gs2.jobQueue.result.GetJobResultResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
GetJobResultResult result = client.getJobResult(
new GetJobResultRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withJobName("job-0001")
);
JobResult 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetJobResultRequest;
using Gs2.Gs2JobQueue.Result.GetJobResultResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetJobResultResult> asyncResult = null;
yield return client.GetJobResult(
new Gs2.Gs2JobQueue.Request.GetJobResultRequest()
.WithNamespaceName("namespace1")
.WithAccessToken("$access_token_0001")
.WithJobName("job-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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getJobResult(
new Gs2JobQueue.GetJobResultRequest()
.withNamespaceName("namespace1")
.withAccessToken("$access_token_0001")
.withJobName("job-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_job_result(
job_queue.GetJobResultRequest()
.with_namespace_name(self.hash1)
.with_access_token(self.access_token_0001)
.with_job_name('job-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_job_result({
namespaceName='namespace1',
accessToken='$access_token_0001',
jobName='job-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
getJobResultByUserId
ユーザーIDを指定してジョブの実行結果を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
jobName | string | ✓ | UUID | ~ 36文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetJobResultByUserId(
&job_queue.GetJobResultByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
JobName: pointy.String("job-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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\GetJobResultByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getJobResultByUserId(
(new GetJobResultByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withJobName("job-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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetJobResultByUserIdRequest;
import io.gs2.jobQueue.result.GetJobResultByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
GetJobResultByUserIdResult result = client.getJobResultByUserId(
new GetJobResultByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job-0001")
);
JobResult 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetJobResultByUserIdRequest;
using Gs2.Gs2JobQueue.Result.GetJobResultByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetJobResultByUserIdResult> asyncResult = null;
yield return client.GetJobResultByUserId(
new Gs2.Gs2JobQueue.Request.GetJobResultByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithJobName("job-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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getJobResultByUserId(
new Gs2JobQueue.GetJobResultByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withJobName("job-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_job_result_by_user_id(
job_queue.GetJobResultByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_job_name('job-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_job_result_by_user_id({
namespaceName='namespace1',
userId='user-0001',
jobName='job-0001',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
describeDeadLetterJobsByUserId
デッドレタージョブの一覧を取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
pageToken | string | | | ~ 1024文字 | データの取得を開始する位置を指定するトークン |
limit | int | ✓ | 30 | 1 ~ 1000 | データの取得件数 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DescribeDeadLetterJobsByUserId(
&job_queue.DescribeDeadLetterJobsByUserIdRequest {
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\DescribeDeadLetterJobsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->describeDeadLetterJobsByUserId(
(new DescribeDeadLetterJobsByUserIdRequest())
->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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DescribeDeadLetterJobsByUserIdRequest;
import io.gs2.jobQueue.result.DescribeDeadLetterJobsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
DescribeDeadLetterJobsByUserIdResult result = client.describeDeadLetterJobsByUserId(
new DescribeDeadLetterJobsByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withPageToken(null)
.withLimit(null)
);
List<DeadLetterJob> 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DescribeDeadLetterJobsByUserIdRequest;
using Gs2.Gs2JobQueue.Result.DescribeDeadLetterJobsByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DescribeDeadLetterJobsByUserIdResult> asyncResult = null;
yield return client.DescribeDeadLetterJobsByUserId(
new Gs2.Gs2JobQueue.Request.DescribeDeadLetterJobsByUserIdRequest()
.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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.describeDeadLetterJobsByUserId(
new Gs2JobQueue.DescribeDeadLetterJobsByUserIdRequest()
.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 job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.describe_dead_letter_jobs_by_user_id(
job_queue.DescribeDeadLetterJobsByUserIdRequest()
.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('jobQueue')
api_result = client.describe_dead_letter_jobs_by_user_id({
namespaceName='namespace1',
userId='user-0001',
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
getDeadLetterJobByUserId
デッドレタージョブを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
deadLetterJobName | string | ✓ | | ~ 128文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.GetDeadLetterJobByUserId(
&job_queue.GetDeadLetterJobByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
DeadLetterJobName: pointy.String("deadLetterJob1"),
}
)
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\GetDeadLetterJobByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->getDeadLetterJobByUserId(
(new GetDeadLetterJobByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withDeadLetterJobName("deadLetterJob1")
);
$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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.GetDeadLetterJobByUserIdRequest;
import io.gs2.jobQueue.result.GetDeadLetterJobByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
GetDeadLetterJobByUserIdResult result = client.getDeadLetterJobByUserId(
new GetDeadLetterJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withDeadLetterJobName("deadLetterJob1")
);
DeadLetterJob 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.GetDeadLetterJobByUserIdRequest;
using Gs2.Gs2JobQueue.Result.GetDeadLetterJobByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.GetDeadLetterJobByUserIdResult> asyncResult = null;
yield return client.GetDeadLetterJobByUserId(
new Gs2.Gs2JobQueue.Request.GetDeadLetterJobByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithDeadLetterJobName("deadLetterJob1"),
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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.getDeadLetterJobByUserId(
new Gs2JobQueue.GetDeadLetterJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withDeadLetterJobName("deadLetterJob1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.get_dead_letter_job_by_user_id(
job_queue.GetDeadLetterJobByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_dead_letter_job_name('deadLetterJob1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.get_dead_letter_job_by_user_id({
namespaceName='namespace1',
userId='user-0001',
deadLetterJobName='deadLetterJob1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;
deleteDeadLetterJobByUserId
デッドレタージョブを取得
Request
| 型 | 必須 | デフォルト | 値の制限 | 説明 |
---|
namespaceName | string | ✓ | | ~ 32文字 | ネームスペース名 |
userId | string | ✓ | | ~ 128文字 | ユーザーID |
deadLetterJobName | string | ✓ | | ~ 128文字 | ジョブの名前 |
Result
実装例
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/job_queue"
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 := job_queue.Gs2JobQueueRestClient{
Session: &session,
}
result, err := client.DeleteDeadLetterJobByUserId(
&job_queue.DeleteDeadLetterJobByUserIdRequest {
NamespaceName: pointy.String("namespace1"),
UserId: pointy.String("user-0001"),
DeadLetterJobName: pointy.String("deadLetterJob1"),
}
)
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\JobQueue\Gs2JobQueueRestClient;
use Gs2\JobQueue\Request\DeleteDeadLetterJobByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2AccountRestClient(
$session
);
try {
$result = $client->deleteDeadLetterJobByUserId(
(new DeleteDeadLetterJobByUserIdRequest())
->withNamespaceName(self::namespace1)
->withUserId("user-0001")
->withDeadLetterJobName("deadLetterJob1")
);
$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.jobQueue.rest.Gs2JobQueueRestClient;
import io.gs2.jobQueue.request.DeleteDeadLetterJobByUserIdRequest;
import io.gs2.jobQueue.result.DeleteDeadLetterJobByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
'your client id',
'your client secret'
)
);
session.connect();
Gs2JobQueueRestClient client = new Gs2JobQueueRestClient(session);
try {
DeleteDeadLetterJobByUserIdResult result = client.deleteDeadLetterJobByUserId(
new DeleteDeadLetterJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withDeadLetterJobName("deadLetterJob1")
);
DeadLetterJob 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.Gs2JobQueue.Gs2JobQueueRestClient;
using Gs2.Gs2JobQueue.Request.DeleteDeadLetterJobByUserIdRequest;
using Gs2.Gs2JobQueue.Result.DeleteDeadLetterJobByUserIdResult;
var session = new Gs2RestSession(
new BasicGs2Credential(
'your client id',
'your client secret'
),
Region.ApNortheast1
);
yield return session.Open();
var client = new Gs2JobQueueRestClient(session);
AsyncResult<Gs2.Gs2JobQueue.Result.DeleteDeadLetterJobByUserIdResult> asyncResult = null;
yield return client.DeleteDeadLetterJobByUserId(
new Gs2.Gs2JobQueue.Request.DeleteDeadLetterJobByUserIdRequest()
.WithNamespaceName("namespace1")
.WithUserId("user-0001")
.WithDeadLetterJobName("deadLetterJob1"),
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 Gs2JobQueue from '@/gs2/jobQueue';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2JobQueue.Gs2JobQueueRestClient(session);
try {
const result = await client.deleteDeadLetterJobByUserId(
new Gs2JobQueue.DeleteDeadLetterJobByUserIdRequest()
.withNamespaceName("namespace1")
.withUserId("user-0001")
.withDeadLetterJobName("deadLetterJob1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}
from gs2 import core
from gs2 import job_queue
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = job_queue.Gs2JobQueueRestClient(session)
try:
result = client.delete_dead_letter_job_by_user_id(
job_queue.DeleteDeadLetterJobByUserIdRequest()
.with_namespace_name(self.hash1)
.with_user_id('user-0001')
.with_dead_letter_job_name('deadLetterJob1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)
client = gs2('jobQueue')
api_result = client.delete_dead_letter_job_by_user_id({
namespaceName='namespace1',
userId='user-0001',
deadLetterJobName='deadLetterJob1',
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['message'])
end
result = api_result.result
item = result.item;