I am using Java api (azure-compute:version 0.9.0) to perform VM operation. I want to make sure cloud operation on VM is performed successfully. I am getting some issue in Delete operation.
My expectation is to get VM object even after termination of instance with status like Deleted(or terminated) as I get in Amazon. So that I can get assured my cloud operation is successful.
Any APIs call of Azure SDK for Java are really calling the related Azure REST APIs. So according to the references of REST API Delete a virtual machine & Get information about a virtual machine, you only could get the error status which comes from the response 404
status code, as below, because the resource has been deleted.
Quote from the description of Response
of Delete a virtual machine
.
If resource does not exist, 404 (NotFound) is returned.
Quote from the description of Response
of Get information about a virtual machine
.
otherwise 404 (Not Found) is returned.
For your question in the comment, if you want to get the last n
number of logs, the only way is using Azure Monitor REST API in Java. On Azure Offical website, you can refer to the documents below to know Azure Monitor service.