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

com.azure.resourcemanager.network.models.NetworkSecurityGroupResult Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure Network Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt

The 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.network.models;

import com.azure.core.annotation.Fluent;
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;

/**
 * Network configuration diagnostic result corresponded provided traffic query.
 */
@Fluent
public final class NetworkSecurityGroupResult implements JsonSerializable {
    /*
     * The network traffic is allowed or denied.
     */
    private SecurityRuleAccess securityRuleAccessResult;

    /*
     * List of results network security groups diagnostic.
     */
    private List evaluatedNetworkSecurityGroups;

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

    /**
     * Get the securityRuleAccessResult property: The network traffic is allowed or denied.
     * 
     * @return the securityRuleAccessResult value.
     */
    public SecurityRuleAccess securityRuleAccessResult() {
        return this.securityRuleAccessResult;
    }

    /**
     * Set the securityRuleAccessResult property: The network traffic is allowed or denied.
     * 
     * @param securityRuleAccessResult the securityRuleAccessResult value to set.
     * @return the NetworkSecurityGroupResult object itself.
     */
    public NetworkSecurityGroupResult withSecurityRuleAccessResult(SecurityRuleAccess securityRuleAccessResult) {
        this.securityRuleAccessResult = securityRuleAccessResult;
        return this;
    }

    /**
     * Get the evaluatedNetworkSecurityGroups property: List of results network security groups diagnostic.
     * 
     * @return the evaluatedNetworkSecurityGroups value.
     */
    public List evaluatedNetworkSecurityGroups() {
        return this.evaluatedNetworkSecurityGroups;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("securityRuleAccessResult",
            this.securityRuleAccessResult == null ? null : this.securityRuleAccessResult.toString());
        return jsonWriter.writeEndObject();
    }

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

                if ("securityRuleAccessResult".equals(fieldName)) {
                    deserializedNetworkSecurityGroupResult.securityRuleAccessResult
                        = SecurityRuleAccess.fromString(reader.getString());
                } else if ("evaluatedNetworkSecurityGroups".equals(fieldName)) {
                    List evaluatedNetworkSecurityGroups
                        = reader.readArray(reader1 -> EvaluatedNetworkSecurityGroup.fromJson(reader1));
                    deserializedNetworkSecurityGroupResult.evaluatedNetworkSecurityGroups
                        = evaluatedNetworkSecurityGroups;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNetworkSecurityGroupResult;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy