Search in sources :

Example 1 with VirtualMachineExtensionInstanceView

use of com.microsoft.azure.management.compute.VirtualMachineExtensionInstanceView in project azure-sdk-for-java by Azure.

the class LinuxDiskVolumeEncryptionMonitorImpl method instanceViewFirstSubStatus.

/**
     * @return the first sub-status from instance view sub-status collection associated with the
     * encryption extension
     */
private JsonNode instanceViewFirstSubStatus() {
    if (!hasEncryptionExtension()) {
        return null;
    }
    VirtualMachineExtensionInstanceView instanceView = this.encryptionExtension.instanceView();
    if (instanceView == null || instanceView.substatuses() == null) {
        return null;
    }
    List<InstanceViewStatus> instanceViewSubStatuses = instanceView.substatuses();
    if (instanceViewSubStatuses.size() == 0) {
        return null;
    }
    ObjectMapper mapper = new ObjectMapper();
    final JsonNode rootNode;
    try {
        rootNode = mapper.readTree(instanceViewSubStatuses.get(0).message());
    } catch (IOException exception) {
        return null;
    }
    return rootNode;
}
Also used : VirtualMachineExtensionInstanceView(com.microsoft.azure.management.compute.VirtualMachineExtensionInstanceView) InstanceViewStatus(com.microsoft.azure.management.compute.InstanceViewStatus) JsonNode(com.fasterxml.jackson.databind.JsonNode) IOException(java.io.IOException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 InstanceViewStatus (com.microsoft.azure.management.compute.InstanceViewStatus)1 VirtualMachineExtensionInstanceView (com.microsoft.azure.management.compute.VirtualMachineExtensionInstanceView)1 IOException (java.io.IOException)1