找不到任何示例或文檔。 看python cli工具: http://softlayer-python.readthedocs.io/en/latest/_modules/SoftLayer/managers/network.html#NetworkManager.cancel_subnet如何使用SoftLayer API和Java客戶端刪除子網?
看來我必須刪除與子網ID匹配的結算項目?
找不到任何示例或文檔。 看python cli工具: http://softlayer-python.readthedocs.io/en/latest/_modules/SoftLayer/managers/network.html#NetworkManager.cancel_subnet如何使用SoftLayer API和Java客戶端刪除子網?
看來我必須刪除與子網ID匹配的結算項目?
根據尼爾森勞爾CABERO門多薩的答案,該代碼爲我工作刪除子網。
public void deleteSubnet() {
ApiClient appClient = new RestApiClient().withCredentials("user", "api-key");
List <com.softlayer.api.service.network.Subnet> subnets = Account.service(appClient).getSubnets();
for (com.softlayer.api.service.network.Subnet subnet : subnets){
if (subnet.getId() == 1310845L){
Item billingItem = subnet.asService(appClient).getBillingItem();
billingItem.asService(appClient).cancelService();
}
}
這幾乎所有的Softlayer服務都有一個計費項目,如果你想取消服務,你需要取消計費項目。
子網服務提供了一種方法來檢索相關BILLIG項目 http://sldn.softlayer.com/reference/services/SoftLayer_Network_Subnet/getBillingItem
,一旦你有,你可以繼續取消使用> http://sldn.softlayer.com/reference/services/SoftLayer_Billing_Item/cancelService
開票項目IG你需要的例子在Java中,讓我知道,但實際上,如果您使用Java調用上述方法,則不應該有任何問題來取消該項目。
問候
如果您已經有一個代碼示例,那麼代碼示例會很好。我即將嘗試自己編寫它,如果它能正常工作,它會在這裏發佈。 – user921176