我想在將來的某個日期取消SoftLayer
設備,並發現以下SoftLayer_Billing_Item_Cancellation_Request::createObject
。SoftLayer REST API取消請求
request url
會是什麼樣子,如果我使用json,POST parameters
會是什麼樣子?
感謝
我想在將來的某個日期取消SoftLayer
設備,並發現以下SoftLayer_Billing_Item_Cancellation_Request::createObject
。SoftLayer REST API取消請求
request url
會是什麼樣子,如果我使用json,POST parameters
會是什麼樣子?
感謝
這是一個休息的例子可以幫助你:
要獲得結算項目,請參閱:
SoftLayer_Virtual_Guest::getBillingItem
此外,這是一個Python例如:
"""
Cancel a Virtual Guest.
It cancels the resource for a billing Item. The billing item will be cancelled
immediately and reclaim of the resource will begin shortly.
Important manual pages:
http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getObject
http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelService
License: http://sldn.softlayer.com/article/License
Author: SoftLayer Technologies, Inc. <[email protected]>
"""
import SoftLayer.API
from pprint import pprint as pp
# Your SoftLayer API username and key.
API_USERNAME = 'set me'
# Generate one at https://control.softlayer.com/account/users
API_KEY = 'set me'
virtualGuestId = 9923645
client = SoftLayer.Client(
username=API_USERNAME,
api_key=API_KEY,
)
try:
# Getting the billing item id
mask = 'mask.billingItem.id'
cci = client['SoftLayer_Virtual_Guest'].getObject(mask=mask, id=virtualGuestId)
billingItemId = cci['billingItem']['id']
try:
# Canceling the Virtual Guest
result = client['Billing_Item'].cancelService(id=billingItemId)
pp(result)
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to cancel the VSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
except SoftLayer.SoftLayerAPIError as e:
pp('Unable to get the billing item id from VSI faultCode=%s, faultString=%s'
% (e.faultCode, e.faultString))
還有一些其他的客戶有很多例子可以幫助你:
參考
SoftLayer_Billing_Item::cancelService
這可能是你在尋找:
Post URL: https://api.softlayer.com/rest/v3.1/SoftLayer_Billing_Item_Cancellation_Request/createObject.json
Payload:
{
"parameters": [
{
"complexType": "SoftLayer_Billing_Item_Cancellation_Request",
"accountId": 321752,
"notes": "No notes provided",
"items": [
{
"complexType": "SoftLayer_Billing_Item_Cancellation_Request_Item",
"billingItemId": 25849466,
"scheduledCancellationDate": "5/15/2006"
}
]
}
]
}
我希望它能幫助
問候
這不是我想要做的。我想在將來某個時候取消虛擬設備,這意味着我需要爲請求添加某種日期/時間對象。 SoftLayer有類似的東西嗎? – juls85