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

com.azure.resourcemanager.security.models.SecurityAssessmentPropertiesBase 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.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Describes properties of an assessment.
 */
@Fluent
public class SecurityAssessmentPropertiesBase implements JsonSerializable {
    /*
     * Details of the resource that was assessed
     */
    private ResourceDetails resourceDetails;

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

    /*
     * Additional data regarding the assessment
     */
    private Map additionalData;

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

    /*
     * Describes properties of an assessment metadata.
     */
    private SecurityAssessmentMetadataProperties metadata;

    /*
     * Data regarding 3rd party partner integration
     */
    private SecurityAssessmentPartnerData partnersData;

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

    /**
     * Get the resourceDetails property: Details of the resource that was assessed.
     * 
     * @return the resourceDetails value.
     */
    public ResourceDetails resourceDetails() {
        return this.resourceDetails;
    }

    /**
     * Set the resourceDetails property: Details of the resource that was assessed.
     * 
     * @param resourceDetails the resourceDetails value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withResourceDetails(ResourceDetails resourceDetails) {
        this.resourceDetails = resourceDetails;
        return this;
    }

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

    /**
     * Set the displayName property: User friendly display name of the assessment.
     * 
     * @param displayName the displayName value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    SecurityAssessmentPropertiesBase withDisplayName(String displayName) {
        this.displayName = displayName;
        return this;
    }

    /**
     * Get the additionalData property: Additional data regarding the assessment.
     * 
     * @return the additionalData value.
     */
    public Map additionalData() {
        return this.additionalData;
    }

    /**
     * Set the additionalData property: Additional data regarding the assessment.
     * 
     * @param additionalData the additionalData value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withAdditionalData(Map additionalData) {
        this.additionalData = additionalData;
        return this;
    }

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

    /**
     * Set the links property: Links relevant to the assessment.
     * 
     * @param links the links value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    SecurityAssessmentPropertiesBase withLinks(AssessmentLinks links) {
        this.links = links;
        return this;
    }

    /**
     * Get the metadata property: Describes properties of an assessment metadata.
     * 
     * @return the metadata value.
     */
    public SecurityAssessmentMetadataProperties metadata() {
        return this.metadata;
    }

    /**
     * Set the metadata property: Describes properties of an assessment metadata.
     * 
     * @param metadata the metadata value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withMetadata(SecurityAssessmentMetadataProperties metadata) {
        this.metadata = metadata;
        return this;
    }

    /**
     * Get the partnersData property: Data regarding 3rd party partner integration.
     * 
     * @return the partnersData value.
     */
    public SecurityAssessmentPartnerData partnersData() {
        return this.partnersData;
    }

    /**
     * Set the partnersData property: Data regarding 3rd party partner integration.
     * 
     * @param partnersData the partnersData value to set.
     * @return the SecurityAssessmentPropertiesBase object itself.
     */
    public SecurityAssessmentPropertiesBase withPartnersData(SecurityAssessmentPartnerData partnersData) {
        this.partnersData = partnersData;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (resourceDetails() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property resourceDetails in model SecurityAssessmentPropertiesBase"));
        } 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(SecurityAssessmentPropertiesBase.class);

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

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

                if ("resourceDetails".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesBase.resourceDetails = ResourceDetails.fromJson(reader);
                } else if ("displayName".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesBase.displayName = reader.getString();
                } else if ("additionalData".equals(fieldName)) {
                    Map additionalData = reader.readMap(reader1 -> reader1.getString());
                    deserializedSecurityAssessmentPropertiesBase.additionalData = additionalData;
                } else if ("links".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesBase.links = AssessmentLinks.fromJson(reader);
                } else if ("metadata".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesBase.metadata
                        = SecurityAssessmentMetadataProperties.fromJson(reader);
                } else if ("partnersData".equals(fieldName)) {
                    deserializedSecurityAssessmentPropertiesBase.partnersData
                        = SecurityAssessmentPartnerData.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecurityAssessmentPropertiesBase;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy