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

# GS2-Freeze SDK API 레퍼런스

각종 프로그래밍 언어용 GS2-Freeze SDK의 모델 사양과 API 레퍼런스



## 모델

### Output

스테이지 업데이트 진행 상황 출력<br>

스테이지 버전 업데이트 작업 중에 생성되는 로그 엔트리를 나타냅니다. 각 출력은 업데이트 프로세스의 단계나 이벤트를 기록합니다. 출력은 30일 후 자동으로 정리(클린업)됩니다.


|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| outputId | string |  | ※ |  |  ~ 1024자 | 스테이지 갱신 진행 상황 출력 GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ | UUID |  ~ 36자 | 출력명<br>스테이지 업데이트 진행 상황 출력의 고유한 이름을 보관합니다.<br>이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 스테이지 업데이트 진행 상황 출력을 식별하는 데 사용됩니다. |
| text | string |  | ✓ |  |  ~ 1048576자 | 텍스트<br>스테이지 업데이트 프로세스 중 특정 단계나 이벤트를 기술하는 로그 메시지 내용입니다. 버전 전환 작업의 상태 정보, 오류 상세, 진행 지표 등을 포함하는 경우가 있습니다. |
| createdAt | long |  | ※ | 현재 시각 |  | 일시 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | 리비전 |

**관련 메서드:**
describeOutputs - 스테이지 업데이트 진행 상황 출력 목록 취득
getOutput - 스테이지 업데이트 진행 상황 출력 취득



---

### Stage

스테이지<br>

스테이지란 프로그램 버전을 고정하는 환경 정보입니다.<br>
하나의 프로젝트에 대해 여러 개의 스테이지를 가질 수 있습니다.<br>
스테이지는 소스 스테이지를 가지며, 소스 스테이지에서 고정된 버전으로 전환하는 것이 가능합니다.<br>

이 구조를 이용하면 먼저 dev 스테이지에 최신 버전을 반영하여 개발자 레벨에서 동작을 확인하고,<br>
문제가 없어 보이면 dev 스테이지를 소스 스테이지로 하는 stg 스테이지에 반영하며,<br>
QA를 마치면 stg 스테이지를 소스 스테이지로 하는 live 스테이지에 반영하는 방식의 운영이 가능해집니다.


|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageId | string |  | ※ |  |  ~ 1024자 | 스테이지 GRN<br>※ 서버가 자동으로 설정 |
| name | string |  | ✓ |  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |
| sourceStageName | string |  |  |  |  ~ 128자 | 소스 스테이지명<br>이 스테이지가 버전 설정을 가져오는 원본 스테이지명입니다. 업데이트 시 소스 스테이지에서 고정된 버전이 채택됩니다. 예를 들어, "stg" 스테이지의 소스를 "dev"로, "live" 스테이지의 소스를 "stg"로 설정합니다. 지정하지 않은 경우 최신 버전이 직접 사용됩니다. |
| sortNumber | int |  | ✓ |  | 0 ~ 100 | 정렬 번호<br>스테이지의 표시 순서를 제어하기 위한 숫자입니다. 작은 숫자가 먼저 표시됩니다. 스테이지를 논리적인 순서로 나열하는 데 편리합니다(예: dev=0, stg=50, live=100). |
| status | 문자열 열거형<br>enum {<br>"Active",<br>"Updating",<br>"UpdateFailed"<br>}<br> |  |  | "Active" |  | 상태<br>스테이지의 현재 상태입니다. "Active"는 고정된 버전으로 요청을 처리하고 있는 정상 운영 상태를 나타냅니다. "Updating"은 버전 전환이 진행 중임을 나타냅니다. "UpdateFailed"는 버전 업데이트 중 오류가 발생하여 수동 대응이 필요할 수 있음을 나타냅니다.Active: 유효 / Updating: 업데이트 중 / UpdateFailed: 업데이트 실패 /  |
| createdAt | long |  | ※ | 현재 시각 |  | 생성일시<br>UNIX 시간・밀리초<br>※ 서버가 자동으로 설정 |
| updatedAt | long |  | ※ | 현재 시각 |  | 최종 갱신일시<br>UNIX 시간・밀리초<br>※ 서버가 자동으로 설정 |
| revision | long |  |  | 0 | 0 ~ 9223372036854775805 | 리비전 |

**관련 메서드:**
describeStages - 스테이지 목록 취득
getStage - 스테이지 취득
promoteStage - 스테이지 프로모트
rollbackStage - 스테이지 롤백



---

### Microservice

마이크로서비스<br>

GS2 마이크로서비스 컴포넌트를 나타냅니다. 각 마이크로서비스는 이름과 버전을 가지며, 특정 스테이지에 고정할 수 있습니다.


