GS2-StateMachine SDK API 레퍼런스
모델
Namespace
네임스페이스
네임스페이스는 하나의 프로젝트 내에서 동일한 서비스를 서로 다른 용도로 여러 개 이용하기 위한 엔티티입니다.
GS2의 각 서비스는 네임스페이스 단위로 관리됩니다. 네임스페이스가 다르면 동일한 서비스라도 완전히 독립된 데이터 공간으로 취급됩니다.
따라서 각 서비스의 이용을 시작하려면 먼저 네임스페이스를 생성해야 합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceId | string | ※ | ~ 1024자 | 네임스페이스 GRN
※ 서버가 자동으로 설정 | ||||||||
| name | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||
| description | string | ~ 1024자 | 설명문 | |||||||||
| supportSpeculativeExecution | 문자열 열거형 enum { “enable”, “disable” } | “disable” | 투기적 실행을 지원할지 여부 활성화하면 스테이트 머신 정의와 난수 상태가 Status 엔티티에 포함되어, 클라이언트가 서버 확인 전에 로컬에서 상태 전이를 시뮬레이션할 수 있게 됩니다. transactionSetting 설정이 필요합니다.
| |||||||||
| transactionSetting | TransactionSetting | {supportSpeculativeExecution} == “enable” | 트랜잭션 설정 스테이트 머신의 emit 액션 실행 시 트랜잭션 처리 방식을 제어하는 설정입니다. 투기적 실행을 활성화하는 경우 필요합니다. ※ supportSpeculativeExecution이(가) “enable” 이면 활성화 | |||||||||
| startScript | ScriptSetting | 스테이트 머신을 시작했을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - start | ||||||||||
| passScript | ScriptSetting | 스테이트 머신이 정상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - pass | ||||||||||
| errorScript | ScriptSetting | 스테이트 머신이 이상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - error | ||||||||||
| lowestStateMachineVersion | long | 스테이트 머신의 최저 버전 실행 가능한 스테이트 머신의 최저 버전입니다. 이 값보다 오래된 버전의 스테이트 머신으로 생성된 Status 인스턴스는 거부되며, 모든 실행 중인 인스턴스가 최신 정의를 사용하도록 보장됩니다. | ||||||||||
| logSetting | LogSetting | 로그 출력 설정 스테이트 머신의 실행, 상태 전이, emit 이벤트에 관한 API 요청·응답 로그를 출력할 GS2-Log의 네임스페이스를 지정합니다. | ||||||||||
| 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자 | 완료 시 실행할 스크립트 GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. ※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화 | ||||||||||
| doneTriggerQueueNamespaceId | string | {doneTriggerTargetType} == “gs2_script” | ~ 1024자 | 완료 시 스크립트를 실행할 GS2-JobQueue 네임스페이스 GRN
완료 스크립트의 완료 여부를 알고 싶을 때 사용합니다. ※ doneTriggerTargetType이(가) “gs2_script” 이면 활성화 |
LogSetting
로그 출력 설정
로그 데이터의 출력 설정을 관리합니다. 이 타입은 로그 데이터를 출력하기 위해 사용되는 GS2-Log 네임스페이스의 식별자(Namespace ID)를 보관합니다.
로그 네임스페이스ID(loggingNamespaceId)에는 로그 데이터를 수집하여 저장하는 GS2-Log의 네임스페이스를 GRN 형식으로 지정합니다.
이 설정을 하면 설정된 네임스페이스 내에서 발생한 API 요청·응답 로그 데이터가 대상 GS2-Log 네임스페이스 쪽으로 출력됩니다.
GS2-Log에서는 실시간으로 로그가 제공되어 시스템 모니터링, 분석, 디버깅 등에 활용할 수 있습니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| loggingNamespaceId | string | ✓ | ~ 1024자 | 로그를 출력할 GS2-Log의 네임스페이스
GRN
“grn:gs2:“로 시작하는 GRN 형식의 ID로 지정해야 합니다. |
Status
스테이트 머신의 상태
특정 사용자에 대한 스테이트 머신의 실행 인스턴스를 나타냅니다. 변수, 서브 스테이트 머신용 콜 스택, 전이 횟수, 난수 상태를 포함한 현재 실행 상태를 추적합니다. 스테이터스는 Running, Wait, Pass(성공), Error 상태를 전이합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| statusId | string | ※ | ~ 1024자 | 스테이트 머신 상태 GRN
※ 서버가 자동으로 설정 | ||||||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||||
| name | string | ✓ | UUID | ~ 36자 | 스테이터스 이름 스테이트 머신 상태의 고유한 이름을 보유합니다. 이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 스테이트 머신의 상태를 식별하는 데 사용됩니다. | |||||||||||
| stateMachineVersion | long | ✓ | 0 ~ 32503680000000 | 버전 이 스테이트 머신 정의의 버전 식별자입니다. 작성 시 자동으로 할당됩니다. 네임스페이스의 lowestStateMachineVersion과 조합하여, 실행 중인 인스턴스의 버전 호환성을 강제하는 데 사용됩니다. | ||||||||||||
| enableSpeculativeExecution | 문자열 열거형 enum { “enable”, “disable” } | “disable” | 투기적 실행을 활성화할지 여부 활성화하면 스테이트 머신 정의와 난수 상태가 이 Status 엔티티에 포함됩니다. 이를 통해 클라이언트가 서버 확인 전에 로컬에서 전이를 시뮬레이션할 수 있어 체감 지연을 줄일 수 있습니다.
| |||||||||||||
| stateMachineDefinition | string | {enableSpeculativeExecution} == “enable” | ~ 16777216자 | 스테이트 머신 정의 투기적 실행을 위해 이 스테이터스에 포함된 GSL 정의입니다. enableSpeculativeExecution이 활성화된 경우에만 존재합니다. 일반적인 API 응답에서는 필터링되며, 클라이언트 측 시뮬레이션에 필요한 경우에만 포함됩니다. ※ enableSpeculativeExecution이(가) “enable” 이면 활성화 | ||||||||||||
| randomStatus | RandomStatus | {enableSpeculativeExecution} == “enable” | 난수 상태 이 실행 인스턴스의 난수 생성 상태입니다. 투기적 실행 시 클라이언트와 서버에서 결정론적인 난수 동작을 보장하기 위해 사용됩니다. enableSpeculativeExecution이 활성화된 경우에만 존재합니다. ※ enableSpeculativeExecution이(가) “enable” 이면 활성화 | |||||||||||||
| stacks | List<StackEntry> | [] | 0 ~ 1024 items | 스택 서브 스테이트 머신 호출의 콜 스택입니다. 스테이트 머신이 서브 스테이트 머신을 호출하면 호출한 쪽의 스테이트 머신 이름과 반환 태스크가 푸시됩니다. 서브 스테이트 머신이 완료되면 엔트리가 팝되고 반환 태스크에서 실행이 재개됩니다. | ||||||||||||
| variables | List<Variable> | [] | 0 ~ 1000 items | 스테이트 머신별 상태 변수 콜 계층 내 각 스테이트 머신의 현재 변수 값입니다. 각 엔트리는 스테이트 머신 이름과, int, float, string, bool, array, map 타입을 지원하는 JSON 직렬화된 값을 보유합니다. 변수는 동일한 실행 인스턴스 내 상태 전이를 거쳐 유지됩니다. | ||||||||||||
| status | 문자열 열거형 enum { “Running”, “Wait”, “Pass”, “Error” } | “Running” | 스테이터스 이 스테이트 머신 인스턴스의 현재 실행 상태입니다. “Running"은 머신이 전이를 처리 중임을 의미합니다. “Wait"는 머신이 외부 이벤트(emit)를 대기 중임을 의미합니다. “Pass"는 정상적으로 완료되었음을 의미합니다. “Error"는 에러로 종료되었음을 의미합니다.
| |||||||||||||
| lastError | string | ~ 1024자 | 마지막 에러 마지막으로 발생한 에러의 메시지입니다. 스테이터스가 “Error"로 전이되었을 때 설정됩니다. 스테이트 머신이 이상 종료된 원인의 상세 내용을 포함합니다. | |||||||||||||
| transitionCount | int | 0 | 0 ~ 2147483645 | 전이 횟수 이 실행 인스턴스에서 수행된 상태 전이의 총 횟수입니다. 전이할 때마다 증가합니다. 이 값이 1000을 초과하면 무한 루프를 방지하기 위해 스테이트 머신은 에러로 종료됩니다. | ||||||||||||
| createdAt | long | ※ | 현재 시각 | 생성일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||||||||||||
| updatedAt | long | ※ | 현재 시각 | 최종 갱신일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 |
StackEntry
스택 엔트리
서브 스테이트 머신의 콜 스택 내 하나의 엔트리를 나타냅니다. 스테이트 머신이 서브 스테이트 머신을 호출하면 호출한 쪽의 이름과 반환 태스크가 스택에 푸시됩니다. 서브 스테이트 머신이 완료되면 팝된 엔트리의 반환 태스크에서 실행이 재개됩니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| stateMachineName | string | ✓ | ~ 128자 | 스테이트 머신 이름 이 스택 엔트리를 푸시한 호출 측 스테이트 머신의 이름입니다. 서브 스테이트 머신에서 돌아올 때 어떤 스테이트 머신의 컨텍스트를 복원할지 식별하는 데 사용됩니다. | ||
| taskName | string | ✓ | ~ 128자 | 태스크 이름 서브 스테이트 머신이 완료되었을 때 돌아갈 태스크(상태)의 이름입니다. 호출 측 스테이트 머신의 이 태스크에서 실행이 재개됩니다. |
Variable
스테이트 머신별 상태 변수
호출 계층 내 특정 스테이트 머신의 현재 변수 상태를 보유합니다. 값은 int, float, string, bool, array, map 데이터 타입을 지원하는 JSON 직렬화 표현입니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| stateMachineName | string | ✓ | ~ 128자 | 스테이트 머신 이름 이들 변수를 소유하는 스테이트 머신의 이름입니다. 중첩된 호출 계층에서는 각 스테이트 머신이 이 이름으로 식별되는 독립적인 변수 스코프를 가집니다. | ||
| value | string | ✓ | ~ 1048576자 | 값 이 스테이트 머신의 JSON 직렬화된 변수 값입니다. int, float, string, bool, array, map 데이터 타입을 지원합니다. 스테이트 머신이 전이나 액션을 처리할 때 갱신됩니다. |
Event
이벤트
스테이트 머신 실행 중에 발생한 이벤트를 나타냅니다. 상태 변경 이벤트(상태 전이를 기록)이거나 emit 이벤트(외부 액션을 트리거하기 위한 메시지 전송) 중 하나입니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| eventType | 문자열 열거형 enum { “change_state”, “emit” } | ✓ | 이벤트 종류 이벤트의 종류입니다. “change_state"는 스테이트 머신 내의 상태 전이를 기록합니다. “emit"은 보상 지급이나 리소스 소비 등의 외부 액션을 트리거하기 위한 메시지 전송을 나타냅니다.
| |||||||||
| changeStateEvent | ChangeStateEvent | {eventType} == “change_state” | ✓※ | 상태 변경 ※ eventType이(가) “change_state” 이면 필수 | ||||||||
| emitEvent | EmitEvent | {eventType} == “emit” | ✓※ | 메시지 전송 ※ eventType이(가) “emit” 이면 필수 |
ChangeStateEvent
상태 변경 이벤트
스테이트 머신 내에서 발생한 상태 전이를 기록합니다. 전이 대상 태스크 이름, 무결성 검증용 해시, 전이가 발생한 타임스탬프를 포함합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| taskName | string | ✓ | ~ 128자 | 태스크 이름 스테이트 머신이 전이한 대상 태스크(상태)의 이름입니다. | ||
| hash | string | ✓ | ~ 64자 | 해시 상태 전이의 무결성을 검증하기 위한 해시 값입니다. 전이가 올바르게 수행되었고 상태가 일관되어 있음을 검증하는 데 사용됩니다. | ||
| timestamp | long | ✓ | 타임스탬프 |
EmitEvent
메시지 전송 이벤트
외부 액션을 트리거하기 위해 스테이트 머신이 전송하는 메시지를 나타냅니다. 이벤트 이름은 액션의 종류를 식별하고, 파라미터는 액션별 데이터를 제공합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| event | string | ✓ | ~ 128자 | 이벤트 이름 전송된 이벤트의 종류를 식별하는 이름입니다. 보상 지급이나 리소스 소비 등, 어떤 외부 액션을 호출할지 판단하는 데 사용됩니다. | ||
| parameters | string | ✓ | ~ 1024자 | 파라미터 전송된 이벤트와 함께 전달되는 파라미터입니다. 이 이벤트에 의해 트리거되는 외부 액션을 설정하는 데 사용되는, 액션별 데이터를 직렬화된 형식으로 포함합니다. | ||
| timestamp | long | ✓ | 타임스탬프 |
RandomStatus
난수 상태
스테이트 머신 실행 인스턴스의 난수 생성 상태를 관리합니다. 시드 값과 카테고리별 사용 현황 추적을 포함합니다. 추측 실행 시 클라이언트와 서버 간에 결정론적인 난수 동작을 보장하기 위해 사용됩니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| seed | long | ✓ | 0 ~ 4294967294 | 난수 시드 스테이트 머신 실행 내에서 결정론적인 난수 생성을 위한 시드 값입니다. | ||
| used | List<RandomUsed> | 0 ~ 1000 items | 사용된 난수 목록 카테고리별로 소비된 난수를 추적합니다. 각 카테고리는 난수 사용의 서로 다른 목적을 나타내며, 추측 재실행 시 일관성을 유지하기 위한 독립적인 추적을 가능하게 합니다. |
RandomUsed
사용한 난수
스테이트 머신 실행 내 특정 카테고리에서 소비된 난수의 수를 추적합니다. 각 카테고리는 서로 다른 목적을 위한 독립적인 난수 추적을 가능하게 합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| category | long | ✓ | 0 ~ 4294967294 | 카테고리 난수 사용 카테고리의 숫자 식별자입니다. 각 카테고리는 난수 소비를 독립적으로 추적하여, 스테이트 머신이 서로 다른 목적에 별도의 난수 시퀀스를 사용할 수 있도록 합니다. | ||
| used | long | ✓ | 0 ~ 4294967294 | 사용 횟수 이 카테고리에서 소비된 난수의 수입니다. 이 카테고리의 시퀀스에서 난수가 뽑힐 때마다 증가합니다. |
VerifyActionResult
검증 액션 실행 결과
상세
ConsumeActionResult
소비 액션 실행 결과
상세
AcquireActionResult
획득 액션 실행 결과
상세
TransactionResult
트랜잭션 실행 결과
서버 사이드에서 트랜잭션 자동 실행 기능을 이용하여 실행된 트랜잭션의 실행 결과
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| transactionId | string | ✓ | 36 ~ 36자 | 트랜잭션 ID | ||
| verifyResults | List<VerifyActionResult> | 0 ~ 10 items | 검증 액션의 실행 결과 목록 | |||
| consumeResults | List<ConsumeActionResult> | [] | 0 ~ 10 items | 소비 액션의 실행 결과 목록 | ||
| acquireResults | List<AcquireActionResult> | [] | 0 ~ 100 items | 획득 액션 실행 결과 리스트 | ||
| hasError | bool | false | 트랜잭션 실행 중 오류가 발생했는지 여부 |
StateMachineMaster
스테이트 머신 정의
GSL로 작성된 스테이트 머신을 관리합니다.
상세
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| stateMachineId | string | ※ | ~ 1024자 | 스테이트 머신 마스터 GRN
※ 서버가 자동으로 설정 | ||
| mainStateMachineName | string | ✓ | ~ 128자 | 메인 스테이트 머신 이름 GSL 정의 내에서 진입점이 되는 스테이트 머신의 이름입니다. 이 스테이트 머신부터 실행이 시작되며, 스택 메커니즘을 통해 서브 스테이트 머신을 호출할 수 있습니다. | ||
| payload | string | ✓ | ~ 5242880자 | 스테이트 머신 정의 스테이트 머신의 상태, 전이, 액션을 정의하는 GSL(GS2 State Language) 소스 코드입니다. 효율적인 취득을 위해 메타데이터와는 별도로 저장됩니다. | ||
| version | long | ✓ | 0 ~ 32503680000000 | 버전 이 스테이트 머신 정의의 버전 식별자입니다. 작성 시 자동으로 할당됩니다. 네임스페이스의 lowestStateMachineVersion과 조합하여, 실행 중인 인스턴스의 버전 호환성을 강제하는 데 사용됩니다. | ||
| createdAt | long | ※ | 현재 시각 | 생성일시 UNIX 시간·밀리초 ※ 서버가 자동으로 설정 | ||
| updatedAt | 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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DescribeNamespacesRequest;
import io.gs2.stateMachine.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2StateMachine.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 state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.describe_namespaces(
state_machine.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('state_machine')
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('state_machine')
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자 | 설명문 | |||||||||
| supportSpeculativeExecution | 문자열 열거형 enum { “enable”, “disable” } | “disable” | 투기적 실행을 지원할지 여부 활성화하면 스테이트 머신 정의와 난수 상태가 Status 엔티티에 포함되어, 클라이언트가 서버 확인 전에 로컬에서 상태 전이를 시뮬레이션할 수 있게 됩니다. transactionSetting 설정이 필요합니다.
| |||||||||
| transactionSetting | TransactionSetting | {supportSpeculativeExecution} == “enable” | 트랜잭션 설정 스테이트 머신의 emit 액션 실행 시 트랜잭션 처리 방식을 제어하는 설정입니다. 투기적 실행을 활성화하는 경우 필요합니다. ※ supportSpeculativeExecution이(가) “enable” 이면 활성화 | |||||||||
| startScript | ScriptSetting | 스테이트 머신을 시작했을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - start | ||||||||||
| passScript | ScriptSetting | 스테이트 머신이 정상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - pass | ||||||||||
| errorScript | ScriptSetting | 스테이트 머신이 이상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - error | ||||||||||
| lowestStateMachineVersion | long | 스테이트 머신의 최저 버전 실행 가능한 스테이트 머신의 최저 버전입니다. 이 값보다 오래된 버전의 스테이트 머신으로 생성된 Status 인스턴스는 거부되며, 모든 실행 중인 인스턴스가 최신 정의를 사용하도록 보장됩니다. | ||||||||||
| logSetting | LogSetting | 로그 출력 설정 스테이트 머신의 실행, 상태 전이, emit 이벤트에 관한 API 요청·응답 로그를 출력할 GS2-Log의 네임스페이스를 지정합니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 생성한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&state_machine.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
SupportSpeculativeExecution: nil,
TransactionSetting: nil,
StartScript: nil,
PassScript: nil,
ErrorScript: nil,
LowestStateMachineVersion: nil,
LogSetting: &stateMachine.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log: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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withSupportSpeculativeExecution(null)
->withTransactionSetting(null)
->withStartScript(null)
->withPassScript(null)
->withErrorScript(null)
->withLowestStateMachineVersion(null)
->withLogSetting((new \Gs2\StateMachine\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.CreateNamespaceRequest;
import io.gs2.stateMachine.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withSupportSpeculativeExecution(null)
.withTransactionSetting(null)
.withStartScript(null)
.withPassScript(null)
.withErrorScript(null)
.withLowestStateMachineVersion(null)
.withLogSetting(new io.gs2.stateMachine.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2StateMachine.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithSupportSpeculativeExecution(null)
.WithTransactionSetting(null)
.WithStartScript(null)
.WithPassScript(null)
.WithErrorScript(null)
.WithLowestStateMachineVersion(null)
.WithLogSetting(new Gs2.Gs2StateMachine.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.createNamespace(
new Gs2StateMachine.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withSupportSpeculativeExecution(null)
.withTransactionSetting(null)
.withStartScript(null)
.withPassScript(null)
.withErrorScript(null)
.withLowestStateMachineVersion(null)
.withLogSetting(new Gs2StateMachine.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.create_namespace(
state_machine.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_support_speculative_execution(None)
.with_transaction_setting(None)
.with_start_script(None)
.with_pass_script(None)
.with_error_script(None)
.with_lowest_state_machine_version(None)
.with_log_setting(
state_machine.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
supportSpeculativeExecution=nil,
transactionSetting=nil,
startScript=nil,
passScript=nil,
errorScript=nil,
lowestStateMachineVersion=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log: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('state_machine')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
supportSpeculativeExecution=nil,
transactionSetting=nil,
startScript=nil,
passScript=nil,
errorScript=nil,
lowestStateMachineVersion=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log: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;getNamespaceStatus
네임스페이스의 상태 조회
지정된 네임스페이스의 현재 상태를 조회합니다.
상태에는 네임스페이스가 활성 상태인지, 삭제되었는지가 포함됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
Result
| 타입 | 설명 | |||||||
|---|---|---|---|---|---|---|---|---|
| status | string | 네임스페이스의 상태
|
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetNamespaceStatusRequest;
import io.gs2.stateMachine.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2StateMachine.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_namespace_status(
state_machine.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetNamespaceRequest;
import io.gs2.stateMachine.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getNamespace(
new Gs2StateMachine.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_namespace(
state_machine.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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자 | 설명문 | |||||||||
| supportSpeculativeExecution | 문자열 열거형 enum { “enable”, “disable” } | “disable” | 투기적 실행을 지원할지 여부 활성화하면 스테이트 머신 정의와 난수 상태가 Status 엔티티에 포함되어, 클라이언트가 서버 확인 전에 로컬에서 상태 전이를 시뮬레이션할 수 있게 됩니다. transactionSetting 설정이 필요합니다.
| |||||||||
| transactionSetting | TransactionSetting | {supportSpeculativeExecution} == “enable” | 트랜잭션 설정 스테이트 머신의 emit 액션 실행 시 트랜잭션 처리 방식을 제어하는 설정입니다. 투기적 실행을 활성화하는 경우 필요합니다. ※ supportSpeculativeExecution이(가) “enable” 이면 활성화 | |||||||||
| startScript | ScriptSetting | 스테이트 머신을 시작했을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - start | ||||||||||
| passScript | ScriptSetting | 스테이트 머신이 정상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - pass | ||||||||||
| errorScript | ScriptSetting | 스테이트 머신이 이상 종료되었을 때 실행할 스크립트 설정 Script 트리거 레퍼런스 - error | ||||||||||
| lowestStateMachineVersion | long | 스테이트 머신의 최저 버전 실행 가능한 스테이트 머신의 최저 버전입니다. 이 값보다 오래된 버전의 스테이트 머신으로 생성된 Status 인스턴스는 거부되며, 모든 실행 중인 인스턴스가 최신 정의를 사용하도록 보장됩니다. | ||||||||||
| logSetting | LogSetting | 로그 출력 설정 스테이트 머신의 실행, 상태 전이, emit 이벤트에 관한 API 요청·응답 로그를 출력할 GS2-Log의 네임스페이스를 지정합니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 갱신한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&state_machine.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
SupportSpeculativeExecution: nil,
TransactionSetting: nil,
StartScript: nil,
PassScript: nil,
ErrorScript: nil,
LowestStateMachineVersion: nil,
LogSetting: &stateMachine.LogSetting{
LoggingNamespaceId: pointy.String("grn:gs2:ap-northeast-1:YourOwnerId:log: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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withSupportSpeculativeExecution(null)
->withTransactionSetting(null)
->withStartScript(null)
->withPassScript(null)
->withErrorScript(null)
->withLowestStateMachineVersion(null)
->withLogSetting((new \Gs2\StateMachine\Model\LogSetting())
->withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.UpdateNamespaceRequest;
import io.gs2.stateMachine.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withSupportSpeculativeExecution(null)
.withTransactionSetting(null)
.withStartScript(null)
.withPassScript(null)
.withErrorScript(null)
.withLowestStateMachineVersion(null)
.withLogSetting(new io.gs2.stateMachine.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2StateMachine.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithSupportSpeculativeExecution(null)
.WithTransactionSetting(null)
.WithStartScript(null)
.WithPassScript(null)
.WithErrorScript(null)
.WithLowestStateMachineVersion(null)
.WithLogSetting(new Gs2.Gs2StateMachine.Model.LogSetting()
.WithLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log: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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2StateMachine.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withSupportSpeculativeExecution(null)
.withTransactionSetting(null)
.withStartScript(null)
.withPassScript(null)
.withErrorScript(null)
.withLowestStateMachineVersion(null)
.withLogSetting(new Gs2StateMachine.model.LogSetting()
.withLoggingNamespaceId("grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.update_namespace(
state_machine.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_support_speculative_execution(None)
.with_transaction_setting(None)
.with_start_script(None)
.with_pass_script(None)
.with_error_script(None)
.with_lowest_state_machine_version(None)
.with_log_setting(
state_machine.LogSetting()
.with_logging_namespace_id('grn:gs2:ap-northeast-1:YourOwnerId:log:namespace-0001'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
supportSpeculativeExecution=nil,
transactionSetting=nil,
startScript=nil,
passScript=nil,
errorScript=nil,
lowestStateMachineVersion=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log: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('state_machine')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
supportSpeculativeExecution=nil,
transactionSetting=nil,
startScript=nil,
passScript=nil,
errorScript=nil,
lowestStateMachineVersion=nil,
logSetting={
loggingNamespaceId="grn:gs2:ap-northeast-1:YourOwnerId:log: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;deleteNamespace
네임스페이스 삭제
지정된 네임스페이스를 삭제합니다.
이 작업은 되돌릴 수 없으며, 삭제된 네임스페이스와 관련된 모든 데이터는 복구할 수 없게 됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Namespace | 삭제한 네임스페이스 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DeleteNamespaceRequest;
import io.gs2.stateMachine.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2StateMachine.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.delete_namespace(
state_machine.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetServiceVersionRequest;
import io.gs2.stateMachine.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2StateMachine.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_service_version(
state_machine.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DumpUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DumpUserDataByUserIdRequest;
import io.gs2.stateMachine.result.DumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DumpUserDataByUserIdResult> asyncResult = null;
yield return client.DumpUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.dumpUserDataByUserId(
new Gs2StateMachine.DumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.dump_user_data_by_user_id(
state_machine.DumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.CheckDumpUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\CheckDumpUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.CheckDumpUserDataByUserIdRequest;
import io.gs2.stateMachine.result.CheckDumpUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.CheckDumpUserDataByUserIdResult> asyncResult = null;
yield return client.CheckDumpUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.checkDumpUserDataByUserId(
new Gs2StateMachine.CheckDumpUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
const url = result.getUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.check_dump_user_data_by_user_id(
state_machine.CheckDumpUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
url = result.url
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.CleanUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\CleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.CleanUserDataByUserIdRequest;
import io.gs2.stateMachine.result.CleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.CleanUserDataByUserIdResult> asyncResult = null;
yield return client.CleanUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.cleanUserDataByUserId(
new Gs2StateMachine.CleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.clean_user_data_by_user_id(
state_machine.CleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.CheckCleanUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\CheckCleanUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.CheckCleanUserDataByUserIdRequest;
import io.gs2.stateMachine.result.CheckCleanUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.CheckCleanUserDataByUserIdResult> asyncResult = null;
yield return client.CheckCleanUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.checkCleanUserDataByUserId(
new Gs2StateMachine.CheckCleanUserDataByUserIdRequest()
.withUserId("user-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.check_clean_user_data_by_user_id(
state_machine.CheckCleanUserDataByUserIdRequest()
.with_user_id('user-0001')
.with_time_offset_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.PrepareImportUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\PrepareImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.PrepareImportUserDataByUserIdRequest;
import io.gs2.stateMachine.result.PrepareImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.PrepareImportUserDataByUserIdResult> asyncResult = null;
yield return client.PrepareImportUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.prepareImportUserDataByUserId(
new Gs2StateMachine.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 state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.prepare_import_user_data_by_user_id(
state_machine.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('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.ImportUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\ImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.ImportUserDataByUserIdRequest;
import io.gs2.stateMachine.result.ImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.ImportUserDataByUserIdResult> asyncResult = null;
yield return client.ImportUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.importUserDataByUserId(
new Gs2StateMachine.ImportUserDataByUserIdRequest()
.withUserId("user-0001")
.withUploadToken("upload-0001")
.withTimeOffsetToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.import_user_data_by_user_id(
state_machine.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('state_machine')
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('state_machine')
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/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.CheckImportUserDataByUserId(
&state_machine.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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\CheckImportUserDataByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.CheckImportUserDataByUserIdRequest;
import io.gs2.stateMachine.result.CheckImportUserDataByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.CheckImportUserDataByUserIdResult> asyncResult = null;
yield return client.CheckImportUserDataByUserId(
new Gs2.Gs2StateMachine.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.checkImportUserDataByUserId(
new Gs2StateMachine.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 state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.check_import_user_data_by_user_id(
state_machine.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('state_machine')
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('state_machine')
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;describeStatuses
스테이트 머신 상태 목록 취득
요청한 사용자의 스테이트 머신 상태의 페이지네이션 목록을 취득합니다. 상태(Running, Pass, Error)로 필터링하여 특정 상태의 스테이트 머신만 취득할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||||||||||||
| status | 문자열 열거형 enum { “Running”, “Wait”, “Pass”, “Error” } | 스테이터스 이 스테이트 머신 인스턴스의 현재 실행 상태입니다. “Running"은 머신이 전이를 처리 중임을 의미합니다. “Wait"는 머신이 외부 이벤트(emit)를 대기 중임을 의미합니다. “Pass"는 정상적으로 완료되었음을 의미합니다. “Error"는 에러로 종료되었음을 의미합니다.
| ||||||||||||||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||||||||||||
| limit | int | 30 | 1 ~ 1000 | 조회한 데이터 건수 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<Status> | 스테이트 머신 상태 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DescribeStatuses(
&state_machine.DescribeStatusesRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
Status: pointy.String("Running"),
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DescribeStatusesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->describeStatuses(
(new DescribeStatusesRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatus("Running")
->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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DescribeStatusesRequest;
import io.gs2.stateMachine.result.DescribeStatusesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
DescribeStatusesResult result = client.describeStatuses(
new DescribeStatusesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatus("Running")
.withPageToken(null)
.withLimit(null)
);
List<Status> 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DescribeStatusesResult> asyncResult = null;
yield return client.DescribeStatuses(
new Gs2.Gs2StateMachine.Request.DescribeStatusesRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatus("Running")
.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.describeStatuses(
new Gs2StateMachine.DescribeStatusesRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatus("Running")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.describe_statuses(
state_machine.DescribeStatusesRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status('Running')
.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('state_machine')
api_result = client.describe_statuses({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
status="Running",
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('state_machine')
api_result_handler = client.describe_statuses_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
status="Running",
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;describeStatusesByUserId
사용자 ID를 지정하여 스테이트 머신 상태 목록 취득
지정한 사용자의 스테이트 머신 상태의 페이지네이션 목록을 취득합니다. 상태(Running, Pass, Error)로 필터링하여 특정 상태의 스테이트 머신만 취득할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||||||||||||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||||||||||||
| status | 문자열 열거형 enum { “Running”, “Wait”, “Pass”, “Error” } | 스테이터스 이 스테이트 머신 인스턴스의 현재 실행 상태입니다. “Running"은 머신이 전이를 처리 중임을 의미합니다. “Wait"는 머신이 외부 이벤트(emit)를 대기 중임을 의미합니다. “Pass"는 정상적으로 완료되었음을 의미합니다. “Error"는 에러로 종료되었음을 의미합니다.
| ||||||||||||||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||||||||||||
| limit | int | 30 | 1 ~ 1000 | 조회한 데이터 건수 | ||||||||||||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<Status> | 스테이트 머신 상태 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DescribeStatusesByUserId(
&state_machine.DescribeStatusesByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Status: nil,
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DescribeStatusesByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->describeStatusesByUserId(
(new DescribeStatusesByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatus(null)
->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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DescribeStatusesByUserIdRequest;
import io.gs2.stateMachine.result.DescribeStatusesByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
DescribeStatusesByUserIdResult result = client.describeStatusesByUserId(
new DescribeStatusesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatus(null)
.withPageToken(null)
.withLimit(null)
.withTimeOffsetToken(null)
);
List<Status> 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DescribeStatusesByUserIdResult> asyncResult = null;
yield return client.DescribeStatusesByUserId(
new Gs2.Gs2StateMachine.Request.DescribeStatusesByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatus(null)
.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.describeStatusesByUserId(
new Gs2StateMachine.DescribeStatusesByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatus(null)
.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 state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.describe_statuses_by_user_id(
state_machine.DescribeStatusesByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status(None)
.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('state_machine')
api_result = client.describe_statuses_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
status=nil,
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('state_machine')
api_result_handler = client.describe_statuses_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
status=nil,
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;getStatus
스테이트 머신 상태 취득
현재 상태, 변수, 스택 트레이스, 오류 정보를 포함한 요청한 사용자의 스테이트 머신 상태를 취득합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetStatus(
&state_machine.GetStatusRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
StatusName: pointy.String("status-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->getStatus(
(new GetStatusRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatusName("status-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetStatusRequest;
import io.gs2.stateMachine.result.GetStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
GetStatusResult result = client.getStatus(
new GetStatusRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetStatusResult> asyncResult = null;
yield return client.GetStatus(
new Gs2.Gs2StateMachine.Request.GetStatusRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatusName("status-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getStatus(
new Gs2StateMachine.GetStatusRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_status(
state_machine.GetStatusRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status_name('status-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.get_status({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-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('state_machine')
api_result_handler = client.get_status_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-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;getStatusByUserId
사용자 ID를 지정하여 스테이트 머신 상태 취득
현재 상태, 변수, 스택 트레이스, 오류 정보를 포함한 지정한 사용자의 스테이트 머신 상태를 취득합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetStatusByUserId(
&state_machine.GetStatusByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
StatusName: pointy.String("status-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetStatusByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->getStatusByUserId(
(new GetStatusByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatusName("status-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetStatusByUserIdRequest;
import io.gs2.stateMachine.result.GetStatusByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
GetStatusByUserIdResult result = client.getStatusByUserId(
new GetStatusByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetStatusByUserIdResult> asyncResult = null;
yield return client.GetStatusByUserId(
new Gs2.Gs2StateMachine.Request.GetStatusByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatusName("status-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getStatusByUserId(
new Gs2StateMachine.GetStatusByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_status_by_user_id(
state_machine.GetStatusByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status_name('status-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.get_status_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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('state_machine')
api_result_handler = client.get_status_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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;startStateMachineByUserId
사용자 ID를 지정하여 스테이트 머신 시작
최신 마스터 버전을 사용하여 지정한 사용자의 새로운 스테이트 머신 인스턴스를 시작합니다. 인자는 JSON으로 전달되어 스테이트 머신 변수로 파싱됩니다. 선택적으로 TTL(분 단위)을 설정할 수 있으며, 생략한 경우 스테이트 머신은 약 10년간 유효합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| args | string | “{}” | ~ 4096자 | 스테이트 머신에 전달할 인자 | ||
| ttl | int | 1 ~ 525600 | 유효 기간(분) | |||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 시작된 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.StartStateMachineByUserId(
&state_machine.StartStateMachineByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
Args: nil,
Ttl: 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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\StartStateMachineByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->startStateMachineByUserId(
(new StartStateMachineByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withArgs(null)
->withTtl(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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.StartStateMachineByUserIdRequest;
import io.gs2.stateMachine.result.StartStateMachineByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
StartStateMachineByUserIdResult result = client.startStateMachineByUserId(
new StartStateMachineByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withArgs(null)
.withTtl(null)
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.StartStateMachineByUserIdResult> asyncResult = null;
yield return client.StartStateMachineByUserId(
new Gs2.Gs2StateMachine.Request.StartStateMachineByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithArgs(null)
.WithTtl(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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.startStateMachineByUserId(
new Gs2StateMachine.StartStateMachineByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withArgs(null)
.withTtl(null)
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.start_state_machine_by_user_id(
state_machine.StartStateMachineByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_args(None)
.with_ttl(None)
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.start_state_machine_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
args=nil,
ttl=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('state_machine')
api_result_handler = client.start_state_machine_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
args=nil,
ttl=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;emit
스테이트 머신에 이벤트 전송
이름이 지정된 이벤트와 JSON 인자를 스테이트 머신에 전송하여 상태 전이를 트리거합니다. 스테이트 머신의 버전이 네임스페이스의 lowestStateMachineVersion보다 낮은 경우, 상태가 자동으로 삭제되고 NotFound 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| eventName | string | ✓ | ~ 36자 | 이벤트 이름 | ||
| args | string | “{}” | ~ 4096자 | 스테이트 머신에 전달할 인자 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.Emit(
&state_machine.EmitRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
StatusName: pointy.String("status-0001"),
EventName: pointy.String("event-0001"),
Args: pointy.String("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}"),
}
)
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\EmitRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->emit(
(new EmitRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatusName("status-0001")
->withEventName("event-0001")
->withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
);
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.EmitRequest;
import io.gs2.stateMachine.result.EmitResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
EmitResult result = client.emit(
new EmitRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
.withEventName("event-0001")
.withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.EmitResult> asyncResult = null;
yield return client.Emit(
new Gs2.Gs2StateMachine.Request.EmitRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatusName("status-0001")
.WithEventName("event-0001")
.WithArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}"),
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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.emit(
new Gs2StateMachine.EmitRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
.withEventName("event-0001")
.withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.emit(
state_machine.EmitRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status_name('status-0001')
.with_event_name('event-0001')
.with_args('{"value1": "value1", "value2": 2.0, "value3": 3}')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.emit({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-0001",
eventName="event-0001",
args="{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}",
})
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('state_machine')
api_result_handler = client.emit_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-0001",
eventName="event-0001",
args="{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}",
})
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;emitByUserId
사용자 ID를 지정하여 스테이트 머신에 이벤트 전송
지정한 사용자의 스테이트 머신에 이름이 지정된 이벤트와 JSON 인자를 전송하여 상태 전이를 트리거합니다. 스테이트 머신의 버전이 네임스페이스의 lowestStateMachineVersion보다 낮은 경우, 상태가 자동으로 삭제되고 NotFound 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| eventName | string | ✓ | ~ 36자 | 이벤트 이름 | ||
| args | string | “{}” | ~ 4096자 | 스테이트 머신에 전달할 인자 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.EmitByUserId(
&state_machine.EmitByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
StatusName: pointy.String("status-0001"),
EventName: pointy.String("event-0001"),
Args: pointy.String("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}"),
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\EmitByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->emitByUserId(
(new EmitByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatusName("status-0001")
->withEventName("event-0001")
->withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
->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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.EmitByUserIdRequest;
import io.gs2.stateMachine.result.EmitByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
EmitByUserIdResult result = client.emitByUserId(
new EmitByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withEventName("event-0001")
.withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.EmitByUserIdResult> asyncResult = null;
yield return client.EmitByUserId(
new Gs2.Gs2StateMachine.Request.EmitByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatusName("status-0001")
.WithEventName("event-0001")
.WithArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.emitByUserId(
new Gs2StateMachine.EmitByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withEventName("event-0001")
.withArgs("{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.emit_by_user_id(
state_machine.EmitByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status_name('status-0001')
.with_event_name('event-0001')
.with_args('{"value1": "value1", "value2": 2.0, "value3": 3}')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.emit_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-0001",
eventName="event-0001",
args="{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}",
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('state_machine')
api_result_handler = client.emit_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-0001",
eventName="event-0001",
args="{\"value1\": \"value1\", \"value2\": 2.0, \"value3\": 3}",
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;report
스테이트 머신에 복수 이벤트 보고
투기적 실행을 사용하여 클라이언트 측에서 처리된 이벤트의 배치를 보고합니다. 서버는 이벤트를 리플레이하여 상태 전이를 검증합니다. 결과 상태가 클라이언트가 보고한 상태와 일치하지 않는 경우, StateMismatch 오류가 반환됩니다. 네임스페이스에서 투기적 실행이 활성화되어 있어야 합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| events | List<Event> | 0 ~ 1000 items | 이벤트 목록 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.Report(
&state_machine.ReportRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
StatusName: pointy.String("status-0001"),
Events: []stateMachine.Event{
stateMachine.Event{
EventType: pointy.String("emit"),
EmitEvent: &stateMachine.EmitEvent{
Event: pointy.String("message"),
Parameters: pointy.String("{\"payload\": \"Hello World\"}"),
Timestamp: pointy.Int64(1000),
},
},
},
}
)
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\ReportRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->report(
(new ReportRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatusName("status-0001")
->withEvents([
(new Event())
->withEventType("emit")
->withEmitEvent(
(new EmitEvent())
->withEvent("message")
->withParameters("{\"payload\": \"Hello World\"}")
->withTimestamp(1000)
),
])
);
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.ReportRequest;
import io.gs2.stateMachine.result.ReportResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
ReportResult result = client.report(
new ReportRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
.withEvents(Arrays.asList(
new Event()
.withEventType("emit")
.withEmitEvent(
new EmitEvent()
.withEvent("message")
.withParameters("{\"payload\": \"Hello World\"}")
.withTimestamp(1000L)
)
))
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.ReportResult> asyncResult = null;
yield return client.Report(
new Gs2.Gs2StateMachine.Request.ReportRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatusName("status-0001")
.WithEvents(new Gs2.Gs2StateMachine.Model.Event[] {
new Gs2.Gs2StateMachine.Model.Event()
.WithEventType("emit")
.WithEmitEvent(
new Gs2.Gs2StateMachine.Model.EmitEvent()
.WithEvent("message")
.WithParameters("{\"payload\": \"Hello World\"}")
.WithTimestamp(1000L)
),
}),
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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.report(
new Gs2StateMachine.ReportRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
.withEvents([
new Gs2StateMachine.model.Event()
.withEventType("emit")
.withEmitEvent(
new Gs2StateMachine.model.EmitEvent()
.withEvent("message")
.withParameters("{\"payload\": \"Hello World\"}")
.withTimestamp(1000)
),
])
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.report(
state_machine.ReportRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status_name('status-0001')
.with_events([
state_machine.Event()
.with_event_type('emit')
.with_emit_event(
state_machine.EmitEvent()
.with_event('message')
.with_parameters('{"payload": "Hello World"}')
.with_timestamp(1000)
),
])
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.report({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-0001",
events={
{
event_type="emit",
emit_event=
{
event="message",
parameters="{\"payload\": \"Hello World\"}",
timestamp=1000,
},
}
},
})
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('state_machine')
api_result_handler = client.report_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-0001",
events={
{
event_type="emit",
emit_event=
{
event="message",
parameters="{\"payload\": \"Hello World\"}",
timestamp=1000,
},
}
},
})
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;reportByUserId
사용자 ID를 지정하여 스테이트 머신에 복수 이벤트 보고
지정한 사용자에 대해 투기적 실행을 사용하여 클라이언트 측에서 처리된 이벤트의 배치를 보고합니다. 서버는 이벤트를 리플레이하여 상태 전이를 검증합니다. 결과 상태가 클라이언트가 보고한 상태와 일치하지 않는 경우, StateMismatch 오류가 반환됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| events | List<Event> | 0 ~ 1000 items | 이벤트 목록 | |||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.ReportByUserId(
&state_machine.ReportByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
StatusName: pointy.String("status-0001"),
Events: []stateMachine.Event{
stateMachine.Event{
EventType: pointy.String("emit"),
EmitEvent: &stateMachine.EmitEvent{
Event: pointy.String("message"),
Parameters: pointy.String("{\"payload\": \"Hello World\"}"),
Timestamp: pointy.Int64(1000),
},
},
},
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\ReportByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->reportByUserId(
(new ReportByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatusName("status-0001")
->withEvents([
(new Event())
->withEventType("emit")
->withEmitEvent(
(new EmitEvent())
->withEvent("message")
->withParameters("{\"payload\": \"Hello World\"}")
->withTimestamp(1000)
),
])
->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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.ReportByUserIdRequest;
import io.gs2.stateMachine.result.ReportByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
ReportByUserIdResult result = client.reportByUserId(
new ReportByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withEvents(Arrays.asList(
new Event()
.withEventType("emit")
.withEmitEvent(
new EmitEvent()
.withEvent("message")
.withParameters("{\"payload\": \"Hello World\"}")
.withTimestamp(1000L)
)
))
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.ReportByUserIdResult> asyncResult = null;
yield return client.ReportByUserId(
new Gs2.Gs2StateMachine.Request.ReportByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatusName("status-0001")
.WithEvents(new Gs2.Gs2StateMachine.Model.Event[] {
new Gs2.Gs2StateMachine.Model.Event()
.WithEventType("emit")
.WithEmitEvent(
new Gs2.Gs2StateMachine.Model.EmitEvent()
.WithEvent("message")
.WithParameters("{\"payload\": \"Hello World\"}")
.WithTimestamp(1000L)
),
})
.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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.reportByUserId(
new Gs2StateMachine.ReportByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withEvents([
new Gs2StateMachine.model.Event()
.withEventType("emit")
.withEmitEvent(
new Gs2StateMachine.model.EmitEvent()
.withEvent("message")
.withParameters("{\"payload\": \"Hello World\"}")
.withTimestamp(1000)
),
])
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.report_by_user_id(
state_machine.ReportByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status_name('status-0001')
.with_events([
state_machine.Event()
.with_event_type('emit')
.with_emit_event(
state_machine.EmitEvent()
.with_event('message')
.with_parameters('{"payload": "Hello World"}')
.with_timestamp(1000)
),
])
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.report_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-0001",
events={
{
event_type="emit",
emit_event=
{
event="message",
parameters="{\"payload\": \"Hello World\"}",
timestamp=1000,
},
}
},
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('state_machine')
api_result_handler = client.report_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-0001",
events={
{
event_type="emit",
emit_event=
{
event="message",
parameters="{\"payload\": \"Hello World\"}",
timestamp=1000,
},
}
},
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;deleteStatusByUserId
사용자 ID를 지정하여 스테이트 머신 상태 삭제
현재 상태(Running, Pass, Error)에 관계없이 스테이트 머신의 상태를 강제로 삭제합니다. Exit와 달리, 스테이트 머신이 종료 상태에 도달해 있을 필요는 없습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 삭제된 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DeleteStatusByUserId(
&state_machine.DeleteStatusByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
StatusName: pointy.String("status-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DeleteStatusByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->deleteStatusByUserId(
(new DeleteStatusByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatusName("status-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DeleteStatusByUserIdRequest;
import io.gs2.stateMachine.result.DeleteStatusByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
DeleteStatusByUserIdResult result = client.deleteStatusByUserId(
new DeleteStatusByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DeleteStatusByUserIdResult> asyncResult = null;
yield return client.DeleteStatusByUserId(
new Gs2.Gs2StateMachine.Request.DeleteStatusByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatusName("status-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.deleteStatusByUserId(
new Gs2StateMachine.DeleteStatusByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.delete_status_by_user_id(
state_machine.DeleteStatusByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status_name('status-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.delete_status_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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('state_machine')
api_result_handler = client.delete_status_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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;exitStateMachine
스테이트 머신을 종료하고 삭제
스테이트 머신의 상태가 “Pass” 또는 “Error"일 때만 사용할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| accessToken | string | ✓ | ~ 128자 | 액세스 토큰 | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 종료된 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.ExitStateMachine(
&state_machine.ExitStateMachineRequest {
NamespaceName: pointy.String("namespace-0001"),
AccessToken: pointy.String("accessToken-0001"),
StatusName: pointy.String("status-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\ExitStateMachineRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->exitStateMachine(
(new ExitStateMachineRequest())
->withNamespaceName("namespace-0001")
->withAccessToken("accessToken-0001")
->withStatusName("status-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.ExitStateMachineRequest;
import io.gs2.stateMachine.result.ExitStateMachineResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
ExitStateMachineResult result = client.exitStateMachine(
new ExitStateMachineRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.ExitStateMachineResult> asyncResult = null;
yield return client.ExitStateMachine(
new Gs2.Gs2StateMachine.Request.ExitStateMachineRequest()
.WithNamespaceName("namespace-0001")
.WithAccessToken("accessToken-0001")
.WithStatusName("status-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.exitStateMachine(
new Gs2StateMachine.ExitStateMachineRequest()
.withNamespaceName("namespace-0001")
.withAccessToken("accessToken-0001")
.withStatusName("status-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.exit_state_machine(
state_machine.ExitStateMachineRequest()
.with_namespace_name('namespace-0001')
.with_access_token('accessToken-0001')
.with_status_name('status-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.exit_state_machine({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-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('state_machine')
api_result_handler = client.exit_state_machine_async({
namespaceName="namespace-0001",
accessToken="accessToken-0001",
statusName="status-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;exitStateMachineByUserId
사용자 ID를 지정하여 스테이트 머신을 종료하고 삭제
스테이트 머신의 상태가 “Pass” 또는 “Error"일 때만 사용할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| userId | string | ✓ | ~ 128자 | 사용자ID | ||
| statusName | string | ✓ | ~ 36자 | 상태 이름 | ||
| timeOffsetToken | string | ~ 1024자 | 타임 오프셋 토큰 |
Result
| 타입 | 설명 | |
|---|---|---|
| item | Status | 종료된 스테이트 머신 상태 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.ExitStateMachineByUserId(
&state_machine.ExitStateMachineByUserIdRequest {
NamespaceName: pointy.String("namespace-0001"),
UserId: pointy.String("user-0001"),
StatusName: pointy.String("status-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\ExitStateMachineByUserIdRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->exitStateMachineByUserId(
(new ExitStateMachineByUserIdRequest())
->withNamespaceName("namespace-0001")
->withUserId("user-0001")
->withStatusName("status-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.ExitStateMachineByUserIdRequest;
import io.gs2.stateMachine.result.ExitStateMachineByUserIdResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
ExitStateMachineByUserIdResult result = client.exitStateMachineByUserId(
new ExitStateMachineByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
Status 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.ExitStateMachineByUserIdResult> asyncResult = null;
yield return client.ExitStateMachineByUserId(
new Gs2.Gs2StateMachine.Request.ExitStateMachineByUserIdRequest()
.WithNamespaceName("namespace-0001")
.WithUserId("user-0001")
.WithStatusName("status-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.exitStateMachineByUserId(
new Gs2StateMachine.ExitStateMachineByUserIdRequest()
.withNamespaceName("namespace-0001")
.withUserId("user-0001")
.withStatusName("status-0001")
.withTimeOffsetToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.exit_state_machine_by_user_id(
state_machine.ExitStateMachineByUserIdRequest()
.with_namespace_name('namespace-0001')
.with_user_id('user-0001')
.with_status_name('status-0001')
.with_time_offset_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.exit_state_machine_by_user_id({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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('state_machine')
api_result_handler = client.exit_state_machine_by_user_id_async({
namespaceName="namespace-0001",
userId="user-0001",
statusName="status-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;describeStateMachineMasters
스테이트 머신 마스터의 일람을 취득
스테이트 머신 마스터의 버전 목록을 페이지네이션과 함께 취득합니다. 각 버전에는 메인 스테이트 머신 이름과 스테이트 머신 로직을 정의하는 GS2 Script 페이로드가 포함됩니다. 타임스탬프 기반의 버전 번호로 식별되는 여러 버전이 동시에 존재할 수 있습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| pageToken | string | ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 | |||
| limit | int | 30 | 1 ~ 1000 | 조회한 데이터 건수 |
Result
| 타입 | 설명 | |
|---|---|---|
| items | List<StateMachineMaster> | 스테이트 머신 마스터의 목록 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DescribeStateMachineMasters(
&state_machine.DescribeStateMachineMastersRequest {
NamespaceName: pointy.String("namespace-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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DescribeStateMachineMastersRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->describeStateMachineMasters(
(new DescribeStateMachineMastersRequest())
->withNamespaceName("namespace-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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DescribeStateMachineMastersRequest;
import io.gs2.stateMachine.result.DescribeStateMachineMastersResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
DescribeStateMachineMastersResult result = client.describeStateMachineMasters(
new DescribeStateMachineMastersRequest()
.withNamespaceName("namespace-0001")
.withPageToken(null)
.withLimit(null)
);
List<StateMachineMaster> 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DescribeStateMachineMastersResult> asyncResult = null;
yield return client.DescribeStateMachineMasters(
new Gs2.Gs2StateMachine.Request.DescribeStateMachineMastersRequest()
.WithNamespaceName("namespace-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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.describeStateMachineMasters(
new Gs2StateMachine.DescribeStateMachineMastersRequest()
.withNamespaceName("namespace-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 state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.describe_state_machine_masters(
state_machine.DescribeStateMachineMastersRequest()
.with_namespace_name('namespace-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('state_machine')
api_result = client.describe_state_machine_masters({
namespaceName="namespace-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('state_machine')
api_result_handler = client.describe_state_machine_masters_async({
namespaceName="namespace-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;updateStateMachineMaster
새로운 스테이트 머신 마스터를 작성 또는 갱신
스테이트 머신 마스터의 새로운 버전을 작성합니다. GS2 Script 스테이트 머신 정의를 포함한 페이로드는 저장 전에 파싱을 통해 검증됩니다. 이 API를 호출할 때마다 타임스탬프 기반의 버전 번호로 새로운 버전이 작성되며, 이전 버전은 그대로 유지됩니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| mainStateMachineName | string | ✓ | ~ 128자 | 메인 스테이트 머신 이름 GSL 정의 내에서 진입점이 되는 스테이트 머신의 이름입니다. 이 스테이트 머신부터 실행이 시작되며, 스택 메커니즘을 통해 서브 스테이트 머신을 호출할 수 있습니다. | ||
| payload | string | ✓ | ~ 5242880자 | 스테이트 머신 정의 스테이트 머신의 상태, 전이, 액션을 정의하는 GSL(GS2 State Language) 소스 코드입니다. 효율적인 취득을 위해 메타데이터와는 별도로 저장됩니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | StateMachineMaster | 작성한 스테이트 머신 마스터 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.UpdateStateMachineMaster(
&state_machine.UpdateStateMachineMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
MainStateMachineName: pointy.String("MainStateMachine"),
Payload: pointy.String("\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n "),
}
)
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\UpdateStateMachineMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->updateStateMachineMaster(
(new UpdateStateMachineMasterRequest())
->withNamespaceName("namespace-0001")
->withMainStateMachineName("MainStateMachine")
->withPayload("\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ")
);
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.UpdateStateMachineMasterRequest;
import io.gs2.stateMachine.result.UpdateStateMachineMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
UpdateStateMachineMasterResult result = client.updateStateMachineMaster(
new UpdateStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withMainStateMachineName("MainStateMachine")
.withPayload("\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ")
);
StateMachineMaster 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.UpdateStateMachineMasterResult> asyncResult = null;
yield return client.UpdateStateMachineMaster(
new Gs2.Gs2StateMachine.Request.UpdateStateMachineMasterRequest()
.WithNamespaceName("namespace-0001")
.WithMainStateMachineName("MainStateMachine")
.WithPayload("\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n "),
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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.updateStateMachineMaster(
new Gs2StateMachine.UpdateStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withMainStateMachineName("MainStateMachine")
.withPayload("\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.update_state_machine_master(
state_machine.UpdateStateMachineMasterRequest()
.with_namespace_name('namespace-0001')
.with_main_state_machine_name('MainStateMachine')
.with_payload('\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.update_state_machine_master({
namespaceName="namespace-0001",
mainStateMachineName="MainStateMachine",
payload="\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ",
})
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('state_machine')
api_result_handler = client.update_state_machine_master_async({
namespaceName="namespace-0001",
mainStateMachineName="MainStateMachine",
payload="\nStateMachine MainStateMachine {\n EntryPoint Task1;\n\n Task Task1(int initCounter) {\n Event Pass();\n Event Error(string Reason);\n\n Script grn:gs2:ap-northeast-1:YourOwnerId:script:state-machine-0001:script:Task1\n }\n\n PassTask Pass;\n\n ErrorTask Error(string reason);\n\n Transition Task1 handling Pass -> Pass;\n Transition Task1 handling Error -> Error;\n}\n ",
})
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;getStateMachineMaster
스테이트 머신 마스터를 취득
스테이트 머신 로직을 정의하는 메인 스테이트 머신 이름과 GS2 Script 페이로드를 포함하여, 지정된 버전의 스테이트 머신 마스터를 취득합니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| version | long | ✓ | 0 ~ 32503680000000 | 버전 이 스테이트 머신 정의의 버전 식별자입니다. 작성 시 자동으로 할당됩니다. 네임스페이스의 lowestStateMachineVersion과 조합하여, 실행 중인 인스턴스의 버전 호환성을 강제하는 데 사용됩니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | StateMachineMaster | 스테이트 머신 마스터 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.GetStateMachineMaster(
&state_machine.GetStateMachineMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Version: pointy.Int64(1000),
}
)
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\GetStateMachineMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->getStateMachineMaster(
(new GetStateMachineMasterRequest())
->withNamespaceName("namespace-0001")
->withVersion(1000)
);
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.GetStateMachineMasterRequest;
import io.gs2.stateMachine.result.GetStateMachineMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
GetStateMachineMasterResult result = client.getStateMachineMaster(
new GetStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withVersion(1000L)
);
StateMachineMaster 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.GetStateMachineMasterResult> asyncResult = null;
yield return client.GetStateMachineMaster(
new Gs2.Gs2StateMachine.Request.GetStateMachineMasterRequest()
.WithNamespaceName("namespace-0001")
.WithVersion(1000L),
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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.getStateMachineMaster(
new Gs2StateMachine.GetStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withVersion(1000)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.get_state_machine_master(
state_machine.GetStateMachineMasterRequest()
.with_namespace_name('namespace-0001')
.with_version(1000)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.get_state_machine_master({
namespaceName="namespace-0001",
version=1000,
})
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('state_machine')
api_result_handler = client.get_state_machine_master_async({
namespaceName="namespace-0001",
version=1000,
})
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;deleteStateMachineMaster
스테이트 머신 마스터를 삭제
지정된 버전의 스테이트 머신 마스터를 삭제합니다. 이 버전으로 이미 시작된 실행 중인 스테이트 머신은 계속 동작하지만, 삭제된 버전으로 새로운 스테이트 머신을 시작할 수는 없습니다.
상세
Request
| 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128자 | 네임스페이스 이름 네임스페이스 고유의 이름입니다. 영숫자 및 -(하이픈) _(언더스코어) .(마침표)로 지정합니다. | ||
| version | long | ✓ | 0 ~ 32503680000000 | 버전 이 스테이트 머신 정의의 버전 식별자입니다. 작성 시 자동으로 할당됩니다. 네임스페이스의 lowestStateMachineVersion과 조합하여, 실행 중인 인스턴스의 버전 호환성을 강제하는 데 사용됩니다. |
Result
| 타입 | 설명 | |
|---|---|---|
| item | StateMachineMaster | 삭제한 스테이트 머신 마스터 |
구현 예제
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/stateMachine"
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 := state_machine.Gs2StateMachineRestClient{
Session: &session,
}
result, err := client.DeleteStateMachineMaster(
&state_machine.DeleteStateMachineMasterRequest {
NamespaceName: pointy.String("namespace-0001"),
Version: pointy.Int64(1000),
}
)
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\StateMachine\Gs2StateMachineRestClient;
use Gs2\StateMachine\Request\DeleteStateMachineMasterRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2StateMachineRestClient(
$session
);
try {
$result = $client->deleteStateMachineMaster(
(new DeleteStateMachineMasterRequest())
->withNamespaceName("namespace-0001")
->withVersion(1000)
);
$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.stateMachine.rest.Gs2StateMachineRestClient;
import io.gs2.stateMachine.request.DeleteStateMachineMasterRequest;
import io.gs2.stateMachine.result.DeleteStateMachineMasterResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2StateMachineRestClient client = new Gs2StateMachineRestClient(session);
try {
DeleteStateMachineMasterResult result = client.deleteStateMachineMaster(
new DeleteStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withVersion(1000L)
);
StateMachineMaster 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 Gs2StateMachineRestClient(session);
AsyncResult<Gs2.Gs2StateMachine.Result.DeleteStateMachineMasterResult> asyncResult = null;
yield return client.DeleteStateMachineMaster(
new Gs2.Gs2StateMachine.Request.DeleteStateMachineMasterRequest()
.WithNamespaceName("namespace-0001")
.WithVersion(1000L),
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 Gs2StateMachine from '@/gs2/stateMachine';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2StateMachine.Gs2StateMachineRestClient(session);
try {
const result = await client.deleteStateMachineMaster(
new Gs2StateMachine.DeleteStateMachineMasterRequest()
.withNamespaceName("namespace-0001")
.withVersion(1000)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import state_machine
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = state_machine.Gs2StateMachineRestClient(session)
try:
result = client.delete_state_machine_master(
state_machine.DeleteStateMachineMasterRequest()
.with_namespace_name('namespace-0001')
.with_version(1000)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('state_machine')
api_result = client.delete_state_machine_master({
namespaceName="namespace-0001",
version=1000,
})
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('state_machine')
api_result_handler = client.delete_state_machine_master_async({
namespaceName="namespace-0001",
version=1000,
})
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;