问题
I would like to filter the list of VLANs on an account so that I only list the VLANs which can be used to order a Virtual Guest. I am using Softlayer_Account_Service.getNetworkVlans().
What do I need to filter by? It is just filtering for networkVlans.type.keyName = STANDARD?
I’m trying to avoid being able to hit this error when I select a VLAN from my list: SoftLayer_Exception_Public: The frontend VLAN #xxxxxxx is not a standard VLAN. (HTTP 500)
Thanks.
回答1:
In order to get available vlans for ordering, see Retrieve Vlans - Subnets available based on Package and Location section on the below link:
- REST: use SoftLayer_Hardware::createObject instead of SoftLayer_Product_Order::placeOrder
For Vsi's, should be:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Product_Order/getVlans
Method: Post
{
"parameters":
[
448994, 46
]
}
Replace: $user, $apiKey and 448994 with the location identifier that you would like to order
To get datacenter identifiers:
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Location/getDatacenters
Method: Get
To get STANDARD vlans from specific location
https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkVlans?objectMask=mask[type,primaryRouter[datacenter]]&objectFilter={"networkVlans":{"type":{"keyName":{"operation":"STANDARD"}}, "primaryRouter":{"datacenter":{"name":{"operation":"wdc01"}}}}}
Method: Get
Replace: $user, $apiKey and wdc01 with the location that you would like to get the vlans
来源:https://stackoverflow.com/questions/44146080/how-can-i-filter-the-list-of-vlans-to-just-get-ones-valid-for-virtual-guest-orde