2017-01-05 34 views

回答

0

根據尼爾森勞爾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(); 
     } 
    } 
1

這幾乎所有的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調用上述方法,則不應該有任何問題來取消該項目。

問候

+0

如果您已經有一個代碼示例,那麼代碼示例會很好。我即將嘗試自己編寫它,如果它能正常工作,它會在這裏發佈。 – user921176