java - Azure根据请求id获取操作状态java sdk

标签 java azure azure-resource-manager

在 Azure 资源组 java API 中,没有根据请求 ID 获取操作状态的函数。现在如何获取sdk中的运行状态?

服务管理 API 中存在类似的功能,如下所示的服务管理客户端: http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/management/compute/ComputeManagementClient.html#getOperationStatus-java.lang.String-

客户端中不存在类似的功能,例如: http://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/compute/VirtualMachineOperations.html

我看到类似的功能:

LongRunningOperationResponse getLongRunningOperationStatus(java.lang.String operationStatusLink)

获取操作状态操作返回指定操作的状态。

如何生成操作状态链接?

最佳答案

我查看了Azure引用文档,发现Asynchronous Request (classic) REST的引用有Get Operation Status REST API 需要什么 <subscription-id> , <request-id>和请求 header x-ms-version用于服务管理。请引用https://msdn.microsoft.com/en-us/library/azure/ee460783.aspx .

然后,我查看了Azure SDK的JavaDocs,找到了类com.microsoft.windowsazure.core.OperationStatusResponsecom.microsoft.windowsazure.core.AzureAsyncOperationResponse 。他们有功能 getStatus()返回枚举 com.microsoft.windowsazure.core.OperationStatus 之一。 详情请引用http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/core/OperationStatusResponse.htmlhttp://azure.github.io/azure-sdk-for-java/com/microsoft/azure/management/network/models/AzureAsyncOperationResponse.htmlhttp://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/core/OperationStatus.html .

它们用于 Azure 服务管理。所以你需要从maven repo azure-svc-mgmt导入这些类http://mvnrepository.com/artifact/com.microsoft.azure/azure-svc-mgmt/0.9.0 ,参见下面的maven配置:

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

并使用函数OperationStatusResponse getOperationStatus(String requestId)类(class)com.microsoft.windowsazure.management.ManagementClient获取对象OperationStatusResponse得到你想要的。请引用http://azure.github.io/azure-sdk-for-java/com/microsoft/windowsazure/management/ManagementClient.html .

最诚挚的问候。

关于java - Azure根据请求id获取操作状态java sdk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33470262/

相关文章:

java - 通用道 : @Transactional not working. 。再次

java - CAS 和子域的问题

azure - 我在哪里可以在azure函数中上传exe

java - 从 jComboBox(Java 数据库)中选择时用记录填充 jTextField

java - 如何在 TextView 中设置泰卢固语字体?

azure - 如何使用 Azure Bicep 调整现有资源?

c# - 响应状态码不表示成功 : 404 (Not Found) with owin library

Azure Bicep - 其他 IP 限制

azure - 如何访问/将模块输出转换到二头肌中的特定对象?

azure - Bicep 将存储帐户连接字符串传递到 key 保管库 secret