> For the complete documentation index, see [llms.txt](/llms.txt)

# GS2-Freeze SDK API Reference

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



## Models

### Output

Output of stage update progress

Represents a log entry generated during a stage version update operation. Each output captures a step or event in the update process. Outputs are automatically cleaned up after 30 days.



|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| outputId | string |  | * |  |  ~ 1024 chars | Stage update progress output GRN<br>* Set automatically by the server |
| name | string |  | ✓ | UUID |  ~ 36 chars | Output Name<br>Maintains a unique name for each output of stage update progress.<br>The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each output of stage update progress. |
| text | string |  | ✓ |  |  ~ 1048576 chars | Text<br>The log message content describing a specific step or event during the stage update process. May contain status information, error details, or progress indicators for the version transition operation. |
| createdAt | long |  | * | Current time |  | Timestamp |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | Revision |

**Related methods:**
describeOutputs - List stage update progress outputs
getOutput - Get stage update progress output




---

### Stage

Stage

A stage is environment configuration that pins program versions.
You can have multiple stages for one project.
A stage has a source stage, and it is possible to switch to the version fixed by the source stage.

By using this mechanism, you can first incorporate the latest version into the dev stage and check the operation at the developer level.
If there seems to be no problem, the dev stage can be reflected in the stg stage, which has the dev stage as the source stage.
After QA, the stg stage can be reflected in the live stage, which has the stg stage as the source stage.



|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageId | string |  | * |  |  ~ 1024 chars | Stage GRN<br>* Set automatically by the server |
| name | string |  | ✓ |  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |
| sourceStageName | string |  |  |  |  ~ 128 chars | Source stage name<br>The name of the stage from which this stage pulls its version configuration. When updating, the versions pinned by the source stage are adopted. For example, a "stg" stage might have "dev" as its source, and "live" might have "stg". If not specified, the latest versions are used directly. |
| sortNumber | int |  | ✓ |  | 0 ~ 100 | Sort number<br>A numeric value used to control the display order of stages. Lower numbers are displayed first. Useful for arranging stages in a logical progression (e.g., dev=0, stg=50, live=100). |
| status | string (enum)<br>enum {<br>&nbsp;&nbsp;"Active",<br>&nbsp;&nbsp;"Updating",<br>&nbsp;&nbsp;"UpdateFailed"<br>}<br> |  |  | "Active" |  | Status<br>The current state of the stage. "Active" indicates normal operation with pinned versions serving requests. "Updating" indicates a version transition is in progress. "UpdateFailed" indicates the version update encountered an error and may require manual intervention."Active": Active / "Updating": Updating / "UpdateFailed": Update Failed /  |
| createdAt | long |  | * | Current time |  | Creation Timestamp<br>Unix time, milliseconds<br>* Set automatically by the server |
| updatedAt | long |  | * | Current time |  | Last Updated Timestamp<br>Unix time, milliseconds<br>* Set automatically by the server |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | Revision |

**Related methods:**
describeStages - List stages
getStage - Get stage
promoteStage - Promote stage
rollbackStage - Rollback stage




---

### Microservice

Microservice

Represents a GS2 microservice component. Each microservice has a name and version that can be pinned to a specific stage.



|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓ |  |  ~ 128 chars | Microservice name<br>The identifier for this microservice. |
| version | string |  | ✓ |  |  ~ 32 chars | Microservice version<br>The version identifier of this microservice. Used to pin the microservice to a specific version during stage deployment, ensuring consistent behavior across environments. |

**Related methods:**
getStage - Get stage




---
## Methods

### describeOutputs

List stage update progress outputs

