com.azure.resourcemanager.dnsresolver.fluent.models.DnsResolverPolicyVirtualNetworkLinkProperties Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-dnsresolver Show documentation
Show all versions of azure-resourcemanager-dnsresolver Show documentation
This package contains Microsoft Azure SDK for DnsResolver Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The DNS Resolver Management Client. Package tag package-2022-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.dnsresolver.fluent.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.dnsresolver.models.ProvisioningState;
import java.io.IOException;
/**
* Represents the properties of a DNS resolver policy virtual network link.
*/
@Fluent
public final class DnsResolverPolicyVirtualNetworkLinkProperties
implements JsonSerializable {
/*
* The reference to the virtual network. This cannot be changed after creation.
*/
private SubResource virtualNetwork;
/*
* The current provisioning state of the DNS resolver policy virtual network link. This is a read-only property and
* any attempt to set this value will be ignored.
*/
private ProvisioningState provisioningState;
/**
* Creates an instance of DnsResolverPolicyVirtualNetworkLinkProperties class.
*/
public DnsResolverPolicyVirtualNetworkLinkProperties() {
}
/**
* Get the virtualNetwork property: The reference to the virtual network. This cannot be changed after creation.
*
* @return the virtualNetwork value.
*/
public SubResource virtualNetwork() {
return this.virtualNetwork;
}
/**
* Set the virtualNetwork property: The reference to the virtual network. This cannot be changed after creation.
*
* @param virtualNetwork the virtualNetwork value to set.
* @return the DnsResolverPolicyVirtualNetworkLinkProperties object itself.
*/
public DnsResolverPolicyVirtualNetworkLinkProperties withVirtualNetwork(SubResource virtualNetwork) {
this.virtualNetwork = virtualNetwork;
return this;
}
/**
* Get the provisioningState property: The current provisioning state of the DNS resolver policy virtual network
* link. This is a read-only property and any attempt to set this value will be ignored.
*
* @return the provisioningState value.
*/
public ProvisioningState provisioningState() {
return this.provisioningState;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (virtualNetwork() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property virtualNetwork in model DnsResolverPolicyVirtualNetworkLinkProperties"));
}
}
private static final ClientLogger LOGGER = new ClientLogger(DnsResolverPolicyVirtualNetworkLinkProperties.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("virtualNetwork", this.virtualNetwork);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of DnsResolverPolicyVirtualNetworkLinkProperties from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of DnsResolverPolicyVirtualNetworkLinkProperties 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 DnsResolverPolicyVirtualNetworkLinkProperties.
*/
public static DnsResolverPolicyVirtualNetworkLinkProperties fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
DnsResolverPolicyVirtualNetworkLinkProperties deserializedDnsResolverPolicyVirtualNetworkLinkProperties
= new DnsResolverPolicyVirtualNetworkLinkProperties();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("virtualNetwork".equals(fieldName)) {
deserializedDnsResolverPolicyVirtualNetworkLinkProperties.virtualNetwork
= SubResource.fromJson(reader);
} else if ("provisioningState".equals(fieldName)) {
deserializedDnsResolverPolicyVirtualNetworkLinkProperties.provisioningState
= ProvisioningState.fromString(reader.getString());
} else {
reader.skipChildren();
}
}
return deserializedDnsResolverPolicyVirtualNetworkLinkProperties;
});
}
}