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

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

/**
 * Explicit Proxy Settings in Firewall Policy.
 */
@Fluent
public final class ExplicitProxy implements JsonSerializable {
    /*
     * When set to true, explicit proxy mode is enabled.
     */
    private Boolean enableExplicitProxy;

    /*
     * Port number for explicit proxy http protocol, cannot be greater than 64000.
     */
    private Integer httpPort;

    /*
     * Port number for explicit proxy https protocol, cannot be greater than 64000.
     */
    private Integer httpsPort;

    /*
     * When set to true, pac file port and url needs to be provided.
     */
    private Boolean enablePacFile;

    /*
     * Port number for firewall to serve PAC file.
     */
    private Integer pacFilePort;

    /*
     * SAS URL for PAC file.
     */
    private String pacFile;

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

    /**
     * Get the enableExplicitProxy property: When set to true, explicit proxy mode is enabled.
     * 
     * @return the enableExplicitProxy value.
     */
    public Boolean enableExplicitProxy() {
        return this.enableExplicitProxy;
    }

    /**
     * Set the enableExplicitProxy property: When set to true, explicit proxy mode is enabled.
     * 
     * @param enableExplicitProxy the enableExplicitProxy value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withEnableExplicitProxy(Boolean enableExplicitProxy) {
        this.enableExplicitProxy = enableExplicitProxy;
        return this;
    }

    /**
     * Get the httpPort property: Port number for explicit proxy http protocol, cannot be greater than 64000.
     * 
     * @return the httpPort value.
     */
    public Integer httpPort() {
        return this.httpPort;
    }

    /**
     * Set the httpPort property: Port number for explicit proxy http protocol, cannot be greater than 64000.
     * 
     * @param httpPort the httpPort value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withHttpPort(Integer httpPort) {
        this.httpPort = httpPort;
        return this;
    }

    /**
     * Get the httpsPort property: Port number for explicit proxy https protocol, cannot be greater than 64000.
     * 
     * @return the httpsPort value.
     */
    public Integer httpsPort() {
        return this.httpsPort;
    }

    /**
     * Set the httpsPort property: Port number for explicit proxy https protocol, cannot be greater than 64000.
     * 
     * @param httpsPort the httpsPort value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withHttpsPort(Integer httpsPort) {
        this.httpsPort = httpsPort;
        return this;
    }

    /**
     * Get the enablePacFile property: When set to true, pac file port and url needs to be provided.
     * 
     * @return the enablePacFile value.
     */
    public Boolean enablePacFile() {
        return this.enablePacFile;
    }

    /**
     * Set the enablePacFile property: When set to true, pac file port and url needs to be provided.
     * 
     * @param enablePacFile the enablePacFile value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withEnablePacFile(Boolean enablePacFile) {
        this.enablePacFile = enablePacFile;
        return this;
    }

    /**
     * Get the pacFilePort property: Port number for firewall to serve PAC file.
     * 
     * @return the pacFilePort value.
     */
    public Integer pacFilePort() {
        return this.pacFilePort;
    }

    /**
     * Set the pacFilePort property: Port number for firewall to serve PAC file.
     * 
     * @param pacFilePort the pacFilePort value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withPacFilePort(Integer pacFilePort) {
        this.pacFilePort = pacFilePort;
        return this;
    }

    /**
     * Get the pacFile property: SAS URL for PAC file.
     * 
     * @return the pacFile value.
     */
    public String pacFile() {
        return this.pacFile;
    }

    /**
     * Set the pacFile property: SAS URL for PAC file.
     * 
     * @param pacFile the pacFile value to set.
     * @return the ExplicitProxy object itself.
     */
    public ExplicitProxy withPacFile(String pacFile) {
        this.pacFile = pacFile;
        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.writeBooleanField("enableExplicitProxy", this.enableExplicitProxy);
        jsonWriter.writeNumberField("httpPort", this.httpPort);
        jsonWriter.writeNumberField("httpsPort", this.httpsPort);
        jsonWriter.writeBooleanField("enablePacFile", this.enablePacFile);
        jsonWriter.writeNumberField("pacFilePort", this.pacFilePort);
        jsonWriter.writeStringField("pacFile", this.pacFile);
        return jsonWriter.writeEndObject();
    }

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

                if ("enableExplicitProxy".equals(fieldName)) {
                    deserializedExplicitProxy.enableExplicitProxy = reader.getNullable(JsonReader::getBoolean);
                } else if ("httpPort".equals(fieldName)) {
                    deserializedExplicitProxy.httpPort = reader.getNullable(JsonReader::getInt);
                } else if ("httpsPort".equals(fieldName)) {
                    deserializedExplicitProxy.httpsPort = reader.getNullable(JsonReader::getInt);
                } else if ("enablePacFile".equals(fieldName)) {
                    deserializedExplicitProxy.enablePacFile = reader.getNullable(JsonReader::getBoolean);
                } else if ("pacFilePort".equals(fieldName)) {
                    deserializedExplicitProxy.pacFilePort = reader.getNullable(JsonReader::getInt);
                } else if ("pacFile".equals(fieldName)) {
                    deserializedExplicitProxy.pacFile = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedExplicitProxy;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy