Skip to content

Commit

Permalink
Add start to main test and change product code for update testing
Browse files Browse the repository at this point in the history
  • Loading branch information
yuridekim committed Jan 1, 2024
1 parent 3552831 commit bdec322
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit bdec322

Please sign in to comment.