如何使用软层创建块存储 api

how to create block storage using softlayer api

我尝试使用 python 库创建性能块存储,但响应显示 "Price does not have an id",有什么问题,我是否遗漏了任何参数。 这是提交请求的代码。

orderData = {
            "complexType": "Container_Product_Order_Network_PerformanceStorage_Iscsi",
            "packageId": 222,
            "location": 154820,
            "quantity": 1,
            "prices": [
                {
                    "id": 40678           
                },
                {
                    "id": space_id
                },
                {
                    "id": 40798
                },
            ],
            "osFormatType": {'createDate': '', 'keyName': 'LINUX', 'description': 'Use if your host operating system is Linux.', 'name': 'Linux', 'id': 12}
        }
response = productOrderService.verifyOrder(orderData)

我已经使用 python 代码列出了性能存储的所有价格,仅列出零件信息:

************PACKAGE: Pkg Id: 222 OPTIONAL CATEGORY:
----name: Surcharges Cat Id: 315 Item Price id:32082 Description: International Services LocGrp Id: none OPTIONAL CATEGORY:
----name: Performance Storage NFS Cat Id: 378 Item Price id:40668 Description: File Storage (Performance) LocGrp Id: none OPTIONAL CATEGORY:
----name: Storage Replication Cat Id: 388 OPTIONAL CATEGORY:
----name: Performance Storage iSCSI Cat Id: 380 Item Price id:40678 Description: Block Storage (Performance) LocGrp Id: none REQUIRED CATEGORY:
----name: Storage Space Cat Id: 382 Item Price id:82389 Description: 40 GB Storage Space LocGrp Id: 509 Item Price id:82395 Description: 80 GB Storage Space LocGrp Id: 505 Item Price id:90579 Description: 4000 GB Storage Space LocGrp Id: 545 Item Price id:90583 Description: 12000 GB Storage Space LocGrp Id: 505 Item Price id:90585 Description: 12000 GB Storage Space LocGrp Id: 507 Item Price id:90589 Description: 12000 GB Storage Space LocGrp Id: 545


我还检查了其他链接: How to fetch LocationID, Storage Package ID, Storage Size ID and SnapShot Space Size ID for placing order in Endurance Storage API for Performance and Endurance storage(Block storage) 没有找到太多帮助信息。 任何人都可以帮助检查问题,在此先感谢。

您使用的复杂类型无效,您需要使用这个:

"complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi"

这是我使用的 orderData 示例:

orderData = {
             "complexType": "SoftLayer_Container_Product_Order_Network_PerformanceStorage_Iscsi",
            "packageId": 222,
            "location": 154820,
            "quantity": 1,
            "prices": [
                {
                    "id": 40678           
                },
                {
                    "id": 40688
                },
                {
                    "id": 40798
                }
            ],
            "osFormatType": { 
                "keyName": "LINUX",
                "complexType": "SoftLayer_Network_Storage_Iscsi_OS_Type"

            }
          }

此致