com.azure.resourcemanager.dnsresolver.fluent.models.VirtualNetworkDnsForwardingRulesetInner 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.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
/**
* Reference to DNS forwarding ruleset and associated virtual network link.
*/
@Fluent
public final class VirtualNetworkDnsForwardingRulesetInner
implements JsonSerializable {
/*
* DNS Forwarding Ruleset Resource ID.
*/
private String id;
/*
* Properties of the virtual network link sub-resource reference.
*/
private VirtualNetworkLinkSubResourceProperties innerProperties;
/**
* Creates an instance of VirtualNetworkDnsForwardingRulesetInner class.
*/
public VirtualNetworkDnsForwardingRulesetInner() {
}
/**
* Get the id property: DNS Forwarding Ruleset Resource ID.
*
* @return the id value.
*/
public String id() {
return this.id;
}
/**
* Set the id property: DNS Forwarding Ruleset Resource ID.
*
* @param id the id value to set.
* @return the VirtualNetworkDnsForwardingRulesetInner object itself.
*/
public VirtualNetworkDnsForwardingRulesetInner withId(String id) {
this.id = id;
return this;
}
/**
* Get the innerProperties property: Properties of the virtual network link sub-resource reference.
*
* @return the innerProperties value.
*/
private VirtualNetworkLinkSubResourceProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the virtualNetworkLink property: The reference to the virtual network link.
*
* @return the virtualNetworkLink value.
*/
public SubResource virtualNetworkLink() {
return this.innerProperties() == null ? null : this.innerProperties().virtualNetworkLink();
}
/**
* Set the virtualNetworkLink property: The reference to the virtual network link.
*
* @param virtualNetworkLink the virtualNetworkLink value to set.
* @return the VirtualNetworkDnsForwardingRulesetInner object itself.
*/
public VirtualNetworkDnsForwardingRulesetInner withVirtualNetworkLink(SubResource virtualNetworkLink) {
if (this.innerProperties() == null) {
this.innerProperties = new VirtualNetworkLinkSubResourceProperties();
}
this.innerProperties().withVirtualNetworkLink(virtualNetworkLink);
return this;
}
/**
* 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", this.id);
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of VirtualNetworkDnsForwardingRulesetInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of VirtualNetworkDnsForwardingRulesetInner 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 VirtualNetworkDnsForwardingRulesetInner.
*/
public static VirtualNetworkDnsForwardingRulesetInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
VirtualNetworkDnsForwardingRulesetInner deserializedVirtualNetworkDnsForwardingRulesetInner
= new VirtualNetworkDnsForwardingRulesetInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedVirtualNetworkDnsForwardingRulesetInner.id = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedVirtualNetworkDnsForwardingRulesetInner.innerProperties
= VirtualNetworkLinkSubResourceProperties.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedVirtualNetworkDnsForwardingRulesetInner;
});
}
}