GS2-Datastore SDK API 레퍼런스
모델
Namespace
네임스페이스
네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.
따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceId | string | ※ | ~ 1024자 | 네임스페이스 GRN
※ 서버가 자동으로 설정 | ||
| name | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| description | string | ~ 1024자 | 설명문 | |||
| transactionSetting | TransactionSetting | 트랜잭션 설정 데이터스토어 조작 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다. | ||||
| doneUploadScript | ScriptSetting | 업로드 완료 보고 시 실행할 스크립트의 설정 Script 트리거 레퍼런스 - doneUpload | ||||
| logSetting | LogSetting | 로그의 출력 설정 데이터스토어 조작의 로그 데이터를 GS2-Log 로 출력하기 위한 설정입니다. GS2-Log 의 네임스페이스를 지정하면 데이터 오브젝트의 업로드·다운로드·접근 권한 변경 등의 API 요청·응답 로그를 수집할 수 있습니다. | ||||
| createdAt | long | ※ | 현재 시각 | 생성일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||
| updatedAt | long | ※ | 현재 시각 | 최종 갱신일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | 리비전 |
TransactionSetting
트랜잭션 설정
트랜잭션 설정은 트랜잭션의 실행 방법·정합성·비동기 처리·충돌 회피 메커니즘을 제어하는 설정입니다.
자동 실행(AutoRun), 원자적 실행(AtomicCommit), GS2-Distributor를 이용한 비동기 실행, 스크립트 결과의 일괄 적용, GS2-JobQueue를 통한 입수 액션의 비동기화 등을 조합하여 게임 로직에 맞는 견고한 트랜잭션 관리를 가능하게 합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| enableAutoRun | bool | false | 발행한 트랜잭션을 서버 사이드에서 자동으로 실행할지 여부 | |||
| enableAtomicCommit | bool | {enableAutoRun} == true | false | 트랜잭션의 실행을 원자적으로 커밋할지 여부 ※ enableAutoRun이(가) true 이면 활성화 | ||
| transactionUseDistributor | bool | {enableAtomicCommit} == true | false | 트랜잭션을 비동기 처리로 실행할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| commitScriptResultInUseDistributor | bool | {transactionUseDistributor} == true | false | 스크립트의 결과 커밋 처리를 비동기 처리로 실행할지 여부 ※ transactionUseDistributor이(가) true 이면 활성화 | ||
| acquireActionUseJobQueue | bool | {enableAtomicCommit} == true | false | 입수 액션을 실행할 때 GS2-JobQueue를 사용할지 여부 ※ enableAtomicCommit이(가) true 이면 활성화 | ||
| distributorNamespaceId | string | “grn:gs2:{region}:{ownerId}:distributor:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-Distributor 네임스페이스 GRN | ||
| queueNamespaceId | string | “grn:gs2:{region}:{ownerId}:queue:default” | ~ 1024자 | 트랜잭션 실행에 사용하는 GS2-JobQueue의 네임스페이스 GRN |
ScriptSetting
스크립트 설정
GS2에서는 마이크로서비스의 이벤트에 연결하여 커스텀 스크립트를 실행할 수 있습니다.
이 모델은 스크립트 실행을 트리거하기 위한 설정을 보유합니다.
스크립트 실행 방식은 크게 두 가지로, 바로 “동기 실행"과 “비동기 실행"입니다.
동기 실행은 스크립트 실행이 완료될 때까지 처리가 블록됩니다.
대신 스크립트 실행 결과를 이용하여 API 실행을 중단시키거나 API 응답 내용을 제어할 수 있습니다.
한편, 비동기 실행에서는 스크립트 완료를 기다리기 위해 처리가 블록되는 일이 없습니다.
다만 스크립트 실행 결과를 이용하여 API 실행을 중단하거나 API 응답 내용을 변경할 수는 없습니다.
비동기 실행은 API의 응답 흐름에 영향을 주지 않으므로 원칙적으로 비동기 실행을 권장합니다.
비동기 실행에는 실행 방식이 두 가지 있으며, GS2-Script와 Amazon EventBridge가 있습니다.
Amazon EventBridge를 사용함으로써 Lua 이외의 언어로 처리를 작성할 수 있습니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| triggerScriptId | string | ~ 1024자 | API 실행 시 동기적으로 실행되는 GS2-Script의 스크립트
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. | |||||||||||
| doneTriggerTargetType | 문자열 열거형 enum { “none”, “gs2_script”, “aws” } | “none” | 비동기 스크립트의 실행 방법 비동기 실행에서 사용할 스크립트의 종류를 지정합니다. “비동기 실행의 스크립트를 사용하지 않음(none)”, “GS2-Script를 사용함(gs2_script)”, “Amazon EventBridge를 사용함(aws)” 중에서 선택할 수 있습니다.
| |||||||||||
| doneTriggerScriptId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024자 | 비동기 실행할 GS2-Script 스크립트
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. ※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화 | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024자 | 비동기 실행 스크립트를 실행하는 GS2-JobQueue 네임스페이스
GRN
비동기 실행 스크립트를 직접 실행하지 않고 GS2-JobQueue를 경유하는 경우 GS2-JobQueue의 네임스페이스GRN을 지정합니다. GS2-JobQueue를 이용해야 할 이유는 많지 않으므로, 특별한 이유가 없다면 지정할 필요는 없습니다. ※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화 |
LogSetting
로그의 출력 설정
로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하는 데 사용되는 로그 네임스페이스의 식별자(Namespace ID)를 보유합니다.
로그 네임스페이스 ID는 로그 데이터를 집계하여 저장할 대상 GS2-Log 의 네임스페이스를 지정합니다.
이 설정을 통해 이 네임스페이스 이하의 API 요청·응답 로그 데이터가 대상 GS2-Log 로 출력됩니다.
GS2-Log 에서는 실시간으로 로그가 제공되며, 시스템 모니터링, 분석, 디버깅 등에 활용할 수 있습니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024자 | 로그를 출력할 GS2-Log의 네임스페이스
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. |
DataObject
데이터 오브젝트
데이터 오브젝트는 게임 플레이어가 업로드한 데이터입니다.
데이터는 세대 관리되며, 30일분의 과거 데이터도 보관됩니다.
데이터에는 접근 권한을 설정할 수 있습니다.
스코프에는 3종류가 있으며,
- 누구나 접근할 수 있는
public - 지정한 사용자 ID의 게임 플레이어만 접근할 수 있는
protected - 본인만 접근할 수 있는
private
가 있습니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| dataObjectId | string | ※ | ~ 1024자 | 데이터 오브젝트 GRN
※ 서버가 자동으로 설정 | ||||||||||
| name | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||
| scope | 문자열 열거형 enum { “public”, “protected”, “private” } | “private” | 파일 접근 권한 이 데이터 오브젝트에 접근할 수 있는 사용자를 제어합니다. public은 누구나 접근 가능, protected는 allowUserIds에 지정된 사용자 ID만 접근 가능, private은 오너 본인만 접근 가능합니다.
| |||||||||||
| allowUserIds | List<string> | {scope} == “protected” | [] | 0 ~ 100 items | 공개할 사용자 ID 목록 스코프가 protected로 설정되어 있는 경우, 이 데이터 오브젝트에 접근할 수 있는 사용자를 지정합니다. 이 목록에 포함된 사용자 ID를 가진 사용자만 읽기 접근이 허용됩니다.※ scope이(가) “protected” 이면 활성화 | |||||||||
| status | 문자열 열거형 enum { “ACTIVE”, “UPLOADING”, “DELETED” } | ✓ | 상태 데이터 오브젝트의 현재 라이프사이클 상태입니다. ACTIVE는 데이터에 접근 가능함을 나타내고, UPLOADING은 새로운 버전이 업로드 중임을 나타내며, DELETED는 삭제 예정으로 표시된 상태임을 나타냅니다(실제 삭제는 30일 후에 이루어집니다).
| |||||||||||
| generation | string | ~ 128자 | 데이터의 세대 업로드된 데이터의 현재 버전을 나타내는 식별자입니다. 데이터가 재업로드될 때마다 새로운 세대 ID가 할당됩니다. | |||||||||||
| previousGeneration | string | ~ 128자 | 이전에 유효했던 데이터의 세대 현재 업로드 이전에 활성 상태였던 데이터 버전의 세대 ID입니다. 업로드 중(UPLOADING 상태)에는 새로운 업로드가 완료될 때까지 데이터의 지속적인 접근을 보장하기 위해 이전 세대에 계속 접근할 수 있습니다. | |||||||||||
| createdAt | long | ※ | 현재 시각 | 생성일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||||||||||
| updatedAt | long | ※ | 현재 시각 | 최종 갱신일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | 리비전 |
DataObjectHistory
데이터 오브젝트 이력
데이터 오브젝트의 업데이트 이력을 확인할 수 있습니다.
데이터 오브젝트가 재업로드될 때마다 세대 ID와 파일 크기를 포함한 이력 레코드가 생성됩니다. 이력 데이터는 30일간 보관되며, 이전 버전으로의 롤백 및 감사가 가능합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| dataObjectHistoryId | string | ※ | ~ 1024자 | 데이터 오브젝트 이력 GRN
※ 서버가 자동으로 설정 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| generation | string | ✓ | ~ 128자 | 세대 ID 업로드 시점의 데이터 오브젝트의 특정 버전을 나타내는 고유 식별자입니다. DataObject 의 generation 필드에 해당하며, PrepareDownloadByGeneration 에서 이 특정 버전을 다운로드할 때 사용할 수 있습니다. | ||
| contentLength | long | ✓ | 0 ~ 10485760 | 데이터 크기 이 세대의 업로드 데이터 크기(바이트 단위)입니다. 최대 파일 크기는 10 MB(10,485,760 바이트)입니다. | ||
| createdAt | long | ※ | 현재 시각 | 생성일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | 리비전 |
메서드
describeNamespaces
네임스페이스 목록 조회
프로젝트 내에서 서비스 단위로 생성된 네임스페이스의 목록을 조회합니다.
옵션인 페이지 토큰을 사용하여 목록의 특정 위치부터 데이터 조회를 시작할 수 있습니다.
또한 조회할 네임스페이스의 수를 제한하는 것도 가능합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64자 | 네임스페이스 이름의 필터 접두사 | |||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||
| limit | int | 30 | 1 ~ 1000 | 취득할 데이터 건수 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<Namespace> | 네임스페이스 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&datastore.DescribeNamespacesRequest {
NamePrefix: nil,
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->describeNamespaces(
(new DescribeNamespacesRequest())
->withNamePrefix(null)
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeNamespacesRequest;
import io.gs2.datastore.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeNamespacesResult result = client.describeNamespaces(
new DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<Namespace> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Datastore.Request.DescribeNamespacesRequest()
.WithNamePrefix(null)
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Datastore.DescribeNamespacesRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_namespaces(
datastore.DescribeNamespacesRequest()
.with_name_prefix(None)
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.describe_namespaces({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('datastore')
api_result_handler = client.describe_namespaces_async({
namePrefix=nil,
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;createNamespace
네임스페이스 신규 생성
네임스페이스의 이름, 설명 및 각종 설정을 포함한 상세 정보를 지정해야 합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| description | string | ~ 1024자 | 설명문 | |||
| transactionSetting | TransactionSetting | 트랜잭션 설정 데이터스토어 조작 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다. | ||||
| logSetting | LogSetting | 로그의 출력 설정 데이터스토어 조작의 로그 데이터를 GS2-Log 로 출력하기 위한 설정입니다. GS2-Log 의 네임스페이스를 지정하면 데이터 오브젝트의 업로드·다운로드·접근 권한 변경 등의 API 요청·응답 로그를 수집할 수 있습니다. | ||||
| doneUploadScript | ScriptSetting | 업로드 완료 보고 시 실행할 스크립트의 설정 Script 트리거 레퍼런스 - doneUpload |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 생성한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&datastore.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
TransactionSetting: nil,
LogSetting: &datastore.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
DoneUploadScript: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withTransactionSetting(null)
->withLogSetting((new \Gs2\Datastore\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
->withDoneUploadScript(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CreateNamespaceRequest;
import io.gs2.datastore.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withLogSetting(new io.gs2.datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.withDoneUploadScript(null)
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Datastore.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithTransactionSetting(null)
.WithLogSetting(new Gs2.Gs2Datastore.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.WithDoneUploadScript(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Datastore.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withTransactionSetting(null)
.withLogSetting(new Gs2Datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.withDoneUploadScript(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.create_namespace(
datastore.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_transaction_setting(None)
.with_log_setting(
datastore.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
.with_done_upload_script(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
transactionSetting=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
doneUploadScript=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
transactionSetting=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
doneUploadScript=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getNamespaceStatus
네임스페이스의 상태 조회
지정된 네임스페이스의 현재 상태를 조회합니다.
상태에는 네임스페이스가 활성 상태인지, 삭제되었는지가 포함됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
Result
| 타입 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|
| status | string | 네임스페이스 상태
|
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&datastore.GetNamespaceStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
status := result.Statususe Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->getNamespaceStatus(
(new GetNamespaceStatusRequest())
->withNamespaceName("namespace-0001")
);
$status = $result->getStatus();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetNamespaceStatusRequest;
import io.gs2.datastore.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
GetNamespaceStatusResult result = client.getNamespaceStatus(
new GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
String status = result.getStatus();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Datastore.Request.GetNamespaceStatusRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var status = result.Status;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Datastore.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_namespace_status(
datastore.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.get_namespace_status({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;client = gs2('datastore')
api_result_handler = client.get_namespace_status_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
status = result.status;getNamespace
네임스페이스 조회
지정된 네임스페이스의 상세 정보를 조회합니다.
여기에는 네임스페이스의 이름, 설명 및 기타 설정 정보가 포함됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&datastore.GetNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->getNamespace(
(new GetNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetNamespaceRequest;
import io.gs2.datastore.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
GetNamespaceResult result = client.getNamespace(
new GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Datastore.Request.GetNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Datastore.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_namespace(
datastore.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.get_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.get_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateNamespace
네임스페이스 갱신
지정된 네임스페이스의 설정을 갱신합니다.
네임스페이스의 설명이나 특정 설정을 변경할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| description | string | ~ 1024자 | 설명문 | |||
| transactionSetting | TransactionSetting | 트랜잭션 설정 데이터스토어 조작 시 분산 트랜잭션의 실행 방법을 제어하는 설정입니다. 자동 실행, 원자적 커밋, 비동기 처리 등의 옵션을 지원합니다. | ||||
| logSetting | LogSetting | 로그의 출력 설정 데이터스토어 조작의 로그 데이터를 GS2-Log 로 출력하기 위한 설정입니다. GS2-Log 의 네임스페이스를 지정하면 데이터 오브젝트의 업로드·다운로드·접근 권한 변경 등의 API 요청·응답 로그를 수집할 수 있습니다. | ||||
| doneUploadScript | ScriptSetting | 업로드 완료 보고 시 실행할 스크립트의 설정 Script 트리거 레퍼런스 - doneUpload |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 갱신한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&datastore.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
TransactionSetting: nil,
LogSetting: &datastore.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"),
},
DoneUploadScript: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withTransactionSetting(null)
->withLogSetting((new \Gs2\Datastore\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
->withDoneUploadScript(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateNamespaceRequest;
import io.gs2.datastore.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withLogSetting(new io.gs2.datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.withDoneUploadScript(null)
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Datastore.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithTransactionSetting(null)
.WithLogSetting(new Gs2.Gs2Datastore.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.WithDoneUploadScript(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Datastore.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withTransactionSetting(null)
.withLogSetting(new Gs2Datastore.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
.withDoneUploadScript(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_namespace(
datastore.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_transaction_setting(None)
.with_log_setting(
datastore.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
.with_done_upload_script(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
doneUploadScript=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
transactionSetting=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001",
},
doneUploadScript=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteNamespace
네임스페이스 삭제
지정된 네임스페이스를 삭제합니다.
이 작업은 되돌릴 수 없으며, 삭제된 네임스페이스와 관련된 모든 데이터는 복구할 수 없게 됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 삭제한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&datastore.DeleteNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->deleteNamespace(
(new DeleteNamespaceRequest())
->withNamespaceName("namespace-0001")
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DeleteNamespaceRequest;
import io.gs2.datastore.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DeleteNamespaceResult result = client.deleteNamespace(
new DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
Namespace item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Datastore.Request.DeleteNamespaceRequest()
.WithNamespaceName("namespace-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Datastore.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.delete_namespace(
datastore.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.delete_namespace({
namespaceName="namespace-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.delete_namespace_async({
namespaceName="namespace-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getServiceVersion
마이크로서비스 버전 조회
상세
Request
요청 파라미터: 없음
Result
| 타입 | 설명 | |
|---|---|---|
| item | string | 버전 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&datastore.GetServiceVersionRequest {
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->getServiceVersion(
(new GetServiceVersionRequest())
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetServiceVersionRequest;
import io.gs2.datastore.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
GetServiceVersionResult result = client.getServiceVersion(
new GetServiceVersionRequest()
);
String item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Datastore.Request.GetServiceVersionRequest(),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Datastore.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_service_version(
datastore.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.get_service_version({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.get_service_version_async({
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;dumpUserDataByUserId
지정한 사용자 ID에 연결된 데이터의 덤프 취득
개인정보 보호에 관한 법적 요건을 충족시키기 위해 사용하거나, 데이터의 백업 및 이관에 사용할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
반환값: 없음
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&datastore.DumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->dumpUserDataByUserId(
(new DumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DumpUserDataByUserIdRequest;
import io.gs2.datastore.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DumpUserDataByUserIdResult result = client.dumpUserDataByUserId(
new DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2Datastore.Request.DumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2Datastore.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.dump_user_data_by_user_id(
datastore.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('datastore')
api_result_handler = client.dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckDumpUserDataByUserId
지정한 사용자 ID에 연결된 데이터의 덤프가 완료되었는지 확인
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| url | string | 출력 데이터의 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&datastore.CheckDumpUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->checkDumpUserDataByUserId(
(new CheckDumpUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckDumpUserDataByUserIdResult result = client.checkDumpUserDataByUserId(
new CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckDumpUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2Datastore.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
datastore.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.check_dump_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('datastore')
api_result_handler = client.check_dump_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;cleanUserDataByUserId
사용자 데이터 완전 삭제
지정된 사용자 ID에 연결된 데이터의 클리닝을 실행합니다.
이를 통해 특정 사용자 데이터를 프로젝트에서 안전하게 삭제할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
반환값: 없음
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&datastore.CleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->cleanUserDataByUserId(
(new CleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CleanUserDataByUserIdRequest;
import io.gs2.datastore.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CleanUserDataByUserIdResult result = client.cleanUserDataByUserId(
new CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2Datastore.Request.CleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2Datastore.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.clean_user_data_by_user_id(
datastore.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('datastore')
api_result_handler = client.clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckCleanUserDataByUserId
지정한 사용자 ID의 사용자 데이터 완전 삭제가 완료되었는지 확인
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
반환값: 없음
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&datastore.CheckCleanUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->checkCleanUserDataByUserId(
(new CheckCleanUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckCleanUserDataByUserIdResult result = client.checkCleanUserDataByUserId(
new CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckCleanUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2Datastore.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
datastore.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.check_clean_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('datastore')
api_result_handler = client.check_clean_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultprepareImportUserDataByUserId
지정한 사용자 ID에 연결된 데이터의 임포트 준비
임포트에 사용할 수 있는 데이터는 GS2 를 통해 익스포트하여 취득한 데이터로 한정되며, 오래된 데이터는 임포트에 실패할 수 있습니다.
익스포트한 사용자 ID와 다른 사용자 ID로 임포트할 수 있지만, 사용자 데이터의 페이로드 내에 사용자 ID가 포함되어 있는 경우에는 그렇지 않을 수 있습니다.
이 API의 반환값으로 응답된 URL에 익스포트한 zip 파일을 업로드하고 importUserDataByUserId 를 호출함으로써 실제 임포트 처리를 시작할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| uploadToken | string | 업로드 후 결과를 반영할 때 사용하는 토큰 |
| uploadUrl | string | 사용자 데이터 업로드 처리 실행에 사용하는 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&datastore.PrepareImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareImportUserDataByUserId(
(new PrepareImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.datastore.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareImportUserDataByUserIdResult result = client.prepareImportUserDataByUserId(
new PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.PrepareImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2Datastore.PrepareImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
datastore.PrepareImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_import_user_data_by_user_id({
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('datastore')
api_result_handler = client.prepare_import_user_data_by_user_id_async({
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;importUserDataByUserId
지정한 사용자 ID에 연결된 데이터의 임포트 실행
임포트에 사용할 수 있는 데이터는 GS2 를 통해 익스포트하여 취득한 데이터로 한정되며, 오래된 데이터는 임포트에 실패할 수 있습니다.
익스포트한 사용자 ID와 다른 사용자 ID로 임포트할 수 있지만, 사용자 데이터의 페이로드 내에 사용자 ID가 포함되어 있는 경우에는 그렇지 않을 수 있습니다.
이 API를 호출하기 전에 prepareImportUserDataByUserId 를 호출하여 업로드 준비를 완료해야 합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| uploadToken | string | ✓ | ~ 1024자 | 업로드 준비 시 수신한 토큰 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
반환값: 없음
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&datastore.ImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->importUserDataByUserId(
(new ImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.ImportUserDataByUserIdRequest;
import io.gs2.datastore.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
ImportUserDataByUserIdResult result = client.importUserDataByUserId(
new ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.ImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2Datastore.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.import_user_data_by_user_id(
datastore.ImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('datastore')
api_result_handler = client.import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultcheckImportUserDataByUserId
지정한 사용자 ID에 연결된 데이터의 임포트가 완료되었는지 확인
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| uploadToken | string | ✓ | ~ 1024자 | 업로드 준비 시 수신한 토큰 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| url | string | 출력 로그의 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&datastore.CheckImportUserDataByUserIdRequest {
UserId: pointy.String("user-0001"),
UploadToken: pointy.String("upload-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
url := result.Urluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->checkImportUserDataByUserId(
(new CheckImportUserDataByUserIdRequest())
->withUserId("user-0001")
->withUploadToken("upload-0001")
->withTimeOffsetToken(null)
);
$url = $result->getUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.CheckImportUserDataByUserIdRequest;
import io.gs2.datastore.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
CheckImportUserDataByUserIdResult result = client.checkImportUserDataByUserId(
new CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
String url = result.getUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2Datastore.Request.CheckImportUserDataByUserIdRequest()
.WithUserId("user-0001")
.WithUploadToken("upload-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var url = result.Url;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2Datastore.CheckImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
datastore.CheckImportUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_upload_token('upload-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.check_import_user_data_by_user_id({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;client = gs2('datastore')
api_result_handler = client.check_import_user_data_by_user_id_async({
userId="user-0001",
uploadToken="upload-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
url = result.url;describeDataObjects
데이터 오브젝트 목록 조회
지정된 네임스페이스에서 현재 로그인한 사용자가 소유한 데이터 오브젝트의 페이지네이션 지원 목록을 조회합니다.
선택적으로 상태(ACTIVE, UPLOADING, DELETED)를 지정하여 특정 상태의 오브젝트만 조회할 수 있습니다.
상태 필터를 지정하지 않으면 상태와 관계없이 모든 데이터 오브젝트가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||||||||||
| status | 문자열 열거형 enum { “ACTIVE”, “UPLOADING”, “DELETED” } | 상태
| ||||||||||||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||||||||||
| limit | int | 30 | 1 ~ 1000 | 취득할 데이터 건수 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<DataObject> | 데이터 오브젝트 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjects(
&datastore.DescribeDataObjectsRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Status: pointy.String("ACTIVE"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->describeDataObjects(
(new DescribeDataObjectsRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatus("ACTIVE")
->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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectsRequest;
import io.gs2.datastore.result.DescribeDataObjectsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectsResult result = client.describeDataObjects(
new DescribeDataObjectsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
);
List<DataObject> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectsResult> asyncResult = null;
yield return client.DescribeDataObjects(
new Gs2.Gs2Datastore.Request.DescribeDataObjectsRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatus("ACTIVE")
.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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjects(
new Gs2Datastore.DescribeDataObjectsRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_objects(
datastore.DescribeDataObjectsRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status('ACTIVE')
.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('datastore')
api_result = client.describe_data_objects({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
status="ACTIVE",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('datastore')
api_result_handler = client.describe_data_objects_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
status="ACTIVE",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeDataObjectsByUserId
사용자 ID를 지정하여 데이터 오브젝트 목록 조회
지정된 네임스페이스에서 지정된 사용자가 소유한 데이터 오브젝트의 페이지네이션 지원 목록을 조회합니다.
선택적으로 상태(ACTIVE, UPLOADING, DELETED)를 지정하여 특정 상태의 오브젝트만 조회할 수 있습니다.
상태 필터를 지정하지 않으면 상태와 관계없이 모든 데이터 오브젝트가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||
| status | 문자열 열거형 enum { “ACTIVE”, “UPLOADING”, “DELETED” } | 상태
| ||||||||||||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||||||||||
| limit | int | 30 | 1 ~ 1000 | 취득할 데이터 건수 | ||||||||||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<DataObject> | 데이터 오브젝트 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjectsByUserId(
&datastore.DescribeDataObjectsByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Status: pointy.String("ACTIVE"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectsByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->describeDataObjectsByUserId(
(new DescribeDataObjectsByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatus("ACTIVE")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectsByUserIdRequest;
import io.gs2.datastore.result.DescribeDataObjectsByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectsByUserIdResult result = client.describeDataObjectsByUserId(
new DescribeDataObjectsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<DataObject> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectsByUserIdResult> asyncResult = null;
yield return client.DescribeDataObjectsByUserId(
new Gs2.Gs2Datastore.Request.DescribeDataObjectsByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatus("ACTIVE")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjectsByUserId(
new Gs2Datastore.DescribeDataObjectsByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatus("ACTIVE")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_objects_by_user_id(
datastore.DescribeDataObjectsByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status('ACTIVE')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.describe_data_objects_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
status="ACTIVE",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('datastore')
api_result_handler = client.describe_data_objects_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
status="ACTIVE",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;prepareUpload
데이터 오브젝트의 업로드를 준비한다
새로운 데이터 오브젝트를 생성하고, 파일 업로드용 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트 이름은 생략할 수 있으며, 생략한 경우 UUID가 자동으로 할당됩니다.
접근 범위(public / protected / private) 설정과 오브젝트에 대한 접근을 허용할 사용자 ID 목록을 지정할 수 있습니다.
updateIfExists가 true이고 동일한 이름의 오브젝트가 이미 존재하는 경우, 기존 오브젝트의 범위와 권한이 업데이트되며 오류 대신 재업로드용 URL이 생성됩니다.
반환된 서명된 URL을 사용하여 파일 데이터를 직접 PUT하십시오. 업로드 후 DoneUpload를 호출하여 데이터 오브젝트를 확정합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||||||||||
| name | string | ~ 128자 | 데이터 오브젝트의 이름 지정하지 않으면 자동으로 UUID가 할당됩니다. | |||||||||||
| contentType | string | “application/octet-stream” | ~ 256자 | 업로드할 데이터의 MIME-Type | ||||||||||
| scope | 문자열 열거형 enum { “public”, “protected”, “private” } | “private” | 파일 접근 권한 이 데이터 오브젝트에 접근할 수 있는 사용자를 제어합니다. public은 누구나 접근 가능, protected는 allowUserIds에 지정된 사용자 ID만 접근 가능, private은 오너 본인만 접근 가능합니다.
| |||||||||||
| allowUserIds | List<string> | {scope} == “protected” | [] | 0 ~ 100 items | 공개할 사용자 ID 목록 스코프가 protected로 설정되어 있는 경우, 이 데이터 오브젝트에 접근할 수 있는 사용자를 지정합니다. 이 목록에 포함된 사용자 ID를 가진 사용자만 읽기 접근이 허용됩니다.※ scope이(가) “protected” 이면 활성화 | |||||||||
| updateIfExists | bool | false | 이미 데이터가 존재하는 경우 오류로 처리할지, 데이터를 업데이트할지 여부 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| uploadUrl | string | 업로드 처리를 실행하는 데 사용하는 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareUpload(
&datastore.PrepareUploadRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Name: pointy.String("dataObject-0001"),
ContentType: pointy.String("application/octet-stream"),
Scope: pointy.String("public"),
AllowUserIds: nil,
UpdateIfExists: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareUpload(
(new PrepareUploadRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withName("dataObject-0001")
->withContentType("application/octet-stream")
->withScope("public")
->withAllowUserIds(null)
->withUpdateIfExists(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareUploadRequest;
import io.gs2.datastore.result.PrepareUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareUploadResult result = client.prepareUpload(
new PrepareUploadRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withName("dataObject-0001")
.withContentType("application/octet-stream")
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareUploadResult> asyncResult = null;
yield return client.PrepareUpload(
new Gs2.Gs2Datastore.Request.PrepareUploadRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithName("dataObject-0001")
.WithContentType("application/octet-stream")
.WithScope("public")
.WithAllowUserIds(null)
.WithUpdateIfExists(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareUpload(
new Gs2Datastore.PrepareUploadRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withName("dataObject-0001")
.withContentType("application/octet-stream")
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_upload(
datastore.PrepareUploadRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_name('dataObject-0001')
.with_content_type('application/octet-stream')
.with_scope('public')
.with_allow_user_ids(None)
.with_update_if_exists(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_upload({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
name="dataObject-0001",
contentType="application/octet-stream",
scope="public",
allowUserIds=nil,
updateIfExists=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;client = gs2('datastore')
api_result_handler = client.prepare_upload_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
name="dataObject-0001",
contentType="application/octet-stream",
scope="public",
allowUserIds=nil,
updateIfExists=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;prepareUploadByUserId
사용자 ID를 지정하여 데이터 오브젝트의 업로드를 준비한다
지정된 사용자의 새로운 데이터 오브젝트를 생성하고, 파일 업로드용 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트 이름은 생략할 수 있으며, 생략한 경우 UUID가 자동으로 할당됩니다.
접근 범위(public / protected / private) 설정과 오브젝트에 대한 접근을 허용할 사용자 ID 목록을 지정할 수 있습니다.
updateIfExists가 true이고 동일한 이름의 오브젝트가 이미 존재하는 경우, 기존 오브젝트의 범위와 권한이 업데이트되며 오류 대신 재업로드용 URL이 생성됩니다.
반환된 서명된 URL을 사용하여 파일 데이터를 직접 PUT하십시오. 업로드 후 DoneUpload를 호출하여 데이터 오브젝트를 확정합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||
| name | string | ~ 128자 | 데이터 오브젝트의 이름 지정하지 않으면 자동으로 UUID가 할당됩니다. | |||||||||||
| contentType | string | “application/octet-stream” | ~ 256자 | 업로드할 데이터의 MIME-Type | ||||||||||
| scope | 문자열 열거형 enum { “public”, “protected”, “private” } | “private” | 파일 접근 권한 이 데이터 오브젝트에 접근할 수 있는 사용자를 제어합니다. public은 누구나 접근 가능, protected는 allowUserIds에 지정된 사용자 ID만 접근 가능, private은 오너 본인만 접근 가능합니다.
| |||||||||||
| allowUserIds | List<string> | {scope} == “protected” | [] | 0 ~ 100 items | 공개할 사용자 ID 목록 스코프가 protected로 설정되어 있는 경우, 이 데이터 오브젝트에 접근할 수 있는 사용자를 지정합니다. 이 목록에 포함된 사용자 ID를 가진 사용자만 읽기 접근이 허용됩니다.※ scope이(가) “protected” 이면 활성화 | |||||||||
| updateIfExists | bool | false | 이미 데이터가 존재하는 경우 오류로 처리할지, 데이터를 업데이트할지 여부 | |||||||||||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| uploadUrl | string | 업로드 처리를 실행하는 데 사용하는 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareUploadByUserId(
&datastore.PrepareUploadByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Name: pointy.String("dataObject-0001"),
ContentType: pointy.String("application/octet-stream"),
Scope: pointy.String("public"),
AllowUserIds: nil,
UpdateIfExists: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareUploadByUserId(
(new PrepareUploadByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withName("dataObject-0001")
->withContentType("application/octet-stream")
->withScope("public")
->withAllowUserIds(null)
->withUpdateIfExists(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareUploadByUserIdRequest;
import io.gs2.datastore.result.PrepareUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareUploadByUserIdResult result = client.prepareUploadByUserId(
new PrepareUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withName("dataObject-0001")
.withContentType("application/octet-stream")
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareUploadByUserIdResult> asyncResult = null;
yield return client.PrepareUploadByUserId(
new Gs2.Gs2Datastore.Request.PrepareUploadByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithName("dataObject-0001")
.WithContentType("application/octet-stream")
.WithScope("public")
.WithAllowUserIds(null)
.WithUpdateIfExists(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareUploadByUserId(
new Gs2Datastore.PrepareUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withName("dataObject-0001")
.withContentType("application/octet-stream")
.withScope("public")
.withAllowUserIds(null)
.withUpdateIfExists(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_upload_by_user_id(
datastore.PrepareUploadByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_name('dataObject-0001')
.with_content_type('application/octet-stream')
.with_scope('public')
.with_allow_user_ids(None)
.with_update_if_exists(None)
.with_time_offset_token(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_upload_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
name="dataObject-0001",
contentType="application/octet-stream",
scope="public",
allowUserIds=nil,
updateIfExists=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;client = gs2('datastore')
api_result_handler = client.prepare_upload_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
name="dataObject-0001",
contentType="application/octet-stream",
scope="public",
allowUserIds=nil,
updateIfExists=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;updateDataObject
데이터 오브젝트를 업데이트
현재 로그인한 사용자가 소유한 기존 데이터 오브젝트의 메타데이터를 업데이트합니다.
접근 범위(public / protected / private)와 오브젝트에 대한 접근을 허용할 사용자 ID 목록을 변경할 수 있습니다.
이 작업은 접근 제어 설정만 업데이트하며, 파일 내용 자체는 변경되지 않습니다. 파일 내용을 업데이트하려면 대신 PrepareReUpload를 사용하십시오.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |||||||||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||||||||||
| scope | 문자열 열거형 enum { “public”, “protected”, “private” } | “private” | 파일 접근 권한 이 데이터 오브젝트에 접근할 수 있는 사용자를 제어합니다. public은 누구나 접근 가능, protected는 allowUserIds에 지정된 사용자 ID만 접근 가능, private은 오너 본인만 접근 가능합니다.
| |||||||||||
| allowUserIds | List<string> | {scope} == “protected” | [] | 0 ~ 100 items | 공개할 사용자 ID 목록 스코프가 protected로 설정되어 있는 경우, 이 데이터 오브젝트에 접근할 수 있는 사용자를 지정합니다. 이 목록에 포함된 사용자 ID를 가진 사용자만 읽기 접근이 허용됩니다.※ scope이(가) “protected” 이면 활성화 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateDataObject(
&datastore.UpdateDataObjectRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
Scope: pointy.String("public"),
AllowUserIds: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\UpdateDataObjectRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->updateDataObject(
(new UpdateDataObjectRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withAccessToken("accessToken-0001")
->withScope("public")
->withAllowUserIds(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateDataObjectRequest;
import io.gs2.datastore.result.UpdateDataObjectResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateDataObjectResult result = client.updateDataObject(
new UpdateDataObjectRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withScope("public")
.withAllowUserIds(null)
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateDataObjectResult> asyncResult = null;
yield return client.UpdateDataObject(
new Gs2.Gs2Datastore.Request.UpdateDataObjectRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-0001")
.WithScope("public")
.WithAllowUserIds(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateDataObject(
new Gs2Datastore.UpdateDataObjectRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withScope("public")
.withAllowUserIds(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_data_object(
datastore.UpdateDataObjectRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_access_token('accessToken-0001')
.with_scope('public')
.with_allow_user_ids(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.update_data_object({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
scope="public",
allowUserIds=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.update_data_object_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
scope="public",
allowUserIds=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;updateDataObjectByUserId
사용자 ID를 지정하여 데이터 오브젝트를 업데이트
지정된 사용자가 소유한 기존 데이터 오브젝트의 메타데이터를 업데이트합니다.
접근 범위(public / protected / private)와 오브젝트에 대한 접근을 허용할 사용자 ID 목록을 변경할 수 있습니다.
이 작업은 접근 제어 설정만 업데이트하며, 파일 내용 자체는 변경되지 않습니다. 파일 내용을 업데이트하려면 대신 PrepareReUpload를 사용하십시오.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||
| scope | 문자열 열거형 enum { “public”, “protected”, “private” } | “private” | 파일 접근 권한 이 데이터 오브젝트에 접근할 수 있는 사용자를 제어합니다. public은 누구나 접근 가능, protected는 allowUserIds에 지정된 사용자 ID만 접근 가능, private은 오너 본인만 접근 가능합니다.
| |||||||||||
| allowUserIds | List<string> | {scope} == “protected” | [] | 0 ~ 100 items | 공개할 사용자 ID 목록 스코프가 protected로 설정되어 있는 경우, 이 데이터 오브젝트에 접근할 수 있는 사용자를 지정합니다. 이 목록에 포함된 사용자 ID를 가진 사용자만 읽기 접근이 허용됩니다.※ scope이(가) “protected” 이면 활성화 | |||||||||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.UpdateDataObjectByUserId(
&datastore.UpdateDataObjectByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
Scope: pointy.String("public"),
AllowUserIds: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\UpdateDataObjectByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->updateDataObjectByUserId(
(new UpdateDataObjectByUserIdRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withScope("public")
->withAllowUserIds(null)
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.UpdateDataObjectByUserIdRequest;
import io.gs2.datastore.result.UpdateDataObjectByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
UpdateDataObjectByUserIdResult result = client.updateDataObjectByUserId(
new UpdateDataObjectByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withScope("public")
.withAllowUserIds(null)
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.UpdateDataObjectByUserIdResult> asyncResult = null;
yield return client.UpdateDataObjectByUserId(
new Gs2.Gs2Datastore.Request.UpdateDataObjectByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithScope("public")
.WithAllowUserIds(null)
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.updateDataObjectByUserId(
new Gs2Datastore.UpdateDataObjectByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withScope("public")
.withAllowUserIds(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.update_data_object_by_user_id(
datastore.UpdateDataObjectByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_scope('public')
.with_allow_user_ids(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.update_data_object_by_user_id({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
scope="public",
allowUserIds=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.update_data_object_by_user_id_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
scope="public",
allowUserIds=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;prepareReUpload
데이터 오브젝트의 재업로드를 준비한다
기존 데이터 오브젝트의 파일 내용을 재업로드하기 위한 새로운 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트의 상태는 UPLOADING으로 변경되며, 새로운 세대 번호가 할당됩니다.
이전 버전의 파일은 데이터 오브젝트 이력에 보관되며, 세대 번호를 지정하여 이전 버전을 다운로드할 수 있습니다.
반환된 URL에 새 파일을 업로드한 후, DoneUpload를 호출하여 업데이트를 확정합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| contentType | string | “application/octet-stream” | ~ 256자 | 업로드할 데이터 오브젝트의 MIME-Type |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| uploadUrl | string | 업로드 처리를 실행하는 데 사용하는 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareReUpload(
&datastore.PrepareReUploadRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
ContentType: pointy.String("application/octet-stream"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareReUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareReUpload(
(new PrepareReUploadRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withAccessToken("accessToken-0001")
->withContentType("application/octet-stream")
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareReUploadRequest;
import io.gs2.datastore.result.PrepareReUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareReUploadResult result = client.prepareReUpload(
new PrepareReUploadRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withContentType("application/octet-stream")
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareReUploadResult> asyncResult = null;
yield return client.PrepareReUpload(
new Gs2.Gs2Datastore.Request.PrepareReUploadRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-0001")
.WithContentType("application/octet-stream"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareReUpload(
new Gs2Datastore.PrepareReUploadRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
.withContentType("application/octet-stream")
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_re_upload(
datastore.PrepareReUploadRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_access_token('accessToken-0001')
.with_content_type('application/octet-stream')
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_re_upload({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
contentType="application/octet-stream",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;client = gs2('datastore')
api_result_handler = client.prepare_re_upload_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
contentType="application/octet-stream",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;prepareReUploadByUserId
사용자 ID를 지정하여 데이터 오브젝트의 재업로드를 준비한다
지정된 사용자가 소유한 기존 데이터 오브젝트의 파일 내용을 재업로드하기 위한 새로운 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트의 상태는 UPLOADING으로 변경되며, 새로운 세대 번호가 할당됩니다.
이전 버전의 파일은 데이터 오브젝트 이력에 보관됩니다.
반환된 URL에 새 파일을 업로드한 후, DoneUpload를 호출하여 업데이트를 확정합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| contentType | string | “application/octet-stream” | ~ 256자 | 업로드할 데이터 오브젝트의 MIME-Type | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| uploadUrl | string | 업로드 처리를 실행하는 데 사용하는 URL |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareReUploadByUserId(
&datastore.PrepareReUploadByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
ContentType: pointy.String("application/octet-stream"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareReUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareReUploadByUserId(
(new PrepareReUploadByUserIdRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withContentType("application/octet-stream")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$uploadUrl = $result->getUploadUrl();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareReUploadByUserIdRequest;
import io.gs2.datastore.result.PrepareReUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareReUploadByUserIdResult result = client.prepareReUploadByUserId(
new PrepareReUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withContentType("application/octet-stream")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareReUploadByUserIdResult> asyncResult = null;
yield return client.PrepareReUploadByUserId(
new Gs2.Gs2Datastore.Request.PrepareReUploadByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithContentType("application/octet-stream")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareReUploadByUserId(
new Gs2Datastore.PrepareReUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withContentType("application/octet-stream")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_re_upload_by_user_id(
datastore.PrepareReUploadByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_content_type('application/octet-stream')
.with_time_offset_token(None)
)
item = result.item
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_re_upload_by_user_id({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
contentType="application/octet-stream",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;client = gs2('datastore')
api_result_handler = client.prepare_re_upload_by_user_id_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
contentType="application/octet-stream",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
uploadUrl = result.uploadUrl;doneUpload
데이터 오브젝트의 업로드 완료를 보고
PrepareUpload 또는 PrepareReUpload로 취득한 서명된 URL에 파일이 업로드된 후, 데이터 오브젝트를 확정합니다.
데이터 오브젝트의 상태가 UPLOADING에서 ACTIVE로 변경되며, 파일 메타데이터(크기, 세대)가 기록됩니다.
네임스페이스 설정에서 doneUploadScript가 설정되어 있는 경우, 업로드 확인 후 훅으로 스크립트가 실행됩니다.
데이터 오브젝트가 UPLOADING 상태가 아니거나 업로드된 파일을 찾을 수 없는 경우 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DoneUpload(
&datastore.DoneUploadRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
AccessToken: pointy.String("accessToken-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DoneUploadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->doneUpload(
(new DoneUploadRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withAccessToken("accessToken-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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DoneUploadRequest;
import io.gs2.datastore.result.DoneUploadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DoneUploadResult result = client.doneUpload(
new DoneUploadRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DoneUploadResult> asyncResult = null;
yield return client.DoneUpload(
new Gs2.Gs2Datastore.Request.DoneUploadRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithAccessToken("accessToken-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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.doneUpload(
new Gs2Datastore.DoneUploadRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withAccessToken("accessToken-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.done_upload(
datastore.DoneUploadRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_access_token('accessToken-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.done_upload({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.done_upload_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
accessToken="accessToken-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;doneUploadByUserId
사용자 ID를 지정하여 데이터 오브젝트의 업로드 완료를 보고
PrepareUpload 또는 PrepareReUpload로 취득한 서명된 URL에 파일이 업로드된 후, 데이터 오브젝트를 확정합니다.
데이터 오브젝트의 상태가 UPLOADING에서 ACTIVE로 변경되며, 파일 메타데이터(크기, 세대)가 기록됩니다.
네임스페이스 설정에서 doneUploadScript가 설정되어 있는 경우, 업로드 확인 후 훅으로 스크립트가 실행됩니다.
데이터 오브젝트가 UPLOADING 상태가 아니거나 업로드된 파일을 찾을 수 없는 경우 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DoneUploadByUserId(
&datastore.DoneUploadByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectName: pointy.String("dataObject-0001"),
UserId: pointy.String("user-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DoneUploadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->doneUploadByUserId(
(new DoneUploadByUserIdRequest())
->withNamespaceName("namespace-0001")
->withDataObjectName("dataObject-0001")
->withUserId("user-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DoneUploadByUserIdRequest;
import io.gs2.datastore.result.DoneUploadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DoneUploadByUserIdResult result = client.doneUploadByUserId(
new DoneUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DoneUploadByUserIdResult> asyncResult = null;
yield return client.DoneUploadByUserId(
new Gs2.Gs2Datastore.Request.DoneUploadByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectName("dataObject-0001")
.WithUserId("user-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.doneUploadByUserId(
new Gs2Datastore.DoneUploadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withDataObjectName("dataObject-0001")
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.done_upload_by_user_id(
datastore.DoneUploadByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_data_object_name('dataObject-0001')
.with_user_id('user-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.done_upload_by_user_id({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.done_upload_by_user_id_async({
namespaceName="namespace-0001",
dataObjectName="dataObject-0001",
userId="user-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteDataObject
데이터 오브젝트의 삭제
지정된 데이터 오브젝트를 삭제 대상으로 표시합니다.
현재 로그인한 사용자가 소유한 데이터 오브젝트가 대상입니다. 실제 파일 데이터는 30일 후에 삭제됩니다.
데이터 오브젝트가 삭제 가능한 상태가 아닌 경우(예: 업로드 중)에는 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DeleteDataObject(
&datastore.DeleteDataObjectRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectName: pointy.String("dataObject-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DeleteDataObjectRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->deleteDataObject(
(new DeleteDataObjectRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectName("dataObject-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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DeleteDataObjectRequest;
import io.gs2.datastore.result.DeleteDataObjectResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DeleteDataObjectResult result = client.deleteDataObject(
new DeleteDataObjectRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DeleteDataObjectResult> asyncResult = null;
yield return client.DeleteDataObject(
new Gs2.Gs2Datastore.Request.DeleteDataObjectRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectName("dataObject-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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.deleteDataObject(
new Gs2Datastore.DeleteDataObjectRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.delete_data_object(
datastore.DeleteDataObjectRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_name('dataObject-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.delete_data_object({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.delete_data_object_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;deleteDataObjectByUserId
사용자 ID를 지정하여 데이터 오브젝트의 삭제
지정된 사용자가 소유한 지정된 데이터 오브젝트를 삭제 대상으로 표시합니다.
실제 파일 데이터는 30일 후에 삭제됩니다.
데이터 오브젝트가 삭제 가능한 상태가 아닌 경우(예: 업로드 중)에는 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DeleteDataObjectByUserId(
&datastore.DeleteDataObjectByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectName: pointy.String("dataObject-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DeleteDataObjectByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->deleteDataObjectByUserId(
(new DeleteDataObjectByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectName("dataObject-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DeleteDataObjectByUserIdRequest;
import io.gs2.datastore.result.DeleteDataObjectByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DeleteDataObjectByUserIdResult result = client.deleteDataObjectByUserId(
new DeleteDataObjectByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DeleteDataObjectByUserIdResult> asyncResult = null;
yield return client.DeleteDataObjectByUserId(
new Gs2.Gs2Datastore.Request.DeleteDataObjectByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectName("dataObject-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.deleteDataObjectByUserId(
new Gs2Datastore.DeleteDataObjectByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.delete_data_object_by_user_id(
datastore.DeleteDataObjectByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_name('dataObject-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.delete_data_object_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.delete_data_object_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;prepareDownload
데이터 오브젝트의 다운로드 준비
지정된 데이터 오브젝트의 최신 버전을 다운로드하기 위한 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트는 GRN(dataObjectId)으로 지정합니다. 접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectId | string | ✓ | ~ 1024자 | 데이터 오브젝트 GRN |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownload(
&datastore.PrepareDownloadRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownload(
(new PrepareDownloadRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadRequest;
import io.gs2.datastore.result.PrepareDownloadResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadResult result = client.prepareDownload(
new PrepareDownloadRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadResult> asyncResult = null;
yield return client.PrepareDownload(
new Gs2.Gs2Datastore.Request.PrepareDownloadRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownload(
new Gs2Datastore.PrepareDownloadRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download(
datastore.PrepareDownloadRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_id('grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001')
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadByUserId
사용자 ID를 지정하여 데이터 오브젝트의 다운로드 준비
지정된 데이터 오브젝트의 최신 버전을 다운로드하기 위한 서명된 클라우드 스토리지 URL을 생성합니다.
데이터 오브젝트는 GRN(dataObjectId)으로 지정합니다. 접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectId | string | ✓ | ~ 1024자 | 데이터 오브젝트 GRN | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadByUserId(
&datastore.PrepareDownloadByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadByUserId(
(new PrepareDownloadByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadByUserIdRequest;
import io.gs2.datastore.result.PrepareDownloadByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadByUserIdResult result = client.prepareDownloadByUserId(
new PrepareDownloadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadByUserIdResult> asyncResult = null;
yield return client.PrepareDownloadByUserId(
new Gs2.Gs2Datastore.Request.PrepareDownloadByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadByUserId(
new Gs2Datastore.PrepareDownloadByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_by_user_id(
datastore.PrepareDownloadByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_id('grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001')
.with_time_offset_token(None)
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadByGeneration
데이터 오브젝트를 세대를 지정하여 다운로드 준비
데이터 오브젝트의 특정 버전(세대)을 다운로드하기 위한 서명된 클라우드 스토리지 URL을 생성합니다.
데이터를 재업로드할 때 보관된 이전 버전의 파일에 접근할 수 있습니다.
접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectId | string | ✓ | ~ 1024자 | 데이터 오브젝트 GRN | ||
| generation | string | ✓ | ~ 128자 | 데이터의 세대 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadByGeneration(
&datastore.PrepareDownloadByGenerationRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
Generation: pointy.String("generation-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadByGenerationRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadByGeneration(
(new PrepareDownloadByGenerationRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
->withGeneration("generation-0001")
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadByGenerationRequest;
import io.gs2.datastore.result.PrepareDownloadByGenerationResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadByGenerationResult result = client.prepareDownloadByGeneration(
new PrepareDownloadByGenerationRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withGeneration("generation-0001")
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadByGenerationResult> asyncResult = null;
yield return client.PrepareDownloadByGeneration(
new Gs2.Gs2Datastore.Request.PrepareDownloadByGenerationRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.WithGeneration("generation-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadByGeneration(
new Gs2Datastore.PrepareDownloadByGenerationRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withGeneration("generation-0001")
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_by_generation(
datastore.PrepareDownloadByGenerationRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_id('grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001')
.with_generation('generation-0001')
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_by_generation({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
generation="generation-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_by_generation_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
generation="generation-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadByGenerationAndUserId
사용자 ID를 지정하여 데이터 오브젝트의 세대를 지정하여 다운로드 준비
데이터 오브젝트의 특정 버전(세대)을 다운로드하기 위한 서명된 클라우드 스토리지 URL을 생성합니다.
데이터를 재업로드할 때 보관된 이전 버전의 파일에 접근할 수 있습니다.
접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectId | string | ✓ | ~ 1024자 | 데이터 오브젝트 GRN | ||
| generation | string | ✓ | ~ 128자 | 데이터의 세대 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadByGenerationAndUserId(
&datastore.PrepareDownloadByGenerationAndUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
Generation: pointy.String("generation-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadByGenerationAndUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadByGenerationAndUserId(
(new PrepareDownloadByGenerationAndUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
->withGeneration("generation-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadByGenerationAndUserIdRequest;
import io.gs2.datastore.result.PrepareDownloadByGenerationAndUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadByGenerationAndUserIdResult result = client.prepareDownloadByGenerationAndUserId(
new PrepareDownloadByGenerationAndUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadByGenerationAndUserIdResult> asyncResult = null;
yield return client.PrepareDownloadByGenerationAndUserId(
new Gs2.Gs2Datastore.Request.PrepareDownloadByGenerationAndUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.WithGeneration("generation-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadByGenerationAndUserId(
new Gs2Datastore.PrepareDownloadByGenerationAndUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_by_generation_and_user_id(
datastore.PrepareDownloadByGenerationAndUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_id('grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001')
.with_generation('generation-0001')
.with_time_offset_token(None)
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_by_generation_and_user_id({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_by_generation_and_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadOwnData
이름을 지정하여 자신의 데이터 오브젝트 다운로드 준비
GRN(dataObjectId) 대신 이름을 지정하여, 현재 로그인한 사용자 자신의 데이터 오브젝트를 다운로드하기 위한 간편 API입니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadOwnData(
&datastore.PrepareDownloadOwnDataRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectName: pointy.String("dataObject-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadOwnDataRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadOwnData(
(new PrepareDownloadOwnDataRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectName("dataObject-0001")
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadOwnDataRequest;
import io.gs2.datastore.result.PrepareDownloadOwnDataResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadOwnDataResult result = client.prepareDownloadOwnData(
new PrepareDownloadOwnDataRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadOwnDataResult> asyncResult = null;
yield return client.PrepareDownloadOwnData(
new Gs2.Gs2Datastore.Request.PrepareDownloadOwnDataRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectName("dataObject-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadOwnData(
new Gs2Datastore.PrepareDownloadOwnDataRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_own_data(
datastore.PrepareDownloadOwnDataRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_name('dataObject-0001')
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_own_data({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_own_data_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadByUserIdAndDataObjectName
사용자 ID와 오브젝트 이름을 지정하여 데이터 오브젝트 다운로드 준비
GRN(dataObjectId)대신 사용자 ID와 오브젝트 이름을 지정하여 사용자의 데이터 오브젝트를 다운로드하기 위한 간편 API입니다.
접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadByUserIdAndDataObjectName(
&datastore.PrepareDownloadByUserIdAndDataObjectNameRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectName: pointy.String("dataObject-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadByUserIdAndDataObjectNameRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadByUserIdAndDataObjectName(
(new PrepareDownloadByUserIdAndDataObjectNameRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectName("dataObject-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadByUserIdAndDataObjectNameRequest;
import io.gs2.datastore.result.PrepareDownloadByUserIdAndDataObjectNameResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadByUserIdAndDataObjectNameResult result = client.prepareDownloadByUserIdAndDataObjectName(
new PrepareDownloadByUserIdAndDataObjectNameRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadByUserIdAndDataObjectNameResult> asyncResult = null;
yield return client.PrepareDownloadByUserIdAndDataObjectName(
new Gs2.Gs2Datastore.Request.PrepareDownloadByUserIdAndDataObjectNameRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectName("dataObject-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadByUserIdAndDataObjectName(
new Gs2Datastore.PrepareDownloadByUserIdAndDataObjectNameRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_by_user_id_and_data_object_name(
datastore.PrepareDownloadByUserIdAndDataObjectNameRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_name('dataObject-0001')
.with_time_offset_token(None)
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_by_user_id_and_data_object_name({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_by_user_id_and_data_object_name_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadOwnDataByGeneration
자신의 데이터 오브젝트의 세대를 지정하여 다운로드 준비
GRN 대신 이름을 지정하여, 현재 로그인한 사용자 자신의 데이터 오브젝트의 특정 버전(세대)을 다운로드하기 위한 간편 API입니다.
데이터가 재업로드될 때 보관된 이전 버전의 파일에 접근할 수 있습니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| generation | string | ✓ | ~ 128자 | 데이터의 세대 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadOwnDataByGeneration(
&datastore.PrepareDownloadOwnDataByGenerationRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectName: pointy.String("dataObject-0001"),
Generation: pointy.String("generation-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadOwnDataByGenerationRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadOwnDataByGeneration(
(new PrepareDownloadOwnDataByGenerationRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectName("dataObject-0001")
->withGeneration("generation-0001")
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadOwnDataByGenerationRequest;
import io.gs2.datastore.result.PrepareDownloadOwnDataByGenerationResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadOwnDataByGenerationResult result = client.prepareDownloadOwnDataByGeneration(
new PrepareDownloadOwnDataByGenerationRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadOwnDataByGenerationResult> asyncResult = null;
yield return client.PrepareDownloadOwnDataByGeneration(
new Gs2.Gs2Datastore.Request.PrepareDownloadOwnDataByGenerationRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectName("dataObject-0001")
.WithGeneration("generation-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadOwnDataByGeneration(
new Gs2Datastore.PrepareDownloadOwnDataByGenerationRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_own_data_by_generation(
datastore.PrepareDownloadOwnDataByGenerationRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_name('dataObject-0001')
.with_generation('generation-0001')
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_own_data_by_generation({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_own_data_by_generation_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;prepareDownloadByUserIdAndDataObjectNameAndGeneration
사용자 ID·오브젝트 이름·세대를 지정하여 데이터 오브젝트의 다운로드 준비
GRN 대신 사용자 ID와 오브젝트 이름을 지정하여 사용자의 데이터 오브젝트의 특정 버전(세대)을 다운로드하기 위한 간편 API입니다.
데이터가 재업로드될 때 보관된 이전 버전의 파일에 접근할 수 있습니다.
접근 제어가 적용되어 데이터 소유자 또는 allowUserIds에 등록된 사용자만 다운로드할 수 있습니다.
서명된 다운로드 URL과 파일 크기(콘텐츠 길이)가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| generation | string | ✓ | ~ 128자 | 데이터의 세대 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
| fileUrl | string | 파일을 다운로드하기 위한 URL |
| contentLength | long | 파일 용량 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.PrepareDownloadByUserIdAndDataObjectNameAndGeneration(
&datastore.PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectName: pointy.String("dataObject-0001"),
Generation: pointy.String("generation-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Item
fileUrl := result.FileUrl
contentLength := result.ContentLengthuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->prepareDownloadByUserIdAndDataObjectNameAndGeneration(
(new PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectName("dataObject-0001")
->withGeneration("generation-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
$fileUrl = $result->getFileUrl();
$contentLength = $result->getContentLength();
} 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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest;
import io.gs2.datastore.result.PrepareDownloadByUserIdAndDataObjectNameAndGenerationResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
PrepareDownloadByUserIdAndDataObjectNameAndGenerationResult result = client.prepareDownloadByUserIdAndDataObjectNameAndGeneration(
new PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
DataObject item = result.getItem();
String fileUrl = result.getFileUrl();
long contentLength = result.getContentLength();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.PrepareDownloadByUserIdAndDataObjectNameAndGenerationResult> asyncResult = null;
yield return client.PrepareDownloadByUserIdAndDataObjectNameAndGeneration(
new Gs2.Gs2Datastore.Request.PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectName("dataObject-0001")
.WithGeneration("generation-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var fileUrl = result.FileUrl;
var contentLength = result.ContentLength;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.prepareDownloadByUserIdAndDataObjectNameAndGeneration(
new Gs2Datastore.PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
const fileUrl = result.getFileUrl();
const contentLength = result.getContentLength();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.prepare_download_by_user_id_and_data_object_name_and_generation(
datastore.PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_name('dataObject-0001')
.with_generation('generation-0001')
.with_time_offset_token(None)
)
item = result.item
file_url = result.file_url
content_length = result.content_length
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.prepare_download_by_user_id_and_data_object_name_and_generation({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;client = gs2('datastore')
api_result_handler = client.prepare_download_by_user_id_and_data_object_name_and_generation_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;
fileUrl = result.fileUrl;
contentLength = result.contentLength;restoreDataObject
데이터 오브젝트의 관리 정보 복구
데이터 오브젝트에 저장된 메타데이터를 실제 파일 상태와 대조합니다.
기록되어 있는 세대 번호나 콘텐츠 길이가 실제 파일과 다른 경우, 메타데이터가 일치하도록 업데이트됩니다.
업로드 중 발생한 부분적인 장애로 인해 생길 수 있는 불일치로부터 복구할 때 유용합니다.
ACTIVE 상태의 데이터 오브젝트만 복구할 수 있으며, 그 외의 상태에서는 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| dataObjectId | string | ✓ | ~ 1024자 | 데이터 오브젝트 GRN |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObject | 데이터 오브젝트 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.RestoreDataObject(
&datastore.RestoreDataObjectRequest {
NamespaceName: pointy.String("namespace-0001"),
DataObjectId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\RestoreDataObjectRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->restoreDataObject(
(new RestoreDataObjectRequest())
->withNamespaceName("namespace-0001")
->withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.RestoreDataObjectRequest;
import io.gs2.datastore.result.RestoreDataObjectResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
RestoreDataObjectResult result = client.restoreDataObject(
new RestoreDataObjectRequest()
.withNamespaceName("namespace-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
);
DataObject item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.RestoreDataObjectResult> asyncResult = null;
yield return client.RestoreDataObject(
new Gs2.Gs2Datastore.Request.RestoreDataObjectRequest()
.WithNamespaceName("namespace-0001")
.WithDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.restoreDataObject(
new Gs2Datastore.RestoreDataObjectRequest()
.withNamespaceName("namespace-0001")
.withDataObjectId("grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.restore_data_object(
datastore.RestoreDataObjectRequest()
.with_namespace_name('namespace-0001')
.with_data_object_id('grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.restore_data_object({
namespaceName="namespace-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.restore_data_object_async({
namespaceName="namespace-0001",
dataObjectId="grn:gs2:ap-northeast-1:YourOwnerId:datastore:namespace-0001:user:user-0001:data:dataObject-0001",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;describeDataObjectHistories
데이터 오브젝트 이력 목록 조회
현재 로그인한 사용자가 소유한 특정 데이터 오브젝트의 전체 버전 이력(세대)을 목록으로 조회합니다.
PrepareReUpload와 DoneUpload를 통해 데이터 오브젝트의 파일 내용이 재업로드될 때마다 새로운 세대가 생성되고, 이전 버전이 이력에 기록됩니다.
이력 항목에는 각 세대의 콘텐츠 크기나 생성 타임스탬프 등의 메타데이터가 포함됩니다.
페이지 토큰과 취득 건수 제한을 사용하여 결과를 페이지네이션할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||
| limit | int | 30 | 1 ~ 1000 | 취득할 데이터 건수 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<DataObjectHistory> | 데이터 오브젝트 이력 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjectHistories(
&datastore.DescribeDataObjectHistoriesRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectName: pointy.String("dataObject-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectHistoriesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->describeDataObjectHistories(
(new DescribeDataObjectHistoriesRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectName("dataObject-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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectHistoriesRequest;
import io.gs2.datastore.result.DescribeDataObjectHistoriesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectHistoriesResult result = client.describeDataObjectHistories(
new DescribeDataObjectHistoriesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
.withPageToken(null)
.withLimit(null)
);
List<DataObjectHistory> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectHistoriesResult> asyncResult = null;
yield return client.DescribeDataObjectHistories(
new Gs2.Gs2Datastore.Request.DescribeDataObjectHistoriesRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectName("dataObject-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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjectHistories(
new Gs2Datastore.DescribeDataObjectHistoriesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-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 datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_object_histories(
datastore.DescribeDataObjectHistoriesRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_name('dataObject-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('datastore')
api_result = client.describe_data_object_histories({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('datastore')
api_result_handler = client.describe_data_object_histories_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;describeDataObjectHistoriesByUserId
사용자 ID를 지정하여 데이터 오브젝트 이력 목록 조회
지정된 사용자가 소유한 특정 데이터 오브젝트의 전체 버전 이력(세대)을 목록으로 조회합니다.
PrepareReUpload와 DoneUpload를 통해 데이터 오브젝트의 파일 내용이 재업로드될 때마다 새로운 세대가 생성되고, 이전 버전이 이력에 기록됩니다.
이력 항목에는 각 세대의 콘텐츠 크기나 생성 타임스탬프 등의 메타데이터가 포함됩니다.
페이지 토큰과 취득 건수 제한을 사용하여 결과를 페이지네이션할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||
| limit | int | 30 | 1 ~ 1000 | 취득할 데이터 건수 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<DataObjectHistory> | 데이터 오브젝트 이력 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.DescribeDataObjectHistoriesByUserId(
&datastore.DescribeDataObjectHistoriesByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectName: pointy.String("dataObject-0001"),
PageToken: nil,
Limit: nil,
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\DescribeDataObjectHistoriesByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->describeDataObjectHistoriesByUserId(
(new DescribeDataObjectHistoriesByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectName("dataObject-0001")
->withPageToken(null)
->withLimit(null)
->withTimeOffsetToken(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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.DescribeDataObjectHistoriesByUserIdRequest;
import io.gs2.datastore.result.DescribeDataObjectHistoriesByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
DescribeDataObjectHistoriesByUserIdResult result = client.describeDataObjectHistoriesByUserId(
new DescribeDataObjectHistoriesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<DataObjectHistory> items = result.getItems();
String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.DescribeDataObjectHistoriesByUserIdResult> asyncResult = null;
yield return client.DescribeDataObjectHistoriesByUserId(
new Gs2.Gs2Datastore.Request.DescribeDataObjectHistoriesByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectName("dataObject-0001")
.WithPageToken(null)
.WithLimit(null)
.WithTimeOffsetToken(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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.describeDataObjectHistoriesByUserId(
new Gs2Datastore.DescribeDataObjectHistoriesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.describe_data_object_histories_by_user_id(
datastore.DescribeDataObjectHistoriesByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_name('dataObject-0001')
.with_page_token(None)
.with_limit(None)
.with_time_offset_token(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.describe_data_object_histories_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('datastore')
api_result_handler = client.describe_data_object_histories_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
pageToken=nil,
limit=nil,
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getDataObjectHistory
데이터 오브젝트 이력 조회
현재 로그인한 사용자가 소유한 데이터 오브젝트의 특정 세대에 대한 이력 항목을 조회합니다.
세대 번호를 지정함으로써, 데이터 오브젝트의 특정 버전에 관한 메타데이터(콘텐츠 크기, 생성 타임스탬프 등)에 접근할 수 있습니다.
PrepareDownloadByGeneration으로 과거 버전을 다운로드하기 전에, 해당 버전의 정보를 확인하는 데 유용합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| generation | string | ✓ | ~ 128자 | 세대 ID 업로드 시점의 데이터 오브젝트의 특정 버전을 나타내는 고유 식별자입니다. DataObject 의 generation 필드에 해당하며, PrepareDownloadByGeneration 에서 이 특정 버전을 다운로드할 때 사용할 수 있습니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObjectHistory | 데이터 오브젝트 이력 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetDataObjectHistory(
&datastore.GetDataObjectHistoryRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
DataObjectName: pointy.String("dataObject-0001"),
Generation: pointy.String("1"),
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\GetDataObjectHistoryRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->getDataObjectHistory(
(new GetDataObjectHistoryRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withDataObjectName("dataObject-0001")
->withGeneration("1")
);
$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.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetDataObjectHistoryRequest;
import io.gs2.datastore.result.GetDataObjectHistoryResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
GetDataObjectHistoryResult result = client.getDataObjectHistory(
new GetDataObjectHistoryRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("1")
);
DataObjectHistory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetDataObjectHistoryResult> asyncResult = null;
yield return client.GetDataObjectHistory(
new Gs2.Gs2Datastore.Request.GetDataObjectHistoryRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithDataObjectName("dataObject-0001")
.WithGeneration("1"),
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 Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getDataObjectHistory(
new Gs2Datastore.GetDataObjectHistoryRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("1")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_data_object_history(
datastore.GetDataObjectHistoryRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_data_object_name('dataObject-0001')
.with_generation('1')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.get_data_object_history({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
generation="1",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.get_data_object_history_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
dataObjectName="dataObject-0001",
generation="1",
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;getDataObjectHistoryByUserId
사용자 ID를 지정하여 데이터 오브젝트 이력 조회
지정된 사용자가 소유한 데이터 오브젝트의 특정 세대에 대한 이력 항목을 조회합니다.
세대 번호를 지정함으로써, 데이터 오브젝트의 특정 버전에 관한 메타데이터(콘텐츠 크기, 생성 타임스탬프 등)에 접근할 수 있습니다.
PrepareDownloadByGeneration으로 과거 버전을 다운로드하기 전에, 해당 버전의 정보를 확인하는 데 유용합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| dataObjectName | string | ✓ | UUID | ~ 128자 | 데이터 오브젝트의 이름 데이터 오브젝트를 식별하는 고유한 이름입니다. 기본적으로 UUID 형식으로 자동 생성됩니다. 네임스페이스 내에서 업로드된 데이터를 참조·관리하는 데 사용됩니다. | |
| generation | string | ✓ | ~ 128자 | 세대 ID 업로드 시점의 데이터 오브젝트의 특정 버전을 나타내는 고유 식별자입니다. DataObject 의 generation 필드에 해당하며, PrepareDownloadByGeneration 에서 이 특정 버전을 다운로드할 때 사용할 수 있습니다. | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | DataObjectHistory | 데이터 오브젝트 이력 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/datastore"
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 := datastore.Gs2DatastoreRestClient{
Session: &session,
}
result, err := client.GetDataObjectHistoryByUserId(
&datastore.GetDataObjectHistoryByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
DataObjectName: pointy.String("dataObject-0001"),
Generation: pointy.String("generation-0001"),
TimeOffsetToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Datastore\Gs2DatastoreRestClient;
use Gs2\Datastore\Request\GetDataObjectHistoryByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DatastoreRestClient(
$session
);
try {
$result = $client->getDataObjectHistoryByUserId(
(new GetDataObjectHistoryByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withDataObjectName("dataObject-0001")
->withGeneration("generation-0001")
->withTimeOffsetToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.datastore.rest.Gs2DatastoreRestClient;
import io.gs2.datastore.request.GetDataObjectHistoryByUserIdRequest;
import io.gs2.datastore.result.GetDataObjectHistoryByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DatastoreRestClient client = new Gs2DatastoreRestClient(session);
try {
GetDataObjectHistoryByUserIdResult result = client.getDataObjectHistoryByUserId(
new GetDataObjectHistoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
DataObjectHistory item = result.getItem();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DatastoreRestClient(session);
AsyncResult<Gs2.Gs2Datastore.Result.GetDataObjectHistoryByUserIdResult> asyncResult = null;
yield return client.GetDataObjectHistoryByUserId(
new Gs2.Gs2Datastore.Request.GetDataObjectHistoryByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithDataObjectName("dataObject-0001")
.WithGeneration("generation-0001")
.WithTimeOffsetToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Datastore from '@/gs2/datastore';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Datastore.Gs2DatastoreRestClient(session);
try {
const result = await client.getDataObjectHistoryByUserId(
new Gs2Datastore.GetDataObjectHistoryByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withDataObjectName("dataObject-0001")
.withGeneration("generation-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import datastore
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = datastore.Gs2DatastoreRestClient(session)
try:
result = client.get_data_object_history_by_user_id(
datastore.GetDataObjectHistoryByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_data_object_name('dataObject-0001')
.with_generation('generation-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('datastore')
api_result = client.get_data_object_history_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('datastore')
api_result_handler = client.get_data_object_history_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
dataObjectName="dataObject-0001",
generation="generation-0001",
timeOffsetToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;