How to get order username and provisionDate for all SoftLayer machines using Ruby?

跟風遠走 提交于 2019-12-02 10:58:49

Please see the following provisioning steps, below is a little flow to consider:

1.  Order a Server

Result: 
* An orderId is assigned to the server
* The createDate has a new value
* activeTransaction value is =  Null
* provisionDate value is = Null

2.  The order is approved

Result: 
* activeTransaction value is <> Null
* provisionDate value = Null

3.  Server  is already provisioned

Result:
* activeTransaction value is = Null
* provisionDate value has a New value
* billingItem property has a new value

To see if your machines have still ”activeTransaction”, please execute:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Hardware_Server/[server_id]/getActiveTransaction
Method: GET

Now, after reviewing your example response, this server had some problems when completing the provisioning; for that reason this step was completed manually but the provisionDate was not set for any reason(please open a ticket if you want that the provisionDate can be set) . This is a special case. I can see that another server has a similar behavior. But the other servers that don’t have provisionDate, have still ”activeTransaction<>null” (it means that these server are not provisioned yet).

EDIT:

Other property can help you to know that your machine has been already provisioned although other kind of transaction is being executed, is “hardwareStatus”, it should have “ACTIVE” value.

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getHardware?objectMask=mask[id, hostname, fullyQualifiedDomainName, provisionDate,hardwareStatus]
Method: GET

The response should be something like this:

{
"fullyQualifiedDomainName": "myhostname.softlayer.com"
"hostname": " myhostname"
"id": 1234567
"provisionDate": "2015-06-29T00:21:39-05:00"
"hardwareStatus": {
"id": 5
"status": "ACTIVE"
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!