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

com.azure.resourcemanager.security.models.TopologySingleResource 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;
import java.util.List;

/**
 * The TopologySingleResource model.
 */
@Immutable
public final class TopologySingleResource implements JsonSerializable {
    /*
     * Azure resource id
     */
    private String resourceId;

    /*
     * The security severity of the resource
     */
    private String severity;

    /*
     * Indicates if the resource has security recommendations
     */
    private Boolean recommendationsExist;

    /*
     * Indicates the resource connectivity level to the Internet (InternetFacing, Internal ,etc.)
     */
    private String networkZones;

    /*
     * Score of the resource based on its security severity
     */
    private Integer topologyScore;

    /*
     * The location of this resource
     */
    private String location;

    /*
     * Azure resources connected to this resource which are in higher level in the topology view
     */
    private List parents;

    /*
     * Azure resources connected to this resource which are in lower level in the topology view
     */
    private List children;

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

    /**
     * Get the resourceId property: Azure resource id.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

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

    /**
     * Get the recommendationsExist property: Indicates if the resource has security recommendations.
     * 
     * @return the recommendationsExist value.
     */
    public Boolean recommendationsExist() {
        return this.recommendationsExist;
    }

    /**
     * Get the networkZones property: Indicates the resource connectivity level to the Internet (InternetFacing,
     * Internal ,etc.).
     * 
     * @return the networkZones value.
     */
    public String networkZones() {
        return this.networkZones;
    }

    /**
     * Get the topologyScore property: Score of the resource based on its security severity.
     * 
     * @return the topologyScore value.
     */
    public Integer topologyScore() {
        return this.topologyScore;
    }

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

    /**
     * Get the parents property: Azure resources connected to this resource which are in higher level in the topology
     * view.
     * 
     * @return the parents value.
     */
    public List parents() {
        return this.parents;
    }

    /**
     * Get the children property: Azure resources connected to this resource which are in lower level in the topology
     * view.
     * 
     * @return the children value.
     */
    public List children() {
        return this.children;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (parents() != null) {
            parents().forEach(e -> e.validate());
        }
        if (children() != null) {
            children().forEach(e -> e.validate());
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

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

                if ("resourceId".equals(fieldName)) {
                    deserializedTopologySingleResource.resourceId = reader.getString();
                } else if ("severity".equals(fieldName)) {
                    deserializedTopologySingleResource.severity = reader.getString();
                } else if ("recommendationsExist".equals(fieldName)) {
                    deserializedTopologySingleResource.recommendationsExist
                        = reader.getNullable(JsonReader::getBoolean);
                } else if ("networkZones".equals(fieldName)) {
                    deserializedTopologySingleResource.networkZones = reader.getString();
                } else if ("topologyScore".equals(fieldName)) {
                    deserializedTopologySingleResource.topologyScore = reader.getNullable(JsonReader::getInt);
                } else if ("location".equals(fieldName)) {
                    deserializedTopologySingleResource.location = reader.getString();
                } else if ("parents".equals(fieldName)) {
                    List parents
                        = reader.readArray(reader1 -> TopologySingleResourceParent.fromJson(reader1));
                    deserializedTopologySingleResource.parents = parents;
                } else if ("children".equals(fieldName)) {
                    List children
                        = reader.readArray(reader1 -> TopologySingleResourceChild.fromJson(reader1));
                    deserializedTopologySingleResource.children = children;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTopologySingleResource;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy