builder/ncloud: Migrate ncloud-sdk-go-v1 to ncloud-sdk-go-v2 (#8678)

This commit is contained in:
Yu SungDuk 2020-02-03 22:55:01 +09:00 committed by GitHub
parent 4f78876754
commit df18187032
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
204 changed files with 9265 additions and 2983 deletions

View File

@ -4,13 +4,13 @@ import (
"bytes"
"fmt"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
)
const BuilderID = "ncloud.server.image"
type Artifact struct {
ServerImage *ncloud.ServerImage
MemberServerImage *server.MemberServerImage
// StateData should store data such as GeneratedData
// to be shared with post-processors
@ -27,7 +27,7 @@ func (a *Artifact) Files() []string {
}
func (a *Artifact) Id() string {
return a.ServerImage.MemberServerImageNo
return *a.MemberServerImage.MemberServerImageNo
}
func (a *Artifact) String() string {
@ -35,8 +35,8 @@ func (a *Artifact) String() string {
// TODO : Logging artifact information
buf.WriteString(fmt.Sprintf("%s:\n\n", a.BuilderId()))
buf.WriteString(fmt.Sprintf("Member Server Image Name: %s\n", a.ServerImage.MemberServerImageName))
buf.WriteString(fmt.Sprintf("Member Server Image No: %s\n", a.ServerImage.MemberServerImageNo))
buf.WriteString(fmt.Sprintf("Member Server Image Name: %s\n", *a.MemberServerImage.MemberServerImageName))
buf.WriteString(fmt.Sprintf("Member Server Image No: %s\n", *a.MemberServerImage.MemberServerImageNo))
return buf.String()
}
@ -45,7 +45,7 @@ func (a *Artifact) State(name string) interface{} {
if _, ok := a.StateData[name]; ok {
return a.StateData[name]
}
return a.ServerImage.MemberServerImageStatus
return a.MemberServerImage.MemberServerImageStatus
}
func (a *Artifact) Destroy() error {

View File

@ -3,7 +3,7 @@ package ncloud
import (
"context"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/hcl/v2/hcldec"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
@ -33,7 +33,15 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error) {
ui.Message("Creating Naver Cloud Platform Connection ...")
conn := ncloud.NewConnection(b.config.AccessKey, b.config.SecretKey)
config := Config{
AccessKey: b.config.AccessKey,
SecretKey: b.config.SecretKey,
}
conn, err := config.Client()
if err != nil {
return nil, err
}
b.stateBag.Put("hook", hook)
b.stateBag.Put("ui", ui)
@ -109,7 +117,7 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack
}
if serverImage, ok := b.stateBag.GetOk("memberServerImage"); ok {
artifact.ServerImage = serverImage.(*ncloud.ServerImage)
artifact.MemberServerImage = serverImage.(*server.MemberServerImage)
}
return artifact, nil

View File

@ -8,6 +8,8 @@ import (
"fmt"
"os"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/common"
"github.com/hashicorp/packer/helper/communicator"
"github.com/hashicorp/packer/helper/config"
@ -140,3 +142,17 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
return warnings, nil
}
type NcloudAPIClient struct {
server *server.APIClient
}
func (c *Config) Client() (*NcloudAPIClient, error) {
apiKey := &ncloud.APIKey{
AccessKey: c.AccessKey,
SecretKey: c.SecretKey,
}
return &NcloudAPIClient{
server: server.NewAPIClient(server.NewConfiguration(apiKey)),
}, nil
}

View File

@ -7,22 +7,23 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
// StepCreateBlockStorageInstance struct is for making extra block storage
type StepCreateBlockStorageInstance struct {
Conn *ncloud.Conn
CreateBlockStorageInstance func(serverInstanceNo string) (string, error)
Conn *NcloudAPIClient
CreateBlockStorageInstance func(serverInstanceNo string) (*string, error)
Say func(message string)
Error func(e error)
Config *Config
}
// NewStepCreateBlockStorageInstance make StepCreateBlockStorage struct to make extra block storage
func NewStepCreateBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreateBlockStorageInstance {
func NewStepCreateBlockStorageInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateBlockStorageInstance {
var step = &StepCreateBlockStorageInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -35,24 +36,25 @@ func NewStepCreateBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *
return step
}
func (s *StepCreateBlockStorageInstance) createBlockStorageInstance(serverInstanceNo string) (string, error) {
func (s *StepCreateBlockStorageInstance) createBlockStorageInstance(serverInstanceNo string) (*string, error) {
reqParams := new(ncloud.RequestBlockStorageInstance)
reqParams.BlockStorageSize = s.Config.BlockStorageSize
reqParams.ServerInstanceNo = serverInstanceNo
reqParams := new(server.CreateBlockStorageInstanceRequest)
reqParams.BlockStorageSize = ncloud.Int64(int64(s.Config.BlockStorageSize))
reqParams.ServerInstanceNo = &serverInstanceNo
blockStorageInstanceList, err := s.Conn.CreateBlockStorageInstance(reqParams)
resp, err := s.Conn.server.V2Api.CreateBlockStorageInstance(reqParams)
if err != nil {
return "", err
return nil, err
}
log.Println("Block Storage Instance information : ", blockStorageInstanceList.BlockStorageInstance[0])
blockStorageInstance := resp.BlockStorageInstanceList[0]
log.Println("Block Storage Instance information : ", blockStorageInstance.BlockStorageInstanceNo)
if err := waiterBlockStorageInstanceStatus(s.Conn, blockStorageInstanceList.BlockStorageInstance[0].BlockStorageInstanceNo, "ATTAC", 10*time.Minute); err != nil {
return "", errors.New("TIMEOUT : Block Storage instance status is not attached")
if err := waiterBlockStorageInstanceStatus(s.Conn, blockStorageInstance.BlockStorageInstanceNo, "ATTAC", 10*time.Minute); err != nil {
return nil, errors.New("TIMEOUT : Block Storage instance status is not attached")
}
return blockStorageInstanceList.BlockStorageInstance[0].BlockStorageInstanceNo, nil
return blockStorageInstance.BlockStorageInstanceNo, nil
}
func (s *StepCreateBlockStorageInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
@ -66,7 +68,7 @@ func (s *StepCreateBlockStorageInstance) Run(ctx context.Context, state multiste
blockStorageInstanceNo, err := s.CreateBlockStorageInstance(serverInstanceNo)
if err == nil {
state.Put("BlockStorageInstanceNo", blockStorageInstanceNo)
state.Put("BlockStorageInstanceNo", *blockStorageInstanceNo)
}
return processStepResult(err, s.Error, state)
@ -86,16 +88,18 @@ func (s *StepCreateBlockStorageInstance) Cleanup(state multistep.StateBag) {
if blockStorageInstanceNo, ok := state.GetOk("BlockStorageInstanceNo"); ok {
s.Say("Clean up Block Storage Instance")
no := blockStorageInstanceNo.(string)
blockStorageInstanceList, err := s.Conn.DeleteBlockStorageInstances([]string{no})
reqParams := server.DeleteBlockStorageInstancesRequest{
BlockStorageInstanceNoList: []*string{blockStorageInstanceNo.(*string)},
}
blockStorageInstanceList, err := s.Conn.server.V2Api.DeleteBlockStorageInstances(&reqParams)
if err != nil {
return
}
s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage InstanceNo is %s", no))
log.Println("Block Storage Instance information : ", blockStorageInstanceList.BlockStorageInstance[0])
s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage InstanceNo is %s", blockStorageInstanceNo.(string)))
log.Println("Block Storage Instance information : ", blockStorageInstanceList.BlockStorageInstanceList[0])
if err := waiterBlockStorageInstanceStatus(s.Conn, no, "DETAC", time.Minute); err != nil {
if err := waiterBlockStorageInstanceStatus(s.Conn, blockStorageInstanceNo.(*string), "DETAC", time.Minute); err != nil {
s.Say("TIMEOUT : Block Storage instance status is not deattached")
}
}

View File

@ -11,7 +11,7 @@ import (
func TestStepCreateBlockStorageInstanceShouldFailIfOperationCreateBlockStorageInstanceFails(t *testing.T) {
var testSubject = &StepCreateBlockStorageInstance{
CreateBlockStorageInstance: func(serverInstanceNo string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
CreateBlockStorageInstance: func(serverInstanceNo string) (*string, error) { return nil, fmt.Errorf("!! Unit Test FAIL !!") },
Say: func(message string) {},
Error: func(e error) {},
Config: new(Config),
@ -33,8 +33,9 @@ func TestStepCreateBlockStorageInstanceShouldFailIfOperationCreateBlockStorageIn
}
func TestStepCreateBlockStorageInstanceShouldPassIfOperationCreateBlockStorageInstancePasses(t *testing.T) {
var instanceNo = "a"
var testSubject = &StepCreateBlockStorageInstance{
CreateBlockStorageInstance: func(serverInstanceNo string) (string, error) { return "a", nil },
CreateBlockStorageInstance: func(serverInstanceNo string) (*string, error) { return &instanceNo, nil },
Say: func(message string) {},
Error: func(e error) {},
Config: new(Config),

View File

@ -5,7 +5,7 @@ import (
"fmt"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
@ -16,13 +16,13 @@ type LoginKey struct {
}
type StepCreateLoginKey struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
CreateLoginKey func() (*LoginKey, error)
Say func(message string)
Error func(e error)
}
func NewStepCreateLoginKey(conn *ncloud.Conn, ui packer.Ui) *StepCreateLoginKey {
func NewStepCreateLoginKey(conn *NcloudAPIClient, ui packer.Ui) *StepCreateLoginKey {
var step = &StepCreateLoginKey{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -35,14 +35,15 @@ func NewStepCreateLoginKey(conn *ncloud.Conn, ui packer.Ui) *StepCreateLoginKey
}
func (s *StepCreateLoginKey) createLoginKey() (*LoginKey, error) {
KeyName := fmt.Sprintf("packer-%d", time.Now().Unix())
keyName := fmt.Sprintf("packer-%d", time.Now().Unix())
reqParams := &server.CreateLoginKeyRequest{KeyName: &keyName}
privateKey, err := s.Conn.CreateLoginKey(KeyName)
privateKey, err := s.Conn.server.V2Api.CreateLoginKey(reqParams)
if err != nil {
return nil, err
}
return &LoginKey{KeyName, privateKey.PrivateKey}, nil
return &LoginKey{keyName, *privateKey.PrivateKey}, nil
}
func (s *StepCreateLoginKey) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
@ -60,6 +61,7 @@ func (s *StepCreateLoginKey) Run(ctx context.Context, state multistep.StateBag)
func (s *StepCreateLoginKey) Cleanup(state multistep.StateBag) {
if loginKey, ok := state.GetOk("LoginKey"); ok {
s.Say("Clean up login key")
s.Conn.DeleteLoginKey(loginKey.(*LoginKey).KeyName)
reqParams := &server.DeleteLoginKeyRequest{KeyName: &loginKey.(*LoginKey).KeyName}
s.Conn.server.V2Api.DeleteLoginKey(reqParams)
}
}

View File

@ -6,21 +6,22 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepCreatePublicIPInstance struct {
Conn *ncloud.Conn
CreatePublicIPInstance func(serverInstanceNo string) (*ncloud.PublicIPInstance, error)
Conn *NcloudAPIClient
CreatePublicIPInstance func(serverInstanceNo string) (*server.PublicIpInstance, error)
WaiterAssociatePublicIPToServerInstance func(serverInstanceNo string, publicIP string) error
Say func(message string)
Error func(e error)
Config *Config
}
func NewStepCreatePublicIPInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreatePublicIPInstance {
func NewStepCreatePublicIPInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreatePublicIPInstance {
var step = &StepCreatePublicIPInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -35,21 +36,21 @@ func NewStepCreatePublicIPInstance(conn *ncloud.Conn, ui packer.Ui, config *Conf
}
func (s *StepCreatePublicIPInstance) waiterAssociatePublicIPToServerInstance(serverInstanceNo string, publicIP string) error {
reqParams := new(ncloud.RequestGetServerInstanceList)
reqParams.ServerInstanceNoList = []string{serverInstanceNo}
reqParams := new(server.GetServerInstanceListRequest)
reqParams.ServerInstanceNoList = []*string{&serverInstanceNo}
c1 := make(chan error, 1)
go func() {
for {
serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams)
serverInstanceList, err := s.Conn.server.V2Api.GetServerInstanceList(reqParams)
if err != nil {
c1 <- err
return
}
if publicIP == serverInstanceList.ServerInstanceList[0].PublicIP {
if publicIP == *serverInstanceList.ServerInstanceList[0].PublicIp {
c1 <- nil
return
}
@ -67,25 +68,25 @@ func (s *StepCreatePublicIPInstance) waiterAssociatePublicIPToServerInstance(ser
}
}
func (s *StepCreatePublicIPInstance) createPublicIPInstance(serverInstanceNo string) (*ncloud.PublicIPInstance, error) {
reqParams := new(ncloud.RequestCreatePublicIPInstance)
reqParams.ServerInstanceNo = serverInstanceNo
func (s *StepCreatePublicIPInstance) createPublicIPInstance(serverInstanceNo string) (*server.PublicIpInstance, error) {
reqParams := new(server.CreatePublicIpInstanceRequest)
reqParams.ServerInstanceNo = &serverInstanceNo
publicIPInstanceList, err := s.Conn.CreatePublicIPInstance(reqParams)
publicIPInstanceList, err := s.Conn.server.V2Api.CreatePublicIpInstance(reqParams)
if err != nil {
return nil, err
}
publicIPInstance := publicIPInstanceList.PublicIPInstanceList[0]
publicIP := publicIPInstance.PublicIP
s.Say(fmt.Sprintf("Public IP Instance [%s:%s] is created", publicIPInstance.PublicIPInstanceNo, publicIP))
publicIPInstance := publicIPInstanceList.PublicIpInstanceList[0]
publicIP := publicIPInstance.PublicIp
s.Say(fmt.Sprintf("Public IP Instance [%s:%s] is created", *publicIPInstance.PublicIpInstanceNo, *publicIP))
err = s.waiterAssociatePublicIPToServerInstance(serverInstanceNo, publicIP)
err = s.waiterAssociatePublicIPToServerInstance(serverInstanceNo, *publicIP)
if err != nil {
return nil, err
}
return &publicIPInstance, nil
return publicIPInstance, nil
}
func (s *StepCreatePublicIPInstance) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {
@ -95,11 +96,11 @@ func (s *StepCreatePublicIPInstance) Run(ctx context.Context, state multistep.St
publicIPInstance, err := s.CreatePublicIPInstance(serverInstanceNo)
if err == nil {
state.Put("PublicIP", publicIPInstance.PublicIP)
state.Put("PublicIP", *publicIPInstance.PublicIp)
state.Put("PublicIPInstance", publicIPInstance)
// instance_id is the generic term used so that users can have access to the
// instance id inside of the provisioners, used in step_provision.
state.Put("instance_id", publicIPInstance)
state.Put("instance_id", *publicIPInstance)
}
return processStepResult(err, s.Error, state)
@ -112,43 +113,45 @@ func (s *StepCreatePublicIPInstance) Cleanup(state multistep.StateBag) {
}
s.Say("Clean up Public IP Instance")
publicIPInstanceNo := publicIPInstance.(*ncloud.PublicIPInstance).PublicIPInstanceNo
publicIPInstanceNo := publicIPInstance.(*server.PublicIpInstance).PublicIpInstanceNo
s.waitPublicIPInstanceStatus(publicIPInstanceNo, "USED")
log.Println("Disassociate Public IP Instance ", publicIPInstanceNo)
s.Conn.DisassociatePublicIP(publicIPInstanceNo)
reqParams := &server.DisassociatePublicIpFromServerInstanceRequest{PublicIpInstanceNo: publicIPInstanceNo}
s.Conn.server.V2Api.DisassociatePublicIpFromServerInstance(reqParams)
s.waitPublicIPInstanceStatus(publicIPInstanceNo, "CREAT")
reqParams := new(ncloud.RequestDeletePublicIPInstances)
reqParams.PublicIPInstanceNoList = []string{publicIPInstanceNo}
reqDeleteParams := &server.DeletePublicIpInstancesRequest{
PublicIpInstanceNoList: ncloud.StringList([]string{*publicIPInstanceNo}),
}
log.Println("Delete Public IP Instance ", publicIPInstanceNo)
s.Conn.DeletePublicIPInstances(reqParams)
s.Conn.server.V2Api.DeletePublicIpInstances(reqDeleteParams)
}
func (s *StepCreatePublicIPInstance) waitPublicIPInstanceStatus(publicIPInstanceNo string, status string) {
func (s *StepCreatePublicIPInstance) waitPublicIPInstanceStatus(publicIPInstanceNo *string, status string) {
c1 := make(chan error, 1)
go func() {
reqParams := new(ncloud.RequestPublicIPInstanceList)
reqParams.PublicIPInstanceNoList = []string{publicIPInstanceNo}
reqParams := new(server.GetPublicIpInstanceListRequest)
reqParams.PublicIpInstanceNoList = []*string{publicIPInstanceNo}
for {
resp, err := s.Conn.GetPublicIPInstanceList(reqParams)
resp, err := s.Conn.server.V2Api.GetPublicIpInstanceList(reqParams)
if err != nil {
log.Printf(err.Error())
c1 <- err
return
}
if resp.TotalRows == 0 {
if *resp.TotalRows == 0 {
c1 <- nil
return
}
instance := resp.PublicIPInstanceList[0]
if instance.PublicIPInstanceStatus.Code == status && instance.PublicIPInstanceOperation.Code == "NULL" {
instance := resp.PublicIpInstanceList[0]
if *instance.PublicIpInstanceStatus.Code == status && *instance.PublicIpInstanceOperation.Code == "NULL" {
c1 <- nil
return
}

View File

@ -5,14 +5,15 @@ import (
"fmt"
"testing"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
)
func TestStepCreatePublicIPInstanceShouldFailIfOperationCreatePublicIPInstanceFails(t *testing.T) {
var testSubject = &StepCreatePublicIPInstance{
CreatePublicIPInstance: func(serverInstanceNo string) (*ncloud.PublicIPInstance, error) {
CreatePublicIPInstance: func(serverInstanceNo string) (*server.PublicIpInstance, error) {
return nil, fmt.Errorf("!! Unit Test FAIL !!")
},
Say: func(message string) {},
@ -38,8 +39,8 @@ func TestStepCreatePublicIPInstanceShouldPassIfOperationCreatePublicIPInstancePa
c.Comm.Type = "ssh"
var testSubject = &StepCreatePublicIPInstance{
CreatePublicIPInstance: func(serverInstanceNo string) (*ncloud.PublicIPInstance, error) {
return &ncloud.PublicIPInstance{PublicIPInstanceNo: "a", PublicIP: "b"}, nil
CreatePublicIPInstance: func(serverInstanceNo string) (*server.PublicIpInstance, error) {
return &server.PublicIpInstance{PublicIpInstanceNo: ncloud.String("a"), PublicIp: ncloud.String("b")}, nil
},
Say: func(message string) {},
Error: func(e error) {},

View File

@ -6,20 +6,20 @@ import (
"fmt"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepCreateServerImage struct {
Conn *ncloud.Conn
CreateServerImage func(serverInstanceNo string) (*ncloud.ServerImage, error)
Conn *NcloudAPIClient
CreateServerImage func(serverInstanceNo string) (*server.MemberServerImage, error)
Say func(message string)
Error func(e error)
Config *Config
}
func NewStepCreateServerImage(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreateServerImage {
func NewStepCreateServerImage(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateServerImage {
var step = &StepCreateServerImage{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -32,33 +32,33 @@ func NewStepCreateServerImage(conn *ncloud.Conn, ui packer.Ui, config *Config) *
return step
}
func (s *StepCreateServerImage) createServerImage(serverInstanceNo string) (*ncloud.ServerImage, error) {
func (s *StepCreateServerImage) createServerImage(serverInstanceNo string) (*server.MemberServerImage, error) {
// Can't create server image when status of server instance is stopping (not stopped)
if err := waiterServerInstanceStatus(s.Conn, serverInstanceNo, "NSTOP", 1*time.Minute); err != nil {
return nil, err
}
reqParams := new(ncloud.RequestCreateServerImage)
reqParams.MemberServerImageName = s.Config.ServerImageName
reqParams.MemberServerImageDescription = s.Config.ServerImageDescription
reqParams.ServerInstanceNo = serverInstanceNo
reqParams := new(server.CreateMemberServerImageRequest)
reqParams.MemberServerImageName = &s.Config.ServerImageName
reqParams.MemberServerImageDescription = &s.Config.ServerImageDescription
reqParams.ServerInstanceNo = &serverInstanceNo
memberServerImageList, err := s.Conn.CreateMemberServerImage(reqParams)
memberServerImageList, err := s.Conn.server.V2Api.CreateMemberServerImage(reqParams)
if err != nil {
return nil, err
}
serverImage := memberServerImageList.MemberServerImageList[0]
s.Say(fmt.Sprintf("Server Image[%s:%s] is creating...", serverImage.MemberServerImageName, serverImage.MemberServerImageNo))
s.Say(fmt.Sprintf("Server Image[%s:%s] is creating...", *serverImage.MemberServerImageName, *serverImage.MemberServerImageNo))
if err := waiterMemberServerImageStatus(s.Conn, serverImage.MemberServerImageNo, "CREAT", 6*time.Hour); err != nil {
if err := waiterMemberServerImageStatus(s.Conn, *serverImage.MemberServerImageNo, "CREAT", 6*time.Hour); err != nil {
return nil, errors.New("TIMEOUT : Server Image is not created")
}
s.Say(fmt.Sprintf("Server Image[%s:%s] is created", serverImage.MemberServerImageName, serverImage.MemberServerImageNo))
s.Say(fmt.Sprintf("Server Image[%s:%s] is created", *serverImage.MemberServerImageName, *serverImage.MemberServerImageNo))
return &serverImage, nil
return serverImage, nil
}
func (s *StepCreateServerImage) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {

View File

@ -5,14 +5,14 @@ import (
"fmt"
"testing"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
)
func TestStepCreateServerImageShouldFailIfOperationCreateServerImageFails(t *testing.T) {
var testSubject = &StepCreateServerImage{
CreateServerImage: func(serverInstanceNo string) (*ncloud.ServerImage, error) {
CreateServerImage: func(serverInstanceNo string) (*server.MemberServerImage, error) {
return nil, fmt.Errorf("!! Unit Test FAIL !!")
},
Say: func(message string) {},
@ -33,7 +33,7 @@ func TestStepCreateServerImageShouldFailIfOperationCreateServerImageFails(t *tes
}
func TestStepCreateServerImageShouldPassIfOperationCreateServerImagePasses(t *testing.T) {
var testSubject = &StepCreateServerImage{
CreateServerImage: func(serverInstanceNo string) (*ncloud.ServerImage, error) { return nil, nil },
CreateServerImage: func(serverInstanceNo string) (*server.MemberServerImage, error) { return nil, nil },
Say: func(message string) {},
Error: func(e error) {},
}

View File

@ -8,13 +8,14 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepCreateServerInstance struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
CreateServerInstance func(loginKeyName string, zoneNo string, feeSystemTypeCode string) (string, error)
CheckServerInstanceStatusIsRunning func(serverInstanceNo string) error
Say func(message string)
@ -23,7 +24,7 @@ type StepCreateServerInstance struct {
serverInstanceNo string
}
func NewStepCreateServerInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepCreateServerInstance {
func NewStepCreateServerInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepCreateServerInstance {
var step = &StepCreateServerInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -37,18 +38,18 @@ func NewStepCreateServerInstance(conn *ncloud.Conn, ui packer.Ui, config *Config
}
func (s *StepCreateServerInstance) createServerInstance(loginKeyName string, zoneNo string, feeSystemTypeCode string) (string, error) {
reqParams := new(ncloud.RequestCreateServerInstance)
reqParams.ServerProductCode = s.Config.ServerProductCode
reqParams.MemberServerImageNo = s.Config.MemberServerImageNo
reqParams := new(server.CreateServerInstancesRequest)
reqParams.ServerProductCode = &s.Config.ServerProductCode
reqParams.MemberServerImageNo = &s.Config.MemberServerImageNo
if s.Config.MemberServerImageNo == "" {
reqParams.ServerImageProductCode = s.Config.ServerImageProductCode
reqParams.ServerImageProductCode = &s.Config.ServerImageProductCode
}
reqParams.LoginKeyName = loginKeyName
reqParams.ZoneNo = zoneNo
reqParams.FeeSystemTypeCode = feeSystemTypeCode
reqParams.LoginKeyName = &loginKeyName
reqParams.ZoneNo = &zoneNo
reqParams.FeeSystemTypeCode = &feeSystemTypeCode
if s.Config.UserData != "" {
reqParams.UserData = s.Config.UserData
reqParams.UserData = &s.Config.UserData
}
if s.Config.UserDataFile != "" {
@ -57,19 +58,19 @@ func (s *StepCreateServerInstance) createServerInstance(loginKeyName string, zon
return "", fmt.Errorf("Problem reading user data file: %s", err)
}
reqParams.UserData = string(contents)
reqParams.UserData = ncloud.String(string(contents))
}
if s.Config.AccessControlGroupConfigurationNo != "" {
reqParams.AccessControlGroupConfigurationNoList = []string{s.Config.AccessControlGroupConfigurationNo}
reqParams.AccessControlGroupConfigurationNoList = []*string{&s.Config.AccessControlGroupConfigurationNo}
}
serverInstanceList, err := s.Conn.CreateServerInstances(reqParams)
serverInstanceList, err := s.Conn.server.V2Api.CreateServerInstances(reqParams)
if err != nil {
return "", err
}
s.serverInstanceNo = serverInstanceList.ServerInstanceList[0].ServerInstanceNo
s.serverInstanceNo = *serverInstanceList.ServerInstanceList[0].ServerInstanceNo
s.Say(fmt.Sprintf("Server Instance is creating. Server InstanceNo is %s", s.serverInstanceNo))
log.Println("Server Instance information : ", serverInstanceList.ServerInstanceList[0])
@ -116,11 +117,11 @@ func (s *StepCreateServerInstance) Cleanup(state multistep.StateBag) {
return
}
reqParams := new(ncloud.RequestGetServerInstanceList)
reqParams.ServerInstanceNoList = []string{s.serverInstanceNo}
reqParams := new(server.GetServerInstanceListRequest)
reqParams.ServerInstanceNoList = []*string{&s.serverInstanceNo}
serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams)
if err != nil || serverInstanceList.TotalRows == 0 {
serverInstanceList, err := s.Conn.server.V2Api.GetServerInstanceList(reqParams)
if err != nil || *serverInstanceList.TotalRows == 0 {
return
}
@ -128,21 +129,21 @@ func (s *StepCreateServerInstance) Cleanup(state multistep.StateBag) {
serverInstance := serverInstanceList.ServerInstanceList[0]
// stop server instance
if serverInstance.ServerInstanceStatus.Code != "NSTOP" && serverInstance.ServerInstanceStatus.Code != "TERMT" {
reqParams := new(ncloud.RequestStopServerInstances)
reqParams.ServerInstanceNoList = []string{s.serverInstanceNo}
if *serverInstance.ServerInstanceStatus.Code != "NSTOP" && *serverInstance.ServerInstanceStatus.Code != "TERMT" {
reqParams := new(server.StopServerInstancesRequest)
reqParams.ServerInstanceNoList = []*string{&s.serverInstanceNo}
log.Println("Stop Server Instance")
s.Conn.StopServerInstances(reqParams)
s.Conn.server.V2Api.StopServerInstances(reqParams)
waiterServerInstanceStatus(s.Conn, s.serverInstanceNo, "NSTOP", time.Minute)
}
// terminate server instance
if serverInstance.ServerInstanceStatus.Code != "TERMT" {
reqParams := new(ncloud.RequestTerminateServerInstances)
reqParams.ServerInstanceNoList = []string{s.serverInstanceNo}
if *serverInstance.ServerInstanceStatus.Code != "TERMT" {
reqParams := new(server.TerminateServerInstancesRequest)
reqParams.ServerInstanceNoList = []*string{&s.serverInstanceNo}
log.Println("Terminate Server Instance")
s.Conn.TerminateServerInstances(reqParams)
s.Conn.server.V2Api.TerminateServerInstances(reqParams)
}
}

View File

@ -7,20 +7,20 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepDeleteBlockStorageInstance struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
DeleteBlockStorageInstance func(blockStorageInstanceNo string) error
Say func(message string)
Error func(e error)
Config *Config
}
func NewStepDeleteBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepDeleteBlockStorageInstance {
func NewStepDeleteBlockStorageInstance(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepDeleteBlockStorageInstance {
var step = &StepDeleteBlockStorageInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -33,24 +33,24 @@ func NewStepDeleteBlockStorageInstance(conn *ncloud.Conn, ui packer.Ui, config *
return step
}
func (s *StepDeleteBlockStorageInstance) getBlockInstanceList(serverInstanceNo string) []string {
reqParams := new(ncloud.RequestBlockStorageInstanceList)
reqParams.ServerInstanceNo = serverInstanceNo
func (s *StepDeleteBlockStorageInstance) getBlockInstanceList(serverInstanceNo string) []*string {
reqParams := new(server.GetBlockStorageInstanceListRequest)
reqParams.ServerInstanceNo = &serverInstanceNo
blockStorageInstanceList, err := s.Conn.GetBlockStorageInstance(reqParams)
blockStorageInstanceList, err := s.Conn.server.V2Api.GetBlockStorageInstanceList(reqParams)
if err != nil {
return nil
}
if blockStorageInstanceList.TotalRows == 1 {
if *blockStorageInstanceList.TotalRows == 1 {
return nil
}
var instanceList []string
var instanceList []*string
for _, blockStorageInstance := range blockStorageInstanceList.BlockStorageInstance {
for _, blockStorageInstance := range blockStorageInstanceList.BlockStorageInstanceList {
log.Println(blockStorageInstance)
if blockStorageInstance.BlockStorageType.Code != "BASIC" {
if *blockStorageInstance.BlockStorageType.Code != "BASIC" {
instanceList = append(instanceList, blockStorageInstance.BlockStorageInstanceNo)
}
}
@ -63,13 +63,15 @@ func (s *StepDeleteBlockStorageInstance) deleteBlockStorageInstance(serverInstan
if blockStorageInstanceList == nil || len(blockStorageInstanceList) == 0 {
return nil
}
_, err := s.Conn.DeleteBlockStorageInstances(blockStorageInstanceList)
reqParams := server.DeleteBlockStorageInstancesRequest{
BlockStorageInstanceNoList: blockStorageInstanceList,
}
_, err := s.Conn.server.V2Api.DeleteBlockStorageInstances(&reqParams)
if err != nil {
return err
}
s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage InstanceNo is %s", blockStorageInstanceList))
s.Say(fmt.Sprintf("Block Storage Instance is deleted. Block Storage Instance List is %v", blockStorageInstanceList))
if err := waiterDetachedBlockStorageInstance(s.Conn, serverInstanceNo, time.Minute); err != nil {
return errors.New("TIMEOUT : Block Storage instance status is not deattached")

View File

@ -4,20 +4,20 @@ import (
"context"
"fmt"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepGetRootPassword struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
GetRootPassword func(serverInstanceNo string, privateKey string) (string, error)
Say func(message string)
Error func(e error)
Config *Config
}
func NewStepGetRootPassword(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepGetRootPassword {
func NewStepGetRootPassword(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepGetRootPassword {
var step = &StepGetRootPassword{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -31,18 +31,18 @@ func NewStepGetRootPassword(conn *ncloud.Conn, ui packer.Ui, config *Config) *St
}
func (s *StepGetRootPassword) getRootPassword(serverInstanceNo string, privateKey string) (string, error) {
reqParams := new(ncloud.RequestGetRootPassword)
reqParams.ServerInstanceNo = serverInstanceNo
reqParams.PrivateKey = privateKey
reqParams := new(server.GetRootPasswordRequest)
reqParams.ServerInstanceNo = &serverInstanceNo
reqParams.PrivateKey = &privateKey
rootPassword, err := s.Conn.GetRootPassword(reqParams)
rootPassword, err := s.Conn.server.V2Api.GetRootPassword(reqParams)
if err != nil {
return "", err
}
s.Say(fmt.Sprintf("Root password is %s", rootPassword.RootPassword))
s.Say(fmt.Sprintf("Root password is %s", *rootPassword.RootPassword))
return rootPassword.RootPassword, nil
return *rootPassword.RootPassword, nil
}
func (s *StepGetRootPassword) Run(ctx context.Context, state multistep.StateBag) multistep.StepAction {

View File

@ -6,19 +6,19 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepStopServerInstance struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
StopServerInstance func(serverInstanceNo string) error
Say func(message string)
Error func(e error)
}
func NewStepStopServerInstance(conn *ncloud.Conn, ui packer.Ui) *StepStopServerInstance {
func NewStepStopServerInstance(conn *NcloudAPIClient, ui packer.Ui) *StepStopServerInstance {
var step = &StepStopServerInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -31,22 +31,22 @@ func NewStepStopServerInstance(conn *ncloud.Conn, ui packer.Ui) *StepStopServerI
}
func (s *StepStopServerInstance) stopServerInstance(serverInstanceNo string) error {
reqParams := new(ncloud.RequestStopServerInstances)
reqParams.ServerInstanceNoList = []string{serverInstanceNo}
reqParams := new(server.StopServerInstancesRequest)
reqParams.ServerInstanceNoList = []*string{&serverInstanceNo}
serverInstanceList, err := s.Conn.StopServerInstances(reqParams)
serverInstanceList, err := s.Conn.server.V2Api.StopServerInstances(reqParams)
if err != nil {
return err
}
s.Say(fmt.Sprintf("Server Instance is stopping. Server InstanceNo is %s", serverInstanceList.ServerInstanceList[0].ServerInstanceNo))
s.Say(fmt.Sprintf("Server Instance is stopping. Server InstanceNo is %s", *serverInstanceList.ServerInstanceList[0].ServerInstanceNo))
log.Println("Server Instance information : ", serverInstanceList.ServerInstanceList[0])
if err := waiterServerInstanceStatus(s.Conn, serverInstanceNo, "NSTOP", 5*time.Minute); err != nil {
return err
}
s.Say(fmt.Sprintf("Server Instance stopped. Server InstanceNo is %s", serverInstanceList.ServerInstanceList[0].ServerInstanceNo))
s.Say(fmt.Sprintf("Server Instance stopped. Server InstanceNo is %s", *serverInstanceList.ServerInstanceList[0].ServerInstanceNo))
return nil
}

View File

@ -5,19 +5,19 @@ import (
"errors"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
)
type StepTerminateServerInstance struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
TerminateServerInstance func(serverInstanceNo string) error
Say func(message string)
Error func(e error)
}
func NewStepTerminateServerInstance(conn *ncloud.Conn, ui packer.Ui) *StepTerminateServerInstance {
func NewStepTerminateServerInstance(conn *NcloudAPIClient, ui packer.Ui) *StepTerminateServerInstance {
var step = &StepTerminateServerInstance{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -30,10 +30,10 @@ func NewStepTerminateServerInstance(conn *ncloud.Conn, ui packer.Ui) *StepTermin
}
func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo string) error {
reqParams := new(ncloud.RequestTerminateServerInstances)
reqParams.ServerInstanceNoList = []string{serverInstanceNo}
reqParams := new(server.TerminateServerInstancesRequest)
reqParams.ServerInstanceNoList = []*string{&serverInstanceNo}
_, err := s.Conn.TerminateServerInstances(reqParams)
_, err := s.Conn.server.V2Api.TerminateServerInstances(reqParams)
if err != nil {
return err
}
@ -41,16 +41,16 @@ func (s *StepTerminateServerInstance) terminateServerInstance(serverInstanceNo s
c1 := make(chan error, 1)
go func() {
reqParams := new(ncloud.RequestGetServerInstanceList)
reqParams.ServerInstanceNoList = []string{serverInstanceNo}
reqParams := new(server.GetServerInstanceListRequest)
reqParams.ServerInstanceNoList = []*string{&serverInstanceNo}
for {
serverInstanceList, err := s.Conn.GetServerInstanceList(reqParams)
serverInstanceList, err := s.Conn.server.V2Api.GetServerInstanceList(reqParams)
if err != nil {
c1 <- err
return
} else if serverInstanceList.TotalRows == 0 {
} else if *serverInstanceList.TotalRows == 0 {
c1 <- nil
return
}

View File

@ -7,7 +7,8 @@ import (
"fmt"
"strings"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
"github.com/hashicorp/packer/helper/multistep"
"github.com/hashicorp/packer/packer"
"github.com/olekukonko/tablewriter"
@ -15,7 +16,7 @@ import (
//StepValidateTemplate : struct for Validation a template
type StepValidateTemplate struct {
Conn *ncloud.Conn
Conn *NcloudAPIClient
Validate func() error
Say func(message string)
Error func(e error)
@ -26,7 +27,7 @@ type StepValidateTemplate struct {
}
// NewStepValidateTemplate : function for Validation a template
func NewStepValidateTemplate(conn *ncloud.Conn, ui packer.Ui, config *Config) *StepValidateTemplate {
func NewStepValidateTemplate(conn *NcloudAPIClient, ui packer.Ui, config *Config) *StepValidateTemplate {
var step = &StepValidateTemplate{
Conn: conn,
Say: func(message string) { ui.Say(message) },
@ -45,15 +46,15 @@ func (s *StepValidateTemplate) getZoneNo() error {
return nil
}
regionList, err := s.Conn.GetRegionList()
regionList, err := s.Conn.server.V2Api.GetRegionList(&server.GetRegionListRequest{})
if err != nil {
return err
}
var regionNo string
for _, region := range regionList.RegionList {
if strings.EqualFold(region.RegionName, s.Config.Region) {
regionNo = region.RegionNo
if strings.EqualFold(*region.RegionName, s.Config.Region) {
regionNo = *region.RegionNo
}
}
@ -64,13 +65,13 @@ func (s *StepValidateTemplate) getZoneNo() error {
s.regionNo = regionNo
// Get ZoneNo
ZoneList, err := s.Conn.GetZoneList(regionNo)
resp, err := s.Conn.server.V2Api.GetZoneList(&server.GetZoneListRequest{RegionNo: &regionNo})
if err != nil {
return err
}
if len(ZoneList.Zone) > 0 {
s.zoneNo = ZoneList.Zone[0].ZoneNo
if len(resp.ZoneList) > 0 {
s.zoneNo = *resp.ZoneList[0].ZoneNo
}
return nil
@ -79,10 +80,10 @@ func (s *StepValidateTemplate) getZoneNo() error {
func (s *StepValidateTemplate) validateMemberServerImage() error {
var serverImageName = s.Config.ServerImageName
reqParams := new(ncloud.RequestServerImageList)
reqParams.RegionNo = s.regionNo
reqParams := new(server.GetMemberServerImageListRequest)
reqParams.RegionNo = &s.regionNo
memberServerImageList, err := s.Conn.GetMemberServerImageList(reqParams)
memberServerImageList, err := s.Conn.server.V2Api.GetMemberServerImageList(reqParams)
if err != nil {
return err
}
@ -90,17 +91,17 @@ func (s *StepValidateTemplate) validateMemberServerImage() error {
var isExistMemberServerImageNo = false
for _, image := range memberServerImageList.MemberServerImageList {
// Check duplicate server_image_name
if image.MemberServerImageName == serverImageName {
if *image.MemberServerImageName == serverImageName {
return fmt.Errorf("server_image_name %s is exists", serverImageName)
}
if image.MemberServerImageNo == s.Config.MemberServerImageNo {
if *image.MemberServerImageNo == s.Config.MemberServerImageNo {
isExistMemberServerImageNo = true
if s.Config.ServerProductCode == "" {
s.Config.ServerProductCode = image.OriginalServerProductCode
s.Say("server_product_code for member server image '" + image.OriginalServerProductCode + "' is configured automatically")
s.Config.ServerProductCode = *image.OriginalServerProductCode
s.Say("server_product_code for member server image '" + *image.OriginalServerProductCode + "' is configured automatically")
}
s.Config.ServerImageProductCode = image.OriginalServerImageProductCode
s.Config.ServerImageProductCode = *image.OriginalServerImageProductCode
}
}
@ -117,10 +118,10 @@ func (s *StepValidateTemplate) validateServerImageProduct() error {
return nil
}
reqParams := new(ncloud.RequestGetServerImageProductList)
reqParams.RegionNo = s.regionNo
reqParams := new(server.GetServerImageProductListRequest)
reqParams.RegionNo = &s.regionNo
serverImageProductList, err := s.Conn.GetServerImageProductList(reqParams)
serverImageProductList, err := s.Conn.server.V2Api.GetServerImageProductList(reqParams)
if err != nil {
return err
}
@ -131,34 +132,34 @@ func (s *StepValidateTemplate) validateServerImageProduct() error {
table := tablewriter.NewWriter(&buf)
table.SetHeader([]string{"Name", "Code"})
for _, product := range serverImageProductList.Product {
for _, product := range serverImageProductList.ProductList {
// Check exist server image product code
if product.ProductCode == serverImageProductCode {
if *product.ProductCode == serverImageProductCode {
isExistServerImage = true
productName = product.ProductName
productName = *product.ProductName
break
}
table.Append([]string{product.ProductName, product.ProductCode})
table.Append([]string{*product.ProductName, *product.ProductCode})
}
if !isExistServerImage {
reqParams.BlockStorageSize = 100
reqParams.BlockStorageSize = ncloud.Int32(100)
serverImageProductList, err := s.Conn.GetServerImageProductList(reqParams)
serverImageProductList, err := s.Conn.server.V2Api.GetServerImageProductList(reqParams)
if err != nil {
return err
}
for _, product := range serverImageProductList.Product {
for _, product := range serverImageProductList.ProductList {
// Check exist server image product code
if product.ProductCode == serverImageProductCode {
if *product.ProductCode == serverImageProductCode {
isExistServerImage = true
productName = product.ProductName
productName = *product.ProductName
break
}
table.Append([]string{product.ProductName, product.ProductCode})
table.Append([]string{*product.ProductName, *product.ProductCode})
}
}
@ -180,33 +181,33 @@ func (s *StepValidateTemplate) validateServerProductCode() error {
var serverImageProductCode = s.Config.ServerImageProductCode
var productCode = s.Config.ServerProductCode
reqParams := new(ncloud.RequestGetServerProductList)
reqParams.ServerImageProductCode = serverImageProductCode
reqParams.RegionNo = s.regionNo
reqParams := new(server.GetServerProductListRequest)
reqParams.ServerImageProductCode = &serverImageProductCode
reqParams.RegionNo = &s.regionNo
productList, err := s.Conn.GetServerProductList(reqParams)
resp, err := s.Conn.server.V2Api.GetServerProductList(reqParams)
if err != nil {
return err
}
var isExistProductCode = false
for _, product := range productList.Product {
for _, product := range resp.ProductList {
// Check exist server image product code
if product.ProductCode == productCode {
if *product.ProductCode == productCode {
isExistProductCode = true
if strings.Contains(product.ProductName, "mssql") {
if strings.Contains(*product.ProductName, "mssql") {
s.FeeSystemTypeCode = "FXSUM"
}
if product.ProductType.Code == "VDS" {
if *product.ProductType.Code == "VDS" {
return errors.New("You cannot create my server image for VDS servers")
}
break
} else if productCode == "" && product.ProductType.Code == "STAND" {
} else if productCode == "" && *product.ProductType.Code == "STAND" {
isExistProductCode = true
s.Config.ServerProductCode = product.ProductCode
s.Say("server_product_code '" + product.ProductCode + "' is configured automatically")
s.Config.ServerProductCode = *product.ProductCode
s.Say("server_product_code '" + *product.ProductCode + "' is configured automatically")
break
}
}
@ -215,8 +216,8 @@ func (s *StepValidateTemplate) validateServerProductCode() error {
var buf bytes.Buffer
table := tablewriter.NewWriter(&buf)
table.SetHeader([]string{"Name", "Code"})
for _, product := range productList.Product {
table.Append([]string{product.ProductName, product.ProductCode})
for _, product := range resp.ProductList {
table.Append([]string{*product.ProductName, *product.ProductCode})
}
table.Render()

View File

@ -5,37 +5,38 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
)
func waiterBlockStorageInstanceStatus(conn *ncloud.Conn, blockStorageInstanceNo string, status string, timeout time.Duration) error {
reqParams := new(ncloud.RequestBlockStorageInstanceList)
reqParams.BlockStorageInstanceNoList = []string{blockStorageInstanceNo}
func waiterBlockStorageInstanceStatus(conn *NcloudAPIClient, blockStorageInstanceNo *string, status string, timeout time.Duration) error {
reqParams := new(server.GetBlockStorageInstanceListRequest)
reqParams.BlockStorageInstanceNoList = []*string{blockStorageInstanceNo}
c1 := make(chan error, 1)
go func() {
for {
blockStorageInstanceList, err := conn.GetBlockStorageInstance(reqParams)
blockStorageInstanceList, err := conn.server.V2Api.GetBlockStorageInstanceList(reqParams)
if err != nil {
c1 <- err
return
}
if status == "DETAC" && len(blockStorageInstanceList.BlockStorageInstance) == 0 {
if status == "DETAC" && len(blockStorageInstanceList.BlockStorageInstanceList) == 0 {
c1 <- nil
return
}
code := blockStorageInstanceList.BlockStorageInstance[0].BlockStorageInstanceStatus.Code
operationCode := blockStorageInstanceList.BlockStorageInstance[0].BlockStorageInstanceOperation.Code
blockStorageInstance := blockStorageInstanceList.BlockStorageInstanceList[0]
code := blockStorageInstance.BlockStorageInstanceStatus.Code
operationCode := blockStorageInstance.BlockStorageInstanceOperation.Code
if code == status && operationCode == "NULL" {
if *code == status && *operationCode == "NULL" {
c1 <- nil
return
}
log.Println(blockStorageInstanceList.BlockStorageInstance[0])
log.Println(blockStorageInstance)
time.Sleep(time.Second * 5)
}
}()
@ -48,21 +49,21 @@ func waiterBlockStorageInstanceStatus(conn *ncloud.Conn, blockStorageInstanceNo
}
}
func waiterDetachedBlockStorageInstance(conn *ncloud.Conn, serverInstanceNo string, timeout time.Duration) error {
reqParams := new(ncloud.RequestBlockStorageInstanceList)
reqParams.ServerInstanceNo = serverInstanceNo
func waiterDetachedBlockStorageInstance(conn *NcloudAPIClient, serverInstanceNo string, timeout time.Duration) error {
reqParams := new(server.GetBlockStorageInstanceListRequest)
reqParams.ServerInstanceNo = &serverInstanceNo
c1 := make(chan error, 1)
go func() {
for {
blockStorageInstanceList, err := conn.GetBlockStorageInstance(reqParams)
blockStorageInstanceList, err := conn.server.V2Api.GetBlockStorageInstanceList(reqParams)
if err != nil {
c1 <- err
return
}
if blockStorageInstanceList.TotalRows == 1 {
if *blockStorageInstanceList.TotalRows == 1 {
c1 <- nil
return
}

View File

@ -5,30 +5,30 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
)
func waiterMemberServerImageStatus(conn *ncloud.Conn, memberServerImageNo string, status string, timeout time.Duration) error {
reqParams := new(ncloud.RequestServerImageList)
reqParams.MemberServerImageNoList = []string{memberServerImageNo}
func waiterMemberServerImageStatus(conn *NcloudAPIClient, memberServerImageNo string, status string, timeout time.Duration) error {
reqParams := new(server.GetMemberServerImageListRequest)
reqParams.MemberServerImageNoList = []*string{&memberServerImageNo}
c1 := make(chan error, 1)
go func() {
for {
memberServerImageList, err := conn.GetMemberServerImageList(reqParams)
memberServerImageList, err := conn.server.V2Api.GetMemberServerImageList(reqParams)
if err != nil {
c1 <- err
return
}
code := memberServerImageList.MemberServerImageList[0].MemberServerImageStatus.Code
if code == status {
if *code == status {
c1 <- nil
return
}
log.Printf("Status of member server image [%s] is %s\n", memberServerImageNo, code)
log.Printf("Status of member server image [%s] is %s\n", memberServerImageNo, *code)
log.Println(memberServerImageList.MemberServerImageList[0])
time.Sleep(time.Second * 5)
}

View File

@ -5,30 +5,30 @@ import (
"log"
"time"
ncloud "github.com/NaverCloudPlatform/ncloud-sdk-go/sdk"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/services/server"
)
func waiterServerInstanceStatus(conn *ncloud.Conn, serverInstanceNo string, status string, timeout time.Duration) error {
reqParams := new(ncloud.RequestGetServerInstanceList)
reqParams.ServerInstanceNoList = []string{serverInstanceNo}
func waiterServerInstanceStatus(conn *NcloudAPIClient, serverInstanceNo string, status string, timeout time.Duration) error {
reqParams := new(server.GetServerInstanceListRequest)
reqParams.ServerInstanceNoList = []*string{&serverInstanceNo}
c1 := make(chan error, 1)
go func() {
for {
serverInstanceList, err := conn.GetServerInstanceList(reqParams)
serverInstanceList, err := conn.server.V2Api.GetServerInstanceList(reqParams)
if err != nil {
c1 <- err
return
}
code := serverInstanceList.ServerInstanceList[0].ServerInstanceStatus.Code
if code == status {
if *code == status {
c1 <- nil
return
}
log.Printf("Status of serverInstanceNo [%s] is %s\n", serverInstanceNo, code)
log.Printf("Status of serverInstanceNo [%s] is %s\n", serverInstanceNo, *code)
log.Println(serverInstanceList.ServerInstanceList[0])
time.Sleep(time.Second * 5)
}

7
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/Azure/go-autorest v12.0.0+incompatible
github.com/Azure/go-ntlmssp v0.0.0-20191115201650-bad6df29494a // indirect
github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290
github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591
github.com/NaverCloudPlatform/ncloud-sdk-go-v2 v1.1.0
github.com/PuerkitoBio/goquery v1.5.0 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340
@ -106,6 +106,7 @@ require (
github.com/mitchellh/go-fs v0.0.0-20180402234041-7b48fa161ea7
github.com/mitchellh/go-homedir v1.0.0
github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed
github.com/mitchellh/gox v1.0.1 // indirect
github.com/mitchellh/iochan v1.0.0
github.com/mitchellh/mapstructure v0.0.0-20180111000720-b4575eea38cc
github.com/mitchellh/panicwrap v0.0.0-20170106182340-fce601fe5557
@ -115,11 +116,8 @@ require (
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef // indirect
github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 // indirect
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b
github.com/onsi/ginkgo v1.7.0 // indirect
github.com/onsi/gomega v1.4.3 // indirect
github.com/oracle/oci-go-sdk v1.8.0
github.com/outscale/osc-go v0.0.1
github.com/packer-community/winrmcp v0.0.0-20180921204643-0fd363d6159a
@ -166,7 +164,6 @@ require (
google.golang.org/genproto v0.0.0-20191115221424-83cc0476cb11 // indirect
google.golang.org/grpc v1.25.1
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/h2non/gock.v1 v1.0.12 // indirect
gopkg.in/ini.v1 v1.42.0 // indirect
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516 // indirect
gopkg.in/yaml.v2 v2.2.7 // indirect

32
go.sum
View File

@ -35,14 +35,12 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290 h1:K9I21XUHNbYD3GNMmJBN0UKJCpdP+glftwNZ7Bo8kqY=
github.com/ChrisTrenkamp/goxpath v0.0.0-20170625215350-4fe035839290/go.mod h1:nuWgzSkT5PnyOd+272uUmV0dnAnAn42Mk7PiQC5VzN4=
github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591 h1:/P9HCl71+Eh6vDbKNyRu+rpIIR70UCZWNOGexVV3e6k=
github.com/NaverCloudPlatform/ncloud-sdk-go v0.0.0-20180110055012-c2e73f942591/go.mod h1:EHGzQGbwozJBj/4qj3WGrTJ0FqjgOTOxLQ0VNWvPn08=
github.com/NaverCloudPlatform/ncloud-sdk-go-v2 v1.1.0 h1:0nxjOH7NurPGUWNG5BCrASWjB0uuhGbgJAKLqj2ZDTo=
github.com/NaverCloudPlatform/ncloud-sdk-go-v2 v1.1.0/go.mod h1:P+3VS0ETiQPyWOx3vB/oeC8J3qd7jnVZLYAFwWgGRt8=
github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk=
github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk=
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/Telmate/proxmox-api-go v0.0.0-20191015171801-b0c2796b9fcf h1:rVT2xsBm03Jp0r0yfGm5AMlqp0mZmxTTiNnSrc9S+Hs=
github.com/Telmate/proxmox-api-go v0.0.0-20191015171801-b0c2796b9fcf/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340 h1:bOjy6c07dpipWm11dL92FbtmXGnDywOm2uKzG4CePuY=
github.com/Telmate/proxmox-api-go v0.0.0-20200116224409-320525bf3340/go.mod h1:OGWyIMJ87/k/GCz8CGiWB2HOXsOVDM6Lpe/nFPkC4IQ=
github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14=
@ -140,8 +138,6 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
github.com/fatih/structtag v1.0.0 h1:pTHj65+u3RKWYPSGaU290FpI/dXxTaHdVwVwbcPKmEc=
github.com/fatih/structtag v1.0.0/go.mod h1:IKitwq45uXL/yqi5mYghiD3w9H6eTOvI9vnk8tXMphA=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@ -247,6 +243,7 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv
github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE=
github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.0.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.1.0 h1:bPIoEKD27tNdebFGGxxYwcL4nepeY4j1QP23PFRGzg0=
github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.2.0 h1:3vNe/fWF5CBgRIguda1meWhsZHy3m8gCJ5wx+dIzX/E=
@ -274,8 +271,6 @@ github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/hetznercloud/hcloud-go v1.15.1 h1:G8Q+xyAqQ5IUY7yq4HKZgkabFa0S/VXJXq3TGCeT8JM=
github.com/hetznercloud/hcloud-go v1.15.1/go.mod h1:8lR3yHBHZWy2uGcUi9Ibt4UOoop2wrVdERJgCtxsF3Q=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/hyperonecom/h1-client-go v0.0.0-20191203060043-b46280e4c4a4 h1:mSmyzhwBeQt2TlHbsXYLona9pwjWAvYGwQJ2Cq/k3VE=
github.com/hyperonecom/h1-client-go v0.0.0-20191203060043-b46280e4c4a4/go.mod h1:yNUVHSleURKSaYUKq4Wx0i/vjCen2aq7CvPyHd/Vj2Q=
github.com/jdcloud-api/jdcloud-sdk-go v1.9.1-0.20190605102154-3d81a50ca961 h1:a2/K4HRhg31A5vafiz5yYiGMjaCxwRpyjJStfVquKds=
@ -354,6 +349,8 @@ github.com/mitchellh/go-vnc v0.0.0-20150629162542-723ed9867aed/go.mod h1:3rdaFaC
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM=
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
github.com/mitchellh/gox v1.0.1 h1:x0jD3dcHk9a9xPSDN6YEL4xL6Qz0dvNYm8yZqui5chI=
github.com/mitchellh/gox v1.0.1/go.mod h1:ED6BioOGXMswlXa2zxfh/xdd5QhwYliBFn9V18Ap4z4=
github.com/mitchellh/iochan v1.0.0 h1:C+X3KsSTLFVBr/tK1eYN/vs4rJcvsiLU338UhYPJWeY=
github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
@ -373,17 +370,10 @@ github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef h1:E/seV1Rtsnr2juBw1
github.com/moul/anonuuid v0.0.0-20160222162117-609b752a95ef/go.mod h1:LgKrp0Iss/BVwquptq4eIe6HPr0s3t1WHT5x0qOh14U=
github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215 h1:y6FZWUBBt1iPmJyGbGza3ncvVBMKzgd32oFChRZR7Do=
github.com/moul/gotty-client v0.0.0-20180327180212-b26a57ebc215/go.mod h1:CxM/JGtpRrEPve5H04IhxJrGhxgwxMc6jSP2T4YD60w=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32 h1:W6apQkHrMkS0Muv8G/TipAy/FJl/rCYT0+EuS8+Z0z4=
github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b h1:LGItPaClbzopugAomw5VFKnG3h1dUr9QW5KOU+m8gu0=
github.com/olekukonko/tablewriter v0.0.0-20180105111133-96aac992fc8b/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0 h1:WSHQ+IS43OoUrWtD1/bbclrwK8TTH5hzp+umCiuxHgs=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
github.com/oracle/oci-go-sdk v1.8.0 h1:4SO45bKV0I3/Mn1os3ANDZmV0eSE5z5CLdSUIkxtyzs=
github.com/oracle/oci-go-sdk v1.8.0/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888=
@ -526,7 +516,6 @@ golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73r
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181201002055-351d144fa1fc h1:a3CU5tJYVj92DY2LaA1kUkrsqD5/3mLDhx2NcNqyW+0=
@ -565,8 +554,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e h1:o3PsSEY8E4eXWkXrIP9YJALUkVZqzHJT5DOasTyn8Vs=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5 h1:x6r4Jo0KNzOOzYd8lbcRsqjuqEASK6ob3auvWYM4/8U=
golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -670,21 +657,13 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/cheggaaa/pb.v1 v1.0.27 h1:kJdccidYzt3CaHD1crCFTS1hxyhSi059NhOFUf03YFo=
gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7 h1:xOHLXZwVvI9hhs+cLKq5+I5onOuwQLhQwiu63xxlHs4=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/h2non/gock.v1 v1.0.12 h1:o3JJqe+h7R9Ay6LtMeFrKz1WnokrJDrNpDQs9KGqVn8=
gopkg.in/h2non/gock.v1 v1.0.12/go.mod h1:KHI4Z1sxDW6P4N3DfTWSEza07YpkQP7KJBfglRMEjKY=
gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk=
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516 h1:H6trpavCIuipdInWrab8l34Mf+GGVfphniHostMdMaQ=
gopkg.in/jarcoal/httpmock.v1 v1.0.0-20181117152235-275e9df93516/go.mod h1:d3R+NllX3X5e0zlG1Rful3uLvsGC/Q3OHut5464DEQw=
gopkg.in/resty.v1 v1.12.0 h1:CuXP0Pjfw9rOuY6EP+UvtNvt5DSqHpIxILZKT/quCZI=
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.7 h1:VUgggvou5XRW9mHwD/yXxIYSMtY0zoKQf/v226p2nyo=
@ -695,5 +674,4 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=

View File

@ -1,7 +1,7 @@
Copyright 2017 NAVER BUSINESS PLATFORM Corp.
Copyright 2018 NAVER BUSINESS PLATFORM Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,67 @@
package hmac
import (
"crypto"
"crypto/hmac"
"encoding/base64"
"fmt"
"net/url"
)
func NewSigner(secretKey string, hashFunc crypto.Hash) *HMACSigner {
return &HMACSigner{
secretKey: secretKey,
hashFunc: hashFunc,
}
}
type signer interface {
Sign(method string, url string, accessKey string, apiKey string, timestamp string) (string, error)
HashFunc() crypto.Hash
Debug(enabled bool)
}
type HMACSigner struct {
secretKey string
hashFunc crypto.Hash
debug bool
}
func (s *HMACSigner) Debug(enabled bool) {
s.debug = enabled
}
func (s *HMACSigner) Sign(method string, reqUrl string, accessKey string, timestamp string) (string, error) {
const space = " "
const newLine = "\n"
u, err := url.Parse(reqUrl)
if err != nil {
return "", err
}
if s.debug {
fmt.Println("reqUrl: ", reqUrl)
fmt.Println("accessKey: ", accessKey)
}
h := hmac.New(s.HashFunc().New, []byte(s.secretKey))
h.Write([]byte(method))
h.Write([]byte(space))
h.Write([]byte(u.RequestURI()))
h.Write([]byte(newLine))
h.Write([]byte(timestamp))
h.Write([]byte(newLine))
h.Write([]byte(accessKey))
rawSignature := h.Sum(nil)
base64signature := base64.StdEncoding.EncodeToString(rawSignature)
if s.debug {
fmt.Println("Base64 signature:", base64signature)
}
return base64signature, nil
}
func (s *HMACSigner) HashFunc() crypto.Hash {
return s.hashFunc
}

View File

@ -0,0 +1,75 @@
package ncloud
import (
"bufio"
"log"
"net/http"
"os"
"os/user"
"path/filepath"
"strings"
)
type APIKey struct {
AccessKey string
SecretKey string
}
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
HTTPClient *http.Client
APIKey *APIKey
}
func Keys() *APIKey {
apiKey := &APIKey{
AccessKey: "",
SecretKey: "",
}
usr, err := user.Current()
if err != nil {
log.Fatal(err)
return nil
}
if usr.HomeDir == "" {
log.Fatal("use.HomeDir is nil")
return nil
}
configureFile := filepath.Join(usr.HomeDir, ".ncloud", "configure")
file, err := os.Open(configureFile)
if err != nil {
log.Fatal(err)
return nil
}
defer file.Close()
scanner := bufio.NewScanner(file)
for scanner.Scan() {
line := scanner.Text()
s := strings.Split(line, "=")
switch strings.TrimSpace(s[0]) {
case "ncloud_access_key_id":
apiKey.AccessKey = strings.TrimSpace(s[1])
case "ncloud_secret_access_key":
apiKey.SecretKey = strings.TrimSpace(s[1])
}
}
if err := scanner.Err(); err != nil {
log.Fatal(err)
return nil
}
return apiKey
}
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}

View File

@ -0,0 +1,106 @@
package ncloud
import (
"strconv"
)
func String(v string) *string {
return &v
}
func IntString(n int) *string {
return String(strconv.Itoa(n))
}
func StringInterfaceList(i []interface{}) []*string {
vs := make([]*string, 0, len(i))
for _, v := range i {
switch v.(type) {
case *string:
vs = append(vs, v.(*string))
default:
vs = append(vs, String(v.(string)))
}
}
return vs
}
func StringList(s []string) []*string {
vs := make([]*string, 0, len(s))
for _, v := range s {
vs = append(vs, String(v))
}
return vs
}
func StringListValue(input []*string) []string {
vs := make([]string, 0, len(input))
for _, v := range input {
vs = append(vs, StringValue(v))
}
return vs
}
func StringValue(v *string) string {
if v != nil {
return *v
}
return ""
}
func Bool(v bool) *bool {
return &v
}
func BoolValue(v *bool) bool {
if v != nil {
return *v
}
return false
}
func Int(v int) *int {
return &v
}
func IntValue(v *int) int {
if v != nil {
return *v
}
return 0
}
func Int32(v int32) *int32 {
return &v
}
func Int32Value(v *int32) int32 {
if v != nil {
return *v
}
return 0
}
func Int64(v int64) *int64 {
return &v
}
func Int64Value(v *int64) int64 {
if v != nil {
return *v
}
return 0
}
func Float32(v float32) *float32 {
return &v
}
func Float32Value(v *float32) float32 {
if v != nil {
return *v
}
return 0
}

View File

@ -0,0 +1,8 @@
language: go
install:
- go get -d -v .
script:
- go build -v ./

View File

@ -0,0 +1,7 @@
Copyright 2018 NAVER BUSINESS PLATFORM Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,224 @@
# Go API client for server
<br/>https://ncloud.apigw.ntruss.com/server/v2
## Overview
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
- API version: 2018-10-18T06:16:13Z
- Package version: 1.1.0
- Build package: io.swagger.codegen.languages.NcpGoForNcloudClientCodegen
## Installation
Put the package under your project folder and add the following in import:
```
"./server"
```
## Documentation for API Endpoints
All URIs are relative to *https://ncloud.apigw.ntruss.com/server/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*V2Api* | [**AddNasVolumeAccessControl**](docs/V2Api.md#addnasvolumeaccesscontrol) | **Post** /addNasVolumeAccessControl |
*V2Api* | [**AddPortForwardingRules**](docs/V2Api.md#addportforwardingrules) | **Post** /addPortForwardingRules |
*V2Api* | [**AssociatePublicIpWithServerInstance**](docs/V2Api.md#associatepublicipwithserverinstance) | **Post** /associatePublicIpWithServerInstance |
*V2Api* | [**AttachBlockStorageInstance**](docs/V2Api.md#attachblockstorageinstance) | **Post** /attachBlockStorageInstance |
*V2Api* | [**AttachNetworkInterface**](docs/V2Api.md#attachnetworkinterface) | **Post** /attachNetworkInterface |
*V2Api* | [**ChangeNasVolumeSize**](docs/V2Api.md#changenasvolumesize) | **Post** /changeNasVolumeSize |
*V2Api* | [**ChangeServerInstanceSpec**](docs/V2Api.md#changeserverinstancespec) | **Post** /changeServerInstanceSpec |
*V2Api* | [**CreateBlockStorageInstance**](docs/V2Api.md#createblockstorageinstance) | **Post** /createBlockStorageInstance |
*V2Api* | [**CreateBlockStorageSnapshotInstance**](docs/V2Api.md#createblockstoragesnapshotinstance) | **Post** /createBlockStorageSnapshotInstance |
*V2Api* | [**CreateInstanceTags**](docs/V2Api.md#createinstancetags) | **Post** /createInstanceTags |
*V2Api* | [**CreateLoginKey**](docs/V2Api.md#createloginkey) | **Post** /createLoginKey |
*V2Api* | [**CreateMemberServerImage**](docs/V2Api.md#creatememberserverimage) | **Post** /createMemberServerImage |
*V2Api* | [**CreateNasVolumeInstance**](docs/V2Api.md#createnasvolumeinstance) | **Post** /createNasVolumeInstance |
*V2Api* | [**CreateNetworkInterface**](docs/V2Api.md#createnetworkinterface) | **Post** /createNetworkInterface |
*V2Api* | [**CreatePublicIpInstance**](docs/V2Api.md#createpublicipinstance) | **Post** /createPublicIpInstance |
*V2Api* | [**CreateServerInstances**](docs/V2Api.md#createserverinstances) | **Post** /createServerInstances |
*V2Api* | [**DeleteBlockStorageInstances**](docs/V2Api.md#deleteblockstorageinstances) | **Post** /deleteBlockStorageInstances |
*V2Api* | [**DeleteBlockStorageSnapshotInstances**](docs/V2Api.md#deleteblockstoragesnapshotinstances) | **Post** /deleteBlockStorageSnapshotInstances |
*V2Api* | [**DeleteInstanceTags**](docs/V2Api.md#deleteinstancetags) | **Post** /deleteInstanceTags |
*V2Api* | [**DeleteLoginKey**](docs/V2Api.md#deleteloginkey) | **Post** /deleteLoginKey |
*V2Api* | [**DeleteMemberServerImages**](docs/V2Api.md#deletememberserverimages) | **Post** /deleteMemberServerImages |
*V2Api* | [**DeleteNasVolumeInstance**](docs/V2Api.md#deletenasvolumeinstance) | **Post** /deleteNasVolumeInstance |
*V2Api* | [**DeleteNetworkInterface**](docs/V2Api.md#deletenetworkinterface) | **Post** /deleteNetworkInterface |
*V2Api* | [**DeletePortForwardingRules**](docs/V2Api.md#deleteportforwardingrules) | **Post** /deletePortForwardingRules |
*V2Api* | [**DeletePublicIpInstances**](docs/V2Api.md#deletepublicipinstances) | **Post** /deletePublicIpInstances |
*V2Api* | [**DetachBlockStorageInstances**](docs/V2Api.md#detachblockstorageinstances) | **Post** /detachBlockStorageInstances |
*V2Api* | [**DetachNetworkInterface**](docs/V2Api.md#detachnetworkinterface) | **Post** /detachNetworkInterface |
*V2Api* | [**DisassociatePublicIpFromServerInstance**](docs/V2Api.md#disassociatepublicipfromserverinstance) | **Post** /disassociatePublicIpFromServerInstance |
*V2Api* | [**GetAccessControlGroupList**](docs/V2Api.md#getaccesscontrolgrouplist) | **Post** /getAccessControlGroupList |
*V2Api* | [**GetAccessControlGroupServerInstanceList**](docs/V2Api.md#getaccesscontrolgroupserverinstancelist) | **Post** /getAccessControlGroupServerInstanceList |
*V2Api* | [**GetAccessControlRuleList**](docs/V2Api.md#getaccesscontrolrulelist) | **Post** /getAccessControlRuleList |
*V2Api* | [**GetBlockStorageInstanceList**](docs/V2Api.md#getblockstorageinstancelist) | **Post** /getBlockStorageInstanceList |
*V2Api* | [**GetBlockStorageSnapshotInstanceList**](docs/V2Api.md#getblockstoragesnapshotinstancelist) | **Post** /getBlockStorageSnapshotInstanceList |
*V2Api* | [**GetInstanceTagList**](docs/V2Api.md#getinstancetaglist) | **Post** /getInstanceTagList |
*V2Api* | [**GetLoginKeyList**](docs/V2Api.md#getloginkeylist) | **Post** /getLoginKeyList |
*V2Api* | [**GetMemberServerImageList**](docs/V2Api.md#getmemberserverimagelist) | **Post** /getMemberServerImageList |
*V2Api* | [**GetNasVolumeInstanceList**](docs/V2Api.md#getnasvolumeinstancelist) | **Post** /getNasVolumeInstanceList |
*V2Api* | [**GetNasVolumeInstanceRatingList**](docs/V2Api.md#getnasvolumeinstanceratinglist) | **Post** /getNasVolumeInstanceRatingList |
*V2Api* | [**GetNetworkInterfaceList**](docs/V2Api.md#getnetworkinterfacelist) | **Post** /getNetworkInterfaceList |
*V2Api* | [**GetPortForwardingRuleList**](docs/V2Api.md#getportforwardingrulelist) | **Post** /getPortForwardingRuleList |
*V2Api* | [**GetPrivateSubnetInstanceList**](docs/V2Api.md#getprivatesubnetinstancelist) | **Post** /getPrivateSubnetInstanceList |
*V2Api* | [**GetPublicIpInstanceList**](docs/V2Api.md#getpublicipinstancelist) | **Post** /getPublicIpInstanceList |
*V2Api* | [**GetPublicIpTargetServerInstanceList**](docs/V2Api.md#getpubliciptargetserverinstancelist) | **Post** /getPublicIpTargetServerInstanceList |
*V2Api* | [**GetRaidList**](docs/V2Api.md#getraidlist) | **Post** /getRaidList |
*V2Api* | [**GetRegionList**](docs/V2Api.md#getregionlist) | **Post** /getRegionList |
*V2Api* | [**GetRootPassword**](docs/V2Api.md#getrootpassword) | **Post** /getRootPassword |
*V2Api* | [**GetServerImageProductList**](docs/V2Api.md#getserverimageproductlist) | **Post** /getServerImageProductList |
*V2Api* | [**GetServerInstanceList**](docs/V2Api.md#getserverinstancelist) | **Post** /getServerInstanceList |
*V2Api* | [**GetServerProductList**](docs/V2Api.md#getserverproductlist) | **Post** /getServerProductList |
*V2Api* | [**GetZoneList**](docs/V2Api.md#getzonelist) | **Post** /getZoneList |
*V2Api* | [**ImportLoginKey**](docs/V2Api.md#importloginkey) | **Post** /importLoginKey |
*V2Api* | [**RebootServerInstances**](docs/V2Api.md#rebootserverinstances) | **Post** /rebootServerInstances |
*V2Api* | [**RecreateServerInstance**](docs/V2Api.md#recreateserverinstance) | **Post** /recreateServerInstance |
*V2Api* | [**RemoveNasVolumeAccessControl**](docs/V2Api.md#removenasvolumeaccesscontrol) | **Post** /removeNasVolumeAccessControl |
*V2Api* | [**SetNasVolumeAccessControl**](docs/V2Api.md#setnasvolumeaccesscontrol) | **Post** /setNasVolumeAccessControl |
*V2Api* | [**StartServerInstances**](docs/V2Api.md#startserverinstances) | **Post** /startServerInstances |
*V2Api* | [**StopServerInstances**](docs/V2Api.md#stopserverinstances) | **Post** /stopServerInstances |
*V2Api* | [**TerminateServerInstances**](docs/V2Api.md#terminateserverinstances) | **Post** /terminateServerInstances |
## Documentation For Models
- [AccessControlGroup](docs/AccessControlGroup.md)
- [AccessControlRule](docs/AccessControlRule.md)
- [AddNasVolumeAccessControlRequest](docs/AddNasVolumeAccessControlRequest.md)
- [AddNasVolumeAccessControlResponse](docs/AddNasVolumeAccessControlResponse.md)
- [AddPortForwardingRulesRequest](docs/AddPortForwardingRulesRequest.md)
- [AddPortForwardingRulesResponse](docs/AddPortForwardingRulesResponse.md)
- [AssociatePublicIpWithServerInstanceRequest](docs/AssociatePublicIpWithServerInstanceRequest.md)
- [AssociatePublicIpWithServerInstanceResponse](docs/AssociatePublicIpWithServerInstanceResponse.md)
- [AttachBlockStorageInstanceRequest](docs/AttachBlockStorageInstanceRequest.md)
- [AttachBlockStorageInstanceResponse](docs/AttachBlockStorageInstanceResponse.md)
- [AttachNetworkInterfaceRequest](docs/AttachNetworkInterfaceRequest.md)
- [AttachNetworkInterfaceResponse](docs/AttachNetworkInterfaceResponse.md)
- [BlockStorageInstance](docs/BlockStorageInstance.md)
- [BlockStorageSnapshotInstance](docs/BlockStorageSnapshotInstance.md)
- [ChangeNasVolumeSizeRequest](docs/ChangeNasVolumeSizeRequest.md)
- [ChangeNasVolumeSizeResponse](docs/ChangeNasVolumeSizeResponse.md)
- [ChangeServerInstanceSpecRequest](docs/ChangeServerInstanceSpecRequest.md)
- [ChangeServerInstanceSpecResponse](docs/ChangeServerInstanceSpecResponse.md)
- [CommonCode](docs/CommonCode.md)
- [CreateBlockStorageInstanceRequest](docs/CreateBlockStorageInstanceRequest.md)
- [CreateBlockStorageInstanceResponse](docs/CreateBlockStorageInstanceResponse.md)
- [CreateBlockStorageSnapshotInstanceRequest](docs/CreateBlockStorageSnapshotInstanceRequest.md)
- [CreateBlockStorageSnapshotInstanceResponse](docs/CreateBlockStorageSnapshotInstanceResponse.md)
- [CreateInstanceTagsRequest](docs/CreateInstanceTagsRequest.md)
- [CreateInstanceTagsResponse](docs/CreateInstanceTagsResponse.md)
- [CreateLoginKeyRequest](docs/CreateLoginKeyRequest.md)
- [CreateLoginKeyResponse](docs/CreateLoginKeyResponse.md)
- [CreateMemberServerImageRequest](docs/CreateMemberServerImageRequest.md)
- [CreateMemberServerImageResponse](docs/CreateMemberServerImageResponse.md)
- [CreateNasVolumeInstanceRequest](docs/CreateNasVolumeInstanceRequest.md)
- [CreateNasVolumeInstanceResponse](docs/CreateNasVolumeInstanceResponse.md)
- [CreateNetworkInterfaceRequest](docs/CreateNetworkInterfaceRequest.md)
- [CreateNetworkInterfaceResponse](docs/CreateNetworkInterfaceResponse.md)
- [CreatePublicIpInstanceRequest](docs/CreatePublicIpInstanceRequest.md)
- [CreatePublicIpInstanceResponse](docs/CreatePublicIpInstanceResponse.md)
- [CreateServerInstancesRequest](docs/CreateServerInstancesRequest.md)
- [CreateServerInstancesResponse](docs/CreateServerInstancesResponse.md)
- [DeleteBlockStorageInstancesRequest](docs/DeleteBlockStorageInstancesRequest.md)
- [DeleteBlockStorageInstancesResponse](docs/DeleteBlockStorageInstancesResponse.md)
- [DeleteBlockStorageSnapshotInstancesRequest](docs/DeleteBlockStorageSnapshotInstancesRequest.md)
- [DeleteBlockStorageSnapshotInstancesResponse](docs/DeleteBlockStorageSnapshotInstancesResponse.md)
- [DeleteInstanceTagsRequest](docs/DeleteInstanceTagsRequest.md)
- [DeleteInstanceTagsResponse](docs/DeleteInstanceTagsResponse.md)
- [DeleteLoginKeyRequest](docs/DeleteLoginKeyRequest.md)
- [DeleteLoginKeyResponse](docs/DeleteLoginKeyResponse.md)
- [DeleteMemberServerImagesRequest](docs/DeleteMemberServerImagesRequest.md)
- [DeleteMemberServerImagesResponse](docs/DeleteMemberServerImagesResponse.md)
- [DeleteNasVolumeInstanceRequest](docs/DeleteNasVolumeInstanceRequest.md)
- [DeleteNasVolumeInstanceResponse](docs/DeleteNasVolumeInstanceResponse.md)
- [DeleteNetworkInterfaceRequest](docs/DeleteNetworkInterfaceRequest.md)
- [DeleteNetworkInterfaceResponse](docs/DeleteNetworkInterfaceResponse.md)
- [DeletePortForwardingRulesRequest](docs/DeletePortForwardingRulesRequest.md)
- [DeletePortForwardingRulesResponse](docs/DeletePortForwardingRulesResponse.md)
- [DeletePublicIpInstancesRequest](docs/DeletePublicIpInstancesRequest.md)
- [DeletePublicIpInstancesResponse](docs/DeletePublicIpInstancesResponse.md)
- [DetachBlockStorageInstancesRequest](docs/DetachBlockStorageInstancesRequest.md)
- [DetachBlockStorageInstancesResponse](docs/DetachBlockStorageInstancesResponse.md)
- [DetachNetworkInterfaceRequest](docs/DetachNetworkInterfaceRequest.md)
- [DetachNetworkInterfaceResponse](docs/DetachNetworkInterfaceResponse.md)
- [DisassociatePublicIpFromServerInstanceRequest](docs/DisassociatePublicIpFromServerInstanceRequest.md)
- [DisassociatePublicIpFromServerInstanceResponse](docs/DisassociatePublicIpFromServerInstanceResponse.md)
- [GetAccessControlGroupListRequest](docs/GetAccessControlGroupListRequest.md)
- [GetAccessControlGroupListResponse](docs/GetAccessControlGroupListResponse.md)
- [GetAccessControlGroupServerInstanceListRequest](docs/GetAccessControlGroupServerInstanceListRequest.md)
- [GetAccessControlGroupServerInstanceListResponse](docs/GetAccessControlGroupServerInstanceListResponse.md)
- [GetAccessControlRuleListRequest](docs/GetAccessControlRuleListRequest.md)
- [GetAccessControlRuleListResponse](docs/GetAccessControlRuleListResponse.md)
- [GetBlockStorageInstanceListRequest](docs/GetBlockStorageInstanceListRequest.md)
- [GetBlockStorageInstanceListResponse](docs/GetBlockStorageInstanceListResponse.md)
- [GetBlockStorageSnapshotInstanceListRequest](docs/GetBlockStorageSnapshotInstanceListRequest.md)
- [GetBlockStorageSnapshotInstanceListResponse](docs/GetBlockStorageSnapshotInstanceListResponse.md)
- [GetInstanceTagListRequest](docs/GetInstanceTagListRequest.md)
- [GetInstanceTagListResponse](docs/GetInstanceTagListResponse.md)
- [GetLoginKeyListRequest](docs/GetLoginKeyListRequest.md)
- [GetLoginKeyListResponse](docs/GetLoginKeyListResponse.md)
- [GetMemberServerImageListRequest](docs/GetMemberServerImageListRequest.md)
- [GetMemberServerImageListResponse](docs/GetMemberServerImageListResponse.md)
- [GetNasVolumeInstanceListRequest](docs/GetNasVolumeInstanceListRequest.md)
- [GetNasVolumeInstanceListResponse](docs/GetNasVolumeInstanceListResponse.md)
- [GetNasVolumeInstanceRatingListRequest](docs/GetNasVolumeInstanceRatingListRequest.md)
- [GetNasVolumeInstanceRatingListResponse](docs/GetNasVolumeInstanceRatingListResponse.md)
- [GetNetworkInterfaceListRequest](docs/GetNetworkInterfaceListRequest.md)
- [GetNetworkInterfaceListResponse](docs/GetNetworkInterfaceListResponse.md)
- [GetPortForwardingRuleListRequest](docs/GetPortForwardingRuleListRequest.md)
- [GetPortForwardingRuleListResponse](docs/GetPortForwardingRuleListResponse.md)
- [GetPrivateSubnetInstanceListRequest](docs/GetPrivateSubnetInstanceListRequest.md)
- [GetPrivateSubnetInstanceListResponse](docs/GetPrivateSubnetInstanceListResponse.md)
- [GetPublicIpInstanceListRequest](docs/GetPublicIpInstanceListRequest.md)
- [GetPublicIpInstanceListResponse](docs/GetPublicIpInstanceListResponse.md)
- [GetPublicIpTargetServerInstanceListRequest](docs/GetPublicIpTargetServerInstanceListRequest.md)
- [GetPublicIpTargetServerInstanceListResponse](docs/GetPublicIpTargetServerInstanceListResponse.md)
- [GetRaidListRequest](docs/GetRaidListRequest.md)
- [GetRaidListResponse](docs/GetRaidListResponse.md)
- [GetRegionListRequest](docs/GetRegionListRequest.md)
- [GetRegionListResponse](docs/GetRegionListResponse.md)
- [GetRootPasswordRequest](docs/GetRootPasswordRequest.md)
- [GetRootPasswordResponse](docs/GetRootPasswordResponse.md)
- [GetServerImageProductListRequest](docs/GetServerImageProductListRequest.md)
- [GetServerImageProductListResponse](docs/GetServerImageProductListResponse.md)
- [GetServerInstanceListRequest](docs/GetServerInstanceListRequest.md)
- [GetServerInstanceListResponse](docs/GetServerInstanceListResponse.md)
- [GetServerProductListRequest](docs/GetServerProductListRequest.md)
- [GetServerProductListResponse](docs/GetServerProductListResponse.md)
- [GetZoneListRequest](docs/GetZoneListRequest.md)
- [GetZoneListResponse](docs/GetZoneListResponse.md)
- [ImportLoginKeyRequest](docs/ImportLoginKeyRequest.md)
- [ImportLoginKeyResponse](docs/ImportLoginKeyResponse.md)
- [InstanceTag](docs/InstanceTag.md)
- [InstanceTagParameter](docs/InstanceTagParameter.md)
- [LoginKey](docs/LoginKey.md)
- [MemberServerImage](docs/MemberServerImage.md)
- [NasVolumeInstance](docs/NasVolumeInstance.md)
- [NasVolumeInstanceCustomIp](docs/NasVolumeInstanceCustomIp.md)
- [NasVolumeInstanceRating](docs/NasVolumeInstanceRating.md)
- [NetworkInterface](docs/NetworkInterface.md)
- [PortForwardingRule](docs/PortForwardingRule.md)
- [PortForwardingRuleParameter](docs/PortForwardingRuleParameter.md)
- [PrivateSubnetInstance](docs/PrivateSubnetInstance.md)
- [Product](docs/Product.md)
- [PublicIpInstance](docs/PublicIpInstance.md)
- [Raid](docs/Raid.md)
- [RebootServerInstancesRequest](docs/RebootServerInstancesRequest.md)
- [RebootServerInstancesResponse](docs/RebootServerInstancesResponse.md)
- [RecreateServerInstanceRequest](docs/RecreateServerInstanceRequest.md)
- [RecreateServerInstanceResponse](docs/RecreateServerInstanceResponse.md)
- [Region](docs/Region.md)
- [RemoveNasVolumeAccessControlRequest](docs/RemoveNasVolumeAccessControlRequest.md)
- [RemoveNasVolumeAccessControlResponse](docs/RemoveNasVolumeAccessControlResponse.md)
- [ServerInstance](docs/ServerInstance.md)
- [SetNasVolumeAccessControlRequest](docs/SetNasVolumeAccessControlRequest.md)
- [SetNasVolumeAccessControlResponse](docs/SetNasVolumeAccessControlResponse.md)
- [StartServerInstancesRequest](docs/StartServerInstancesRequest.md)
- [StartServerInstancesResponse](docs/StartServerInstancesResponse.md)
- [StopServerInstancesRequest](docs/StopServerInstancesRequest.md)
- [StopServerInstancesResponse](docs/StopServerInstancesResponse.md)
- [TerminateServerInstancesRequest](docs/TerminateServerInstancesRequest.md)
- [TerminateServerInstancesResponse](docs/TerminateServerInstancesResponse.md)
- [Zone](docs/Zone.md)

View File

@ -0,0 +1,28 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AccessControlGroup struct {
// 접근제어그룹설정번호
AccessControlGroupConfigurationNo *string `json:"accessControlGroupConfigurationNo,omitempty"`
// 접근제어그룹명
AccessControlGroupName *string `json:"accessControlGroupName,omitempty"`
// 접근제어그룹설명
AccessControlGroupDescription *string `json:"accessControlGroupDescription,omitempty"`
// 디폴트그룹여부
IsDefaultGroup *bool `json:"isDefaultGroup,omitempty"`
// 생성일자
CreateDate *string `json:"createDate,omitempty"`
}

View File

@ -0,0 +1,34 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AccessControlRule struct {
// 접근제어RULE설정번호
AccessControlRuleConfigurationNo *string `json:"accessControlRuleConfigurationNo,omitempty"`
// 프로토콜구분
ProtocolType *CommonCode `json:"protocolType,omitempty"`
// 소스IP
SourceIp *string `json:"sourceIp,omitempty"`
// 소스접근제어그룹번호
SourceAccessControlRuleConfigurationNo *string `json:"sourceAccessControlRuleConfigurationNo,omitempty"`
// 소스접근제어그룹이름
SourceAccessControlRuleName *string `json:"sourceAccessControlRuleName,omitempty"`
// 목적지포트
DestinationPort *string `json:"destinationPort,omitempty"`
// 접근제어RULE설명
AccessControlRuleDescription *string `json:"accessControlRuleDescription,omitempty"`
}

View File

@ -0,0 +1,22 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AddNasVolumeAccessControlRequest struct {
// NAS볼륨인스턴스번호
NasVolumeInstanceNo *string `json:"nasVolumeInstanceNo"`
// 서버인스턴스번호리스트
ServerInstanceNoList []*string `json:"serverInstanceNoList,omitempty"`
// 커스텀IP리스트
CustomIpList []*string `json:"customIpList,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AddNasVolumeAccessControlResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
NasVolumeInstanceList []*NasVolumeInstance `json:"nasVolumeInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AddPortForwardingRulesRequest struct {
// 포트포워딩설정번호
PortForwardingConfigurationNo *string `json:"portForwardingConfigurationNo"`
// 포트포워딩RULE리스트
PortForwardingRuleList []*PortForwardingRuleParameter `json:"portForwardingRuleList"`
}

View File

@ -0,0 +1,35 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AddPortForwardingRulesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
// 포트포워딩설정번호
PortForwardingConfigurationNo *string `json:"portForwardingConfigurationNo,omitempty"`
// 포트포워딩공인IP
PortForwardingPublicIp *string `json:"portForwardingPublicIp,omitempty"`
// ZONE
Zone *Zone `json:"zone,omitempty"`
// 인터넷회선구분
InternetLineType *CommonCode `json:"internetLineType,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PortForwardingRuleList []*PortForwardingRule `json:"portForwardingRuleList,omitempty"`
}

View File

@ -0,0 +1,474 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
import (
"bytes"
"crypto"
"errors"
"fmt"
"io"
"mime/multipart"
"net/http"
"net/url"
"os"
"path/filepath"
"reflect"
"regexp"
"strconv"
"strings"
"time"
"unicode"
"unicode/utf8"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/hmac"
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
)
var (
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
)
// APIClient manages communication with the server API v2018-10-18T06:16:13Z
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *ncloud.Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
// API Services
V2Api *V2ApiService
}
type service struct {
client *APIClient
}
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
// optionally a custom http.Client to allow for advanced features such as caching.
func NewAPIClient(cfg *ncloud.Configuration) *APIClient {
if cfg.HTTPClient == nil {
cfg.HTTPClient = http.DefaultClient
}
c := &APIClient{}
c.cfg = cfg
c.common.client = c
// API Services
c.V2Api = (*V2ApiService)(&c.common)
return c
}
func atoi(in string) (int, error) {
return strconv.Atoi(in)
}
// selectHeaderContentType select a content type from the available list.
func selectHeaderContentType(contentTypes []string) string {
if len(contentTypes) == 0 {
return ""
}
if contains(contentTypes, "application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
// selectHeaderAccept join all accept types and return
func selectHeaderAccept(accepts []string) string {
if len(accepts) == 0 {
return ""
}
if contains(accepts, "application/json") {
return "application/json"
}
return strings.Join(accepts, ",")
}
// contains is a case insenstive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
return true
}
}
return false
}
// Verify optional parameters are of the correct type.
func typeCheckParameter(obj interface{}, expected string, name string) error {
// Make sure there is an object.
if obj == nil {
return nil
}
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func parameterToString(obj interface{}, collectionFormat string) string {
var delimiter string
switch collectionFormat {
case "pipes":
delimiter = "|"
case "ssv":
delimiter = " "
case "tsv":
delimiter = "\t"
case "csv":
delimiter = ","
}
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
}
return fmt.Sprintf("%v", obj)
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
return c.cfg.HTTPClient.Do(request)
}
// Change base path to allow switching to mocks
func (c *APIClient) ChangeBasePath(path string) {
c.cfg.BasePath = path
}
// prepareRequest build the request
func (c *APIClient) prepareRequest(
path string,
method string,
postBody interface{},
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
// Detect postBody type and post.
if postBody != nil {
contentType := headerParams["Content-Type"]
if contentType == "" {
contentType = detectContentType(postBody)
headerParams["Content-Type"] = contentType
}
body, err = setBody(postBody, contentType)
if err != nil {
return nil, err
}
}
// add form parameters and file if available.
if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
if body != nil {
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
}
body = &bytes.Buffer{}
w := multipart.NewWriter(body)
for k, v := range formParams {
for _, iv := range v {
if strings.HasPrefix(k, "@") { // file
err = addFile(w, k[1:], iv)
if err != nil {
return nil, err
}
} else { // form value
w.WriteField(k, iv)
}
}
}
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile("file", filepath.Base(fileName))
if err != nil {
return nil, err
}
_, err = part.Write(fileBytes)
if err != nil {
return nil, err
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
}
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
w.Close()
}
// Setup path and query parameters
url, err := url.Parse(path)
if err != nil {
return nil, err
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
query.Add(k, iv)
}
}
// Encode the parameters.
url.RawQuery = query.Encode()
// Generate a new request
if body != nil {
localVarRequest, err = http.NewRequest(method, url.String(), body)
} else {
localVarRequest, err = http.NewRequest(method, url.String(), nil)
}
if err != nil {
return nil, err
}
// add header parameters, if any
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers.Set(h, v)
}
localVarRequest.Header = headers
}
// Override request host, if applicable
if c.cfg.Host != "" {
localVarRequest.Host = c.cfg.Host
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
// APIKey Authentication
if auth := c.cfg.APIKey; auth != nil {
timestamp := strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10)
signer := hmac.NewSigner(auth.SecretKey, crypto.SHA256)
signature, _ := signer.Sign(method, path, auth.AccessKey, timestamp)
localVarRequest.Header.Add("x-ncp-apigw-timestamp", timestamp)
localVarRequest.Header.Add("x-ncp-iam-access-key", auth.AccessKey)
localVarRequest.Header.Add("x-ncp-apigw-signature-v1", signature)
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
return err
}
_, err = io.Copy(part, file)
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) error {
return fmt.Errorf(format, a...)
}
func toLowerFirstChar(s string) string {
a := []rune(s)
a[0] = unicode.ToLower(a[0])
return string(a)
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
bodyBuf = &bytes.Buffer{}
}
result := "responseFormatType=json"
s := reflect.ValueOf(body).Elem()
typeOfT := s.Type()
for i := 0; i < s.NumField(); i++ {
f := s.Field(i)
if !f.IsNil() {
key := toLowerFirstChar(typeOfT.Field(i).Name)
if f.Kind() == reflect.Ptr {
switch f.Type().String() {
case "*string":
result += fmt.Sprintf("&%s=%s", key, url.QueryEscape(ncloud.StringValue(f.Interface().(*string))))
case "*bool":
result += fmt.Sprintf("&%s=%t", key, ncloud.BoolValue(f.Interface().(*bool)))
case "*int":
result += fmt.Sprintf("&%s=%d", key, ncloud.IntValue(f.Interface().(*int)))
case "*int32":
result += fmt.Sprintf("&%s=%d", key, ncloud.Int32Value(f.Interface().(*int32)))
case "*int64":
result += fmt.Sprintf("&%s=%d", key, ncloud.Int64Value(f.Interface().(*int64)))
case "*float32":
result += fmt.Sprintf("&%s=%f", key, ncloud.Float32Value(f.Interface().(*float32)))
}
} else if f.Kind() == reflect.Slice {
for i := 0; i < f.Len(); i++ {
item := f.Index(i)
if item.Elem().Kind() == reflect.Struct {
item := item.Elem()
typeOfSubItem := item.Type()
for j := 0; j < item.NumField(); j++ {
subItem := item.Field(j)
subKey := toLowerFirstChar(typeOfSubItem.Field(j).Name)
switch subItem.Type().String() {
case "*string":
result += fmt.Sprintf("&%s.%d.%s=%s", key, i+1, subKey, url.QueryEscape(ncloud.StringValue(subItem.Interface().(*string))))
case "*bool":
result += fmt.Sprintf("&%s.%d.%s=%t", key, i+1, subKey, ncloud.BoolValue(subItem.Interface().(*bool)))
case "*int":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, subKey, ncloud.IntValue(subItem.Interface().(*int)))
case "*int32":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, subKey, ncloud.Int32Value(subItem.Interface().(*int32)))
case "*int64":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, subKey, ncloud.Int64Value(subItem.Interface().(*int64)))
case "*float32":
result += fmt.Sprintf("&%s.%d.%s=%f", key, i+1, subKey, ncloud.Float32Value(subItem.Interface().(*float32)))
}
}
} else {
switch item.Type().String() {
case "*string":
result += fmt.Sprintf("&%s.%d=%s", key, i+1, url.QueryEscape(*item.Interface().(*string)))
case "*bool":
result += fmt.Sprintf("&%s.%d.%s=%t", key, i+1, ncloud.BoolValue(item.Interface().(*bool)))
case "*int":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, item.Interface().(*int))
case "*int32":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, item.Interface().(*int32))
case "*int64":
result += fmt.Sprintf("&%s.%d.%s=%d", key, i+1, item.Interface().(*int64))
case "*float32":
result += fmt.Sprintf("&%s.%d.%s=%f", key, i+1, item.Interface().(*float32))
}
}
}
}
}
}
if err != nil {
return nil, err
}
bodyBuf.WriteString(result)
if bodyBuf.Len() == 0 {
err = fmt.Errorf("Invalid body type %s", contentType)
return nil, err
}
return bodyBuf, nil
}
// detectContentType method is used to figure out `Request.Body` content type for request header
func detectContentType(body interface{}) string {
contentType := "text/plain; charset=utf-8"
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"
default:
if b, ok := body.([]byte); ok {
contentType = http.DetectContentType(b)
} else if kind == reflect.Slice {
contentType = "application/json; charset=utf-8"
}
}
return contentType
}
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
type cacheControl map[string]string
func parseCacheControl(headers http.Header) cacheControl {
cc := cacheControl{}
ccHeader := headers.Get("Cache-Control")
for _, part := range strings.Split(ccHeader, ",") {
part = strings.Trim(part, " ")
if part == "" {
continue
}
if strings.ContainsRune(part, '=') {
keyval := strings.Split(part, "=")
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
} else {
cc[part] = ""
}
}
return cc
}
// CacheExpires helper function to determine remaining time before repeating a request.
func CacheExpires(r *http.Response) time.Time {
// Figure out when the cache expires.
var expires time.Time
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
if err != nil {
return time.Now()
}
respCacheControl := parseCacheControl(r.Header)
if maxAge, ok := respCacheControl["max-age"]; ok {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
}
expires = now.Add(lifetime)
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
expires, err = time.Parse(time.RFC1123, expiresHeader)
if err != nil {
expires = now
}
}
}
return expires
}
func strlen(s string) int {
return utf8.RuneCountInString(s)
}

View File

@ -0,0 +1,43 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
import (
"net/http"
)
type APIResponse struct {
*http.Response `json:"-"`
Message string `json:"message,omitempty"`
// Operation is the name of the swagger operation.
Operation string `json:"operation,omitempty"`
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
RequestURL string `json:"url,omitempty"`
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
Method string `json:"method,omitempty"`
// Payload holds the contents of the response body (which may be nil or empty).
// This is provided here as the raw response.Body() reader will have already
// been drained.
Payload []byte `json:"-"`
}
func NewAPIResponse(r *http.Response) *APIResponse {
response := &APIResponse{Response: r}
return response
}
func NewAPIResponseWithError(errorMessage string) *APIResponse {
response := &APIResponse{Message: errorMessage}
return response
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AssociatePublicIpWithServerInstanceRequest struct {
// 공인IP인스턴스번호
PublicIpInstanceNo *string `json:"publicIpInstanceNo"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AssociatePublicIpWithServerInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PublicIpInstanceList []*PublicIpInstance `json:"publicIpInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AttachBlockStorageInstanceRequest struct {
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
// 블록스토리지인스턴스번호
BlockStorageInstanceNo *string `json:"blockStorageInstanceNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AttachBlockStorageInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageInstanceList []*BlockStorageInstance `json:"blockStorageInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AttachNetworkInterfaceRequest struct {
// Network Interface번호
NetworkInterfaceNo *string `json:"networkInterfaceNo"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type AttachNetworkInterfaceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
}

View File

@ -0,0 +1,68 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type BlockStorageInstance struct {
// 블록스토리지인스턴스번호
BlockStorageInstanceNo *string `json:"blockStorageInstanceNo,omitempty"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo,omitempty"`
// 서버명
ServerName *string `json:"serverName,omitempty"`
// 블록스토리지구분
BlockStorageType *CommonCode `json:"blockStorageType,omitempty"`
// 블록스토리지명
BlockStorageName *string `json:"blockStorageName,omitempty"`
// 블록스토리지사이즈
BlockStorageSize *int64 `json:"blockStorageSize,omitempty"`
// 디바이스명
DeviceName *string `json:"deviceName,omitempty"`
// 회원서버이미지번호
MemberServerImageNo *string `json:"memberServerImageNo,omitempty"`
// 블록스토리지상품코드
BlockStorageProductCode *string `json:"blockStorageProductCode,omitempty"`
// 블록스토리지인스턴스상태
BlockStorageInstanceStatus *CommonCode `json:"blockStorageInstanceStatus,omitempty"`
// 블록스토리지인스턴스OP
BlockStorageInstanceOperation *CommonCode `json:"blockStorageInstanceOperation,omitempty"`
// 블록스토리지인스턴스상태명
BlockStorageInstanceStatusName *string `json:"blockStorageInstanceStatusName,omitempty"`
// 생성일시
CreateDate *string `json:"createDate,omitempty"`
// 블록스토리지인스턴스설명
BlockStorageInstanceDescription *string `json:"blockStorageInstanceDescription,omitempty"`
// 디스크유형
DiskType *CommonCode `json:"diskType,omitempty"`
// 디스크상세유형
DiskDetailType *CommonCode `json:"diskDetailType,omitempty"`
// 최대 IOPS
MaxIopsThroughput *int32 `json:"maxIopsThroughput,omitempty"`
Region *Region `json:"region,omitempty"`
Zone *Zone `json:"zone,omitempty"`
}

View File

@ -0,0 +1,48 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type BlockStorageSnapshotInstance struct {
// 블록스토리지스냅샷인스턴스번호
BlockStorageSnapshotInstanceNo *string `json:"blockStorageSnapshotInstanceNo,omitempty"`
// 블록스토리지스냅샷명
BlockStorageSnapshotName *string `json:"blockStorageSnapshotName,omitempty"`
// 블록스토지리볼륨사이즈
BlockStorageSnapshotVolumeSize *int64 `json:"blockStorageSnapshotVolumeSize,omitempty"`
// 원본블록스토리지인스턴스번호
OriginalBlockStorageInstanceNo *string `json:"originalBlockStorageInstanceNo,omitempty"`
// 원본블록스토리지명
OriginalBlockStorageName *string `json:"originalBlockStorageName,omitempty"`
// 블록스토리지스냅샷인스턴스상태
BlockStorageSnapshotInstanceStatus *CommonCode `json:"blockStorageSnapshotInstanceStatus,omitempty"`
// 블록스토리지스냅샷인스턴스OP
BlockStorageSnapshotInstanceOperation *CommonCode `json:"blockStorageSnapshotInstanceOperation,omitempty"`
BlockStorageSnapshotInstanceStatusName *string `json:"blockStorageSnapshotInstanceStatusName,omitempty"`
// 생성일시
CreateDate *string `json:"createDate,omitempty"`
// 블록스토리지스냅샷인스턴스설명
BlockStorageSnapshotInstanceDescription *string `json:"blockStorageSnapshotInstanceDescription,omitempty"`
// 서버이미지상품코드
ServerImageProductCode *string `json:"serverImageProductCode,omitempty"`
// OS정보
OsInformation *string `json:"osInformation,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type ChangeNasVolumeSizeRequest struct {
// NAS볼륨인스턴스번호
NasVolumeInstanceNo *string `json:"nasVolumeInstanceNo"`
// NAS볼륨사이즈
VolumeSize *int32 `json:"volumeSize"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type ChangeNasVolumeSizeResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
NasVolumeInstanceList []*NasVolumeInstance `json:"nasVolumeInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type ChangeServerInstanceSpecRequest struct {
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
// 서버상품코드
ServerProductCode *string `json:"serverProductCode"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type ChangeServerInstanceSpecResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
ServerInstanceList []*ServerInstance `json:"serverInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CommonCode struct {
// 코드
Code *string `json:"code,omitempty"`
// 코드명
CodeName *string `json:"codeName,omitempty"`
}

View File

@ -0,0 +1,38 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
import (
"github.com/NaverCloudPlatform/ncloud-sdk-go-v2/ncloud"
"os"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
func NewConfiguration(apiKey *ncloud.APIKey) *ncloud.Configuration {
cfg := &ncloud.Configuration{
BasePath: "https://ncloud.apigw.ntruss.com/server/v2",
DefaultHeader: make(map[string]string),
UserAgent: "server/1.1.0/go",
APIKey: apiKey,
}
if os.Getenv("NCLOUD_API_GW") != "" {
cfg.BasePath = os.Getenv("NCLOUD_API_GW") + "/server/v2"
}
return cfg
}

View File

@ -0,0 +1,28 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateBlockStorageInstanceRequest struct {
// 블럭스토리지명
BlockStorageName *string `json:"blockStorageName,omitempty"`
// 블럭스토리지사이즈
BlockStorageSize *int64 `json:"blockStorageSize"`
// 블럭스토리지설명
BlockStorageDescription *string `json:"blockStorageDescription,omitempty"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
// 디스크상세유형코드
DiskDetailTypeCode *string `json:"diskDetailTypeCode,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateBlockStorageInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageInstanceList []*BlockStorageInstance `json:"blockStorageInstanceList,omitempty"`
}

View File

@ -0,0 +1,22 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateBlockStorageSnapshotInstanceRequest struct {
// 블록스토리지인스턴스번호
BlockStorageInstanceNo *string `json:"blockStorageInstanceNo"`
// 블록스토리지스냅샷이름
BlockStorageSnapshotName *string `json:"blockStorageSnapshotName,omitempty"`
// 블록스토리지스냅샷설명
BlockStorageSnapshotDescription *string `json:"blockStorageSnapshotDescription,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateBlockStorageSnapshotInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageSnapshotInstanceList []*BlockStorageSnapshotInstance `json:"blockStorageSnapshotInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateInstanceTagsRequest struct {
// 인스턴스번호리스트
InstanceNoList []*string `json:"instanceNoList"`
// 인스턴스태그리스트
InstanceTagList []*InstanceTagParameter `json:"instanceTagList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateInstanceTagsResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
InstanceTagList []*InstanceTag `json:"instanceTagList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateLoginKeyRequest struct {
// 키명
KeyName *string `json:"keyName"`
}

View File

@ -0,0 +1,21 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateLoginKeyResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
PrivateKey *string `json:"privateKey,omitempty"`
}

View File

@ -0,0 +1,22 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateMemberServerImageRequest struct {
// 회원서버이미지설명
MemberServerImageDescription *string `json:"memberServerImageDescription,omitempty"`
// 회원서버이미지명
MemberServerImageName *string `json:"memberServerImageName,omitempty"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateMemberServerImageResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
MemberServerImageList []*MemberServerImage `json:"memberServerImageList,omitempty"`
}

View File

@ -0,0 +1,43 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateNasVolumeInstanceRequest struct {
// 볼륨이름
VolumeName *string `json:"volumeName"`
// NAS볼륨사이즈
VolumeSize *int32 `json:"volumeSize"`
// 볼륨할당프로토콜유형코드
VolumeAllotmentProtocolTypeCode *string `json:"volumeAllotmentProtocolTypeCode"`
// 서버인스턴스번호리스트
ServerInstanceNoList []*string `json:"serverInstanceNoList,omitempty"`
// 커스텀IP리스트
CustomIpList []*string `json:"customIpList,omitempty"`
// CIFS유저이름
CifsUserName *string `json:"cifsUserName,omitempty"`
// CIFS유저비밀번호
CifsUserPassword *string `json:"cifsUserPassword,omitempty"`
// NAS볼륨설명
NasVolumeDescription *string `json:"nasVolumeDescription,omitempty"`
// 리전번호
RegionNo *string `json:"regionNo,omitempty"`
// ZONE번호
ZoneNo *string `json:"zoneNo,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateNasVolumeInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
NasVolumeInstanceList []*NasVolumeInstance `json:"nasVolumeInstanceList,omitempty"`
}

View File

@ -0,0 +1,34 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateNetworkInterfaceRequest struct {
// Private Subnet인스턴스번호
PrivateSubnetInstanceNo *string `json:"privateSubnetInstanceNo"`
// Network Interface이름
NetworkInterfaceName *string `json:"networkInterfaceName"`
// Network Interface IP
NetworkInterfaceIp *string `json:"networkInterfaceIp"`
// Network Interface설명
NetworkInterfaceDescription *string `json:"networkInterfaceDescription,omitempty"`
// 리전번호
RegionNo *string `json:"regionNo,omitempty"`
// ZONE번호
ZoneNo *string `json:"zoneNo,omitempty"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateNetworkInterfaceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
}

View File

@ -0,0 +1,28 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreatePublicIpInstanceRequest struct {
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo,omitempty"`
// 공인IP설명
PublicIpDescription *string `json:"publicIpDescription,omitempty"`
// 인터넷라인구분코드
InternetLineTypeCode *string `json:"internetLineTypeCode,omitempty"`
// 리전번호
RegionNo *string `json:"regionNo,omitempty"`
// ZONE번호
ZoneNo *string `json:"zoneNo,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreatePublicIpInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PublicIpInstanceList []*PublicIpInstance `json:"publicIpInstanceList,omitempty"`
}

View File

@ -0,0 +1,61 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateServerInstancesRequest struct {
// 서버이미지상품코드
ServerImageProductCode *string `json:"serverImageProductCode,omitempty"`
// 서버상품코드
ServerProductCode *string `json:"serverProductCode,omitempty"`
// 회원서버이미지번호
MemberServerImageNo *string `json:"memberServerImageNo,omitempty"`
// 서버명
ServerName *string `json:"serverName,omitempty"`
// 서버설명
ServerDescription *string `json:"serverDescription,omitempty"`
// 로그인키명
LoginKeyName *string `json:"loginKeyName,omitempty"`
// 반납보호여부
IsProtectServerTermination *bool `json:"isProtectServerTermination,omitempty"`
// 서버생성갯수
ServerCreateCount *int32 `json:"serverCreateCount,omitempty"`
// 서버생성시작번호
ServerCreateStartNo *int32 `json:"serverCreateStartNo,omitempty"`
// 인터넷라인구분코드
InternetLineTypeCode *string `json:"internetLineTypeCode,omitempty"`
// 요금제구분코드
FeeSystemTypeCode *string `json:"feeSystemTypeCode,omitempty"`
// 사용자데이터
UserData *string `json:"userData,omitempty"`
// ZONE번호
ZoneNo *string `json:"zoneNo,omitempty"`
// ACG설정번호리스트
AccessControlGroupConfigurationNoList []*string `json:"accessControlGroupConfigurationNoList,omitempty"`
// RAID구분이름
RaidTypeName *string `json:"raidTypeName,omitempty"`
// 인스턴스태그리스트
InstanceTagList []*InstanceTagParameter `json:"instanceTagList,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type CreateServerInstancesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
ServerInstanceList []*ServerInstance `json:"serverInstanceList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteBlockStorageInstancesRequest struct {
// 블록스토리지인스턴스번호리스트
BlockStorageInstanceNoList []*string `json:"blockStorageInstanceNoList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteBlockStorageInstancesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageInstanceList []*BlockStorageInstance `json:"blockStorageInstanceList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteBlockStorageSnapshotInstancesRequest struct {
// 블록스토리지스냅샷인스턴스번호리스트
BlockStorageSnapshotInstanceNoList []*string `json:"blockStorageSnapshotInstanceNoList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteBlockStorageSnapshotInstancesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageSnapshotInstanceList []*BlockStorageSnapshotInstance `json:"blockStorageSnapshotInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteInstanceTagsRequest struct {
// 인스턴스번호리스트
InstanceNoList []*string `json:"instanceNoList"`
// 인스턴스태그리스트
InstanceTagList []*InstanceTagParameter `json:"instanceTagList,omitempty"`
}

View File

@ -0,0 +1,21 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteInstanceTagsResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteLoginKeyRequest struct {
// 키명
KeyName *string `json:"keyName"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteLoginKeyResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteMemberServerImagesRequest struct {
// 회원서버이미지번호리스트
MemberServerImageNoList []*string `json:"memberServerImageNoList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteMemberServerImagesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
MemberServerImageList []*MemberServerImage `json:"memberServerImageList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteNasVolumeInstanceRequest struct {
// NAS볼륨인스턴스번호
NasVolumeInstanceNo *string `json:"nasVolumeInstanceNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteNasVolumeInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
NasVolumeInstanceList []*NasVolumeInstance `json:"nasVolumeInstanceList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteNetworkInterfaceRequest struct {
// Network Interface번호
NetworkInterfaceNo *string `json:"networkInterfaceNo"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeleteNetworkInterfaceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeletePortForwardingRulesRequest struct {
// 포트포워딩설정번호
PortForwardingConfigurationNo *string `json:"portForwardingConfigurationNo"`
// 포트포워딩RULE리스트
PortForwardingRuleList []*PortForwardingRuleParameter `json:"portForwardingRuleList"`
}

View File

@ -0,0 +1,29 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeletePortForwardingRulesResponse struct {
// 포트포워딩설정번호
PortForwardingConfigurationNo *string `json:"portForwardingConfigurationNo,omitempty"`
// 포트포워딩공인IP
PortForwardingPublicIp *string `json:"portForwardingPublicIp,omitempty"`
// ZONE
Zone *Zone `json:"zone,omitempty"`
// 인터넷회선구분
InternetLineType *CommonCode `json:"internetLineType,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PortForwardingRuleList []*PortForwardingRule `json:"portForwardingRuleList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeletePublicIpInstancesRequest struct {
// 공인IP인스턴스번호리스트
PublicIpInstanceNoList []*string `json:"publicIpInstanceNoList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DeletePublicIpInstancesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PublicIpInstanceList []*PublicIpInstance `json:"publicIpInstanceList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DetachBlockStorageInstancesRequest struct {
// 블록스토리지인스턴스번호리스트
BlockStorageInstanceNoList []*string `json:"blockStorageInstanceNoList"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DetachBlockStorageInstancesResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageInstanceList []*BlockStorageInstance `json:"blockStorageInstanceList,omitempty"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DetachNetworkInterfaceRequest struct {
// Network Interface번호
NetworkInterfaceNo *string `json:"networkInterfaceNo"`
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo"`
}

View File

@ -0,0 +1,19 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DetachNetworkInterfaceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DisassociatePublicIpFromServerInstanceRequest struct {
// 공인IP인스턴스번호
PublicIpInstanceNo *string `json:"publicIpInstanceNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type DisassociatePublicIpFromServerInstanceResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
PublicIpInstanceList []*PublicIpInstance `json:"publicIpInstanceList,omitempty"`
}

View File

@ -0,0 +1,28 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlGroupListRequest struct {
// 접근제어그룹설정번호리스트
AccessControlGroupConfigurationNoList []*string `json:"accessControlGroupConfigurationNoList,omitempty"`
// 디폴트여부
IsDefault *bool `json:"isDefault,omitempty"`
// 접근제어그룹명
AccessControlGroupName *string `json:"accessControlGroupName,omitempty"`
// 페이지번호
PageNo *int32 `json:"pageNo,omitempty"`
// 페이지사이즈
PageSize *int32 `json:"pageSize,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlGroupListResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
AccessControlGroupList []*AccessControlGroup `json:"accessControlGroupList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlGroupServerInstanceListRequest struct {
// 접근제어그룹설정번호
AccessControlGroupConfigurationNo *string `json:"accessControlGroupConfigurationNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlGroupServerInstanceListResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
ServerInstanceList []*ServerInstance `json:"serverInstanceList,omitempty"`
}

View File

@ -0,0 +1,16 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlRuleListRequest struct {
// 접근제어그룹설정번호
AccessControlGroupConfigurationNo *string `json:"accessControlGroupConfigurationNo"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetAccessControlRuleListResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
AccessControlRuleList []*AccessControlRule `json:"accessControlRuleList,omitempty"`
}

View File

@ -0,0 +1,55 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetBlockStorageInstanceListRequest struct {
// 서버인스턴스번호
ServerInstanceNo *string `json:"serverInstanceNo,omitempty"`
// 블록스토리지인스턴스번호리스트
BlockStorageInstanceNoList []*string `json:"blockStorageInstanceNoList,omitempty"`
// 검색할필터명
SearchFilterName *string `json:"searchFilterName,omitempty"`
// 검색할필터값
SearchFilterValue *string `json:"searchFilterValue,omitempty"`
// 블록스토리지구분코드리스트
BlockStorageTypeCodeList []*string `json:"blockStorageTypeCodeList,omitempty"`
// 페이지번호
PageNo *int32 `json:"pageNo,omitempty"`
// 페이지사이즈
PageSize *int32 `json:"pageSize,omitempty"`
// 블록스토리지인스턴스상태코드
BlockStorageInstanceStatusCode *string `json:"blockStorageInstanceStatusCode,omitempty"`
// 디스크유형코드
DiskTypeCode *string `json:"diskTypeCode,omitempty"`
// 디스크유형상세코드
DiskDetailTypeCode *string `json:"diskDetailTypeCode,omitempty"`
// 리전번호
RegionNo *string `json:"regionNo,omitempty"`
// ZONE번호
ZoneNo *string `json:"zoneNo,omitempty"`
// 소팅대상
SortedBy *string `json:"sortedBy,omitempty"`
// 소팅순서
SortingOrder *string `json:"sortingOrder,omitempty"`
}

View File

@ -0,0 +1,23 @@
/*
* server
*
* <br/>https://ncloud.apigw.ntruss.com/server/v2
*
* API version: 2018-10-18T06:16:13Z
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package server
type GetBlockStorageInstanceListResponse struct {
RequestId *string `json:"requestId,omitempty"`
ReturnCode *string `json:"returnCode,omitempty"`
ReturnMessage *string `json:"returnMessage,omitempty"`
TotalRows *int32 `json:"totalRows,omitempty"`
BlockStorageInstanceList []*BlockStorageInstance `json:"blockStorageInstanceList,omitempty"`
}

Some files were not shown because too many files have changed in this diff Show More