|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| name | string |  | ✓ |  |  ~ 128자 | 마이크로서비스명<br>이 마이크로서비스의 식별자입니다. |
| version | string |  | ✓ |  |  ~ 32자 | 마이크로서비스 버전<br>이 마이크로서비스의 버전 식별자입니다. 스테이지 배포 시 마이크로서비스를 특정 버전에 고정하여, 환경 간에 일관된 동작을 보장하는 데 사용됩니다. |

**관련 메서드:**
getStage - 스테이지 취득



---
## 메서드

### describeOutputs

스테이지 업데이트 진행 상황 출력 목록 취득<br>

특정 스테이지의 업데이트 작업(프로모트/롤백)에 대한 출력 로그 엔트리의 페이지네이션 목록을 취득합니다.<br>
출력 엔트리는 프로모트 또는 롤백 프로세스의 각 단계(시작, 단계 완료, 최종 성공 또는 실패 메시지)에서 생성됩니다.<br>
이 API를 사용하여 진행 중인 배포의 진행 상황을 모니터링할 수 있습니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |
| pageToken | string |  | |  |  ~ 1024자 | 데이터 취득을 시작할 위치를 지정하는 토큰 |
| limit | int |  | | 30 | 1 ~ 1000 | 취득할 데이터 건수 |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| items | [List&lt;Output&gt;](#output) | 스테이지 업데이트 진행 상황 출력 리스트 |
| nextPageToken | string | 목록의 나머지를 취득하기 위한 페이지 토큰 |

#### 구현 예제




**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

스테이지 업데이트 진행 상황 출력 취득<br>

스테이지의 업데이트 작업에 대한 특정 출력 로그 엔트리를 취득합니다.<br>
각 출력 엔트리에는 프로모트 또는 롤백 프로세스의 해당 시점에서 발생한 내용을 설명하는 텍스트 메시지가 포함됩니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |
| outputName | string |  | ✓| UUID |  ~ 36자 | 출력명<br>스테이지 업데이트 진행 상황 출력의 고유한 이름을 보관합니다.<br>이름은 UUID(Universally Unique Identifier) 형식으로 자동 생성되며, 각 스테이지 업데이트 진행 상황 출력을 식별하는 데 사용됩니다. |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| item | [Output](#output) | 스테이지 업데이트 진행 상황 출력 |

#### 구현 예제




**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

스테이지 목록 취득<br>

요청한 사용자가 소유한 배포 스테이지의 목록을 취득합니다.<br>
각 스테이지는 고유한 마이크로서비스 버전 구성을 가진 환경(예: 개발, 스테이징, 프로덕션)을 나타냅니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| items | [List&lt;Stage&gt;](#stage) | 스테이지 리스트 |

#### 구현 예제




**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

스테이지 취득<br>

특정 배포 스테이지의 상세 정보를 취득합니다. 소스 마이크로서비스 버전(이전 단계 스테이지의 버전)과 현재 배포되어 있는 마이크로서비스 버전을 포함합니다.<br>
소스 버전은 다음 프로모션 시 적용될 버전 구성을 나타내며, 현재 버전은 실제로 배포되어 있는 버전을 나타냅니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| item | [Stage](#stage) | 스테이지 |
| source | [List&lt;Microservice&gt;](#microservice) | 소스 마이크로서비스 버전 리스트 |
| current | [List&lt;Microservice&gt;](#microservice) | 현재 적용되어 있는 마이크로서비스 버전 리스트 |

#### 구현 예제




**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

스테이지 프로모트<br>

소스 스테이지의 마이크로서비스 버전을 이 스테이지에 적용하고, 비동기 배포 프로세스를 시작합니다.<br>
처리 중에는 스테이지 상태가 Updating으로 변경되며, 성공 시 Active, 실패 시 UpdateFailed가 됩니다.<br>
진행 상황은 Output API로 모니터링할 수 있습니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| item | [Stage](#stage) | 업데이트한 스테이지 |

#### 구현 예제




**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

스테이지 롤백<br>

스테이지를 이전에 배포되어 있던 마이크로서비스 버전으로 되돌리고, 비동기 롤백 프로세스를 시작합니다.<br>
처리 중에는 스테이지 상태가 Updating으로 변경되며, 성공 시 Active, 실패 시 UpdateFailed가 됩니다.<br>
진행 상황은 Output API로 모니터링할 수 있습니다.


#### Request

|  | 타입 | 활성화 조건 | 필수 | 기본값 | 값 제한 | 설명 |
| --- | --- | --- | --- | --- | --- | --- |
| stageName | string |  | ✓|  |  ~ 128자 | 스테이지명<br>이 스테이지 환경의 식별자입니다(예: "dev", "stg", "live"). |

#### Result

|  | 타입 | 설명 |
| --- | --- | --- |
| item | [Stage](#stage) | 업데이트한 스테이지 |

#### 구현 예제




**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;

```



---



