简体   繁体   English

如何通过Rest api或Java SDK停止Azure VM以来的时间

[英]How to get the time since when my Azure VM is stopped through Rest api or Java sdk

I am working on a Java application and my requirement is 我正在开发Java应用程序,我的要求是

1. To check if my Azure Virtual Machine is in stopped state. 1.检查我的Azure虚拟机是否处于停止状态。

2. Since when (Date/Time) it is in stopped state. 2.由于(日期/时间)处于停止状态。

Azure Java SDK is preference but Rest API will also suffice. Azure Java SDK是首选项,但Rest API也足够。

You can get all the information of VM on Azure through Java sdk com.microsoft.azure.management.compute.VirtualMachine , for more details, you can reference the code Get information about the VM . 您可以通过Java sdk com.microsoft.azure.management.compute.VirtualMachine获取Azure上VM的所有信息,有关更多详细信息,您可以参考代码获取有关VM的信息

Update 更新

Java SDK com.microsoft.azure.credentials.ApplicationTokenCredentials for vm authentication and method statuses() of SDK com.microsoft.azure.management.compute.VirtualMachineInstanceView to get vm state. Java SDK的com.microsoft.azure.credentials.ApplicationTokenCredentials为VM认证和方法statuses() SDK的com.microsoft.azure.management.compute.VirtualMachineInstanceView让VM的状态。 If you want to get the time of stop state, you can read the time from the log. 如果要获取停止状态的时间,则可以从日志中读取时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM