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

com.azure.resourcemanager.network.models.FirewallPolicyIntrusionDetectionBypassTrafficSpecifications 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;

/**
 * Intrusion detection bypass traffic specification.
 */
@Fluent
public final class FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
    implements JsonSerializable {
    /*
     * Name of the bypass traffic rule.
     */
    private String name;

    /*
     * Description of the bypass traffic rule.
     */
    private String description;

    /*
     * The rule bypass protocol.
     */
    private FirewallPolicyIntrusionDetectionProtocol protocol;

    /*
     * List of source IP addresses or ranges for this rule.
     */
    private List sourceAddresses;

    /*
     * List of destination IP addresses or ranges for this rule.
     */
    private List destinationAddresses;

    /*
     * List of destination ports or ranges.
     */
    private List destinationPorts;

    /*
     * List of source IpGroups for this rule.
     */
    private List sourceIpGroups;

    /*
     * List of destination IpGroups for this rule.
     */
    private List destinationIpGroups;

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

    /**
     * Get the name property: Name of the bypass traffic rule.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: Name of the bypass traffic rule.
     * 
     * @param name the name value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the description property: Description of the bypass traffic rule.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: Description of the bypass traffic rule.
     * 
     * @param description the description value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the protocol property: The rule bypass protocol.
     * 
     * @return the protocol value.
     */
    public FirewallPolicyIntrusionDetectionProtocol protocol() {
        return this.protocol;
    }

    /**
     * Set the protocol property: The rule bypass protocol.
     * 
     * @param protocol the protocol value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
        withProtocol(FirewallPolicyIntrusionDetectionProtocol protocol) {
        this.protocol = protocol;
        return this;
    }

    /**
     * Get the sourceAddresses property: List of source IP addresses or ranges for this rule.
     * 
     * @return the sourceAddresses value.
     */
    public List sourceAddresses() {
        return this.sourceAddresses;
    }

    /**
     * Set the sourceAddresses property: List of source IP addresses or ranges for this rule.
     * 
     * @param sourceAddresses the sourceAddresses value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
        withSourceAddresses(List sourceAddresses) {
        this.sourceAddresses = sourceAddresses;
        return this;
    }

    /**
     * Get the destinationAddresses property: List of destination IP addresses or ranges for this rule.
     * 
     * @return the destinationAddresses value.
     */
    public List destinationAddresses() {
        return this.destinationAddresses;
    }

    /**
     * Set the destinationAddresses property: List of destination IP addresses or ranges for this rule.
     * 
     * @param destinationAddresses the destinationAddresses value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
        withDestinationAddresses(List destinationAddresses) {
        this.destinationAddresses = destinationAddresses;
        return this;
    }

    /**
     * Get the destinationPorts property: List of destination ports or ranges.
     * 
     * @return the destinationPorts value.
     */
    public List destinationPorts() {
        return this.destinationPorts;
    }

    /**
     * Set the destinationPorts property: List of destination ports or ranges.
     * 
     * @param destinationPorts the destinationPorts value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
        withDestinationPorts(List destinationPorts) {
        this.destinationPorts = destinationPorts;
        return this;
    }

    /**
     * Get the sourceIpGroups property: List of source IpGroups for this rule.
     * 
     * @return the sourceIpGroups value.
     */
    public List sourceIpGroups() {
        return this.sourceIpGroups;
    }

    /**
     * Set the sourceIpGroups property: List of source IpGroups for this rule.
     * 
     * @param sourceIpGroups the sourceIpGroups value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications withSourceIpGroups(List sourceIpGroups) {
        this.sourceIpGroups = sourceIpGroups;
        return this;
    }

    /**
     * Get the destinationIpGroups property: List of destination IpGroups for this rule.
     * 
     * @return the destinationIpGroups value.
     */
    public List destinationIpGroups() {
        return this.destinationIpGroups;
    }

    /**
     * Set the destinationIpGroups property: List of destination IpGroups for this rule.
     * 
     * @param destinationIpGroups the destinationIpGroups value to set.
     * @return the FirewallPolicyIntrusionDetectionBypassTrafficSpecifications object itself.
     */
    public FirewallPolicyIntrusionDetectionBypassTrafficSpecifications
        withDestinationIpGroups(List destinationIpGroups) {
        this.destinationIpGroups = destinationIpGroups;
        return this;
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeStringField("description", this.description);
        jsonWriter.writeStringField("protocol", this.protocol == null ? null : this.protocol.toString());
        jsonWriter.writeArrayField("sourceAddresses", this.sourceAddresses,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("destinationAddresses", this.destinationAddresses,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("destinationPorts", this.destinationPorts,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("sourceIpGroups", this.sourceIpGroups,
            (writer, element) -> writer.writeString(element));
        jsonWriter.writeArrayField("destinationIpGroups", this.destinationIpGroups,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.name = reader.getString();
                } else if ("description".equals(fieldName)) {
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.description
                        = reader.getString();
                } else if ("protocol".equals(fieldName)) {
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.protocol
                        = FirewallPolicyIntrusionDetectionProtocol.fromString(reader.getString());
                } else if ("sourceAddresses".equals(fieldName)) {
                    List sourceAddresses = reader.readArray(reader1 -> reader1.getString());
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.sourceAddresses
                        = sourceAddresses;
                } else if ("destinationAddresses".equals(fieldName)) {
                    List destinationAddresses = reader.readArray(reader1 -> reader1.getString());
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.destinationAddresses
                        = destinationAddresses;
                } else if ("destinationPorts".equals(fieldName)) {
                    List destinationPorts = reader.readArray(reader1 -> reader1.getString());
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.destinationPorts
                        = destinationPorts;
                } else if ("sourceIpGroups".equals(fieldName)) {
                    List sourceIpGroups = reader.readArray(reader1 -> reader1.getString());
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.sourceIpGroups
                        = sourceIpGroups;
                } else if ("destinationIpGroups".equals(fieldName)) {
                    List destinationIpGroups = reader.readArray(reader1 -> reader1.getString());
                    deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications.destinationIpGroups
                        = destinationIpGroups;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedFirewallPolicyIntrusionDetectionBypassTrafficSpecifications;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy