Dies ist ein Rast Beispiel können Sie helfen:
Cancel Service - rest
Abrechnungsposition zu erhalten, finden Sie unter:
SoftLayer_Virtual_Guest::getBillingItem
Auch dies ist ein Python Beispiel:
"""
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))
Auch gibt es viele Beispiele in anderen Clients können Ihnen helfen:
Cancel Service - rest
Cancel service - Python
cancel service - php
cancel service-perl
Referenzen
SoftLayer_Billing_Item::cancelService
SoftLayer_Virtual_Guest::getBillingItem
SoftLayer_Virtual_Guest::getObject
Das habe ich nicht versucht. Ich möchte ein virtuelles Gerät irgendwann in der Zukunft abbrechen, was bedeutet, dass ich ein Datum/Zeit-Objekt an die Anfrage anhängen müsste. Gibt es so etwas für SoftLayer? – juls85