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

com.azure.resourcemanager.security.models.StatusAutoGenerated Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for Security Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. API spec for Microsoft.Security (Azure Security Center) resource provider. Package tag package-composite-v3.

There is a newer version: 1.0.0
Show 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.security.models;

import com.azure.core.annotation.Fluent;
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;

/**
 * The status of the health report.
 */
@Fluent
public final class StatusAutoGenerated implements JsonSerializable {
    /*
     * The status of the health report
     */
    private StatusName code;

    /*
     * The reason of the given status
     */
    private String reason;

    /*
     * The date of when the resource was scanned in the last time
     */
    private OffsetDateTime lastScannedDate;

    /*
     * The date of when the status of the health report was changed in the last time
     */
    private OffsetDateTime statusChangeDate;

    /*
     * The date of when the resource of the health report was scanned in the first time
     */
    private OffsetDateTime firstEvaluationDate;

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

    /**
     * Get the code property: The status of the health report.
     * 
     * @return the code value.
     */
    public StatusName code() {
        return this.code;
    }

    /**
     * Set the code property: The status of the health report.
     * 
     * @param code the code value to set.
     * @return the StatusAutoGenerated object itself.
     */
    public StatusAutoGenerated withCode(StatusName code) {
        this.code = code;
        return this;
    }

    /**
     * Get the reason property: The reason of the given status.
     * 
     * @return the reason value.
     */
    public String reason() {
        return this.reason;
    }

    /**
     * Get the lastScannedDate property: The date of when the resource was scanned in the last time.
     * 
     * @return the lastScannedDate value.
     */
    public OffsetDateTime lastScannedDate() {
        return this.lastScannedDate;
    }

    /**
     * Get the statusChangeDate property: The date of when the status of the health report was changed in the last time.
     * 
     * @return the statusChangeDate value.
     */
    public OffsetDateTime statusChangeDate() {
        return this.statusChangeDate;
    }

    /**
     * Get the firstEvaluationDate property: The date of when the resource of the health report was scanned in the first
     * time.
     * 
     * @return the firstEvaluationDate value.
     */
    public OffsetDateTime firstEvaluationDate() {
        return this.firstEvaluationDate;
    }

    /**
     * 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();
        jsonWriter.writeStringField("code", this.code == null ? null : this.code.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("code".equals(fieldName)) {
                    deserializedStatusAutoGenerated.code = StatusName.fromString(reader.getString());
                } else if ("reason".equals(fieldName)) {
                    deserializedStatusAutoGenerated.reason = reader.getString();
                } else if ("lastScannedDate".equals(fieldName)) {
                    deserializedStatusAutoGenerated.lastScannedDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("statusChangeDate".equals(fieldName)) {
                    deserializedStatusAutoGenerated.statusChangeDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("firstEvaluationDate".equals(fieldName)) {
                    deserializedStatusAutoGenerated.firstEvaluationDate = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStatusAutoGenerated;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy