GS2-Guard SDK API Reference
Model
Namespace
Namespace
A Namespace allows multiple independent instances of the same service within a single project by separating data spaces and usage contexts.
Each GS2 service is managed on a per-namespace basis. Even when using the same service, if the namespace differs, the data is treated as a completely independent data space.
Therefore, you must create a namespace before you can start using each service.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceId | string | * | ~ 1024 chars | Namespace GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| blockingPolicy | BlockingPolicyModel | ✓ | Blocking Policy The security policy configuration for this namespace that controls access to GS2 services. Defines which services are accessible, geo-restriction rules, anonymous IP detection, hosting provider IP detection, reputation-based IP filtering, and custom IP address allow/deny lists. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||
| updatedAt | long | * | Now | Datetime of last update Unix time, milliseconds * Set automatically by the server | ||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
BlockingPolicyModel
Blocking Policy
Defines the comprehensive access control rules for a GS2-Guard namespace. Combines multiple security layers including service-level access control, geo-restriction by country, anonymous IP detection (Tor/proxy), hosting provider IP detection (VPN/rental servers), IP reputation filtering, and custom IP address allow/deny lists.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| passServices | List<string> | ✓ | 1 ~ 100 items | List of Accessible GS2 Services The list of GS2 services that clients are allowed to access through this guard namespace. Only services included in this list will be protected by the blocking policy. At least one service must be specified. | ||||||||
| defaultRestriction | String Enum enum { “Allow”, “Deny” } | “Allow” | Default Restriction The default action applied to requests that do not match any of the configured detection rules. “Allow” permits all unmatched traffic (blocklist approach), while “Deny” blocks all unmatched traffic (allowlist approach).
| |||||||||
| locationDetection | String Enum enum { “Enable”, “Disable” } | “Disable” | Location Detection Enables or disables geo-restriction based on the client’s country of origin. When enabled, access is filtered by country. The specific countries and the allow/deny behavior are configured via the locations and locationRestriction fields.
| |||||||||
| locations | List<string> | {locationDetection} == “Enable” | [] | 1 ~ 100 items | List of Countries to Detect Access The list of countries used for geo-restriction filtering. Each country is specified using ISO 3166-1 alpha-2 country codes. Whether these countries are allowed or denied is determined by the locationRestriction setting. Only effective when locationDetection is enabled. * Applicable only if locationDetection is “Enable” | |||||||
| locationRestriction | String Enum enum { “Allow”, “Deny” } | {locationDetection} == “Enable” | ✓* | Location Restriction Action The action to take when a request originates from a country in the locations list. “Allow” permits access only from listed countries (allowlist), while “Deny” blocks access from listed countries (blocklist). Works in conjunction with locationDetection and the locations list.
* Required if locationDetection is “Enable” | ||||||||
| anonymousIpDetection | String Enum enum { “Enable”, “Disable” } | “Disable” | Anonymous IP Service Detection Enables or disables detection of access from anonymous IP services such as Tor exit nodes and public proxies. When enabled, requests from these sources are identified and evaluated.
| |||||||||
| anonymousIpRestriction | String Enum enum { “Deny” } | {anonymousIpDetection} == “Enable” | “Deny” | Anonymous IP Restriction Action The action to take when access from an anonymous IP service (Tor/public proxy) is detected. Currently only supports “Deny” to block such access. Only effective when anonymousIpDetection is enabled.
* Applicable only if anonymousIpDetection is “Enable” | ||||||||
| hostingProviderIpDetection | String Enum enum { “Enable”, “Disable” } | “Disable” | Hosting Provider IP Detection Enables or disables detection of access from hosting provider IP addresses such as public VPN services and rental servers. When enabled, traffic originating from cloud infrastructure or hosting services rather than end-user devices is identified and evaluated.
| |||||||||
| hostingProviderIpRestriction | String Enum enum { “Deny” } | {hostingProviderIpDetection} == “Enable” | “Deny” | Hosting Provider IP Restriction Action The action to take when access from a hosting provider IP (public VPN/rental server) is detected. Currently only supports “Deny” to block such access. Only effective when hostingProviderIpDetection is enabled.
* Applicable only if hostingProviderIpDetection is “Enable” | ||||||||
| reputationIpDetection | String Enum enum { “Enable”, “Disable” } | “Disable” | Reputation IP Detection Enables or disables detection of access from IP addresses with a known bad reputation. When enabled, IPs associated with bots, DDoS attacks, and other malicious activities are identified and evaluated.
| |||||||||
| reputationIpRestriction | String Enum enum { “Deny” } | {reputationIpDetection} == “Enable” | “Deny” | Reputation IP Restriction Action The action to take when access from an IP with a bad reputation is detected. Currently only supports “Deny” to block such access. Only effective when reputationIpDetection is enabled.
* Applicable only if reputationIpDetection is “Enable” | ||||||||
| ipAddressesDetection | String Enum enum { “Enable”, “Disable” } | “Disable” | IP Address Detection Enables or disables custom IP address-based access filtering. When enabled, requests are evaluated against the custom IP address list specified in the ipAddresses field. The allow/deny behavior is controlled by ipAddressRestriction.
| |||||||||
| ipAddresses | List<string> | {ipAddressesDetection} == “Enable” | 0 ~ 100 items | List of IP Address Ranges A list of IP address ranges in CIDR notation used for custom IP-based access filtering. Each incoming request’s source IP is evaluated against these ranges. Whether matching IPs are allowed or denied is controlled by ipAddressRestriction. Only effective when ipAddressesDetection is enabled. * Applicable only if ipAddressesDetection is “Enable” | ||||||||
| ipAddressRestriction | String Enum enum { “Allow”, “Deny” } | {ipAddressesDetection} == “Enable” | ✓* | IP Address Restriction Action The action to take when a request’s source IP matches the custom IP address list. “Allow” permits access only from listed IPs (allowlist), while “Deny” blocks access from listed IPs (blocklist). Only effective when ipAddressesDetection is enabled.
* Required if ipAddressesDetection is “Enable” |
Methods
describeNamespaces
Get a list of Namespaces
Retrieves a paginated list of GS2-Guard namespaces within the project. Each namespace defines a blocking policy that controls access restrictions such as IP address detection, anonymous IP blocking, and reputation-based IP filtering. An optional name prefix filter can be specified to narrow down the results.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64 chars | Filter by Namespace name prefix | |||
| pageToken | string | ~ 1024 chars | Token specifying the position from which to start acquiring data | |||
| limit | int | 30 | 1 ~ 1000 | Number of data items to retrieve |
Result
| Type | Description | |
|---|---|---|
| items | List<Namespace> | List of Namespace |
| nextPageToken | string | Page token to retrieve the rest of the listing |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.DescribeNamespaces(
&guard.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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\DescribeNamespacesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.DescribeNamespacesRequest;
import io.gs2.guard.result.DescribeNamespacesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
new Gs2.Gs2Guard.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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.describeNamespaces(
new Gs2Guard.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 guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.describe_namespaces(
guard.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('guard')
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('guard')
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
Create a new Namespace
Creates a new GS2-Guard namespace with the specified blocking policy. The blocking policy defines access control rules including IP address detection, anonymous IP blocking, and reputation-based IP filtering. The namespace is initially created with a “Deploying” status and transitions to “Active” once deployment is complete.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| blockingPolicy | BlockingPolicyModel | ✓ | Blocking Policy The security policy configuration for this namespace that controls access to GS2 services. Defines which services are accessible, geo-restriction rules, anonymous IP detection, hosting provider IP detection, reputation-based IP filtering, and custom IP address allow/deny lists. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.CreateNamespace(
&guard.CreateNamespaceRequest {
Name: pointy.String("namespace-0001"),
Description: nil,
BlockingPolicy: &guard.BlockingPolicyModel{
PassServices: []*string{
pointy.String("account"),
},
DefaultRestriction: pointy.String("Deny"),
LocationDetection: pointy.String("Disable"),
AnonymousIpDetection: pointy.String("Disable"),
HostingProviderIpDetection: pointy.String("Disable"),
ReputationIpDetection: pointy.String("Disable"),
IpAddressesDetection: pointy.String("Enable"),
IpAddresses: []*string{
pointy.String("192.168.0.0/24"),
},
IpAddressRestriction: pointy.String("Allow"),
},
}
)
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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\CreateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$session
);
try {
$result = $client->createNamespace(
(new CreateNamespaceRequest())
->withName("namespace-0001")
->withDescription(null)
->withBlockingPolicy((new \Gs2\Guard\Model\BlockingPolicyModel())
->withPassServices([
"account",
])
->withDefaultRestriction("Deny")
->withLocationDetection("Disable")
->withAnonymousIpDetection("Disable")
->withHostingProviderIpDetection("Disable")
->withReputationIpDetection("Disable")
->withIpAddressesDetection("Enable")
->withIpAddresses([
"192.168.0.0/24",
])
->withIpAddressRestriction("Allow"))
);
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.CreateNamespaceRequest;
import io.gs2.guard.result.CreateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(session);
try {
CreateNamespaceResult result = client.createNamespace(
new CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withBlockingPolicy(new io.gs2.guard.model.BlockingPolicyModel()
.withPassServices(Arrays.asList(
"account"
))
.withDefaultRestriction("Deny")
.withLocationDetection("Disable")
.withAnonymousIpDetection("Disable")
.withHostingProviderIpDetection("Disable")
.withReputationIpDetection("Disable")
.withIpAddressesDetection("Enable")
.withIpAddresses(Arrays.asList(
"192.168.0.0/24"
))
.withIpAddressRestriction("Allow"))
);
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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.CreateNamespaceResult> asyncResult = null;
yield return client.CreateNamespace(
new Gs2.Gs2Guard.Request.CreateNamespaceRequest()
.WithName("namespace-0001")
.WithDescription(null)
.WithBlockingPolicy(new Gs2.Gs2Guard.Model.BlockingPolicyModel()
.WithPassServices(new string[] {
"account",
})
.WithDefaultRestriction("Deny")
.WithLocationDetection("Disable")
.WithAnonymousIpDetection("Disable")
.WithHostingProviderIpDetection("Disable")
.WithReputationIpDetection("Disable")
.WithIpAddressesDetection("Enable")
.WithIpAddresses(new string[] {
"192.168.0.0/24",
})
.WithIpAddressRestriction("Allow")),
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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.createNamespace(
new Gs2Guard.CreateNamespaceRequest()
.withName("namespace-0001")
.withDescription(null)
.withBlockingPolicy(new Gs2Guard.model.BlockingPolicyModel()
.withPassServices([
"account",
])
.withDefaultRestriction("Deny")
.withLocationDetection("Disable")
.withAnonymousIpDetection("Disable")
.withHostingProviderIpDetection("Disable")
.withReputationIpDetection("Disable")
.withIpAddressesDetection("Enable")
.withIpAddresses([
"192.168.0.0/24",
])
.withIpAddressRestriction("Allow"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.create_namespace(
guard.CreateNamespaceRequest()
.with_name('namespace-0001')
.with_description(None)
.with_blocking_policy(
guard.BlockingPolicyModel()
.with_pass_services([
'account',
])
.with_default_restriction('Deny')
.with_location_detection('Disable')
.with_anonymous_ip_detection('Disable')
.with_hosting_provider_ip_detection('Disable')
.with_reputation_ip_detection('Disable')
.with_ip_addresses_detection('Enable')
.with_ip_addresses([
'192.168.0.0/24',
])
.with_ip_address_restriction('Allow'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
api_result = client.create_namespace({
name="namespace-0001",
description=nil,
blockingPolicy={
passServices={
"account"
},
defaultRestriction="Deny",
locationDetection="Disable",
anonymousIpDetection="Disable",
hostingProviderIpDetection="Disable",
reputationIpDetection="Disable",
ipAddressesDetection="Enable",
ipAddresses={
"192.168.0.0/24"
},
ipAddressRestriction="Allow",
},
})
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('guard')
api_result_handler = client.create_namespace_async({
name="namespace-0001",
description=nil,
blockingPolicy={
passServices={
"account"
},
defaultRestriction="Deny",
locationDetection="Disable",
anonymousIpDetection="Disable",
hostingProviderIpDetection="Disable",
reputationIpDetection="Disable",
ipAddressesDetection="Enable",
ipAddresses={
"192.168.0.0/24"
},
ipAddressRestriction="Allow",
},
})
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
Get Namespace status
Gets the current deployment status of the specified GS2-Guard namespace. Possible statuses include “Deploying” (initial deployment or update in progress), “Active” (deployment complete, namespace is operational), and “Deleting” (cleanup in progress).
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.GetNamespaceStatus(
&guard.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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\GetNamespaceStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.GetNamespaceStatusRequest;
import io.gs2.guard.result.GetNamespaceStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.GetNamespaceStatusResult> asyncResult = null;
yield return client.GetNamespaceStatus(
new Gs2.Gs2Guard.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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.getNamespaceStatus(
new Gs2Guard.GetNamespaceStatusRequest()
.withNamespaceName("namespace-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.get_namespace_status(
guard.GetNamespaceStatusRequest()
.with_namespace_name('namespace-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
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('guard')
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
Get namespace
Retrieves the detailed information of the specified GS2-Guard namespace. The returned data includes the namespace name, description, current deployment status, and the configured blocking policy with its access control rules.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.GetNamespace(
&guard.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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\GetNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.GetNamespaceRequest;
import io.gs2.guard.result.GetNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.GetNamespaceResult> asyncResult = null;
yield return client.GetNamespace(
new Gs2.Gs2Guard.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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.getNamespace(
new Gs2Guard.GetNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.get_namespace(
guard.GetNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
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('guard')
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
Update Namespace
Updates the description and blocking policy of the specified GS2-Guard namespace. The namespace must be in “Active” status; updates are rejected if a deployment is currently in progress. After updating, the namespace enters “Deploying” status while the new blocking policy is applied, then returns to “Active” once complete.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). | ||
| description | string | ~ 1024 chars | Description | |||
| blockingPolicy | BlockingPolicyModel | ✓ | Blocking Policy The security policy configuration for this namespace that controls access to GS2 services. Defines which services are accessible, geo-restriction rules, anonymous IP detection, hosting provider IP detection, reputation-based IP filtering, and custom IP address allow/deny lists. |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | Namespace updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.UpdateNamespace(
&guard.UpdateNamespaceRequest {
NamespaceName: pointy.String("namespace-0001"),
Description: pointy.String("description1"),
BlockingPolicy: &guard.BlockingPolicyModel{
PassServices: []*string{
pointy.String("account"),
pointy.String("dictionary"),
pointy.String("inventory"),
},
DefaultRestriction: pointy.String("Allow"),
LocationDetection: pointy.String("Enable"),
Locations: []*string{
pointy.String("CN"),
},
LocationRestriction: pointy.String("Deny"),
},
}
)
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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\UpdateNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$session
);
try {
$result = $client->updateNamespace(
(new UpdateNamespaceRequest())
->withNamespaceName("namespace-0001")
->withDescription("description1")
->withBlockingPolicy((new \Gs2\Guard\Model\BlockingPolicyModel())
->withPassServices([
"account",
"dictionary",
"inventory",
])
->withDefaultRestriction("Allow")
->withLocationDetection("Enable")
->withLocations([
"CN",
])
->withLocationRestriction("Deny"))
);
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.UpdateNamespaceRequest;
import io.gs2.guard.result.UpdateNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(session);
try {
UpdateNamespaceResult result = client.updateNamespace(
new UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withBlockingPolicy(new io.gs2.guard.model.BlockingPolicyModel()
.withPassServices(Arrays.asList(
"account",
"dictionary",
"inventory"
))
.withDefaultRestriction("Allow")
.withLocationDetection("Enable")
.withLocations(Arrays.asList(
"CN"
))
.withLocationRestriction("Deny"))
);
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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.UpdateNamespaceResult> asyncResult = null;
yield return client.UpdateNamespace(
new Gs2.Gs2Guard.Request.UpdateNamespaceRequest()
.WithNamespaceName("namespace-0001")
.WithDescription("description1")
.WithBlockingPolicy(new Gs2.Gs2Guard.Model.BlockingPolicyModel()
.WithPassServices(new string[] {
"account",
"dictionary",
"inventory",
})
.WithDefaultRestriction("Allow")
.WithLocationDetection("Enable")
.WithLocations(new string[] {
"CN",
})
.WithLocationRestriction("Deny")),
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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.updateNamespace(
new Gs2Guard.UpdateNamespaceRequest()
.withNamespaceName("namespace-0001")
.withDescription("description1")
.withBlockingPolicy(new Gs2Guard.model.BlockingPolicyModel()
.withPassServices([
"account",
"dictionary",
"inventory",
])
.withDefaultRestriction("Allow")
.withLocationDetection("Enable")
.withLocations([
"CN",
])
.withLocationRestriction("Deny"))
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.update_namespace(
guard.UpdateNamespaceRequest()
.with_namespace_name('namespace-0001')
.with_description('description1')
.with_blocking_policy(
guard.BlockingPolicyModel()
.with_pass_services([
'account',
'dictionary',
'inventory',
])
.with_default_restriction('Allow')
.with_location_detection('Enable')
.with_locations([
'CN',
])
.with_location_restriction('Deny'))
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
api_result = client.update_namespace({
namespaceName="namespace-0001",
description="description1",
blockingPolicy={
passServices={
"account",
"dictionary",
"inventory"
},
defaultRestriction="Allow",
locationDetection="Enable",
locations={
"CN"
},
locationRestriction="Deny",
},
})
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('guard')
api_result_handler = client.update_namespace_async({
namespaceName="namespace-0001",
description="description1",
blockingPolicy={
passServices={
"account",
"dictionary",
"inventory"
},
defaultRestriction="Allow",
locationDetection="Enable",
locations={
"CN"
},
locationRestriction="Deny",
},
})
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
Delete Namespace
Deletes the specified GS2-Guard namespace. If a deployment is still in progress, the deletion is rejected until the deployment completes. This operation is irreversible and all data associated with the deleted namespace will be lost.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namespaceName | string | ✓ | ~ 128 chars | Namespace name Namespace-specific name. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). |
Result
| Type | Description | |
|---|---|---|
| item | Namespace | The deleted Namespace |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.DeleteNamespace(
&guard.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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\DeleteNamespaceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.DeleteNamespaceRequest;
import io.gs2.guard.result.DeleteNamespaceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.DeleteNamespaceResult> asyncResult = null;
yield return client.DeleteNamespace(
new Gs2.Gs2Guard.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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.deleteNamespace(
new Gs2Guard.DeleteNamespaceRequest()
.withNamespaceName("namespace-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.delete_namespace(
guard.DeleteNamespaceRequest()
.with_namespace_name('namespace-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
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('guard')
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
Get the microservice version
Returns the current version of the GS2-Guard microservice.
Details
Request
Request parameters: None
Result
| Type | Description | |
|---|---|---|
| item | string | Version |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/guard"
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 := guard.Gs2GuardRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&guard.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\Guard\Gs2GuardRestClient;
use Gs2\Guard\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2GuardRestClient(
$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.guard.rest.Gs2GuardRestClient;
import io.gs2.guard.request.GetServiceVersionRequest;
import io.gs2.guard.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2GuardRestClient client = new Gs2GuardRestClient(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 Gs2GuardRestClient(session);
AsyncResult<Gs2.Gs2Guard.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Guard.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 Gs2Guard from '@/gs2/guard';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Guard.Gs2GuardRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Guard.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import guard
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = guard.Gs2GuardRestClient(session)
try:
result = client.get_service_version(
guard.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('guard')
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('guard')
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;