com.azure.resourcemanager.servicefabricmanagedclusters.models.EndpointRangeDescription Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
Show all versions of azure-resourcemanager-servicefabricmanagedclusters Show documentation
This package contains Microsoft Azure SDK for Service Fabric Managed Clusters Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Service Fabric Managed Clusters Management Client. Package tag package-2024-04.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.servicefabricmanagedclusters.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;
/**
* Port range details.
*/
@Fluent
public final class EndpointRangeDescription implements JsonSerializable {
/*
* Starting port of a range of ports
*/
private int startPort;
/*
* End port of a range of ports
*/
private int endPort;
/**
* Creates an instance of EndpointRangeDescription class.
*/
public EndpointRangeDescription() {
}
/**
* Get the startPort property: Starting port of a range of ports.
*
* @return the startPort value.
*/
public int startPort() {
return this.startPort;
}
/**
* Set the startPort property: Starting port of a range of ports.
*
* @param startPort the startPort value to set.
* @return the EndpointRangeDescription object itself.
*/
public EndpointRangeDescription withStartPort(int startPort) {
this.startPort = startPort;
return this;
}
/**
* Get the endPort property: End port of a range of ports.
*
* @return the endPort value.
*/
public int endPort() {
return this.endPort;
}
/**
* Set the endPort property: End port of a range of ports.
*
* @param endPort the endPort value to set.
* @return the EndpointRangeDescription object itself.
*/
public EndpointRangeDescription withEndPort(int endPort) {
this.endPort = endPort;
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.writeIntField("startPort", this.startPort);
jsonWriter.writeIntField("endPort", this.endPort);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of EndpointRangeDescription from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of EndpointRangeDescription if the JsonReader was pointing to an instance of it, or null if
* it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the EndpointRangeDescription.
*/
public static EndpointRangeDescription fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
EndpointRangeDescription deserializedEndpointRangeDescription = new EndpointRangeDescription();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("startPort".equals(fieldName)) {
deserializedEndpointRangeDescription.startPort = reader.getInt();
} else if ("endPort".equals(fieldName)) {
deserializedEndpointRangeDescription.endPort = reader.getInt();
} else {
reader.skipChildren();
}
}
return deserializedEndpointRangeDescription;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy