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

com.azure.resourcemanager.security.models.SubAssessmentStatus 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.security.models;

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

/**
 * Status of the sub-assessment.
 */
@Immutable
public final class SubAssessmentStatus implements JsonSerializable {
    /*
     * Programmatic code for the status of the assessment
     */
    private SubAssessmentStatusCode code;

    /*
     * Programmatic code for the cause of the assessment status
     */
    private String cause;

    /*
     * Human readable description of the assessment status
     */
    private String description;

    /*
     * The sub-assessment severity level
     */
    private Severity severity;

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

    /**
     * Get the code property: Programmatic code for the status of the assessment.
     * 
     * @return the code value.
     */
    public SubAssessmentStatusCode code() {
        return this.code;
    }

    /**
     * Get the cause property: Programmatic code for the cause of the assessment status.
     * 
     * @return the cause value.
     */
    public String cause() {
        return this.cause;
    }

    /**
     * Get the description property: Human readable description of the assessment status.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Get the severity property: The sub-assessment severity level.
     * 
     * @return the severity value.
     */
    public Severity severity() {
        return this.severity;
    }

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

                if ("code".equals(fieldName)) {
                    deserializedSubAssessmentStatus.code = SubAssessmentStatusCode.fromString(reader.getString());
                } else if ("cause".equals(fieldName)) {
                    deserializedSubAssessmentStatus.cause = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedSubAssessmentStatus.description = reader.getString();
                } else if ("severity".equals(fieldName)) {
                    deserializedSubAssessmentStatus.severity = Severity.fromString(reader.getString());
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSubAssessmentStatus;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy