REST: use SoftLayer_Hardware::createObject instead of SoftLayer_Product_Order::placeOrder

这一生的挚爱 提交于 2019-12-25 05:19:16

问题


I want to order two bare metal servers I did it via REST api: SoftLayer_Product_Order/placeOrder with the following payload.

 "useHourlyPricing": true,
          "quantity": 2,
          "location": 448994,
          "packageId": 200,
          "presetId": 95,
          "prices": [
            {
              "id": 36365
            },
            {
              "id": 52795
            },
            {
              "id": 1800
            },
            {
              "id": 21
            },
            {
              "id": 906
            },
            {
              "id": 420
            },
            {
              "id": 418
            }
          ]

However, the servers created with separate vLANs. How to make the order of multiple servers share the same vLANs?


回答1:


Unfortunately, it's not possible to define VLANS for package 200 (Fast Servers), it means that you will not be able to do this through SoftLayer_Hardware_Server::createObject

You will be able to set VLANS (even subnets), if you try with a different package for Bare Metal Servers.

Just in case, here an example to order a Server defining the vlans and subnets (This is for VSI, but the same idea should be applied for Bare Metal Servers)

  • Create a SoftLayer virtual guest on a specific subnet

Note: SoftLayer_Hardware_Server::createObject method allows to order packages 50 and 200 (package 200 when you set preset configuration), in case that you wish to order package 50 (without preset config), you will be able to set vlans and subnets.


Updated


Retrieve Vlans - Subnets available based on Package and Location

The vlans should belong in the same datacenter in which you wish to place the order, to get vlan and subnets (public/private) information available for the package and location, you can try the following request:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/getVlans

Method: Post

{
  "parameters": 
   [
       448994, 50
   ]
}

Replace: $user and $apiKey with you own information. Also 448994 refers to locationId and 50 refers to packageId, replace them with the values that you wish

References: - SoftLayer_Product_Order::getVlans



来源:https://stackoverflow.com/questions/42964159/rest-use-softlayer-hardwarecreateobject-instead-of-softlayer-product-orderp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!