这是我放置裸机服务器的代码。 placeOrder函数将返回订单收据。然后,我从SL门户检查订单状态,并将其更改为已批准。
我的问题是,我们是否有任何API来检查何时配置裸机服务器?我们需要在配置裸机服务器之后对其进行配置。
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.
答案 0 :(得分:0)
您需要使用SoftLayer_Hardware::getObject方法并使其重复查询服务器,直到" provisionDate"参数填写完成后,填写完毕后就会填写。
有关更多信息,请参阅以下内容:
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/