0

This is my code to place a baremetal server. The placeOrder function will return the order receipt. Then I check the order status from SL portal and it was changed to approved.

My question is do we have any API's to check when the baremetal server will be provisioned? We need to configure it after the baremetal server provisioned.

var sess = session.New(userName, apiKey, endpoint)
accountService := services.GetAccountService(sess)  
order := datatypes.Container_Product_Order{
    Quantity:            sl.Int(1),
    Hardware: []datatypes.Hardware{
        {
            Hostname: sl.String("test10g"),
            Domain:   sl.String("example.com"),
            PrimaryBackendNetworkComponent: &datatypes.Network_Component{           
                NetworkVlan: &datatypes.Network_Vlan{Id: sl.Int(2288425)},          
            },
        },
    },
    Location:  sl.String("DALLAS10"),
    PackageId: sl.Int(911),  // Single E3-1270 v6
    Prices: []datatypes.Product_Item_Price{
        {Id : sl.Int(206249)},  // server
        {Id : sl.Int(209427)},  // ram
        {Id : sl.Int(175789)},  // os
        {Id : sl.Int(32927)},   // disk controller 
        {Id : sl.Int(49761)},   // disk 0
        {Id : sl.Int(50359)},   // bandwidth
        {Id : sl.Int(35686)},   // portSpeed
        {Id : sl.Int(34241)},   // monitoring
        {Id : sl.Int(34996)},   // response
        {Id : sl.Int(33483)},   // vpn management
        {Id : sl.Int(35310)},   // vulnerabilityScanner
        {Id : sl.Int(34807)},   // pri_ip_address
        {Id : sl.Int(32500)},   // notification
        {Id : sl.Int(25014)},   // remote_management
    },       
}
service := services.GetProductOrderService(sess)
receipt, err := service.PlaceOrder(&order, sl.Bool(false))

// Any functions to check the order status here? 
// Need some code to waiting for the baremetal server to become ready.

1 Answers1

1

You need to use the SoftLayer_Hardware::getObject method and make it query the server repeatedly until the "provisionDate" parameter is filled in, once it is filled then the provisioning completed.

Fore more information see the following:

How can I reliably track the status of a newly provisioned BareMetal server using the REST API

what is the API (REST) to find out whether bare metal server provisioned or not?

https://softlayer.github.io/reference/services/SoftLayer_Virtual_Guest/getLastTransaction/

Fernando Iquiza
  • 531
  • 3
  • 7