![JAR search and dependency download from the Maven repository](/logo.png)
com.azure.resourcemanager.hybridcompute.models.IpAddress Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-hybridcompute Show documentation
Show all versions of azure-resourcemanager-hybridcompute Show documentation
This package contains Microsoft Azure SDK for HybridCompute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Hybrid Compute Management Client. Package tag package-preview-2024-07.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.hybridcompute.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;
/**
* Describes properties of the IP address.
*/
@Fluent
public final class IpAddress implements JsonSerializable {
/*
* Represents the IP Address.
*/
private String address;
/*
* Represents the Ip Address Version.
*/
private String ipAddressVersion;
/*
* The subnet to which this IP address belongs.
*/
private Subnet subnet;
/**
* Creates an instance of IpAddress class.
*/
public IpAddress() {
}
/**
* Get the address property: Represents the IP Address.
*
* @return the address value.
*/
public String address() {
return this.address;
}
/**
* Set the address property: Represents the IP Address.
*
* @param address the address value to set.
* @return the IpAddress object itself.
*/
public IpAddress withAddress(String address) {
this.address = address;
return this;
}
/**
* Get the ipAddressVersion property: Represents the Ip Address Version.
*
* @return the ipAddressVersion value.
*/
public String ipAddressVersion() {
return this.ipAddressVersion;
}
/**
* Set the ipAddressVersion property: Represents the Ip Address Version.
*
* @param ipAddressVersion the ipAddressVersion value to set.
* @return the IpAddress object itself.
*/
public IpAddress withIpAddressVersion(String ipAddressVersion) {
this.ipAddressVersion = ipAddressVersion;
return this;
}
/**
* Get the subnet property: The subnet to which this IP address belongs.
*
* @return the subnet value.
*/
public Subnet subnet() {
return this.subnet;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (subnet() != null) {
subnet().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("address", this.address);
jsonWriter.writeStringField("ipAddressVersion", this.ipAddressVersion);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of IpAddress from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of IpAddress 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 IpAddress.
*/
public static IpAddress fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
IpAddress deserializedIpAddress = new IpAddress();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("address".equals(fieldName)) {
deserializedIpAddress.address = reader.getString();
} else if ("ipAddressVersion".equals(fieldName)) {
deserializedIpAddress.ipAddressVersion = reader.getString();
} else if ("subnet".equals(fieldName)) {
deserializedIpAddress.subnet = Subnet.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedIpAddress;
});
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy