API Reference of GS2-Guard SDK

Specification of models and API references for GS2-SDK for various programming languages

Model

Namespace

Namespace

Namespace is a mechanism that allows multiple uses of the same service for different purposes within a single project. Basically, GS2 services have a layer called namespace, and different namespaces are treated as completely different data spaces, even for the same service.

Therefore, it is necessary to create a namespace before starting to use each service.

TypeConditionRequireDefaultLimitationDescription
namespaceIdstring~ 1024 charsNamespace GRN
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
blockingPolicyBlockingPolicyModelBlocking Policy
createdAtlongNowDatetime of creation (Unix time unit:milliseconds)
updatedAtlongNowDatetime of last update (Unix time unit:milliseconds)
revisionlong0~ 9223372036854775805Revision

BlockingPolicyModel

Blocking Policy

TypeConditionRequireDefaultLimitationDescription
passServicesList<string>1 ~ 100 itemsList of GS2 services that can be accessed
defaultRestrictionenum {
    “Allow”,
    “Deny”
}
“Allow”~ 128 charsDefault restriction
locationDetectionenum {
    “Enable”,
    “Disable”
}
“Disable”~ 128 charsLocation detection
locationsList<string>{locationDetection} == “Enable”[]1 ~ 100 itemsList of countries to detect access
locationRestrictionenum {
    “Allow”,
    “Deny”
}
{locationDetection} == “Enable”~ 128 charsBehavior when matched with the country list
anonymousIpDetectionenum {
    “Enable”,
    “Disable”
}
“Disable”~ 128 charsAnonymous IP Service Detection
anonymousIpRestrictionenum {
    “Deny”
}
{anonymousIpDetection} == “Enable”“Deny”~ 128 charsBehavior when detected anonymous IP service
hostingProviderIpDetectionenum {
    “Enable”,
    “Disable”
}
“Disable”~ 128 charsHosting Service Detection
hostingProviderIpRestrictionenum {
    “Deny”
}
{hostingProviderIpDetection} == “Enable”“Deny”~ 128 charsBehavior when detected hosting service
reputationIpDetectionenum {
    “Enable”,
    “Disable”
}
“Disable”~ 128 charsReputation access IP Detection
reputationIpRestrictionenum {
    “Deny”
}
{reputationIpDetection} == “Enable”“Deny”~ 128 charsBehavior when detected malicious access source IP
ipAddressesDetectionenum {
    “Enable”,
    “Disable”
}
“Disable”~ 128 charsAccess source IP detection
ipAddressesList<string>{ipAddressesDetection} == “Enable”~ 100 itemsList of ip addresses
ipAddressRestrictionenum {
    “Allow”,
    “Deny”
}
{ipAddressesDetection} == “Enable”~ 128 charsBehavior when matched with the IP address list

Definition of the string to be specified for passServices

String DefinitionDescription
accountGS2-Account
adRewardGS2-AdReward
authGS2-Auth
buffGS2-Buff
chatGS2-Chat
datastoreGS2-Datastore
deployGS2-Deploy
dictionaryGS2-Dictionary
distributorGS2-Distributor
enchantGS2-Enchant
enhanceGS2-Enhance
exchangeGS2-Exchange
experienceGS2-Experience
formationGS2-Formation
friendGS2-Friend
gatewayGS2-Gateway
gradeGS2-Grade
guardGS2-Guard
guildGS2-Guild
identifierGS2-Identifier
idleGS2-Idle
inboxGS2-Inbox
inventoryGS2-Inventory
jobQueueGS2-JobQueue
keyGS2-Key
limitGS2-Limit
lockGS2-Lock
logGS2-Log
loginRewardGS2-LoginReward
lotteryGS2-Lottery
matchmakingGS2-Matchmaking
megaFieldGS2-MegaField
missionGS2-Mission
moneyGS2-Money
money2GS2-Money2
newsGS2-News
questGS2-Quest
rankingGS2-Ranking
ranking2GS2-Ranking2
realtimeGS2-Realtime
scheduleGS2-Schedule
scriptGS2-Script
seasonRatingGS2-SeasonRating
serialKeyGS2-SerialKey
showcaseGS2-Showcase
skillTreeGS2-SkillTree
staminaGS2-Stamina
stateMachineGS2-StateMachine
versionGS2-Version

Definition of enumeration type to be specified for defaultRestriction

Enumerator String DefinitionDescription
AllowAllow access from a predetermined access source
DenyDeny access from a predetermined access source

Definition of enumeration type to be specified for locationDetection

Enumerator String DefinitionDescription
EnableEnable
DisableDisable

Definition of the string to be specified for locations

String DefinitionDescription
ADAndorra
AEUnited Arab Emirates
AFAfghanistan
AGAntigua and Barbuda
AIAnguilla
ALAlbania
AMArmenia
AOAngola
AQAntarctica
ARArgentina
ASAmerican Samoa
ATAustria
AUAustralia
AWAruba
AXÅland Islands
AZAzerbaijan
BABosnia and Herzegovina
BBBarbados
BDBangladesh
BEBelgium
BFBurkina Faso
BGBulgaria
BHBahrain
BIBurundi
BJBenin
BLSaint Barthélemy
BMBermuda
BNBrunei Darussalam
BOBolivia
BQBonaire, Sint Eustatius and Saba
BRBrazil
BSBahamas
BTBhutan
BVBouvet Island
BWBotswana
BYBelarus
BZBelize
CACanada
CCCocos (Keeling) Islands
CDCongo, The Democratic Republic of the
CFCentral African Republic
CGCongo
CHSwitzerland
CICôte d’Ivoire
CKCook Islands
CLChile
CMCameroon
CNChina
COColombia
CRCosta Rica
CUCuba
CVCape Verde
CWCuraçao
CXChristmas Island
CYCyprus
CZCzech Republic
DEGermany
DJDjibouti
DKDenmark
DMDominica
DODominican Republic
DZAlgeria
ECEcuador
EEEstonia
EGEgypt
EHWestern Sahara
EREritrea
ESSpain
ETEthiopia
FIFinland
FJFiji
FKFalkland Islands (Malvinas)
FMMicronesia, Federated States of
FOFaroe Islands
FRFrance
GAGabon
GBUnited Kingdom
GDGrenada
GEGeorgia
GFFrench Guiana
GGGuernsey
GHGhana
GIGibraltar
GLGreenland
GMGambia
GNGuinea
GPGuadeloupe
GQEquatorial Guinea
GRGreece
GSSouth Georgia and the South Sandwich Islands
GTGuatemala
GUGuam
GWGuinea-Bissau
GYGuyana
HKHong Kong
HMHeard Island and McDonald Islands
HNHonduras
HRCroatia
HTHaiti
HUHungary
IDIndonesia
IEIreland
ILIsrael
IMIsle of Man
INIndia
IOBritish Indian Ocean Territory
IQIraq
IRIran, Islamic Republic of
ISIceland
ITItaly
JEJersey
JMJamaica
JOJordan
JPJapan
KEKenya
KGKyrgyzstan
KHCambodia
KIKiribati
KMComoros
KNSaint Kitts and Nevis
KPKorea, Democratic People’s Republic of
KRKorea, Republic of
KWKuwait
KYCayman Islands
KZKazakhstan
LALao People’s Democratic Republic
LBLebanon
LCSaint Lucia
LILiechtenstein
LKSri Lanka
LRLiberia
LSLesotho
LTLithuania
LULuxembourg
LVLatvia
LYLibya
MAMorocco
MCMonaco
MDMoldova, Republic of
MEMontenegro
MFSaint Martin (French part)
MGMadagascar
MHMarshall Islands
MKMacedonia, The former Yugoslav Republic of
MLMali
MMMyanmar
MNMongolia
MOMacao
MPNorthern Mariana Islands
MQMartinique
MRMauritania
MSMontserrat
MTMalta
MUMauritius
MVMaldives
MWMalawi
MXMexico
MYMalaysia
MZMozambique
NANamibia
NCNew Caledonia
NENiger
NFNorfolk Island
NGNigeria
NINicaragua
NLNetherlands
NONorway
NPNepal
NRNauru
NUNiue
NZNew Zealand
OMOman
PAPanama
PEPeru
PFFrench Polynesia
PGPapua New Guinea
PHPhilippines
PKPakistan
PLPoland
PMSaint Pierre and Miquelon
PNPitcairn
PRPuerto Rico
PSPalestinian Territory, Occupied
PTPortugal
PWPalau
PYParaguay
QAQatar
RERéunion
RORomania
RSSerbia
RURussian Federation
RWRwanda
SASaudi Arabia
SBSolomon Islands
SCSeychelles
SDSudan
SESweden
SGSingapore
SHSaint Helena, Ascension and Tristan da Cunha
SISlovenia
SJSvalbard and Jan Mayen
SKSlovakia
SLSierra Leone
SMSan Marino
SNSenegal
SOSomalia
SRSuriname
SSSouth Sudan
STSao Tome and Principe
SVEl Salvador
SXSint Maarten (Dutch part)
SYSyrian Arab Republic
SZSwaziland
TCTurks and Caicos Islands
TDChad
TFFrench Southern Territories
TGTogo
THThailand
TJTajikistan
TKTokelau
TLTimor-Leste
TMTurkmenistan
TNTunisia
TOTonga
TRTurkey
TTTrinidad and Tobago
TVTuvalu
TWTaiwan, Province of China
TZTanzania, United Republic of
UAUkraine
UGUganda
UMUnited States Minor Outlying Islands
USUnited States
UYUruguay
UZUzbekistan
VAHoly See (Vatican City State)
VCSaint Vincent and the Grenadines
VEVenezuela, Bolivarian Republic of
VGVirgin Islands, British
VIVirgin Islands, U.S.
VNViet Nam
VUVanuatu
WFWallis and Futuna
WSSamoa
YEYemen
YTMayotte
ZASouth Africa
ZMZambia
ZWZimbabwe

