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

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

/**
 * Settings that apply to all backend pools.
 */
@Fluent
public final class BackendPoolsSettings implements JsonSerializable {
    /*
     * Whether to enforce certificate name check on HTTPS requests to all backend pools. No effect on non-HTTPS
     * requests.
     */
    private EnforceCertificateNameCheckEnabledState enforceCertificateNameCheck;

    /*
     * Send and receive timeout on forwarding request to the backend. When timeout is reached, the request fails and
     * returns.
     */
    private Integer sendRecvTimeoutSeconds;

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

    /**
     * Get the enforceCertificateNameCheck property: Whether to enforce certificate name check on HTTPS requests to all
     * backend pools. No effect on non-HTTPS requests.
     * 
     * @return the enforceCertificateNameCheck value.
     */
    public EnforceCertificateNameCheckEnabledState enforceCertificateNameCheck() {
        return this.enforceCertificateNameCheck;
    }

    /**
     * Set the enforceCertificateNameCheck property: Whether to enforce certificate name check on HTTPS requests to all
     * backend pools. No effect on non-HTTPS requests.
     * 
     * @param enforceCertificateNameCheck the enforceCertificateNameCheck value to set.
     * @return the BackendPoolsSettings object itself.
     */
    public BackendPoolsSettings
        withEnforceCertificateNameCheck(EnforceCertificateNameCheckEnabledState enforceCertificateNameCheck) {
        this.enforceCertificateNameCheck = enforceCertificateNameCheck;
        return this;
    }

    /**
     * Get the sendRecvTimeoutSeconds property: Send and receive timeout on forwarding request to the backend. When
     * timeout is reached, the request fails and returns.
     * 
     * @return the sendRecvTimeoutSeconds value.
     */
    public Integer sendRecvTimeoutSeconds() {
        return this.sendRecvTimeoutSeconds;
    }

    /**
     * Set the sendRecvTimeoutSeconds property: Send and receive timeout on forwarding request to the backend. When
     * timeout is reached, the request fails and returns.
     * 
     * @param sendRecvTimeoutSeconds the sendRecvTimeoutSeconds value to set.
     * @return the BackendPoolsSettings object itself.
     */
    public BackendPoolsSettings withSendRecvTimeoutSeconds(Integer sendRecvTimeoutSeconds) {
        this.sendRecvTimeoutSeconds = sendRecvTimeoutSeconds;
        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("enforceCertificateNameCheck",
            this.enforceCertificateNameCheck == null ? null : this.enforceCertificateNameCheck.toString());
        jsonWriter.writeNumberField("sendRecvTimeoutSeconds", this.sendRecvTimeoutSeconds);
        return jsonWriter.writeEndObject();
    }

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

                if ("enforceCertificateNameCheck".equals(fieldName)) {
                    deserializedBackendPoolsSettings.enforceCertificateNameCheck
                        = EnforceCertificateNameCheckEnabledState.fromString(reader.getString());
                } else if ("sendRecvTimeoutSeconds".equals(fieldName)) {
                    deserializedBackendPoolsSettings.sendRecvTimeoutSeconds = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedBackendPoolsSettings;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy