com.azure.resourcemanager.compute.models.VirtualMachinePublicIpAddressConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-compute Show documentation
Show all versions of azure-resourcemanager-compute Show documentation
This package contains Microsoft Azure Compute Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.compute.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.management.SubResource;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.compute.fluent.models.VirtualMachinePublicIpAddressConfigurationProperties;
import java.io.IOException;
import java.util.List;
/**
* Describes a virtual machines IP Configuration's PublicIPAddress configuration.
*/
@Fluent
public final class VirtualMachinePublicIpAddressConfiguration
implements JsonSerializable {
/*
* The publicIP address configuration name.
*/
private String name;
/*
* Describes a virtual machines IP Configuration's PublicIPAddress configuration
*/
private VirtualMachinePublicIpAddressConfigurationProperties innerProperties;
/*
* Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible.
*/
private PublicIpAddressSku sku;
/**
* Creates an instance of VirtualMachinePublicIpAddressConfiguration class.
*/
public VirtualMachinePublicIpAddressConfiguration() {
}
/**
* Get the name property: The publicIP address configuration name.
*
* @return the name value.
*/
public String name() {
return this.name;
}
/**
* Set the name property: The publicIP address configuration name.
*
* @param name the name value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withName(String name) {
this.name = name;
return this;
}
/**
* Get the innerProperties property: Describes a virtual machines IP Configuration's PublicIPAddress configuration.
*
* @return the innerProperties value.
*/
private VirtualMachinePublicIpAddressConfigurationProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible.
*
* @return the sku value.
*/
public PublicIpAddressSku sku() {
return this.sku;
}
/**
* Set the sku property: Describes the public IP Sku. It can only be set with OrchestrationMode as Flexible.
*
* @param sku the sku value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withSku(PublicIpAddressSku sku) {
this.sku = sku;
return this;
}
/**
* Get the idleTimeoutInMinutes property: The idle timeout of the public IP address.
*
* @return the idleTimeoutInMinutes value.
*/
public Integer idleTimeoutInMinutes() {
return this.innerProperties() == null ? null : this.innerProperties().idleTimeoutInMinutes();
}
/**
* Set the idleTimeoutInMinutes property: The idle timeout of the public IP address.
*
* @param idleTimeoutInMinutes the idleTimeoutInMinutes value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withIdleTimeoutInMinutes(Integer idleTimeoutInMinutes) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withIdleTimeoutInMinutes(idleTimeoutInMinutes);
return this;
}
/**
* Get the deleteOption property: Specify what happens to the public IP address when the VM is deleted.
*
* @return the deleteOption value.
*/
public DeleteOptions deleteOption() {
return this.innerProperties() == null ? null : this.innerProperties().deleteOption();
}
/**
* Set the deleteOption property: Specify what happens to the public IP address when the VM is deleted.
*
* @param deleteOption the deleteOption value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withDeleteOption(DeleteOptions deleteOption) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withDeleteOption(deleteOption);
return this;
}
/**
* Get the dnsSettings property: The dns settings to be applied on the publicIP addresses .
*
* @return the dnsSettings value.
*/
public VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings() {
return this.innerProperties() == null ? null : this.innerProperties().dnsSettings();
}
/**
* Set the dnsSettings property: The dns settings to be applied on the publicIP addresses .
*
* @param dnsSettings the dnsSettings value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration
withDnsSettings(VirtualMachinePublicIpAddressDnsSettingsConfiguration dnsSettings) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withDnsSettings(dnsSettings);
return this;
}
/**
* Get the ipTags property: The list of IP tags associated with the public IP address.
*
* @return the ipTags value.
*/
public List ipTags() {
return this.innerProperties() == null ? null : this.innerProperties().ipTags();
}
/**
* Set the ipTags property: The list of IP tags associated with the public IP address.
*
* @param ipTags the ipTags value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withIpTags(List ipTags) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withIpTags(ipTags);
return this;
}
/**
* Get the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses.
*
* @return the publicIpPrefix value.
*/
public SubResource publicIpPrefix() {
return this.innerProperties() == null ? null : this.innerProperties().publicIpPrefix();
}
/**
* Set the publicIpPrefix property: The PublicIPPrefix from which to allocate publicIP addresses.
*
* @param publicIpPrefix the publicIpPrefix value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withPublicIpPrefix(SubResource publicIpPrefix) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withPublicIpPrefix(publicIpPrefix);
return this;
}
/**
* Get the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the
* specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.
*
* @return the publicIpAddressVersion value.
*/
public IpVersions publicIpAddressVersion() {
return this.innerProperties() == null ? null : this.innerProperties().publicIpAddressVersion();
}
/**
* Set the publicIpAddressVersion property: Available from Api-Version 2019-07-01 onwards, it represents whether the
* specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'.
*
* @param publicIpAddressVersion the publicIpAddressVersion value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration withPublicIpAddressVersion(IpVersions publicIpAddressVersion) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withPublicIpAddressVersion(publicIpAddressVersion);
return this;
}
/**
* Get the publicIpAllocationMethod property: Specify the public IP allocation type.
*
* @return the publicIpAllocationMethod value.
*/
public PublicIpAllocationMethod publicIpAllocationMethod() {
return this.innerProperties() == null ? null : this.innerProperties().publicIpAllocationMethod();
}
/**
* Set the publicIpAllocationMethod property: Specify the public IP allocation type.
*
* @param publicIpAllocationMethod the publicIpAllocationMethod value to set.
* @return the VirtualMachinePublicIpAddressConfiguration object itself.
*/
public VirtualMachinePublicIpAddressConfiguration
withPublicIpAllocationMethod(PublicIpAllocationMethod publicIpAllocationMethod) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualMachinePublicIpAddressConfigurationProperties();
}
this.innerProperties().withPublicIpAllocationMethod(publicIpAllocationMethod);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (name() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property name in model VirtualMachinePublicIpAddressConfiguration"));
}
if (innerProperties() != null) {
innerProperties().validate();
}
if (sku() != null) {
sku().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(VirtualMachinePublicIpAddressConfiguration.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("name", this.name);
jsonWriter.writeJsonField("properties", this.innerProperties);
jsonWriter.writeJsonField("sku", this.sku);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VirtualMachinePublicIpAddressConfiguration from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VirtualMachinePublicIpAddressConfiguration 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 VirtualMachinePublicIpAddressConfiguration.
*/
public static VirtualMachinePublicIpAddressConfiguration fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VirtualMachinePublicIpAddressConfiguration deserializedVirtualMachinePublicIpAddressConfiguration
= new VirtualMachinePublicIpAddressConfiguration();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("name".equals(fieldName)) {
deserializedVirtualMachinePublicIpAddressConfiguration.name = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedVirtualMachinePublicIpAddressConfiguration.innerProperties
= VirtualMachinePublicIpAddressConfigurationProperties.fromJson(reader);
} else if ("sku".equals(fieldName)) {
deserializedVirtualMachinePublicIpAddressConfiguration.sku = PublicIpAddressSku.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedVirtualMachinePublicIpAddressConfiguration;
});
}
}