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

com.azure.resourcemanager.frontdoor.models.Backend 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.frontdoor.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;

/**
 * Backend address of a frontDoor load balancer.
 */
@Fluent
public final class Backend implements JsonSerializable {
    /*
     * Location of the backend (IP address or FQDN)
     */
    private String address;

    /*
     * The Alias of the Private Link resource. Populating this optional field indicates that this backend is 'Private'
     */
    private String privateLinkAlias;

    /*
     * The Resource Id of the Private Link resource. Populating this optional field indicates that this backend is
     * 'Private'
     */
    private String privateLinkResourceId;

    /*
     * The location of the Private Link resource. Required only if 'privateLinkResourceId' is populated
     */
    private String privateLinkLocation;

    /*
     * The Approval status for the connection to the Private Link
     */
    private PrivateEndpointStatus privateEndpointStatus;

    /*
     * A custom message to be included in the approval request to connect to the Private Link
     */
    private String privateLinkApprovalMessage;

    /*
     * The HTTP TCP port number. Must be between 1 and 65535.
     */
    private Integer httpPort;

    /*
     * The HTTPS TCP port number. Must be between 1 and 65535.
     */
    private Integer httpsPort;

    /*
     * Whether to enable use of this backend. Permitted values are 'Enabled' or 'Disabled'
     */
    private BackendEnabledState enabledState;

    /*
     * Priority to use for load balancing. Higher priorities will not be used for load balancing if any lower priority
     * backend is healthy.
     */
    private Integer priority;

    /*
     * Weight of this endpoint for load balancing purposes.
     */
    private Integer weight;

    /*
     * The value to use as the host header sent to the backend. If blank or unspecified, this defaults to the incoming
     * host.
     */
    private String backendHostHeader;

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

    /**
     * Get the address property: Location of the backend (IP address or FQDN).
     * 
     * @return the address value.
     */
    public String address() {
        return this.address;
    }

    /**
     * Set the address property: Location of the backend (IP address or FQDN).
     * 
     * @param address the address value to set.
     * @return the Backend object itself.
     */
    public Backend withAddress(String address) {
        this.address = address;
        return this;
    }

    /**
     * Get the privateLinkAlias property: The Alias of the Private Link resource. Populating this optional field
     * indicates that this backend is 'Private'.
     * 
     * @return the privateLinkAlias value.
     */
    public String privateLinkAlias() {
        return this.privateLinkAlias;
    }

    /**
     * Set the privateLinkAlias property: The Alias of the Private Link resource. Populating this optional field
     * indicates that this backend is 'Private'.
     * 
     * @param privateLinkAlias the privateLinkAlias value to set.
     * @return the Backend object itself.
     */
    public Backend withPrivateLinkAlias(String privateLinkAlias) {
        this.privateLinkAlias = privateLinkAlias;
        return this;
    }

    /**
     * Get the privateLinkResourceId property: The Resource Id of the Private Link resource. Populating this optional
     * field indicates that this backend is 'Private'.
     * 
     * @return the privateLinkResourceId value.
     */
    public String privateLinkResourceId() {
        return this.privateLinkResourceId;
    }

    /**
     * Set the privateLinkResourceId property: The Resource Id of the Private Link resource. Populating this optional
     * field indicates that this backend is 'Private'.
     * 
     * @param privateLinkResourceId the privateLinkResourceId value to set.
     * @return the Backend object itself.
     */
    public Backend withPrivateLinkResourceId(String privateLinkResourceId) {
        this.privateLinkResourceId = privateLinkResourceId;
        return this;
    }

    /**
     * Get the privateLinkLocation property: The location of the Private Link resource. Required only if
     * 'privateLinkResourceId' is populated.
     * 
     * @return the privateLinkLocation value.
     */
    public String privateLinkLocation() {
        return this.privateLinkLocation;
    }

    /**
     * Set the privateLinkLocation property: The location of the Private Link resource. Required only if
     * 'privateLinkResourceId' is populated.
     * 
     * @param privateLinkLocation the privateLinkLocation value to set.
     * @return the Backend object itself.
     */
    public Backend withPrivateLinkLocation(String privateLinkLocation) {
        this.privateLinkLocation = privateLinkLocation;
        return this;
    }

    /**
     * Get the privateEndpointStatus property: The Approval status for the connection to the Private Link.
     * 
     * @return the privateEndpointStatus value.
     */
    public PrivateEndpointStatus privateEndpointStatus() {
        return this.privateEndpointStatus;
    }

    /**
     * Get the privateLinkApprovalMessage property: A custom message to be included in the approval request to connect
     * to the Private Link.
     * 
     * @return the privateLinkApprovalMessage value.
     */
    public String privateLinkApprovalMessage() {
        return this.privateLinkApprovalMessage;
    }

    /**
     * Set the privateLinkApprovalMessage property: A custom message to be included in the approval request to connect
     * to the Private Link.
     * 
     * @param privateLinkApprovalMessage the privateLinkApprovalMessage value to set.
     * @return the Backend object itself.
     */
    public Backend withPrivateLinkApprovalMessage(String privateLinkApprovalMessage) {
        this.privateLinkApprovalMessage = privateLinkApprovalMessage;
        return this;
    }

    /**
     * Get the httpPort property: The HTTP TCP port number. Must be between 1 and 65535.
     * 
     * @return the httpPort value.
     */
    public Integer httpPort() {
        return this.httpPort;
    }

