0
votes

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 ?

1

1 Answers

1
votes

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.