【问题标题】:Dynamically Populating Locations on the basis of Storage Type根据存储类型动态填充位置
【发布时间】:2016-02-25 09:57:09
【问题描述】:

我是 Softlayer 的初学者,我们需要在应用程序中实现 softlayer 提供的块存储功能。我们只需要调用 REST 来根据选择的存储类型获取位置。我需要知道存储类型和位置之间的关系。我需要在 REST API 和对象掩码中调用什么方法。在此先感谢。

【问题讨论】:

  • 您好,您想要创建/订购新商品时“网络存储类型”与位置之间的关系吗?或者您是否要获取按“网络存储类型”过滤位置的项目列表?

标签: rest ibm-cloud-infrastructure


【解决方案1】:

如果您想订购新的“网络存储”并了解此项目可用的“位置”,请参阅以下步骤:

1. 我们需要知道的第一个是用于此订单的“包裹 ID”。 “包 id”对于验证和验证哪些物品、哪些位置目前可用于订购网络存储非常重要。

例如:

Storage Type: Endurance, the package to use is “240”
Storage Type: Performance, the package to use is “222”

要获取所有活动包,请查看:

http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getAllObjects

2.一旦我们知道要使用什么包,我们需要根据LOCATION获取有效的“item price ids”。以下请求可以帮助我们:

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/[package_id]/getItemPrices?objectMask=mask[id,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]

Method: GET

Where:
A price id with a locationGroupId = null is considered "A standard price" and the API will internally switch the prices for the customer. But we recommend to execute first the verifyOrder in order to see if the wanted order is ok (the fee can vary).

参考:http://sldn.softlayer.com/blog/cmporter/Location-based-Pricing-and-You

此外,此方法可以帮助您获取特定包裹的可用位置:

http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getRegions

3.然后您就可以订购新的网络存储,请参阅:

API for Performance and Endurance storage(Block storage)

现在,如果您想列出您帐户的网络存储,请参阅:

http://sldn.softlayer.com/reference/services/SoftLayer_Account/getNetworkStorage

这是一个示例,结果显示如下属性:“位置”和“网络存储类型”。

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[storageType, billingItem[description,location[id,longName]]]

使用过滤器:

按网络存储类型过滤:“Endurance Storage”“Block Storage (Performance)”

https://[username]:[apikey]@api.softlayer.com/rest/v3/SoftLayer_Account/getNetworkStorage?objectMask=mask[id,username,nasType,storageType, billingItem[description,location[id,longName]]]&objectFilter={"networkStorage":{"nasType":{"operation":"ISCSI"},"billingItem":{"description":{"operation":"Endurance Storage"}}}}

问候。

【讨论】:

    【解决方案2】:

    你需要使用http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getRegions方法

    它返回一个包的有效位置,每个存储类型属于一个特定的包(即您要查找的关系)以获取包使用http://sldn.softlayer.com/reference/services/SoftLayer_Product_Package/getAllObjects方法

    查看这篇文章了解更多信息

    Filter parameters to POST verify and place order request for Performance storage

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-21
      • 2013-04-16
      • 2023-04-03
      • 1970-01-01
      • 1970-01-01
      • 2019-05-21
      • 1970-01-01
      • 2020-09-04
      相关资源
      最近更新 更多