用于订购虚拟服务器的Softlayer API

时间:2015-10-07 18:18:09

标签: python ibm-cloud-infrastructure

我想使用他们的API在Softlayer中订购虚拟服务器。我想订购一个安装了VCenter的Windows机箱。当我直接从Softlayer客户门户订购VS时,我将VCenter视为系统插件。我无法弄清楚如何使用Softlayer API在订单参数中传递VCenter的参数。我正在使用Softlayer Python API。有谁知道怎么做?我的订单模板如下:

order = {
'complexType': 'SoftLayer_Container_Product_Order_Virtual_Guest', 
'quantity': 1,
'virtualGuests': [
      {
        'hostname': 'test', 
        'domain': 'example.com',
      }
],
'location': 'sanjose',
'packageId': 46, 
'useHourlyPricing': True,
'prices': [
           {'id': 1640},  # 1 x 2.0 GHz Core
           {'id': 1644},  # 1 GB RAM
           {'id':  905},  # Reboot / Remote Console
           {'id':  272},  # 10 Mbps Public & Private Networks
           {'id':  613},  # 1000 GB Bandwidth
           {'id':   21},  # 1 IP Address
           {'id': 2202},  # 25 GB (SAN)
           {'id': 1684},  # CentOS 5 - Minimal Install (32 bit)
           {'id':   55},  # Host Ping Monitoring
           {'id':   57},  # Email and Ticket Notifications
           {'id':   58},  # Automated Notification Response
           {'id':  420},  # Unlimited SSL VPN Users & 1 PPTP VPN User per account
           {'id':  418}
]
}                                    client['Product_Order'].verifyOrder(order);

1 个答案:

答案 0 :(得分:0)

如果您希望在订单中添加加载项,只需在请求中添加该加载项的价格即可。 要获得所有价格,您可以调用SoftLayer_Product_Package :: getItems方法http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getItems

或SoftLayer_Product_Package :: getItemPrices方法

请查看此文档

http://sldn.softlayer.com/blog/bpotter/Going-Further-SoftLayer-API-Python-Client-Part-3

我希望它有所帮助

此致