    /**
     * Set the httpPort property: The HTTP TCP port number. Must be between 1 and 65535.
     * 
     * @param httpPort the httpPort value to set.
     * @return the Backend object itself.
     */
    public Backend withHttpPort(Integer httpPort) {
        this.httpPort = httpPort;
        return this;
    }

    /**
     * Get the httpsPort property: The HTTPS TCP port number. Must be between 1 and 65535.
     * 
     * @return the httpsPort value.
     */
    public Integer httpsPort() {
        return this.httpsPort;
    }

    /**
     * Set the httpsPort property: The HTTPS TCP port number. Must be between 1 and 65535.
     * 
     * @param httpsPort the httpsPort value to set.
     * @return the Backend object itself.
     */
    public Backend withHttpsPort(Integer httpsPort) {
        this.httpsPort = httpsPort;
        return this;
    }

    /**
     * Get the enabledState property: Whether to enable use of this backend. Permitted values are 'Enabled' or
     * 'Disabled'.
     * 
     * @return the enabledState value.
     */
    public BackendEnabledState enabledState() {
        return this.enabledState;
    }

    /**
     * Set the enabledState property: Whether to enable use of this backend. Permitted values are 'Enabled' or
     * 'Disabled'.
     * 
     * @param enabledState the enabledState value to set.
     * @return the Backend object itself.
     */
    public Backend withEnabledState(BackendEnabledState enabledState) {
        this.enabledState = enabledState;
        return this;
    }

    /**
     * Get the priority property: Priority to use for load balancing. Higher priorities will not be used for load
     * balancing if any lower priority backend is healthy.
     * 
     * @return the priority value.
     */
    public Integer priority() {
        return this.priority;
    }

    /**
     * Set the priority property: Priority to use for load balancing. Higher priorities will not be used for load
     * balancing if any lower priority backend is healthy.
     * 
     * @param priority the priority value to set.
     * @return the Backend object itself.
     */
    public Backend withPriority(Integer priority) {
        this.priority = priority;
        return this;
    }

    /**
     * Get the weight property: Weight of this endpoint for load balancing purposes.
     * 
     * @return the weight value.
     */
    public Integer weight() {
        return this.weight;
    }

    /**
     * Set the weight property: Weight of this endpoint for load balancing purposes.
     * 
     * @param weight the weight value to set.
     * @return the Backend object itself.
     */
    public Backend withWeight(Integer weight) {
        this.weight = weight;
        return this;
    }

    /**
     * Get the backendHostHeader property: The value to use as the host header sent to the backend. If blank or
     * unspecified, this defaults to the incoming host.
     * 
     * @return the backendHostHeader value.
     */
    public String backendHostHeader() {
        return this.backendHostHeader;
    }

    /**
     * Set the backendHostHeader property: The value to use as the host header sent to the backend. If blank or
     * unspecified, this defaults to the incoming host.
     * 
     * @param backendHostHeader the backendHostHeader value to set.
     * @return the Backend object itself.
     */
    public Backend withBackendHostHeader(String backendHostHeader) {
        this.backendHostHeader = backendHostHeader;
        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("address", this.address);
        jsonWriter.writeStringField("privateLinkAlias", this.privateLinkAlias);
        jsonWriter.writeStringField("privateLinkResourceId", this.privateLinkResourceId);
        jsonWriter.writeStringField("privateLinkLocation", this.privateLinkLocation);
        jsonWriter.writeStringField("privateLinkApprovalMessage", this.privateLinkApprovalMessage);
        jsonWriter.writeNumberField("httpPort", this.httpPort);
        jsonWriter.writeNumberField("httpsPort", this.httpsPort);
        jsonWriter.writeStringField("enabledState", this.enabledState == null ? null : this.enabledState.toString());
        jsonWriter.writeNumberField("priority", this.priority);
        jsonWriter.writeNumberField("weight", this.weight);
        jsonWriter.writeStringField("backendHostHeader", this.backendHostHeader);
        return jsonWriter.writeEndObject();
    }

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

                if ("address".equals(fieldName)) {
                    deserializedBackend.address = reader.getString();
                } else if ("privateLinkAlias".equals(fieldName)) {
                    deserializedBackend.privateLinkAlias = reader.getString();
                } else if ("privateLinkResourceId".equals(fieldName)) {
                    deserializedBackend.privateLinkResourceId = reader.getString();
                } else if ("privateLinkLocation".equals(fieldName)) {
                    deserializedBackend.privateLinkLocation = reader.getString();
                } else if ("privateEndpointStatus".equals(fieldName)) {
                    deserializedBackend.privateEndpointStatus = PrivateEndpointStatus.fromString(reader.getString());
                } else if ("privateLinkApprovalMessage".equals(fieldName)) {
                    deserializedBackend.privateLinkApprovalMessage = reader.getString();
                } else if ("httpPort".equals(fieldName)) {
                    deserializedBackend.httpPort = reader.getNullable(JsonReader::getInt);
                } else if ("httpsPort".equals(fieldName)) {
                    deserializedBackend.httpsPort = reader.getNullable(JsonReader::getInt);
                } else if ("enabledState".equals(fieldName)) {
                    deserializedBackend.enabledState = BackendEnabledState.fromString(reader.getString());
                } else if ("priority".equals(fieldName)) {
                    deserializedBackend.priority = reader.getNullable(JsonReader::getInt);
                } else if ("weight".equals(fieldName)) {
                    deserializedBackend.weight = reader.getNullable(JsonReader::getInt);
                } else if ("backendHostHeader".equals(fieldName)) {
                    deserializedBackend.backendHostHeader = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBackend;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy