GS2-Deploy SDK API Reference
Model
GitHubCheckoutSetting
Setup to check out master data from GitHub
Configuration for fetching template or master data files directly from a GitHub repository. Supports referencing by commit hash, branch name, or tag name, and requires a GS2-Key GitHub API key for authentication.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apiKeyId | string | ✓ | ~ 1024 chars | GitHub API Key GRN | ||||||||||
| repositoryName | string | ✓ | ~ 1024 chars | Repository Name The GitHub repository name in “owner/repo” format from which to fetch the file. | ||||||||||
| sourcePath | string | ✓ | ~ 1024 chars | Master data (JSON) file path The file path within the repository to the target file. For example, “data/master.json” or “deploy/template.yaml”. | ||||||||||
| referenceType | String Enum enum { “commit_hash”, “branch”, “tag” } | ✓ | Source of code The type of Git reference to use for checking out the file. commit_hash fetches from a specific commit for reproducibility, branch fetches the latest from a branch, and tag fetches from a tagged release.
| |||||||||||
| commitHash | string | {referenceType} == “commit_hash” | ✓* | ~ 1024 chars | Commit hash The full Git commit SHA to check out. Ensures the exact same version of the file is always fetched, providing deployment reproducibility. * Required if referenceType is “commit_hash” | |||||||||
| branchName | string | {referenceType} == “branch” | ✓* | ~ 1024 chars | Branch Name The Git branch name to check out from. The latest commit on this branch will be used to fetch the file. * Required if referenceType is “branch” | |||||||||
| tagName | string | {referenceType} == “tag” | ✓* | ~ 1024 chars | Tag Name The Git tag name to check out from. Tags are typically used to mark release versions, providing a stable reference point for deployment. * Required if referenceType is “tag” |
Resource
Resource
Resources represent individual GS2 service entities managed by a stack. Each resource corresponds to a GS2 API resource (such as a namespace or model) defined in the stack template.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| resourceId | string | * | ~ 1024 chars | Resource GRN * Set automatically by the server | ||||||||||
| type | string | ✓ | ~ 1024 chars | Resource Type The GS2 resource type identifier (e.g., “GS2::Inventory::Namespace”, “GS2::Experience::ExperienceModel”). Determines which GS2 API is called for creating, updating, or deleting this resource. | ||||||||||
| name | string | ✓ | ~ 128 chars | Resource name The logical name assigned to this resource in the stack template. Used to reference the resource within the template for dependency resolution and output field mappings. | ||||||||||
| request | string | ✓ | ~ 1048576 chars | Request parameter The JSON-serialized API request parameters used to create or update this resource. | ||||||||||
| response | string | ✓ | ~ 1048576 chars | Response to resource creation/update The JSON-serialized API response returned when the resource was created or updated. Contains the actual resource state including generated IDs and default values. | ||||||||||
| rollbackContext | String Enum enum { “create”, “update”, “delete” } | Types of rollback operations The operation type to perform when rolling back this resource. create means the resource was newly created and should be deleted on rollback, update means the resource was modified and should be reverted, delete means the resource was removed and should be recreated.
| ||||||||||||
| rollbackRequest | string | ~ 1048576 chars | Request parameters for rollback The JSON-serialized API request parameters to use when rolling back this resource. For updated resources, contains the previous state to restore. For deleted resources, contains the creation parameters to recreate. | |||||||||||
| rollbackAfter | List<string> | [] | 0 ~ 1000 items | Name of the resource on which you are relying at the time of rollback List of resource names that must be rolled back before this resource. Ensures rollback operations are executed in the correct dependency order to maintain consistency. | ||||||||||
| outputFields | List<OutputField> | [] | 0 ~ 1000 items | Fields to be recorded in Output when the resource is created Specifies which fields from the API response should be extracted and saved as stack outputs. Each entry maps an output name to a field path in the response, enabling other stacks or external systems to reference the created resource’s values. | ||||||||||
| workId | string | ✓ | ~ 1024 chars | Execution ID at the time this resource was created A unique identifier for the stack operation (create/update) that provisioned this resource. | ||||||||||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server |
Event
Event
Events are generated to provide information when operations such as creating, updating, or deleting resources in the stack are performed. Developers can monitor how the stack deployment process and resource changes are progressing and take necessary actions.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| eventId | string | * | ~ 1024 chars | Event GRN * Set automatically by the server | ||||||||||||||||||||||||||||||||||
| name | string | ✓ | UUID | ~ 36 chars | Event name Maintains a unique name for each event. The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each event. | |||||||||||||||||||||||||||||||||
| resourceName | string | ✓ | ~ 128 chars | Resource name The logical name assigned to this resource in the stack template. Used to reference the resource within the template for dependency resolution and output field mappings. | ||||||||||||||||||||||||||||||||||
| type | String Enum enum { “CREATE_IN_PROGRESS”, “CREATE_COMPLETE”, “CREATE_FAILED”, “UPDATE_IN_PROGRESS”, “UPDATE_COMPLETE”, “UPDATE_FAILED”, “CLEAN_IN_PROGRESS”, “CLEAN_COMPLETE”, “CLEAN_FAILED”, “DELETE_IN_PROGRESS”, “DELETE_COMPLETE”, “DELETE_FAILED”, “ROLLBACK_IN_PROGRESS”, “ROLLBACK_COMPLETE”, “ROLLBACK_FAILED” } | ✓ | Status The type of event indicating the current state of a resource operation. Tracks progress through in-progress, complete, and failed states for create, update, clean, delete, and rollback operations on individual resources.
| |||||||||||||||||||||||||||||||||||
| message | string | ~ 5242880 chars | Message A detailed message describing the event. For failed operations, contains the error message explaining why the resource operation failed. For successful operations, may contain additional context about the completed action. | |||||||||||||||||||||||||||||||||||
| eventAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server | ||||||||||||||||||||||||||||||||||
| revision | long | 0 | 0 ~ 9223372036854775805 | Revision |
Output
Output created by the stack
You can create outputs using this model by specifying the data you want to record in the Outputs section of the stack. For example, when creating credentials, the client secret can only be confirmed at the moment of creation, but by recording its value as an output, you can refer to the value of the client secret later.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| outputId | string | * | ~ 1024 chars | Output GRN * Set automatically by the server | ||
| name | string | ✓ | ~ 1024 chars | Output Name The logical name of the output as defined in the stack template’s Outputs section. Used to reference this output value from other stacks or external systems. | ||
| value | string | ~ 1048576 chars | Value The actual output value extracted from the resource’s API response. For example, a client secret or resource ARN that was generated during resource creation and can be referenced later. | |||
| createdAt | long | * | Now | Datetime of creation Unix time, milliseconds * Set automatically by the server |
Stack
Stack
A stack is an entity that sets up resources on GS2 using GS2-Deploy.
The stack is designed to specify a template file, and the template file defines the resources needed on GS2. When creating or updating a stack, GS2-Deploy detects changes in the template file. It creates new resources if added, updates existing resources if modified, and deletes resources if removed.
This mechanism allows resources on GS2 to be described declaratively and managed in a reproducible manner. This reproducibility allows for error-free execution when migrating settings from the development environment to the production environment, for example.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stackId | string | * | ~ 1024 chars | Stack GRN * Set automatically by the server | ||||||||||||||||||||||||||
| name | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||||||||||||||||||||||||||
| description | string | ~ 1024 chars | Description | |||||||||||||||||||||||||||
| template | string | ✓ | ~ 5242880 chars | Template data A YAML or JSON document that declaratively defines the GS2 resources to be provisioned. GS2-Deploy detects differences between the current and previous templates to create, update, or delete resources as needed. Maximum size is 5 MB. | ||||||||||||||||||||||||||
| status | String Enum enum { “CREATE_PROCESSING”, “CREATE_COMPLETE”, “UPDATE_PROCESSING”, “UPDATE_COMPLETE”, “CLEAN_PROCESSING”, “CLEAN_COMPLETE”, “DELETE_PROCESSING”, “DELETE_COMPLETE”, “ROLLBACK_INITIALIZING”, “ROLLBACK_PROCESSING”, “ROLLBACK_COMPLETE” } | “CREATE_PROCESSING” | Execution state The current lifecycle state of the stack operation. Transitions through processing and completion states for create, update, clean (resource removal), delete, and rollback operations. A failed operation may trigger a rollback to restore the previous state.
| |||||||||||||||||||||||||||
| 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 |
OutputField
Output field
Defines a mapping from a resource’s API response field to a named stack output.
Details
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 1024 chars | Name The output key name under which the extracted value will be stored. This name is used to reference the output value from the stack’s Outputs. | ||
| fieldName | string | ✓ | ~ 1024 chars | Field name The field path in the resource’s API response to extract the value from. Specifies which property of the created or updated resource should be recorded as the output. |
ChangeSet
Change Details
Represents a single resource change detected when comparing the current and new stack templates. Used in the validate operation to preview what resources will be created, updated, or deleted before actually executing the stack update.
Details
| Type | Condition | Required | Default | Value Limits | Description | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| resourceName | string | ✓ | ~ 128 chars | Resource name The logical name of the resource as defined in the stack template that will be affected by this change. | ||||||||||
| resourceType | string | ✓ | ~ 128 chars | Resource type The GS2 resource type identifier of the resource being changed (e.g., “GS2::Inventory::Namespace”). | ||||||||||
| operation | String Enum enum { “create”, “update”, “delete” } | ✓ | Change type The type of change to be applied to this resource. create indicates a new resource will be provisioned, update indicates an existing resource will be modified, and delete indicates a resource will be removed.
|
Methods
describeResources
Get a list of Resources
Retrieves a paginated list of resources that are managed by the specified stack. Each resource represents a GS2 service component (such as a namespace, model, or configuration) that was provisioned by the stack’s template. The resource information includes the type, name, current request body, and associated properties.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| 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<Resource> | List of Resource |
| 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/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DescribeResources(
&deploy.DescribeResourcesRequest {
StackName: pointy.String("stack-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DescribeResourcesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->describeResources(
(new DescribeResourcesRequest())
->withStackName("stack-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DescribeResourcesRequest;
import io.gs2.deploy.result.DescribeResourcesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DescribeResourcesResult result = client.describeResources(
new DescribeResourcesRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
List<Resource> 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DescribeResourcesResult> asyncResult = null;
yield return client.DescribeResources(
new Gs2.Gs2Deploy.Request.DescribeResourcesRequest()
.WithStackName("stack-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.describeResources(
new Gs2Deploy.DescribeResourcesRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.describe_resources(
deploy.DescribeResourcesRequest()
.with_stack_name('stack-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.describe_resources({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('deploy')
api_result_handler = client.describe_resources_async({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getResource
Get Resource
Retrieves the detailed information of a specific resource managed by the stack. The resource details include its type, name, request body used for provisioning, and response properties returned after creation.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| resourceName | string | ✓ | ~ 128 chars | Resource name The logical name assigned to this resource in the stack template. Used to reference the resource within the template for dependency resolution and output field mappings. |
Result
| Type | Description | |
|---|---|---|
| item | Resource | Resource |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetResource(
&deploy.GetResourceRequest {
StackName: pointy.String("stack-0001"),
ResourceName: pointy.String("resource-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetResourceRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->getResource(
(new GetResourceRequest())
->withStackName("stack-0001")
->withResourceName("resource-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetResourceRequest;
import io.gs2.deploy.result.GetResourceResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
GetResourceResult result = client.getResource(
new GetResourceRequest()
.withStackName("stack-0001")
.withResourceName("resource-0001")
);
Resource 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetResourceResult> asyncResult = null;
yield return client.GetResource(
new Gs2.Gs2Deploy.Request.GetResourceRequest()
.WithStackName("stack-0001")
.WithResourceName("resource-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getResource(
new Gs2Deploy.GetResourceRequest()
.withStackName("stack-0001")
.withResourceName("resource-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_resource(
deploy.GetResourceRequest()
.with_stack_name('stack-0001')
.with_resource_name('resource-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.get_resource({
stackName="stack-0001",
resourceName="resource-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('deploy')
api_result_handler = client.get_resource_async({
stackName="stack-0001",
resourceName="resource-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;describeEvents
Get a list of Events
Retrieves a paginated list of events that occurred during stack operations (creation, update, deletion). Events record the progress and outcomes of each resource operation, including the resource type, action taken, and any error messages. This is useful for monitoring the status of ongoing operations or reviewing the history of completed operations.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| 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<Event> | List of Event |
| 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/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DescribeEvents(
&deploy.DescribeEventsRequest {
StackName: pointy.String("stack-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DescribeEventsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->describeEvents(
(new DescribeEventsRequest())
->withStackName("stack-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DescribeEventsRequest;
import io.gs2.deploy.result.DescribeEventsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DescribeEventsResult result = client.describeEvents(
new DescribeEventsRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
List<Event> 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DescribeEventsResult> asyncResult = null;
yield return client.DescribeEvents(
new Gs2.Gs2Deploy.Request.DescribeEventsRequest()
.WithStackName("stack-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.describeEvents(
new Gs2Deploy.DescribeEventsRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.describe_events(
deploy.DescribeEventsRequest()
.with_stack_name('stack-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.describe_events({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('deploy')
api_result_handler = client.describe_events_async({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getEvent
Get Event
Retrieves the detailed information of a specific event within a stack. The event contains the resource type, action (create/update/delete), status, and any error message that occurred during the operation.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| eventName | string | ✓ | UUID | ~ 36 chars | Event name Maintains a unique name for each event. The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each event. |
Result
| Type | Description | |
|---|---|---|
| item | Event | Event |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetEvent(
&deploy.GetEventRequest {
StackName: pointy.String("stack-0001"),
EventName: pointy.String("event-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetEventRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->getEvent(
(new GetEventRequest())
->withStackName("stack-0001")
->withEventName("event-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetEventRequest;
import io.gs2.deploy.result.GetEventResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
GetEventResult result = client.getEvent(
new GetEventRequest()
.withStackName("stack-0001")
.withEventName("event-0001")
);
Event 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetEventResult> asyncResult = null;
yield return client.GetEvent(
new Gs2.Gs2Deploy.Request.GetEventRequest()
.WithStackName("stack-0001")
.WithEventName("event-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getEvent(
new Gs2Deploy.GetEventRequest()
.withStackName("stack-0001")
.withEventName("event-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_event(
deploy.GetEventRequest()
.with_stack_name('stack-0001')
.with_event_name('event-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.get_event({
stackName="stack-0001",
eventName="event-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('deploy')
api_result_handler = client.get_event_async({
stackName="stack-0001",
eventName="event-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;describeOutputs
Get a list of Outputs
Retrieves a paginated list of output values produced by the stack after successful creation or update. Outputs are key-value pairs defined in the template that expose important information such as resource identifiers, endpoints, or configuration values generated during stack provisioning. Outputs are only available when the stack is in a _COMPLETE status.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| 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<Output> | List of Output |
| 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/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DescribeOutputs(
&deploy.DescribeOutputsRequest {
StackName: pointy.String("stack-0001"),
PageToken: nil,
Limit: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageTokenuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DescribeOutputsRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->describeOutputs(
(new DescribeOutputsRequest())
->withStackName("stack-0001")
->withPageToken(null)
->withLimit(null)
);
$items = $result->getItems();
$nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DescribeOutputsRequest;
import io.gs2.deploy.result.DescribeOutputsResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DescribeOutputsResult result = client.describeOutputs(
new DescribeOutputsRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
List<Output> 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DescribeOutputsResult> asyncResult = null;
yield return client.DescribeOutputs(
new Gs2.Gs2Deploy.Request.DescribeOutputsRequest()
.WithStackName("stack-0001")
.WithPageToken(null)
.WithLimit(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.describeOutputs(
new Gs2Deploy.DescribeOutputsRequest()
.withStackName("stack-0001")
.withPageToken(null)
.withLimit(null)
);
const items = result.getItems();
const nextPageToken = result.getNextPageToken();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.describe_outputs(
deploy.DescribeOutputsRequest()
.with_stack_name('stack-0001')
.with_page_token(None)
.with_limit(None)
)
items = result.items
next_page_token = result.next_page_token
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.describe_outputs({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;client = gs2('deploy')
api_result_handler = client.describe_outputs_async({
stackName="stack-0001",
pageToken=nil,
limit=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;
nextPageToken = result.nextPageToken;getOutput
Get Output
Retrieves a specific output value by name from the stack. The output contains the key name and its corresponding value that was produced during stack provisioning.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| outputName | string | ✓ | ~ 1024 chars | Output Name The logical name of the output as defined in the stack template’s Outputs section. Used to reference this output value from other stacks or external systems. |
Result
| Type | Description | |
|---|---|---|
| item | Output | Output |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetOutput(
&deploy.GetOutputRequest {
StackName: pointy.String("stack-0001"),
OutputName: pointy.String("output-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetOutputRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->getOutput(
(new GetOutputRequest())
->withStackName("stack-0001")
->withOutputName("output-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetOutputRequest;
import io.gs2.deploy.result.GetOutputResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
GetOutputResult result = client.getOutput(
new GetOutputRequest()
.withStackName("stack-0001")
.withOutputName("output-0001")
);
Output 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetOutputResult> asyncResult = null;
yield return client.GetOutput(
new Gs2.Gs2Deploy.Request.GetOutputRequest()
.WithStackName("stack-0001")
.WithOutputName("output-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getOutput(
new Gs2Deploy.GetOutputRequest()
.withStackName("stack-0001")
.withOutputName("output-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_output(
deploy.GetOutputRequest()
.with_stack_name('stack-0001')
.with_output_name('output-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.get_output({
stackName="stack-0001",
outputName="output-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('deploy')
api_result_handler = client.get_output_async({
stackName="stack-0001",
outputName="output-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;describeStacks
Get a list of Stacks
Retrieves a list of stacks with optional filtering by name prefix. You can use pagination with a page token and limit to retrieve the results incrementally. Each stack in the list includes its current status, name, description, and template information.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| namePrefix | string | ~ 64 chars | Filter by Stack 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<Stack> | List of Stack |
| 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/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DescribeStacks(
&deploy.DescribeStacksRequest {
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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DescribeStacksRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->describeStacks(
(new DescribeStacksRequest())
->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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DescribeStacksRequest;
import io.gs2.deploy.result.DescribeStacksResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DescribeStacksResult result = client.describeStacks(
new DescribeStacksRequest()
.withNamePrefix(null)
.withPageToken(null)
.withLimit(null)
);
List<Stack> 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DescribeStacksResult> asyncResult = null;
yield return client.DescribeStacks(
new Gs2.Gs2Deploy.Request.DescribeStacksRequest()
.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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.describeStacks(
new Gs2Deploy.DescribeStacksRequest()
.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 deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.describe_stacks(
deploy.DescribeStacksRequest()
.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('deploy')
api_result = client.describe_stacks({
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('deploy')
api_result_handler = client.describe_stacks_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;preCreateStack
Prepare to create a new Stack (pre-upload)
Obtains an upload token and a presigned URL for uploading a template file. When the template exceeds 1MB, this 3-phase flow is required: 1) call this API to get the upload URL, 2) upload the template to the URL, 3) call CreateStack with the upload token in preUpload mode. The presigned URL expires after 60 minutes.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description |
|---|
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.PreCreateStack(
&deploy.PreCreateStackRequest {
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\PreCreateStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->preCreateStack(
(new PreCreateStackRequest())
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.PreCreateStackRequest;
import io.gs2.deploy.result.PreCreateStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
PreCreateStackResult result = client.preCreateStack(
new PreCreateStackRequest()
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.PreCreateStackResult> asyncResult = null;
yield return client.PreCreateStack(
new Gs2.Gs2Deploy.Request.PreCreateStackRequest(),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.preCreateStack(
new Gs2Deploy.PreCreateStackRequest()
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.pre_create_stack(
deploy.PreCreateStackRequest()
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.pre_create_stack({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('deploy')
api_result_handler = client.pre_create_stack_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
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;createStack
Create a new Stack
Creates a new stack by specifying a name, description, and template. Supports two modes: ‘direct’ mode where the template is passed inline in the request body, and ‘preUpload’ mode where the template was previously uploaded using the PreCreateStack API. The template is validated before the stack is created. If validation fails, an error is returned. After creation, the stack enters the CREATE_PROCESSING status and begins provisioning resources asynchronously.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||||||||
| description | string | ~ 1024 chars | Description | |||||||||
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| template | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Template data A YAML or JSON document that declaratively defines the GS2 resources to be provisioned. GS2-Deploy detects differences between the current and previous templates to create, update, or delete resources as needed. Maximum size is 5 MB. * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token obtained by pre-upload Used to apply the uploaded master data. * Required if mode is “preUpload” |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.CreateStack(
&deploy.CreateStackRequest {
Name: pointy.String("stack-0001"),
Description: nil,
Mode: nil,
Template: pointy.String("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\CreateStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->createStack(
(new CreateStackRequest())
->withName("stack-0001")
->withDescription(null)
->withMode(null)
->withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
->withUploadToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.CreateStackRequest;
import io.gs2.deploy.result.CreateStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
CreateStackResult result = client.createStack(
new CreateStackRequest()
.withName("stack-0001")
.withDescription(null)
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.CreateStackResult> asyncResult = null;
yield return client.CreateStack(
new Gs2.Gs2Deploy.Request.CreateStackRequest()
.WithName("stack-0001")
.WithDescription(null)
.WithMode(null)
.WithTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.WithUploadToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.createStack(
new Gs2Deploy.CreateStackRequest()
.withName("stack-0001")
.withDescription(null)
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.create_stack(
deploy.CreateStackRequest()
.with_name('stack-0001')
.with_description(None)
.with_mode(None)
.with_template('\nGS2TemplateFormatVersion: "2019-05-01"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n')
.with_upload_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.create_stack({
name="stack-0001",
description=nil,
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('deploy')
api_result_handler = client.create_stack_async({
name="stack-0001",
description=nil,
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;createStackFromGitHub
Create a new Stack from GitHub
Creates a new stack by fetching the template directly from a GitHub repository. The checkout settings specify the repository, branch or tag, and file path of the template. The fetched template is validated before the stack is created. This is useful for managing templates in version control and deploying infrastructure directly from the repository.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| name | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| description | string | ~ 1024 chars | Description | |||
| checkoutSetting | GitHubCheckoutSetting | ✓ | Setup to check out template file from GitHub |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack created |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.CreateStackFromGitHub(
&deploy.CreateStackFromGitHubRequest {
Name: pointy.String("stack-0001"),
Description: nil,
CheckoutSetting: &deploy.GitHubCheckoutSetting{
ApiKeyId: pointy.String("apiKeyId-0001"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\CreateStackFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->createStackFromGitHub(
(new CreateStackFromGitHubRequest())
->withName("stack-0001")
->withDescription(null)
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId("apiKeyId-0001")
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.CreateStackFromGitHubRequest;
import io.gs2.deploy.result.CreateStackFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
CreateStackFromGitHubResult result = client.createStackFromGitHub(
new CreateStackFromGitHubRequest()
.withName("stack-0001")
.withDescription(null)
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.CreateStackFromGitHubResult> asyncResult = null;
yield return client.CreateStackFromGitHub(
new Gs2.Gs2Deploy.Request.CreateStackFromGitHubRequest()
.WithName("stack-0001")
.WithDescription(null)
.WithCheckoutSetting(new Gs2.Gs2Deploy.Model.GitHubCheckoutSetting()
.WithApiKeyId("apiKeyId-0001")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.createStackFromGitHub(
new Gs2Deploy.CreateStackFromGitHubRequest()
.withName("stack-0001")
.withDescription(null)
.withCheckoutSetting(new Gs2Deploy.model.GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.create_stack_from_git_hub(
deploy.CreateStackFromGitHubRequest()
.with_name('stack-0001')
.with_description(None)
.with_checkout_setting(deploy.GitHubCheckoutSetting()
.with_api_key_id('apiKeyId-0001')
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.create_stack_from_git_hub({
name="stack-0001",
description=nil,
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
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('deploy')
api_result_handler = client.create_stack_from_git_hub_async({
name="stack-0001",
description=nil,
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
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;preValidate
Prepare to validate Template (pre-upload)
Obtains an upload token and a presigned URL for uploading a template file to validate. When the template exceeds 1MB, this 3-phase flow is required: 1) call this API to get the upload URL, 2) upload the template to the URL, 3) call Validate with the upload token in preUpload mode. The presigned URL expires after 60 minutes.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description |
|---|
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.PreValidate(
&deploy.PreValidateRequest {
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\PreValidateRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->preValidate(
(new PreValidateRequest())
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.PreValidateRequest;
import io.gs2.deploy.result.PreValidateResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
PreValidateResult result = client.preValidate(
new PreValidateRequest()
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.PreValidateResult> asyncResult = null;
yield return client.PreValidate(
new Gs2.Gs2Deploy.Request.PreValidateRequest(),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.preValidate(
new Gs2Deploy.PreValidateRequest()
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.pre_validate(
deploy.PreValidateRequest()
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.pre_validate({
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('deploy')
api_result_handler = client.pre_validate_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
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;validate
Validate Template
Validates the structure and syntax of a template without actually creating or updating a stack. Supports two modes: ‘direct’ mode where the template is passed inline, and ‘preUpload’ mode where the template was previously uploaded using the PreValidate API. Note that this API only performs structural validation. Even if the validation passes, runtime errors may still occur during actual stack creation or update.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| template | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Template data A YAML or JSON document that declaratively defines the GS2 resources to be provisioned. GS2-Deploy detects differences between the current and previous templates to create, update, or delete resources as needed. Maximum size is 5 MB. * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token obtained by pre-upload Used to apply the uploaded master data. * Required if mode is “preUpload” |
Result
| Type | Description |
|---|
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.Validate(
&deploy.ValidateRequest {
Mode: nil,
Template: pointy.String("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\ValidateRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->validate(
(new ValidateRequest())
->withMode(null)
->withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
->withUploadToken(null)
);
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.ValidateRequest;
import io.gs2.deploy.result.ValidateResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
ValidateResult result = client.validate(
new ValidateRequest()
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.ValidateResult> asyncResult = null;
yield return client.Validate(
new Gs2.Gs2Deploy.Request.ValidateRequest()
.WithMode(null)
.WithTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.WithUploadToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.validate(
new Gs2Deploy.ValidateRequest()
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.validate(
deploy.ValidateRequest()
.with_mode(None)
.with_template('\nGS2TemplateFormatVersion: "2019-05-01"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n')
.with_upload_token(None)
)
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.validate({
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.resultclient = gs2('deploy')
api_result_handler = client.validate_async({
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=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.resultgetStackStatus
Get Stack Status
Retrieves only the current status of the specified stack. This API returns only the status string, making it suitable for polling the progress of stack operations.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| status | string |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetStackStatus(
&deploy.GetStackStatusRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetStackStatusRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->getStackStatus(
(new GetStackStatusRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetStackStatusRequest;
import io.gs2.deploy.result.GetStackStatusResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
GetStackStatusResult result = client.getStackStatus(
new GetStackStatusRequest()
.withStackName("stack-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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetStackStatusResult> asyncResult = null;
yield return client.GetStackStatus(
new Gs2.Gs2Deploy.Request.GetStackStatusRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getStackStatus(
new Gs2Deploy.GetStackStatusRequest()
.withStackName("stack-0001")
);
const status = result.getStatus();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_stack_status(
deploy.GetStackStatusRequest()
.with_stack_name('stack-0001')
)
status = result.status
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.get_stack_status({
stackName="stack-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('deploy')
api_result_handler = client.get_stack_status_async({
stackName="stack-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;getStack
Get Stack
Retrieves the detailed information of the specified stack, including its name, description, template, status, and associated resources.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetStack(
&deploy.GetStackRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->getStack(
(new GetStackRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetStackRequest;
import io.gs2.deploy.result.GetStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
GetStackResult result = client.getStack(
new GetStackRequest()
.withStackName("stack-0001")
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetStackResult> asyncResult = null;
yield return client.GetStack(
new Gs2.Gs2Deploy.Request.GetStackRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getStack(
new Gs2Deploy.GetStackRequest()
.withStackName("stack-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_stack(
deploy.GetStackRequest()
.with_stack_name('stack-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.get_stack({
stackName="stack-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('deploy')
api_result_handler = client.get_stack_async({
stackName="stack-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;preUpdateStack
Prepare to update Stack (pre-upload)
Obtains an upload token and a presigned URL for uploading a new template file to update the stack. When the template exceeds 1MB, this 3-phase flow is required: 1) call this API to get the upload URL, 2) upload the template to the URL, 3) call UpdateStack with the upload token in preUpload mode. The presigned URL expires after 60 minutes.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.PreUpdateStack(
&deploy.PreUpdateStackRequest {
StackName: pointy.String("stack-0001"),
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\PreUpdateStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->preUpdateStack(
(new PreUpdateStackRequest())
->withStackName("stack-0001")
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.PreUpdateStackRequest;
import io.gs2.deploy.result.PreUpdateStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
PreUpdateStackResult result = client.preUpdateStack(
new PreUpdateStackRequest()
.withStackName("stack-0001")
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.PreUpdateStackResult> asyncResult = null;
yield return client.PreUpdateStack(
new Gs2.Gs2Deploy.Request.PreUpdateStackRequest()
.WithStackName("stack-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.preUpdateStack(
new Gs2Deploy.PreUpdateStackRequest()
.withStackName("stack-0001")
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.pre_update_stack(
deploy.PreUpdateStackRequest()
.with_stack_name('stack-0001')
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.pre_update_stack({
stackName="stack-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('deploy')
api_result_handler = client.pre_update_stack_async({
stackName="stack-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
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;updateStack
Update Stack
Updates an existing stack with a new template and description. The stack must be in a _COMPLETE status (e.g., CREATE_COMPLETE, UPDATE_COMPLETE) to be updated; an error is returned if the stack is still processing. Supports two modes: ‘direct’ mode where the template is passed inline, and ‘preUpload’ mode where the template was previously uploaded using the PreUpdateStack API. The new template is validated before the update begins. After the update starts, the stack enters UPDATE_PROCESSING status and resources are modified asynchronously according to the change set.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||||||||
| description | string | ~ 1024 chars | Description | |||||||||
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| template | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Template data A YAML or JSON document that declaratively defines the GS2 resources to be provisioned. GS2-Deploy detects differences between the current and previous templates to create, update, or delete resources as needed. Maximum size is 5 MB. * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token obtained by pre-upload Used to apply the uploaded master data. * Required if mode is “preUpload” |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.UpdateStack(
&deploy.UpdateStackRequest {
StackName: pointy.String("stack-0001"),
Description: nil,
Mode: nil,
Template: pointy.String("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}
item := result.Itemuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\UpdateStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->updateStack(
(new UpdateStackRequest())
->withStackName("stack-0001")
->withDescription(null)
->withMode(null)
->withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
->withUploadToken(null)
);
$item = $result->getItem();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.UpdateStackRequest;
import io.gs2.deploy.result.UpdateStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
UpdateStackResult result = client.updateStack(
new UpdateStackRequest()
.withStackName("stack-0001")
.withDescription(null)
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.UpdateStackResult> asyncResult = null;
yield return client.UpdateStack(
new Gs2.Gs2Deploy.Request.UpdateStackRequest()
.WithStackName("stack-0001")
.WithDescription(null)
.WithMode(null)
.WithTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.WithUploadToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.updateStack(
new Gs2Deploy.UpdateStackRequest()
.withStackName("stack-0001")
.withDescription(null)
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.update_stack(
deploy.UpdateStackRequest()
.with_stack_name('stack-0001')
.with_description(None)
.with_mode(None)
.with_template('\nGS2TemplateFormatVersion: "2019-05-01"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n')
.with_upload_token(None)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.update_stack({
stackName="stack-0001",
description=nil,
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;client = gs2('deploy')
api_result_handler = client.update_stack_async({
stackName="stack-0001",
description=nil,
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
api_result = api_result_handler() -- Call the handler to get the result
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
item = result.item;preChangeSet
Prepare to get Change Set (pre-upload)
Obtains an upload token and a presigned URL for uploading a new template file to preview changes. When the template exceeds 1MB, this 3-phase flow is required: 1) call this API to get the upload URL, 2) upload the template to the URL, 3) call ChangeSet with the upload token in preUpload mode. The presigned URL expires after 60 minutes.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| uploadToken | string | Token used to reflect results after upload |
| uploadUrl | string | URL used to upload |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.PreChangeSet(
&deploy.PreChangeSetRequest {
StackName: pointy.String("stack-0001"),
}
)
if err != nil {
panic("error occurred")
}
uploadToken := result.UploadToken
uploadUrl := result.UploadUrluse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\PreChangeSetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->preChangeSet(
(new PreChangeSetRequest())
->withStackName("stack-0001")
);
$uploadToken = $result->getUploadToken();
$uploadUrl = $result->getUploadUrl();
} catch (Gs2Exception $e) {
exit("error occurred")
}import io.gs2.core.model.Region;
import io.gs2.core.model.BasicGs2Credential;
import io.gs2.core.rest.Gs2RestSession;
import io.gs2.core.exception.Gs2Exception;
import io.gs2.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.PreChangeSetRequest;
import io.gs2.deploy.result.PreChangeSetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
PreChangeSetResult result = client.preChangeSet(
new PreChangeSetRequest()
.withStackName("stack-0001")
);
String uploadToken = result.getUploadToken();
String uploadUrl = result.getUploadUrl();
} catch (Gs2Exception e) {
System.exit(1);
}using Gs2.Core;
using Gs2.Core.Model;
using Gs2.Core.Net;
using Gs2.Core.Exception;
var session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region.ApNortheast1
);
yield return session.OpenAsync(r => { });
var client = new Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.PreChangeSetResult> asyncResult = null;
yield return client.PreChangeSet(
new Gs2.Gs2Deploy.Request.PreChangeSetRequest()
.WithStackName("stack-0001"),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var uploadToken = result.UploadToken;
var uploadUrl = result.UploadUrl;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.preChangeSet(
new Gs2Deploy.PreChangeSetRequest()
.withStackName("stack-0001")
);
const uploadToken = result.getUploadToken();
const uploadUrl = result.getUploadUrl();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.pre_change_set(
deploy.PreChangeSetRequest()
.with_stack_name('stack-0001')
)
upload_token = result.upload_token
upload_url = result.upload_url
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.pre_change_set({
stackName="stack-0001",
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;client = gs2('deploy')
api_result_handler = client.pre_change_set_async({
stackName="stack-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
uploadToken = result.uploadToken;
uploadUrl = result.uploadUrl;changeSet
Get Change Set
Compares the current stack template with a new template and returns a list of changes that would be applied. This allows you to preview the impact of an update before actually executing it. Supports two modes: ‘direct’ mode where the template is passed inline, and ‘preUpload’ mode where the template was previously uploaded using the PreChangeSet API. The returned change set lists each resource that would be created, updated, or deleted.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||||||||
| mode | String Enum enum { “direct”, “preUpload” } | “direct” | Update mode
| |||||||||
| template | string | {mode} == “direct” | ✓* | ~ 5242880 chars | Template data A YAML or JSON document that declaratively defines the GS2 resources to be provisioned. GS2-Deploy detects differences between the current and previous templates to create, update, or delete resources as needed. Maximum size is 5 MB. * Required if mode is “direct” | |||||||
| uploadToken | string | {mode} == “preUpload” | ✓* | ~ 1024 chars | Token obtained by pre-upload Used to apply the uploaded master data. * Required if mode is “preUpload” |
Result
| Type | Description | |
|---|---|---|
| items | List<ChangeSet> | List of Stack |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.ChangeSet(
&deploy.ChangeSetRequest {
StackName: pointy.String("stack-0001"),
Mode: nil,
Template: pointy.String("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n"),
UploadToken: nil,
}
)
if err != nil {
panic("error occurred")
}
items := result.Itemsuse Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\ChangeSetRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->changeSet(
(new ChangeSetRequest())
->withStackName("stack-0001")
->withMode(null)
->withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
->withUploadToken(null)
);
$items = $result->getItems();
} 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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.ChangeSetRequest;
import io.gs2.deploy.result.ChangeSetResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
ChangeSetResult result = client.changeSet(
new ChangeSetRequest()
.withStackName("stack-0001")
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
List<ChangeSet> items = result.getItems();
} 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.ChangeSetResult> asyncResult = null;
yield return client.ChangeSet(
new Gs2.Gs2Deploy.Request.ChangeSetRequest()
.WithStackName("stack-0001")
.WithMode(null)
.WithTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.WithUploadToken(null),
r => asyncResult = r
);
if (asyncResult.Error != null) {
throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;import Gs2Core from '@/gs2/core';
import * as Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.changeSet(
new Gs2Deploy.ChangeSetRequest()
.withStackName("stack-0001")
.withMode(null)
.withTemplate("\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n")
.withUploadToken(null)
);
const items = result.getItems();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.change_set(
deploy.ChangeSetRequest()
.with_stack_name('stack-0001')
.with_mode(None)
.with_template('\nGS2TemplateFormatVersion: "2019-05-01"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n')
.with_upload_token(None)
)
items = result.items
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.change_set({
stackName="stack-0001",
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=nil,
})
if(api_result.isError) then
-- When error occurs
fail(api_result['statusCode'], api_result['errorMessage'])
end
result = api_result.result
items = result.items;client = gs2('deploy')
api_result_handler = client.change_set_async({
stackName="stack-0001",
mode=nil,
template="\nGS2TemplateFormatVersion: \"2019-05-01\"\nDescription: Template Sample\n\nResources:\n IdentifierAuthUser:\n Type: GS2::Identifier::User\n Properties:\n Name: auth\n\nOutputs:\n SecretKey: !GetAttr IdentifierAuthUser.Name\n",
uploadToken=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;updateStackFromGitHub
Update Stack from GitHub
Updates an existing stack by fetching a new template directly from a GitHub repository. The stack must be in a _COMPLETE status to be updated. The checkout settings specify the repository, branch or tag, and file path of the template. The fetched template is validated before the update begins.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. | ||
| description | string | ~ 1024 chars | Description | |||
| checkoutSetting | GitHubCheckoutSetting | ✓ | Setup to check out template file from GitHub |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack updated |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.UpdateStackFromGitHub(
&deploy.UpdateStackFromGitHubRequest {
StackName: pointy.String("stack-0001"),
Description: nil,
CheckoutSetting: &deploy.GitHubCheckoutSetting{
ApiKeyId: pointy.String("apiKeyId-0001"),
RepositoryName: pointy.String("gs2io/master-data"),
SourcePath: pointy.String("path/to/file.json"),
ReferenceType: pointy.String("branch"),
BranchName: pointy.String("develop"),
},
}
)
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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\UpdateStackFromGitHubRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->updateStackFromGitHub(
(new UpdateStackFromGitHubRequest())
->withStackName("stack-0001")
->withDescription(null)
->withCheckoutSetting((new GitHubCheckoutSetting())
->withApiKeyId("apiKeyId-0001")
->withRepositoryName("gs2io/master-data")
->withSourcePath("path/to/file.json")
->withReferenceType("branch")
->withBranchName("develop")
)
);
$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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.UpdateStackFromGitHubRequest;
import io.gs2.deploy.result.UpdateStackFromGitHubResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
UpdateStackFromGitHubResult result = client.updateStackFromGitHub(
new UpdateStackFromGitHubRequest()
.withStackName("stack-0001")
.withDescription(null)
.withCheckoutSetting(new GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.UpdateStackFromGitHubResult> asyncResult = null;
yield return client.UpdateStackFromGitHub(
new Gs2.Gs2Deploy.Request.UpdateStackFromGitHubRequest()
.WithStackName("stack-0001")
.WithDescription(null)
.WithCheckoutSetting(new Gs2.Gs2Deploy.Model.GitHubCheckoutSetting()
.WithApiKeyId("apiKeyId-0001")
.WithRepositoryName("gs2io/master-data")
.WithSourcePath("path/to/file.json")
.WithReferenceType("branch")
.WithBranchName("develop")
),
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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.updateStackFromGitHub(
new Gs2Deploy.UpdateStackFromGitHubRequest()
.withStackName("stack-0001")
.withDescription(null)
.withCheckoutSetting(new Gs2Deploy.model.GitHubCheckoutSetting()
.withApiKeyId("apiKeyId-0001")
.withRepositoryName("gs2io/master-data")
.withSourcePath("path/to/file.json")
.withReferenceType("branch")
.withBranchName("develop")
)
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.update_stack_from_git_hub(
deploy.UpdateStackFromGitHubRequest()
.with_stack_name('stack-0001')
.with_description(None)
.with_checkout_setting(deploy.GitHubCheckoutSetting()
.with_api_key_id('apiKeyId-0001')
.with_repository_name('gs2io/master-data')
.with_source_path('path/to/file.json')
.with_reference_type('branch')
.with_branch_name('develop')
)
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.update_stack_from_git_hub({
stackName="stack-0001",
description=nil,
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
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('deploy')
api_result_handler = client.update_stack_from_git_hub_async({
stackName="stack-0001",
description=nil,
checkoutSetting={
api_key_id="apiKeyId-0001",
repository_name="gs2io/master-data",
source_path="path/to/file.json",
reference_type="branch",
branch_name="develop",
},
})
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;deleteStack
Delete Stack
Deletes the resources created by the stack and, if successful, deletes the stack entity. The stack must be in a _COMPLETE status to be deleted. If the stack is already in DELETE_COMPLETE status, only the stack entity is deleted. Otherwise, the stack enters DELETE_PROCESSING status and resource cleanup begins asynchronously. If resource deletion fails for some reason, the stack entity remains so you can retry or use ForceDelete.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stacks deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DeleteStack(
&deploy.DeleteStackRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DeleteStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->deleteStack(
(new DeleteStackRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DeleteStackRequest;
import io.gs2.deploy.result.DeleteStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DeleteStackResult result = client.deleteStack(
new DeleteStackRequest()
.withStackName("stack-0001")
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DeleteStackResult> asyncResult = null;
yield return client.DeleteStack(
new Gs2.Gs2Deploy.Request.DeleteStackRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.deleteStack(
new Gs2Deploy.DeleteStackRequest()
.withStackName("stack-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.delete_stack(
deploy.DeleteStackRequest()
.with_stack_name('stack-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.delete_stack({
stackName="stack-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('deploy')
api_result_handler = client.delete_stack_async({
stackName="stack-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;forceDeleteStack
Force delete Stack
Forcibly deletes the stack entity regardless of its current status or whether resources remain. Unlike the normal Delete API, this does not attempt to clean up resources created by the stack. Any remaining resources will be orphaned and must be manually managed. Use this as a last resort when the normal deletion process has failed or the stack is stuck in an unrecoverable state.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stacks deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.ForceDeleteStack(
&deploy.ForceDeleteStackRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\ForceDeleteStackRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->forceDeleteStack(
(new ForceDeleteStackRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.ForceDeleteStackRequest;
import io.gs2.deploy.result.ForceDeleteStackResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
ForceDeleteStackResult result = client.forceDeleteStack(
new ForceDeleteStackRequest()
.withStackName("stack-0001")
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.ForceDeleteStackResult> asyncResult = null;
yield return client.ForceDeleteStack(
new Gs2.Gs2Deploy.Request.ForceDeleteStackRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.forceDeleteStack(
new Gs2Deploy.ForceDeleteStackRequest()
.withStackName("stack-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.force_delete_stack(
deploy.ForceDeleteStackRequest()
.with_stack_name('stack-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.force_delete_stack({
stackName="stack-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('deploy')
api_result_handler = client.force_delete_stack_async({
stackName="stack-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;deleteStackResources
Delete Stack Resources
Deletes only the resources created by the stack, while preserving the stack entity and its template. This behaves similarly to updating the stack with an empty template: the stack enters DELETE_PROCESSING status and resource cleanup begins asynchronously. Since the original template remains on the stack entity, you can restore the resources by updating the stack again with the same or a new template. This makes it a safer alternative to full stack deletion in case of mishandling.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stack of deleted resources |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DeleteStackResources(
&deploy.DeleteStackResourcesRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DeleteStackResourcesRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->deleteStackResources(
(new DeleteStackResourcesRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DeleteStackResourcesRequest;
import io.gs2.deploy.result.DeleteStackResourcesResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DeleteStackResourcesResult result = client.deleteStackResources(
new DeleteStackResourcesRequest()
.withStackName("stack-0001")
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DeleteStackResourcesResult> asyncResult = null;
yield return client.DeleteStackResources(
new Gs2.Gs2Deploy.Request.DeleteStackResourcesRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.deleteStackResources(
new Gs2Deploy.DeleteStackResourcesRequest()
.withStackName("stack-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.delete_stack_resources(
deploy.DeleteStackResourcesRequest()
.with_stack_name('stack-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.delete_stack_resources({
stackName="stack-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('deploy')
api_result_handler = client.delete_stack_resources_async({
stackName="stack-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;deleteStackEntity
Final Stack Deletion
Deletes the stack entity after all resources have been successfully cleaned up. This is typically used after the Delete Stack Resources (Clean) API has completed and the stack is in DELETE_COMPLETE status. An error is returned if the stack still has remaining resources; use the Delete Stack Resources API first to remove them.
Details
Request
| Type | Condition | Required | Default | Value Limits | Description | |
|---|---|---|---|---|---|---|
| stackName | string | ✓ | ~ 128 chars | Stack name A unique name identifying the stack. Specified using alphanumeric characters, hyphens (-), underscores (_), and periods (.). Used to reference the stack when performing create, update, or delete operations. |
Result
| Type | Description | |
|---|---|---|
| item | Stack | Stacks deleted |
Implementation Example
import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.DeleteStackEntity(
&deploy.DeleteStackEntityRequest {
StackName: pointy.String("stack-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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\DeleteStackEntityRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$session
);
try {
$result = $client->deleteStackEntity(
(new DeleteStackEntityRequest())
->withStackName("stack-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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.DeleteStackEntityRequest;
import io.gs2.deploy.result.DeleteStackEntityResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(session);
try {
DeleteStackEntityResult result = client.deleteStackEntity(
new DeleteStackEntityRequest()
.withStackName("stack-0001")
);
Stack 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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.DeleteStackEntityResult> asyncResult = null;
yield return client.DeleteStackEntity(
new Gs2.Gs2Deploy.Request.DeleteStackEntityRequest()
.WithStackName("stack-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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.deleteStackEntity(
new Gs2Deploy.DeleteStackEntityRequest()
.withStackName("stack-0001")
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.delete_stack_entity(
deploy.DeleteStackEntityRequest()
.with_stack_name('stack-0001')
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
api_result = client.delete_stack_entity({
stackName="stack-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('deploy')
api_result_handler = client.delete_stack_entity_async({
stackName="stack-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
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/deploy"
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 := deploy.Gs2DeployRestClient{
Session: &session,
}
result, err := client.GetServiceVersion(
&deploy.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\Deploy\Gs2DeployRestClient;
use Gs2\Deploy\Request\GetServiceVersionRequest;
$session = new Gs2RestSession(
new BasicGs2Credential(
"your client id",
"your client secret"
),
Region::AP_NORTHEAST_1
);
$session->open();
$client = new Gs2DeployRestClient(
$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.deploy.rest.Gs2DeployRestClient;
import io.gs2.deploy.request.GetServiceVersionRequest;
import io.gs2.deploy.result.GetServiceVersionResult;
Gs2RestSession session = new Gs2RestSession(
Region.AP_NORTHEAST_1,
new BasicGs2Credential(
"your client id",
"your client secret"
)
);
session.connect();
Gs2DeployRestClient client = new Gs2DeployRestClient(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 Gs2DeployRestClient(session);
AsyncResult<Gs2.Gs2Deploy.Result.GetServiceVersionResult> asyncResult = null;
yield return client.GetServiceVersion(
new Gs2.Gs2Deploy.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 Gs2Deploy from '@/gs2/deploy';
const session = new Gs2Core.Gs2RestSession(
"ap-northeast-1",
new Gs2Core.BasicGs2Credential(
'your client id',
'your client secret'
)
);
await session.connect();
const client = new Gs2Deploy.Gs2DeployRestClient(session);
try {
const result = await client.getServiceVersion(
new Gs2Deploy.GetServiceVersionRequest()
);
const item = result.getItem();
} catch (e) {
process.exit(1);
}from gs2 import core
from gs2 import deploy
session = core.Gs2RestSession(
core.BasicGs2Credential(
'your client id',
'your client secret'
),
"ap-northeast-1",
)
session.connect()
client = deploy.Gs2DeployRestClient(session)
try:
result = client.get_service_version(
deploy.GetServiceVersionRequest()
)
item = result.item
except core.Gs2Exception as e:
exit(1)client = gs2('deploy')
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('deploy')
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;