NAV
go python java php typescript csharp GS2-Script

GS2-Deploy

GS2-SDK のリファレンス

モデル

Stack

スタックとは GS2-Deploy を利用してGS2上のリソースをセットアップするエンティティです。

スタックにはテンプレートファイルを指定するようになっており、テンプレートファイルには GS2 上で必要となるリソースを定義します。 GS2-Deploy はスタックを新規作成または更新する際にはテンプレートファイルの変更点を検出し 追加があればリソースを作成、変更があればリソースを更新、削除があればリソースを削除します。

この仕組みを利用することで、GS2上のリソースを宣言的に記述し、再現可能な状態で管理することが可能となります。 この再現性があることで、開発環境から本番環境に設定を移行する際などにミスなく実行できるようになります。

説明
stackId string スタックGRN
name string スタック名
description string 説明文
template string テンプレートデータ
status string 実行状態
createdAt long 作成日時
updatedAt long 最終更新日時

Resource

説明
resourceId string 作成されたのリソースGRN
type string リソースの種類
name string リソース名
request string リクエストパラメータ
response string リソースの作成・更新のレスポンス
rollbackContext string ロールバック操作の種類
rollbackRequest string ロールバック用のリクエストパラメータ
rollbackAfter string[] ロールバック時に依存しているリソースの名前
outputFields OutputField[] リソースを作成したときに Output に記録するフィールド
workId string このリソースが作成された時の実行 ID
createdAt long 作成日時

Event

説明
eventId string 発生したイベントGRN
name string イベント名
resourceName string イベントの種類
type string イベントの種類
message string メッセージ
eventAt long 作成日時

Output

説明
outputId string アウトプットGRN
name string アウトプット名
value string
createdAt long 作成日時

GitHubCheckoutSetting

説明
apiKeyId string GitHub のAPIキーGRN
repositoryName string リポジトリ名
sourcePath string ソースコードのファイルパス
referenceType string コードの取得元
commitHash string コミットハッシュ
branchName string ブランチ名
tagName string タグ名

OutputField

説明
name string 名前
fieldName string フィールド名

メソッド

describeStacks

describeStacks

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

try {
    $result = $client->describeStacks(
        (new DescribeStacksRequest())
            ->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()
            .withPageToken(null)
            .withLimit(null)
    );
    List<Stack> items = result.getItems();
    String nextPageToken = result.getNextPageToken();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DescribeStacksRequest;
using Gs2.Gs2Deploy.Result.DescribeStacksResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeStacks(
    new DescribeStacksRequest()
        .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()
            .withPageToken(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.describe_stacks(
        new deploy.DescribeStacksRequest()
            .with_page_token(None)
            .with_limit(None)
    )
    items = result.items
    next_page_token = result.next_page_token
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.describe_stacks({
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

スタックの一覧を取得

Request

必須 デフォルト 値の制限 説明
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Stack[] スタックのリスト
nextPageToken string リストの続きを取得するためのページトークン

createStack

createStack

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,
        Template: pointy.String(`
        GS2TemplateFormatVersion: "2019-05-01"
        Description: Template Sample

        Resources:
          IdentifierAuthUser:
            Type: GS2::Identifier::User
            Properties:
              Name: auth

        Outputs:
          SecretKey: !GetAttr IdentifierAuthUser.Name
        `),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createStack(
        (new CreateStackRequest())
            ->withName('stack-0001')
            ->withDescription(null)
            ->withTemplate("
            GS2TemplateFormatVersion: \"2019-05-01\"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            ")
    );
    $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)
            .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")
    );
    Stack item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.CreateStackRequest;
using Gs2.Gs2Deploy.Result.CreateStackResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createStack(
    new CreateStackRequest()
        .withName("stack-0001")
        .withDescription(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"),
    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(undefined)
            .withTemplate(`
            GS2TemplateFormatVersion: "2019-05-01"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            `)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.create_stack(
        new deploy.CreateStackRequest()
            .with_name('stack-0001')
            .with_description(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')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.create_stack({
    name='stack-0001',
    description=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',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを新規作成

Request

必須 デフォルト 値の制限 説明
name string ~ 128文字 スタック名
description string ~ 1024文字 説明文
template string ~ 5242880文字 テンプレートデータ

Result

説明
item Stack 作成したスタック

createStackFromGitHub

createStackFromGitHub

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: {'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->createStackFromGitHub(
        (new CreateStackFromGitHubRequest())
            ->withName('stack-0001')
            ->withDescription(null)
            ->withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    Stack item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.CreateStackFromGitHubRequest;
using Gs2.Gs2Deploy.Result.CreateStackFromGitHubResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.createStackFromGitHub(
    new CreateStackFromGitHubRequest()
        .withName("stack-0001")
        .withDescription(null)
        .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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(undefined)
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.create_stack_from_git_hub(
        new deploy.CreateStackFromGitHubRequest()
            .with_name('stack-0001')
            .with_description(None)
            .with_checkout_setting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.create_stack_from_git_hub({
    name='stack-0001',
    description=nil,
    checkoutSetting={'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを新規作成

Request

必須 デフォルト 値の制限 説明
name string ~ 128文字 スタック名
description string ~ 1024文字 説明文
checkoutSetting GitHubCheckoutSetting GitHubからソースコードをチェックアウトしてくる設定

Result

説明
item Stack 作成したスタック

validate

validate

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 {
        Template: pointy.String(`
        GS2TemplateFormatVersion: "2019-05-01"
        Description: Template Sample

        Resources:
          IdentifierAuthUser:
            Type: GS2::Identifier::User
            Properties:
              Name: auth

        Outputs:
          SecretKey: !GetAttr IdentifierAuthUser.Name
        `),
    }
)
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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->validate(
        (new ValidateRequest())
            ->withTemplate("
            GS2TemplateFormatVersion: \"2019-05-01\"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            ")
    );
} 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()
            .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")
    );
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.ValidateRequest;
using Gs2.Gs2Deploy.Result.ValidateResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.validate(
    new ValidateRequest()
        .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"),
    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()
            .withTemplate(`
            GS2TemplateFormatVersion: "2019-05-01"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            `)
    );
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.validate(
        new deploy.ValidateRequest()
            .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')
    )
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.validate({
    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',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result

テンプレートを検証

このAPIの検証内容は簡易検証を行うに過ぎず、 このAPIで検証をパスしたとしても、実行したらエラーが発生する場合もあります

Request

必須 デフォルト 値の制限 説明
template string ~ 5242880文字 テンプレートデータ

Result

説明

getStackStatus

getStackStatus

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.Status
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\GetStackStatusRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.GetStackStatusRequest;
using Gs2.Gs2Deploy.Result.GetStackStatusResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getStackStatus(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.get_stack_status(
        new deploy.GetStackStatusRequest()
            .with_stack_name('stack-0001')
    )
    status = result.status
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.get_stack_status({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
status = result.status;

スタックを取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
status string

getStack

getStack

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.Item
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\GetStackRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.GetStackRequest;
using Gs2.Gs2Deploy.Result.GetStackResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getStack(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.get_stack(
        new deploy.GetStackRequest()
            .with_stack_name('stack-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.get_stack({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
item Stack スタック

updateStack

updateStack

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,
        Template: pointy.String(`
        GS2TemplateFormatVersion: "2019-05-01"
        Description: Template Sample

        Resources:
          IdentifierAuthUser:
            Type: GS2::Identifier::User
            Properties:
              Name: auth

        Outputs:
          SecretKey: !GetAttr IdentifierAuthUser.Name
        `),
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateStack(
        (new UpdateStackRequest())
            ->withStackName('stack-0001')
            ->withDescription(null)
            ->withTemplate("
            GS2TemplateFormatVersion: \"2019-05-01\"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            ")
    );
    $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)
            .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")
    );
    Stack item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.UpdateStackRequest;
using Gs2.Gs2Deploy.Result.UpdateStackResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateStack(
    new UpdateStackRequest()
        .withStackName("stack-0001")
        .withDescription(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"),
    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(undefined)
            .withTemplate(`
            GS2TemplateFormatVersion: "2019-05-01"
            Description: Template Sample

            Resources:
              IdentifierAuthUser:
                Type: GS2::Identifier::User
                Properties:
                  Name: auth

            Outputs:
              SecretKey: !GetAttr IdentifierAuthUser.Name
            `)
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.update_stack(
        new deploy.UpdateStackRequest()
            .with_stack_name('stack-0001')
            .with_description(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')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.update_stack({
    stackName='stack-0001',
    description=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',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを更新

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
description string ~ 1024文字 説明文
template string ~ 5242880文字 テンプレートデータ

Result

説明
item Stack 更新したスタック

updateStackFromGitHub

updateStackFromGitHub

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: {'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
    }
)
if err != nil {
    panic("error occurred")
}
item := result.Item
use Gs2\Core\Model\BasicGs2Credential;
use Gs2\Core\Model\Region;
use Gs2\Core\Net\Gs2RestSession;
use Gs2\Core\Exception\Gs2Exception;
use Gs2\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 Gs2AccountRestClient(
    $session
);

try {
    $result = $client->updateStackFromGitHub(
        (new UpdateStackFromGitHubRequest())
            ->withStackName('stack-0001')
            ->withDescription(null)
            ->withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    Stack item = result.getItem();
} catch (Gs2Exception e) {
    System.exit(1);
}
using Gs2.Core.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.UpdateStackFromGitHubRequest;
using Gs2.Gs2Deploy.Result.UpdateStackFromGitHubResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.updateStackFromGitHub(
    new UpdateStackFromGitHubRequest()
        .withStackName("stack-0001")
        .withDescription(null)
        .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': '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(undefined)
            .withCheckoutSetting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    );
    const item = result.getItem();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.update_stack_from_git_hub(
        new deploy.UpdateStackFromGitHubRequest()
            .with_stack_name('stack-0001')
            .with_description(None)
            .with_checkout_setting({'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'})
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.update_stack_from_git_hub({
    stackName='stack-0001',
    description=nil,
    checkoutSetting={'apiKeyId': '$gitHubApiKey1.apiKeyId', 'repositoryName': 'gs2io/master-data', 'sourcePath': 'path/to/file.json', 'referenceType': 'branch', 'branchName': 'develop'},
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを更新

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
description string ~ 1024文字 説明文
checkoutSetting GitHubCheckoutSetting GitHubからソースコードをチェックアウトしてくる設定

Result

説明
item Stack 更新したスタック

deleteStack

deleteStack

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.Item
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\DeleteStackRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DeleteStackRequest;
using Gs2.Gs2Deploy.Result.DeleteStackResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteStack(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.delete_stack(
        new deploy.DeleteStackRequest()
            .with_stack_name('stack-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.delete_stack({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを削除

スタックによって作成されたリソースの削除を行い、成功すればエンティティを削除します。 何らかの理由でリソースの削除に失敗した場合はエンティティが残ります。

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
item Stack 削除したスタック

forceDeleteStack

forceDeleteStack

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.Item
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\ForceDeleteStackRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.ForceDeleteStackRequest;
using Gs2.Gs2Deploy.Result.ForceDeleteStackResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.forceDeleteStack(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.force_delete_stack(
        new deploy.ForceDeleteStackRequest()
            .with_stack_name('stack-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.force_delete_stack({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを強制的に最終削除

スタックのエンティティを強制的に削除します。 スタックが作成したリソースが残っていても、それらは削除されません。

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
item Stack 削除したスタック

deleteStackResources

deleteStackResources

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.Item
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\DeleteStackResourcesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DeleteStackResourcesRequest;
using Gs2.Gs2Deploy.Result.DeleteStackResourcesResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteStackResources(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.delete_stack_resources(
        new deploy.DeleteStackResourcesRequest()
            .with_stack_name('stack-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.delete_stack_resources({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックのリソースを削除

スタックによって作成されたリソースの削除を行います。 空のテンプレートでスタックを更新するのとほぼ同様の挙動ですが、スタックに適用されていたテンプレートが残るため、誤操作時に、残ったテンプレートからリソースを復元することができます。

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
item Stack リソースを削除したスタック

deleteStackEntity

deleteStackEntity

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.Item
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\DeleteStackEntityRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DeleteStackEntityRequest;
using Gs2.Gs2Deploy.Result.DeleteStackEntityResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.deleteStackEntity(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.delete_stack_entity(
        new deploy.DeleteStackEntityRequest()
            .with_stack_name('stack-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.delete_stack_entity({
    stackName='stack-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

スタックを最終削除

スタックのエンティティを削除します。 リソースの残っているスタックを削除しようとするとエラーになります。

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名

Result

説明
item Stack 削除したスタック

describeResources

describeResources

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.NextPageToken
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\DescribeResourcesRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DescribeResourcesRequest;
using Gs2.Gs2Deploy.Result.DescribeResourcesResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeResources(
    new 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(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.describe_resources(
        new 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:
    os.exit(1);

client = gs2('deploy')

api_result = client.describe_resources({
    stackName='stack-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

作成されたのリソースの一覧を取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Resource[] 作成されたのリソースのリスト
nextPageToken string リストの続きを取得するためのページトークン

getResource

getResource

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.Item
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\GetResourceRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.GetResourceRequest;
using Gs2.Gs2Deploy.Result.GetResourceResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getResource(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.get_resource(
        new deploy.GetResourceRequest()
            .with_stack_name('stack-0001')
            .with_resource_name('resource-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.get_resource({
    stackName='stack-0001',
    resourceName='resource-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

作成されたのリソースを取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
resourceName string ~ 128文字 リソース名

Result

説明
item Resource 作成されたのリソース

describeEvents

describeEvents

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.NextPageToken
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\DescribeEventsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DescribeEventsRequest;
using Gs2.Gs2Deploy.Result.DescribeEventsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeEvents(
    new 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(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.describe_events(
        new 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:
    os.exit(1);

client = gs2('deploy')

api_result = client.describe_events({
    stackName='stack-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

発生したイベントの一覧を取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Event[] 発生したイベントのリスト
nextPageToken string リストの続きを取得するためのページトークン

getEvent

getEvent

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.Item
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\GetEventRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.GetEventRequest;
using Gs2.Gs2Deploy.Result.GetEventResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getEvent(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.get_event(
        new deploy.GetEventRequest()
            .with_stack_name('stack-0001')
            .with_event_name('event-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.get_event({
    stackName='stack-0001',
    eventName='event-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

発生したイベントを取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
eventName string UUID ~ 36文字 イベント名

Result

説明
item Event 発生したイベント

describeOutputs

describeOutputs

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.NextPageToken
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\DescribeOutputsRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.DescribeOutputsRequest;
using Gs2.Gs2Deploy.Result.DescribeOutputsResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.describeOutputs(
    new 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(undefined)
            .withLimit(undefined)
    );
    const items = result.getItems();
    const nextPageToken = result.getNextPageToken();
} catch (e) {
    process.exit(1);
}
from gs2 import core
from gs2 import deploy

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.describe_outputs(
        new 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:
    os.exit(1);

client = gs2('deploy')

api_result = client.describe_outputs({
    stackName='stack-0001',
    pageToken=nil,
    limit=nil,
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

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

アウトプットの一覧を取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
pageToken string ~ 1024文字 データの取得を開始する位置を指定するトークン
limit int 30 1 ~ 1000 データの取得件数

Result

説明
items Output[] アウトプットのリスト
nextPageToken string リストの続きを取得するためのページトークン

getOutput

getOutput

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.Item
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\GetOutputRequest;

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

$session->open();

$client = new Gs2AccountRestClient(
    $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.Model.Region;
using Gs2.Core.Model.BasicGs2Credential;
using Gs2.Core.Net.Gs2RestSession;
using Gs2.Core.Exception.Gs2Exception;
using Gs2.Core.AsyncResult;
using Gs2.Gs2Deploy.Gs2DeployRestClient;
using Gs2.Gs2Deploy.Request.GetOutputRequest;
using Gs2.Gs2Deploy.Result.GetOutputResult;

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

AsyncResult<Gs2.Gs2Account.Result.CreateNamespaceResult> asyncResult = null;
yield return client.getOutput(
    new 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

const session = new core.Gs2RestSession(
    "ap-northeast-1",
    new core.BasicGs2Credential(
        'your client id',
        'your client secret'
    )
)
await session.connect()
client = new deploy.Gs2DeployRestClient(session)

try:
    result = client.get_output(
        new deploy.GetOutputRequest()
            .with_stack_name('stack-0001')
            .with_output_name('output-0001')
    )
    item = result.item
except core.Gs2Exception as e:
    os.exit(1);

client = gs2('deploy')

api_result = client.get_output({
    stackName='stack-0001',
    outputName='output-0001',
});

if(api_result.isError) then
    # エラー発生時
    fail(api_result['statusCode'], api_result['message'])
end

result = api_result.result
item = result.item;

アウトプットを取得

Request

必須 デフォルト 値の制限 説明
stackName string ~ 128文字 スタック名
outputName string ~ 1024文字 アウトプット名

Result

説明
item Output アウトプット