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

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

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.models.AssessmentLinks;
import com.azure.resourcemanager.security.models.AssessmentStatusResponse;
import com.azure.resourcemanager.security.models.ResourceDetails;
import com.azure.resourcemanager.security.models.SecurityAssessmentPartnerData;
import com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBase;
import java.io.IOException;
import java.util.Map;

/**
 * Describes properties of an assessment.
 */
@Fluent
public final class SecurityAssessmentPropertiesResponse extends SecurityAssessmentPropertiesBase {
    /*
     * The result of the assessment
     */
    private AssessmentStatusResponse status;

    /*
     * Links relevant to the assessment
     */
    private AssessmentLinks links;

    /*
     * User friendly display name of the assessment
     */
    private String displayName;

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

    /**
     * Get the status property: The result of the assessment.
     * 
     * @return the status value.
     */
    public AssessmentStatusResponse status() {
        return this.status;
    }

    /**
     * Set the status property: The result of the assessment.
     * 
     * @param status the status value to set.
     * @return the SecurityAssessmentPropertiesResponse object itself.
     */
    public SecurityAssessmentPropertiesResponse withStatus(AssessmentStatusResponse status) {
        this.status = status;
        return this;
    }

    /**
     * Get the links property: Links relevant to the assessment.
     * 
     * @return the links value.
     */
    @Override
    public AssessmentLinks links() {
        return this.links;
    }

    /**
     * Get the displayName property: User friendly display name of the assessment.
     * 
     * @return the displayName value.
     */
    @Override
    public String displayName() {
        return this.displayName;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SecurityAssessmentPropertiesResponse withResourceDetails(ResourceDetails resourceDetails) {
        super.withResourceDetails(resourceDetails);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SecurityAssessmentPropertiesResponse withAdditionalData(Map additionalData) {
        super.withAdditionalData(additionalData);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SecurityAssessmentPropertiesResponse withMetadata(SecurityAssessmentMetadataProperties metadata) {
        super.withMetadata(metadata);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SecurityAssessmentPropertiesResponse withPartnersData(SecurityAssessmentPartnerData partnersData) {
        super.withPartnersData(partnersData);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
        if (status() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property status in model SecurityAssessmentPropertiesResponse"));
        } else {
            status().validate();
        }
        if (resourceDetails() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property resourceDetails in model SecurityAssessmentPropertiesResponse"));
        } else {
            resourceDetails().validate();
        }
        if (links() != null) {
            links().validate();
        }
        if (metadata() != null) {
            metadata().validate();
        }
        if (partnersData() != null) {
            partnersData().validate();
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(SecurityAssessmentPropertiesResponse.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("resourceDetails", resourceDetails());
        jsonWriter.writeMapField("additionalData", additionalData(), (writer, element) -> writer.writeString(element));
        jsonWriter.writeJsonField("metadata", metadata());
        jsonWriter.writeJsonField("partnersData", partnersData());
        jsonWriter.writeJsonField("status", this.status);
        return jsonWriter.writeEndObject();
    }

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

                if ("resourceDetails".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse
                        .withResourceDetails(ResourceDetails.fromJson(reader));
                } else if ("displayName".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse.displayName = reader.getString();
                } else if ("additionalData".equals(fieldName)) {
                    Map additionalData = reader.readMap(reader1 -> reader1.getString());
                    deserializedSecurityAssessmentPropertiesResponse.withAdditionalData(additionalData);
                } else if ("links".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse.links = AssessmentLinks.fromJson(reader);
                } else if ("metadata".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse
                        .withMetadata(SecurityAssessmentMetadataProperties.fromJson(reader));
                } else if ("partnersData".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse
                        .withPartnersData(SecurityAssessmentPartnerData.fromJson(reader));
                } else if ("status".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesResponse.status = AssessmentStatusResponse.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecurityAssessmentPropertiesResponse;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy