From bdec3223cfdb3f91416de7f3c63640d3abf7e602 Mon Sep 17 00:00:00 2001 From: yuridekim Date: Mon, 1 Jan 2024 15:19:00 +0900 Subject: [PATCH] Add start to main test and change product code for update testing --- main.go | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 3d54e63..ce1dcaf 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( pkg "github.com/cloud-club/Aviator-service/pkg" server "github.com/cloud-club/Aviator-service/types/server" + types "github.com/cloud-club/Aviator-service/types/server" ) func getImageProductList(ncp *pkg.NcpService) { @@ -115,10 +116,12 @@ func list(ncp *pkg.NcpService) { //Print response fmt.Println(serverListResponse) + // fmt.Println("server: ", serverListResponse.ServerInstanceList[0]) + // fmt.Println("status: ", serverListResponse.ServerInstanceList[0].ServerInstanceStatus.Code) } func update(ncp *pkg.NcpService) { - usr := &server.UpdateServerRequest{ServerInstanceNo: "21741451", ServerProductCode: "SVR.VSVR.HICPU.C004.M008.NET.HDD.B050.G002"} + usr := &server.UpdateServerRequest{ServerInstanceNo: "21741451", ServerProductCode: "SVR.VSVR.STAND.C032.M128.NET.HDD.B050.G002"} updateServerResponse, err := ncp.Server.Update(pkg.API_URL+pkg.UPDATE_SERVER_INSTANCE_PATH, usr) if err != nil { @@ -143,6 +146,16 @@ func delete(ncp *pkg.NcpService) { fmt.Println(deleteServerResponse) } +func start(ncp *pkg.NcpService) { + ssr := &types.StartServerRequest{ServerNo: "21763788"} + _, err := ncp.Server.Start(pkg.API_URL+pkg.START_SERVER_INSTANCE_PATH, ssr) + if err != nil { + fmt.Println(err) + return + } + +} + func main() { ncp := pkg.NewNcpService("ncp service token") ncp.Server = pkg.NewServerService("6CmrDJ4KaswJ10g25GEP", "OvZ7QHH0Bi3AwGn5rlsD7xoC986bEOiIjdbwMFCo") @@ -174,11 +187,15 @@ func main() { list(ncp) // 7. Stop server instance - //stop(ncp) + stop(ncp) + // list(ncp) + + // Start server instance + // start(ncp) + // list(ncp) - // time.Sleep(20 * time.Second) - // // Update server instance + // Update server instance // update(ncp) // time.Sleep(20 * time.Second) // list(ncp)