Retrieves a paginated list of output log entries for a specific stage's update operations (promote/rollback).
Output entries are created at each step of the promote or rollback process, including start, step completion, and final success or failure messages.
This API can be used to monitor the progress of ongoing deployments.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |
| 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&lt;Output&gt;](#output) | List of Output of stage update progress |
| nextPageToken | string | Page token to retrieve the rest of the listing |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.DescribeOutputs(
    &freeze.DescribeOutputsRequest {
        StageName: pointy.String("namespace-0001"),
        PageToken: nil,
        Limit: nil,
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items
nextPageToken := result.NextPageToken

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\DescribeOutputsRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->describeOutputs(
        (new DescribeOutputsRequest())
            ->withStageName("namespace-0001")
            ->withPageToken(null)
            ->withLimit(null)
    );
    $items = $result->getItems();
    $nextPageToken = $result->getNextPageToken();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.DescribeOutputsRequest;
import io.gs2.freeze.result.DescribeOutputsResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    DescribeOutputsResult result = client.describeOutputs(
        new DescribeOutputsRequest()
            .withStageName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    List<Output> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.DescribeOutputsResult> asyncResult = null;
yield return client.DescribeOutputs(
    new Gs2.Gs2Freeze.Request.DescribeOutputsRequest()
        .WithStageName("namespace-0001")
        .WithPageToken(null)
        .WithLimit(null),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;
var nextPageToken = result.NextPageToken;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.describeOutputs(
        new Gs2Freeze.DescribeOutputsRequest()
            .withStageName("namespace-0001")
            .withPageToken(null)
            .withLimit(null)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.describe_outputs(
        freeze.DescribeOutputsRequest()
            .with_stage_name('namespace-0001')
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.describe_outputs({
    stageName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

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

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

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.describe_outputs_async({
    stageName="namespace-0001",
    pageToken=nil,
    limit=nil,
})

api_result = api_result_handler()  -- Call the handler to get the result

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

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

```




---

### getOutput

Get stage update progress output

Retrieves a specific output log entry for a stage's update operation.
Each output entry contains a text message describing what occurred at that point in the promote or rollback process.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |
| outputName | string |  | ✓| UUID |  ~ 36 chars | Output Name<br>Maintains a unique name for each output of stage update progress.<br>The name is automatically generated in UUID (Universally Unique Identifier) format and used to identify each output of stage update progress. |

#### Result

|  | Type | Description |
| --- | --- | --- |
| item | [Output](#output) | Output |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.GetOutput(
    &freeze.GetOutputRequest {
        StageName: pointy.String("namespace-0001"),
        OutputName: pointy.String("output-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\GetOutputRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->getOutput(
        (new GetOutputRequest())
            ->withStageName("namespace-0001")
            ->withOutputName("output-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.GetOutputRequest;
import io.gs2.freeze.result.GetOutputResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    GetOutputResult result = client.getOutput(
        new GetOutputRequest()
            .withStageName("namespace-0001")
            .withOutputName("output-0001")
    );
    Output item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.GetOutputResult> asyncResult = null;
yield return client.GetOutput(
    new Gs2.Gs2Freeze.Request.GetOutputRequest()
        .WithStageName("namespace-0001")
        .WithOutputName("output-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.getOutput(
        new Gs2Freeze.GetOutputRequest()
            .withStageName("namespace-0001")
            .withOutputName("output-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.get_output(
        freeze.GetOutputRequest()
            .with_stage_name('namespace-0001')
            .with_output_name('output-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.get_output({
    stageName="namespace-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;

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.get_output_async({
    stageName="namespace-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;

```




---

### describeStages

List stages

Retrieves a list of deployment stages owned by the requesting user.
Each stage represents an environment (e.g., development, staging, production) with its own microservice version configuration.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |

#### Result

|  | Type | Description |
| --- | --- | --- |
| items | [List&lt;Stage&gt;](#stage) | List of Stage |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.DescribeStages(
    &freeze.DescribeStagesRequest {
    }
)
if err != nil {
    panic("error occurred")
}
items := result.Items

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\DescribeStagesRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->describeStages(
        (new DescribeStagesRequest())
    );
    $items = $result->getItems();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.DescribeStagesRequest;
import io.gs2.freeze.result.DescribeStagesResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    DescribeStagesResult result = client.describeStages(
        new DescribeStagesRequest()
    );
    List<Stage> items = result.getItems();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.DescribeStagesResult> asyncResult = null;
yield return client.DescribeStages(
    new Gs2.Gs2Freeze.Request.DescribeStagesRequest(),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var items = result.Items;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.describeStages(
        new Gs2Freeze.DescribeStagesRequest()
    );
    const items = result.getItems();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.describe_stages(
        freeze.DescribeStagesRequest()
    )
    items = result.items
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.describe_stages({
})

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

result = api_result.result
items = result.items;

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.describe_stages_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
items = result.items;

```




---

### getStage

Get stage

Retrieves detailed information about a specific deployment stage, including the source microservice versions (from the previous stage) and the currently deployed microservice versions.
The source versions represent the version configuration that would be applied on the next promotion, while the current versions represent what is actually deployed.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |

#### Result

|  | Type | Description |
| --- | --- | --- |
| item | [Stage](#stage) | Stage |
| source | [List&lt;Microservice&gt;](#microservice) | List of source microservice versions |
| current | [List&lt;Microservice&gt;](#microservice) | List of current microservice versions |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.GetStage(
    &freeze.GetStageRequest {
        StageName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
source := result.Source
current := result.Current

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\GetStageRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->getStage(
        (new GetStageRequest())
            ->withStageName("namespace-0001")
    );
    $item = $result->getItem();
    $source = $result->getSource();
    $current = $result->getCurrent();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.GetStageRequest;
import io.gs2.freeze.result.GetStageResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    GetStageResult result = client.getStage(
        new GetStageRequest()
            .withStageName("namespace-0001")
    );
    Stage item = result.getItem();
    List<Microservice> source = result.getSource();
    List<Microservice> current = result.getCurrent();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.GetStageResult> asyncResult = null;
yield return client.GetStage(
    new Gs2.Gs2Freeze.Request.GetStageRequest()
        .WithStageName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;
var source = result.Source;
var current = result.Current;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.getStage(
        new Gs2Freeze.GetStageRequest()
            .withStageName("namespace-0001")
    );
    const item = result.getItem();
    const source = result.getSource();
    const current = result.getCurrent();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.get_stage(
        freeze.GetStageRequest()
            .with_stage_name('namespace-0001')
    )
    item = result.item
    source = result.source
    current = result.current
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.get_stage({
    stageName="namespace-0001",
})

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

result = api_result.result
item = result.item;
source = result.source;
current = result.current;

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.get_stage_async({
    stageName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;
source = result.source;
current = result.current;

```




---

### promoteStage

Promote stage

Applies the microservice versions from the source stage to this stage, initiating an asynchronous deployment process.
The stage status changes to Updating during the process, and returns to Active on success or UpdateFailed on failure.
Progress can be monitored via the Output API.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |

#### Result

|  | Type | Description |
| --- | --- | --- |
| item | [Stage](#stage) | Stage updated |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.PromoteStage(
    &freeze.PromoteStageRequest {
        StageName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\PromoteStageRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->promoteStage(
        (new PromoteStageRequest())
            ->withStageName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.PromoteStageRequest;
import io.gs2.freeze.result.PromoteStageResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    PromoteStageResult result = client.promoteStage(
        new PromoteStageRequest()
            .withStageName("namespace-0001")
    );
    Stage item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.PromoteStageResult> asyncResult = null;
yield return client.PromoteStage(
    new Gs2.Gs2Freeze.Request.PromoteStageRequest()
        .WithStageName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.promoteStage(
        new Gs2Freeze.PromoteStageRequest()
            .withStageName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.promote_stage(
        freeze.PromoteStageRequest()
            .with_stage_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.promote_stage({
    stageName="namespace-0001",
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.promote_stage_async({
    stageName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

```




---

### rollbackStage

Rollback stage

Reverts the stage to the previously deployed microservice versions, initiating an asynchronous rollback process.
The stage status changes to Updating during the process, and returns to Active on success or UpdateFailed on failure.
Progress can be monitored via the Output API.



#### Request

|  | Type | Condition | Required | Default | Value Limits | Description |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128 chars | Stage name<br>The identifier for this stage environment (e.g., "dev", "stg", "live"). |

#### Result

|  | Type | Description |
| --- | --- | --- |
| item | [Stage](#stage) | Stage updated |

#### Implementation Example




**Go**
```go

import "github.com/gs2io/gs2-golang-sdk/core"
import "github.com/gs2io/gs2-golang-sdk/freeze"
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 := freeze.Gs2FreezeRestClient{
    Session: &session,
}
result, err := client.RollbackStage(
    &freeze.RollbackStageRequest {
        StageName: pointy.String("namespace-0001"),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item

```

**PHP**
```php

use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\Freeze\Gs2FreezeRestClient;
use Gs2\Freeze\Request\RollbackStageRequest;

$session = new Gs2RestSession(
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    ),
    Region::AP_NORTHEAST_1
);

$session->open();

$client = new Gs2FreezeRestClient(
    $session
);

try {
    $result = $client->rollbackStage(
        (new RollbackStageRequest())
            ->withStageName("namespace-0001")
    );
    $item = $result->getItem();
} catch (Gs2Exception $e) {
    exit("error occurred")
}

```

**Java**
```java

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.freeze.rest.Gs2FreezeRestClient;
import io.gs2.freeze.request.RollbackStageRequest;
import io.gs2.freeze.result.RollbackStageResult;

Gs2RestSession session = new Gs2RestSession(
    Region.AP_NORTHEAST_1,
    new BasicGs2Credential(
        "your client id",
        "your client secret"
    )
);
session.connect();
Gs2FreezeRestClient client = new Gs2FreezeRestClient(session);

try {
    RollbackStageResult result = client.rollbackStage(
        new RollbackStageRequest()
            .withStageName("namespace-0001")
    );
    Stage item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}

```

**C#**
```csharp

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 Gs2FreezeRestClient(session);

AsyncResult<Gs2.Gs2Freeze.Result.RollbackStageResult> asyncResult = null;
yield return client.RollbackStage(
    new Gs2.Gs2Freeze.Request.RollbackStageRequest()
        .WithStageName("namespace-0001"),
    r => asyncResult = r
);
if (asyncResult.Error != null) {
    throw asyncResult.Error;
}
var result = asyncResult.Result;
var item = result.Item;

```

**TypeScript**
```typescript

import Gs2Core from '@/gs2/core';
import * as Gs2Freeze from '@/gs2/freeze';

const session = new Gs2Core.Gs2RestSession(
    "ap-northeast-1",
    new Gs2Core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
);
await session.connect();
const client = new Gs2Freeze.Gs2FreezeRestClient(session);

try {
    const result = await client.rollbackStage(
        new Gs2Freeze.RollbackStageRequest()
            .withStageName("namespace-0001")
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}

```

**Python**
```python

from gs2 import core
from gs2 import freeze

session = core.Gs2RestSession(
    core.BasicGs2Credential(
        'your client id',
        'your client secret'
    ),
    "ap-northeast-1",
)
session.connect()
client = freeze.Gs2FreezeRestClient(session)

try:
    result = client.rollback_stage(
        freeze.RollbackStageRequest()
            .with_stage_name('namespace-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    exit(1)


```

**GS2-Script**
```lua

client = gs2('freeze')

api_result = client.rollback_stage({
    stageName="namespace-0001",
})

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

result = api_result.result
item = result.item;

```

**GS2-Script(Async)**
```lua

client = gs2('freeze')

api_result_handler = client.rollback_stage_async({
    stageName="namespace-0001",
})

api_result = api_result_handler()  -- Call the handler to get the result

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

result = api_result.result
item = result.item;

```




---