Definition of enumeration type to be specified for locationRestriction

Enumerator String DefinitionDescription
AllowAllow
DenyDeny

Definition of enumeration type to be specified for anonymousIpDetection

Enumerator String DefinitionDescription
EnableEnable
DisableDisable

Definition of enumeration type to be specified for anonymousIpRestriction

Enumerator String DefinitionDescription
DenyDeny

Definition of enumeration type to be specified for hostingProviderIpDetection

Enumerator String DefinitionDescription
EnableEnable
DisableDisable

Definition of enumeration type to be specified for hostingProviderIpRestriction

Enumerator String DefinitionDescription
DenyDeny

Definition of enumeration type to be specified for reputationIpDetection

Enumerator String DefinitionDescription
EnableEnable
DisableDisable

Definition of enumeration type to be specified for reputationIpRestriction

Enumerator String DefinitionDescription
DenyDeny

Definition of enumeration type to be specified for ipAddressesDetection

Enumerator String DefinitionDescription
EnableEnable
DisableDisable

Definition of enumeration type to be specified for ipAddressRestriction

Enumerator String DefinitionDescription
AllowAllow
DenyDeny

Methods

describeNamespaces

Get list of namespaces

Get a list of all namespaces in the project. You can use the optional page token to start acquiring data from a specific location in the list. You can also limit the number of namespaces to be acquired.

Request

TypeConditionRequireDefaultLimitationDescription
pageTokenstring~ 1024 charsToken specifying the position from which to start acquiring data
limitint301 ~ 1000Number of data acquired

Result

TypeDescription
itemsList<Namespace>List of Namespace
nextPageTokenstringPage 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 {
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->describeNamespaces(
        (new DescribeNamespacesRequest())
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}
import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.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()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Namespace> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.DescribeNamespacesRequest;
using Gs2.Gs2Guard.Result.DescribeNamespacesResult;

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

AsyncResult<Gs2.Gs2Guard.Result.DescribeNamespacesResult> asyncResult = null;
yield return client.DescribeNamespaces(
    new Gs2.Gs2Guard.Request.DescribeNamespacesRequest()
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;
import Gs2Core from '@/gs2/core';
import * as 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()
            .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_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({
    pageToken=nil,
    limit=nil,
})

if(api_result.isError) then
    -- When error occurs
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;
client = gs2('guard')

api_result_handler = client.describe_namespaces_async({
    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['message'])
end

result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;

createNamespace

Create new namespace

You must specify detailed information including the name, description, and various settings of the namespace.

Request

TypeConditionRequireDefaultLimitationDescription
namestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
blockingPolicyBlockingPolicyModelBlocking Policy

Result

TypeDescription
itemNamespaceNamespace 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.Item
use 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 Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.CreateNamespaceRequest;
using Gs2.Gs2Guard.Result.CreateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
item = result.item;

getNamespaceStatus

Get namespace status

Get the current status of the specified namespace. This includes whether the namespace is active, pending, or in some other state.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
statusstring

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.Status
use 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 Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.GetNamespaceStatusRequest;
using Gs2.Gs2Guard.Result.GetNamespaceStatusResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
status = result.status;

getNamespace

Get namespace

Get detailed information about the specified namespace. This includes the name, description, and other settings of the namespace.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemNamespaceNamespace

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.Item
use 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 Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.GetNamespaceRequest;
using Gs2.Gs2Guard.Result.GetNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
item = result.item;

updateNamespace

Update namespace

Update the settings of the specified namespace. You can change the description of the namespace and specific settings.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name
descriptionstring~ 1024 charsDescription
blockingPolicyBlockingPolicyModelBlocking Policy

Result

TypeDescription
itemNamespaceUpdated 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.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.Item
use 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 Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.UpdateNamespaceRequest;
using Gs2.Gs2Guard.Result.UpdateNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
item = result.item;

deleteNamespace

Delete namespace

Delete the specified namespace. This operation is irreversible and all data associated with the deleted namespace will be lost.

Request

TypeConditionRequireDefaultLimitationDescription
namespaceNamestring~ 128 charsNamespace name

Result

TypeDescription
itemNamespaceDeleted 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.Item
use 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 Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Guard.Gs2GuardRestClient;
using Gs2.Gs2Guard.Request.DeleteNamespaceRequest;
using Gs2.Gs2Guard.Result.DeleteNamespaceResult;

var session = new Gs2RestSession(
    new BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    Region.ApNortheast1
);
yield return session.Open();
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['message'])
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['message'])
end

result = api_result.result
item = result.item;