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

com.azure.resourcemanager.devcenter.models.HealthCheck Maven / Gradle / Ivy

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

package com.azure.resourcemanager.devcenter.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;

/**
 * An individual health check item.
 */
@Immutable
public final class HealthCheck implements JsonSerializable {
    /*
     * The status of the health check item.
     */
    private HealthCheckStatus status;

    /*
     * The display name of this health check item.
     */
    private String displayName;

    /*
     * Start time of health check item.
     */
    private OffsetDateTime startDateTime;

    /*
     * End time of the health check item.
     */
    private OffsetDateTime endDateTime;

    /*
     * The type of error that occurred during this health check.
     */
    private String errorType;

    /*
     * The recommended action to fix the corresponding error.
     */
    private String recommendedAction;

    /*
     * Additional details about the health check or the recommended action.
     */
    private String additionalDetails;

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

    /**
     * Get the status property: The status of the health check item.
     * 
     * @return the status value.
     */
    public HealthCheckStatus status() {
        return this.status;
    }

    /**
     * Get the displayName property: The display name of this health check item.
     * 
     * @return the displayName value.
     */
    public String displayName() {
        return this.displayName;
    }

    /**
     * Get the startDateTime property: Start time of health check item.
     * 
     * @return the startDateTime value.
     */
    public OffsetDateTime startDateTime() {
        return this.startDateTime;
    }

    /**
     * Get the endDateTime property: End time of the health check item.
     * 
     * @return the endDateTime value.
     */
    public OffsetDateTime endDateTime() {
        return this.endDateTime;
    }

    /**
     * Get the errorType property: The type of error that occurred during this health check.
     * 
     * @return the errorType value.
     */
    public String errorType() {
        return this.errorType;
    }

    /**
     * Get the recommendedAction property: The recommended action to fix the corresponding error.
     * 
     * @return the recommendedAction value.
     */
    public String recommendedAction() {
        return this.recommendedAction;
    }

    /**
     * Get the additionalDetails property: Additional details about the health check or the recommended action.
     * 
     * @return the additionalDetails value.
     */
    public String additionalDetails() {
        return this.additionalDetails;
    }

    /**
     * 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 HealthCheck from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of HealthCheck 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 HealthCheck.
     */
    public static HealthCheck fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            HealthCheck deserializedHealthCheck = new HealthCheck();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("status".equals(fieldName)) {
                    deserializedHealthCheck.status = HealthCheckStatus.fromString(reader.getString());
                } else if ("displayName".equals(fieldName)) {
                    deserializedHealthCheck.displayName = reader.getString();
                } else if ("startDateTime".equals(fieldName)) {
                    deserializedHealthCheck.startDateTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endDateTime".equals(fieldName)) {
                    deserializedHealthCheck.endDateTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("errorType".equals(fieldName)) {
                    deserializedHealthCheck.errorType = reader.getString();
                } else if ("recommendedAction".equals(fieldName)) {
                    deserializedHealthCheck.recommendedAction = reader.getString();
                } else if ("additionalDetails".equals(fieldName)) {
                    deserializedHealthCheck.additionalDetails = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedHealthCheck;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy