com.azure.resourcemanager.network.fluent.models.ProbeInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-network Show documentation
Show all versions of azure-resourcemanager-network Show documentation
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.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.network.models.ProbeNoHealthyBackendsBehavior;
import com.azure.resourcemanager.network.models.ProbeProtocol;
import com.azure.resourcemanager.network.models.ProvisioningState;
import java.io.IOException;
import java.util.List;
/**
* A load balancer probe.
*/
@Fluent
public final class ProbeInner extends SubResource {
/*
* Properties of load balancer probe.
*/
private ProbePropertiesFormat innerProperties;
/*
* The name of the resource that is unique within the set of probes used by the load balancer. This name can be used
* to access the resource.
*/
private String name;
/*
* A unique read-only string that changes whenever the resource is updated.
*/
private String etag;
/*
* Type of the resource.
*/
private String type;
/**
* Creates an instance of ProbeInner class.
*/
public ProbeInner() {
}
/**
* Get the innerProperties property: Properties of load balancer probe.
*
* @return the innerProperties value.
*/
private ProbePropertiesFormat innerProperties() {
return this.innerProperties;
}
/**
* Get the name property: The name of the resource that is unique within the set of probes used by the load
* balancer. This name can be used to access the resource.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The name of the resource that is unique within the set of probes used by the load
* balancer. This name can be used to access the resource.
*
* @param name the name value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withName(String name) {
this.name = name;
return this;
}
/**
* Get the etag property: A unique read-only string that changes whenever the resource is updated.
*
* @return the etag value.
*/
public String etag() {
return this.etag;
}
/**
* Get the type property: Type of the resource.
*
* @return the type value.
*/
public String type() {
return this.type;
}
/**
* {@inheritDoc}
*/
@Override
public ProbeInner withId(String id) {
super.withId(id);
return this;
}
/**
* Get the loadBalancingRules property: The load balancer rules that use this probe.
*
* @return the loadBalancingRules value.
*/
public List loadBalancingRules() {
return this.innerProperties() == null ? null : this.innerProperties().loadBalancingRules();
}
/**
* Get the protocol property: The protocol of the end point. If 'Tcp' is specified, a received ACK is required for
* the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is
* required for the probe to be successful.
*
* @return the protocol value.
*/
public ProbeProtocol protocol() {
return this.innerProperties() == null ? null : this.innerProperties().protocol();
}
/**
* Set the protocol property: The protocol of the end point. If 'Tcp' is specified, a received ACK is required for
* the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is
* required for the probe to be successful.
*
* @param protocol the protocol value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withProtocol(ProbeProtocol protocol) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withProtocol(protocol);
return this;
}
/**
* Get the port property: The port for communicating the probe. Possible values range from 1 to 65535, inclusive.
*
* @return the port value.
*/
public Integer port() {
return this.innerProperties() == null ? null : this.innerProperties().port();
}
/**
* Set the port property: The port for communicating the probe. Possible values range from 1 to 65535, inclusive.
*
* @param port the port value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withPort(Integer port) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withPort(port);
return this;
}
/**
* Get the intervalInSeconds property: The interval, in seconds, for how frequently to probe the endpoint for health
* status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows
* two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5.
*
* @return the intervalInSeconds value.
*/
public Integer intervalInSeconds() {
return this.innerProperties() == null ? null : this.innerProperties().intervalInSeconds();
}
/**
* Set the intervalInSeconds property: The interval, in seconds, for how frequently to probe the endpoint for health
* status. Typically, the interval is slightly less than half the allocated timeout period (in seconds) which allows
* two full probes before taking the instance out of rotation. The default value is 15, the minimum value is 5.
*
* @param intervalInSeconds the intervalInSeconds value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withIntervalInSeconds(Integer intervalInSeconds) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withIntervalInSeconds(intervalInSeconds);
return this;
}
/**
* Get the noHealthyBackendsBehavior property: Determines how new connections are handled by the load balancer when
* all backend instances are probed down.
*
* @return the noHealthyBackendsBehavior value.
*/
public ProbeNoHealthyBackendsBehavior noHealthyBackendsBehavior() {
return this.innerProperties() == null ? null : this.innerProperties().noHealthyBackendsBehavior();
}
/**
* Set the noHealthyBackendsBehavior property: Determines how new connections are handled by the load balancer when
* all backend instances are probed down.
*
* @param noHealthyBackendsBehavior the noHealthyBackendsBehavior value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withNoHealthyBackendsBehavior(ProbeNoHealthyBackendsBehavior noHealthyBackendsBehavior) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withNoHealthyBackendsBehavior(noHealthyBackendsBehavior);
return this;
}
/**
* Get the numberOfProbes property: The number of probes where if no response, will result in stopping further
* traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or
* slower than the typical times used in Azure.
*
* @return the numberOfProbes value.
*/
public Integer numberOfProbes() {
return this.innerProperties() == null ? null : this.innerProperties().numberOfProbes();
}
/**
* Set the numberOfProbes property: The number of probes where if no response, will result in stopping further
* traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or
* slower than the typical times used in Azure.
*
* @param numberOfProbes the numberOfProbes value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withNumberOfProbes(Integer numberOfProbes) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withNumberOfProbes(numberOfProbes);
return this;
}
/**
* Get the probeThreshold property: The number of consecutive successful or failed probes in order to allow or deny
* traffic from being delivered to this endpoint. After failing the number of consecutive probes equal to this
* value, the endpoint will be taken out of rotation and require the same number of successful consecutive probes to
* be placed back in rotation.
*
* @return the probeThreshold value.
*/
public Integer probeThreshold() {
return this.innerProperties() == null ? null : this.innerProperties().probeThreshold();
}
/**
* Set the probeThreshold property: The number of consecutive successful or failed probes in order to allow or deny
* traffic from being delivered to this endpoint. After failing the number of consecutive probes equal to this
* value, the endpoint will be taken out of rotation and require the same number of successful consecutive probes to
* be placed back in rotation.
*
* @param probeThreshold the probeThreshold value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withProbeThreshold(Integer probeThreshold) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withProbeThreshold(probeThreshold);
return this;
}
/**
* Get the requestPath property: The URI used for requesting health status from the VM. Path is required if a
* protocol is set to http. Otherwise, it is not allowed. There is no default value.
*
* @return the requestPath value.
*/
public String requestPath() {
return this.innerProperties() == null ? null : this.innerProperties().requestPath();
}
/**
* Set the requestPath property: The URI used for requesting health status from the VM. Path is required if a
* protocol is set to http. Otherwise, it is not allowed. There is no default value.
*
* @param requestPath the requestPath value to set.
* @return the ProbeInner object itself.
*/
public ProbeInner withRequestPath(String requestPath) {
if (this.innerProperties() == null) {
this.innerProperties = new ProbePropertiesFormat();
}
this.innerProperties().withRequestPath(requestPath);
return this;
}
/**
* Get the provisioningState property: The provisioning state of the probe resource.
*
* @return the provisioningState value.
*/
public ProvisioningState provisioningState() {
return this.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() != null) {
innerProperties().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("id", id());
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeStringField("name", this.name);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ProbeInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ProbeInner 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 ProbeInner.
*/
public static ProbeInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ProbeInner deserializedProbeInner = new ProbeInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedProbeInner.withId(reader.getString());
} else if ("properties".equals(fieldName)) {
deserializedProbeInner.innerProperties = ProbePropertiesFormat.fromJson(reader);
} else if ("name".equals(fieldName)) {
deserializedProbeInner.name = reader.getString();
} else if ("etag".equals(fieldName)) {
deserializedProbeInner.etag = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedProbeInner.type = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedProbeInner;
});
}
}