0

In Azure resource group java API, there is no function to get the operation status based on a request ID. What is the way to get the operation status in the sdk now ?

Similar functionality exists in the service management API like here for the service management client : http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/management/compute/ComputeManagementClient.html#getOperationStatus-java.lang.String-

Similar function does not exist in the clients like : http://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/compute/VirtualMachineOperations.html

I see a similar function :

LongRunningOperationResponse getLongRunningOperationStatus(java.lang.String operationStatusLink)

The Get Operation Status operation returns the status of the specified operation.

How to generate the operationStatusLink ?

Squid
  • 40
  • 5

1 Answers1

1

I checked the Azure Reference document, and I found that the reference of Asynchronous Request (classic) REST has the Get Operation Status REST API what require <subscription-id>, <request-id> and request headerx-ms-version for Service Management. Please refer to https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx.

Then, I reviewed the JavaDocs of Azure SDK and found the Class com.microsoft.windowsazure.core.OperationStatusResponse and com.microsoft.windowsazure.core.AzureAsyncOperationResponse. They have the function getStatus() what return the one of the Enum com.microsoft.windowsazure.core.OperationStatus. For their details, please refer to http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/core/OperationStatusResponse.html and http://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/network/models/AzureAsyncOperationResponse.html and http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/core/OperationStatus.html.

They are for Azure Service Management. So you need to import these Classes from the maven repo azure-svc-mgmt http://mvnrepository.com/artifact/com.microsoft.azure/azure-svc-mgmt/0.9.0, see the maven configure below:

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>azure-svc-mgmt</artifactId>
    <version>0.9.0</version>
</dependency>

And using the function OperationStatusResponse getOperationStatus(String requestId) of the Class com.microsoft.windowsazure.management.ManagementClient to get the Object OperationStatusResponse to get your wants. Please refer to http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/management/ManagementClient.html.

Best Regards.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • I am using resource manager based API. The authentication that I doing is based on the application created in the AD. In this case when I try to use the service SDK like you suggested above, I am getting the following error, I am using the same configuration object : SEVERE: null com.microsoft.windowsazure.exception.ServiceException: ForbiddenError: The server failed to authenticate the request. Verify that the certificate is valid and is associated with this subscription. at com.microsoft.windowsazure.exception.ServiceException.createFromXml(ServiceException.java:208) at – Squid Nov 07 '15 at 07:12
  • @Squid There are two authenticate methods for Service Management: using AAD and using a management certificate(recommended), please refer to https://msdn.microsoft.com/en-us/library/azure/ee460782.aspx. These threads I had answered can help you resolve the issue.http://stackoverflow.com/questions/33082328/azure-java-sdk-serviceexception-forbiddenerror, http://stackoverflow.com/questions/33127506/azure-retrieving-the-publicipaddress-of-virtualmachines-from-azure-java-sdk and http://stackoverflow.com/questions/33239530/azure-free-trial-account-not-able-to-authenticate-via-java-sdk. – Peter Pan Nov 09 '15 at 06:19