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

com.azure.resourcemanager.security.models.SecurityAssessment 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.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentMetadataProperties;
import com.azure.resourcemanager.security.fluent.models.SecurityAssessmentProperties;
import java.io.IOException;
import java.util.Map;

/**
 * Security assessment on a resource.
 */
@Fluent
public final class SecurityAssessment extends ProxyResource {
    /*
     * Describes properties of an assessment.
     */
    private SecurityAssessmentProperties innerProperties;

    /*
     * The type of the resource.
     */
    private String type;

    /*
     * The name of the resource.
     */
    private String name;

    /*
     * Fully qualified resource Id for the resource.
     */
    private String id;

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

    /**
     * Get the innerProperties property: Describes properties of an assessment.
     * 
     * @return the innerProperties value.
     */
    private SecurityAssessmentProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the type property: The type of the resource.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the name property: The name of the resource.
     * 
     * @return the name value.
     */
    @Override
    public String name() {
        return this.name;
    }

    /**
     * Get the id property: Fully qualified resource Id for the resource.
     * 
     * @return the id value.
     */
    @Override
    public String id() {
        return this.id;
    }

    /**
     * Get the status property: The result of the assessment.
     * 
     * @return the status value.
     */
    public AssessmentStatus status() {
        return this.innerProperties() == null ? null : this.innerProperties().status();
    }

    /**
     * Set the status property: The result of the assessment.
     * 
     * @param status the status value to set.
     * @return the SecurityAssessment object itself.
     */
    public SecurityAssessment withStatus(AssessmentStatus status) {
        if (this.innerProperties() == null) {
            this.innerProperties = new SecurityAssessmentProperties();
        }
        this.innerProperties().withStatus(status);
        return this;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("id".equals(fieldName)) {
                    deserializedSecurityAssessment.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedSecurityAssessment.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedSecurityAssessment.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedSecurityAssessment.innerProperties = SecurityAssessmentProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSecurityAssessment;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy