问题
I need to implement placing order for endurance storage in my Application using BPM over ICO (IBM Cloud Orchestrator) dynamically.
I needed following parameters for creating rest call for placing order
- Package to use
- Storage Type
- Location
- Storage Package (IOPS/GB)
- Storage Size
- Snapshot Space Size
OS Type
Package to use:- I already know package value for endurance is
240
.Storage Type:- For endurance storage what will be numeric id for endurance What rest call will help in this..?
Location:- This Rest call gives me locations ID:-
https:[username]:[apiKey]api.softlayer.com/rest /v3.1/SoftLayer_Product_Package/240/getRegions.json
- Storage Package:-
For Endurance I found only these 3 options in storage package :-
- 0.25 IOPS/GB
- 2 IOPS/GB
- 4 IOPS/GB
How will I get id for these three..?
- Storage Size:-
For storage size id I used a rest call :-
https://[username]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Product_Package/240/getItemPrices?objectMask=mask[id,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]&objectFilter={"items":{"prices":{"pricingLocationGroup":{"locations":{"item":{"operation":"loc_code"}}}}}}
Is there any other way..?
- Snapshot Space Size:- What will be the rest call for snapshot space size ids..?
Please help me as I need to integrate this functionality as an API using BPM. We need to place order for endurance storage with dynamic values. Thanks in advance.
回答1:
To get the valid prices for all configuration Endurance items
, you can use SoftLayer_Product_Package::getItemPrices.
To know what package Endurance
(PackageId = 240 ) is using, please see:
https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/getAllObjects
Method: GET
This is an example:
Package to use = 240
Storage Type: Endurance
Location: Dal06
Storage Package: 0.25 IOPS/GB
Storage Size: 40GB
Snapshot Space Size: 5GB
OS Type: Linux
REST example:
{
"parameters": [
{
"location": 154820,
"packageId": 240,
"osFormatType": {
"id": 12,
"keyName": "LINUX"
},
"complexType": "SoftLayer_Container_Product_Order_Network_Storage_Enterprise",
"prices": [
{
"id": 45058 # Endurance Storage
},
{
"id": 45098 # Block Storage
},
{
"id": 45068 # 0.25 IOPS per GB
},
{
"id": 45148 # 40 GB Storage Space
},
{
"id": 46120 # 5 GB Storage Snapshot Space
}
],
"quantity": 1
}
]
}
To get the above ids, we can use some filters for better understanding:
-Getting ** Storage Type**: "id": 45058 # Endurance Storage
:
https://[username]:[apikey]@api.softlayer.com/rest/v3.1/SoftLayer_Product_Package/240/getItemPrices?objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "storage_service_enterprise"}}}}&objectMask=mask[id,categories,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]
Method: GET
Where we are filtering by : categoryCode
- Getting id for “Block Storage” or “File Storage”, we choose Block Storage:
"id": 45098 # Block Storage
The filter will be changed to:
objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "storage_block"}}}}
- Getting available ids for Storage Package:
i.e.: "id": 45068 # 0.25 IOPS per GB
The filter to use is: "categoryCode": "storage_tier_level"
objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "storage_tier_level"}}}}&objectMask=mask[id,categories,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]
- Getting Storage Size:
Filter to use: "categoryCode": "performance_storage_space"
objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "performance_storage_space"}}}}&objectMask=mask[id,categories,item[keyName,description],pricingLocationGroup[locations[id, name, longName]]]
- Getting Snapshot Space Size:
Filter to use: "categoryCode": "storage_snapshot_space"
objectFilter={"itemPrices": {"categories": {"categoryCode": {"operation": "storage_snapshot_space"}}}}
Some references:
API for Performance and Endurance storage(Block storage)
来源:https://stackoverflow.com/questions/35888453/how-to-fetch-locationid-storage-package-id-storage-size-id-and-snapshot-space