
com.azure.resourcemanager.frontdoor.fluent.models.BackendPoolProperties 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.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.frontdoor.models.Backend;
import com.azure.resourcemanager.frontdoor.models.BackendPoolUpdateParameters;
import com.azure.resourcemanager.frontdoor.models.FrontDoorResourceState;
import java.io.IOException;
import java.util.List;
/**
* The JSON object that contains the properties required to create a Backend Pool.
*/
@Fluent
public final class BackendPoolProperties extends BackendPoolUpdateParameters {
/*
* Resource status.
*/
private FrontDoorResourceState resourceState;
/**
* Creates an instance of BackendPoolProperties class.
*/
public BackendPoolProperties() {
}
/**
* Get the resourceState property: Resource status.
*
* @return the resourceState value.
*/
public FrontDoorResourceState resourceState() {
return this.resourceState;
}
/**
* {@inheritDoc}
*/
@Override
public BackendPoolProperties withBackends(List backends) {
super.withBackends(backends);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BackendPoolProperties withLoadBalancingSettings(SubResource loadBalancingSettings) {
super.withLoadBalancingSettings(loadBalancingSettings);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public BackendPoolProperties withHealthProbeSettings(SubResource healthProbeSettings) {
super.withHealthProbeSettings(healthProbeSettings);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (backends() != null) {
backends().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("backends", backends(), (writer, element) -> writer.writeJson(element));
jsonWriter.writeJsonField("loadBalancingSettings", loadBalancingSettings());
jsonWriter.writeJsonField("healthProbeSettings", healthProbeSettings());
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of BackendPoolProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of BackendPoolProperties 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 BackendPoolProperties.
*/
public static BackendPoolProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
BackendPoolProperties deserializedBackendPoolProperties = new BackendPoolProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("backends".equals(fieldName)) {
List backends = reader.readArray(reader1 -> Backend.fromJson(reader1));
deserializedBackendPoolProperties.withBackends(backends);
} else if ("loadBalancingSettings".equals(fieldName)) {
deserializedBackendPoolProperties.withLoadBalancingSettings(SubResource.fromJson(reader));
} else if ("healthProbeSettings".equals(fieldName)) {
deserializedBackendPoolProperties.withHealthProbeSettings(SubResource.fromJson(reader));
} else if ("resourceState".equals(fieldName)) {
deserializedBackendPoolProperties.resourceState
= FrontDoorResourceState.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedBackendPoolProperties;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy