All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.desktopvirtualization.models.SessionHostHealthCheckFailureDetails Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for DesktopVirtualization Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Package tag package-2024-04.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.desktopvirtualization.models;

import com.azure.core.annotation.Immutable;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * Contains details on the failure.
 */
@Immutable
public final class SessionHostHealthCheckFailureDetails
    implements JsonSerializable {
    /*
     * Failure message: hints on what is wrong and how to recover.
     */
    private String message;

    /*
     * Error code corresponding for the failure.
     */
    private Integer errorCode;

    /*
     * The timestamp of the last update.
     */
    private OffsetDateTime lastHealthCheckDateTime;

    /**
     * Creates an instance of SessionHostHealthCheckFailureDetails class.
     */
    public SessionHostHealthCheckFailureDetails() {
    }

    /**
     * Get the message property: Failure message: hints on what is wrong and how to recover.
     * 
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Get the errorCode property: Error code corresponding for the failure.
     * 
     * @return the errorCode value.
     */
    public Integer errorCode() {
        return this.errorCode;
    }

    /**
     * Get the lastHealthCheckDateTime property: The timestamp of the last update.
     * 
     * @return the lastHealthCheckDateTime value.
     */
    public OffsetDateTime lastHealthCheckDateTime() {
        return this.lastHealthCheckDateTime;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of SessionHostHealthCheckFailureDetails from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of SessionHostHealthCheckFailureDetails if the JsonReader was pointing to an instance of it,
     * or null if it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the SessionHostHealthCheckFailureDetails.
     */
    public static SessionHostHealthCheckFailureDetails fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            SessionHostHealthCheckFailureDetails deserializedSessionHostHealthCheckFailureDetails
                = new SessionHostHealthCheckFailureDetails();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("message".equals(fieldName)) {
                    deserializedSessionHostHealthCheckFailureDetails.message = reader.getString();
                } else if ("errorCode".equals(fieldName)) {
                    deserializedSessionHostHealthCheckFailureDetails.errorCode = reader.getNullable(JsonReader::getInt);
                } else if ("lastHealthCheckDateTime".equals(fieldName)) {
                    deserializedSessionHostHealthCheckFailureDetails.lastHealthCheckDateTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSessionHostHealthCheckFailureDetails;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy