Hello I just want to make sure how to cancel Baremetal Server. The code below is used to cancel Baremetal server, but it is not working for Vyatta. What is difference between Bare Metal and Vyatta to cancel.
In case of Virtual Machine, Guest.service(client, vo.getDeviceID()).deleteObject() has been used. I works fine, but What is different between canceling with billingService.cancelItem() and deletObject()?
Hardware.Service hService = Hardware.service(client, vo.getDeviceID());
com.softlayer.api.service.billing.item.Hardware.Mask hmask = new com.softlayer.api.service.billing.item.Hardware.Mask();
hmask.item().id();
hService.setMask(hmask);
logger.debug("To be delelted Billing Item ID : " + hService.getBillingItem().getId());
Item.Service billingService = Item.service(client, hService.getBillingItem().getId());
if (billingService.cancelItem(true, true, "no reason", "deleteBareMetal")) {
vo.setServerStatus("CANCELED");
} else {
vo.setServerStatus("CANCEL_FAIL");
}
Vyatta is a gateway that offers flexible control over your firewall and VPN access, each Vyatta gateway can manage 1 "pod", where a pod is all of your own VLANs behind the same router in the same datacenter. Vyatta is a software component represented by the SoftLayer_Network_Gateway on the API and that can be installed in a Bare Metal Server.
You could review the error message that's thrown after running the cancelItem method. Usually there's the next error when one's trying to cancel a billing Item:
"error": "Bare metal servers can only be canceled immediately if they are billed hourly."
The error happens when one's trying to cancel immediately a server that's billed monthly. You could use the next parameters in your code: (false, true, "no reason", "deleteBareMetal")
Difference between cancelItem and deleteObject
deleteObject: This method will cancel a server effective immediately. For servers billed hourly, the charges will stop immediately after the method returns.
cancelItem: Cancel the resource or service for a billing Item. By default the billing item will be cancelled immediately and reclaim of the resource will begin shortly. Setting the "cancelImmediately" property to false will delay the cancellation until the next bill date, also this method can be used to cancel associated billing items, bring a reason and/or a customer note.