com.azure.resourcemanager.dnsresolver.fluent.models.ForwardingRuleInner 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.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.dnsresolver.models.ForwardingRuleState;
import com.azure.resourcemanager.dnsresolver.models.ProvisioningState;
import com.azure.resourcemanager.dnsresolver.models.TargetDnsServer;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Describes a forwarding rule within a DNS forwarding ruleset.
*/
@Fluent
public final class ForwardingRuleInner extends ProxyResource {
/*
* ETag of the forwarding rule.
*/
private String etag;
/*
* Properties of the forwarding rule.
*/
private ForwardingRuleProperties innerProperties = new ForwardingRuleProperties();
/*
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
private SystemData systemData;
/*
* The type of the resource.
*/
private String type;
/*
* The name of the resource.
*/
private String name;
/*
* Fully qualified resource Id for the resource.
*/
private String id;
/**
* Creates an instance of ForwardingRuleInner class.
*/
public ForwardingRuleInner() {
}
/**
* Get the etag property: ETag of the forwarding rule.
*
* @return the etag value.
*/
public String etag() {
return this.etag;
}
/**
* Get the innerProperties property: Properties of the forwarding rule.
*
* @return the innerProperties value.
*/
private ForwardingRuleProperties innerProperties() {
return this.innerProperties;
}
/**
* Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information.
*
* @return the systemData value.
*/
public SystemData systemData() {
return this.systemData;
}
/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}
/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}
/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}
/**
* Get the domainName property: The domain name for the forwarding rule.
*
* @return the domainName value.
*/
public String domainName() {
return this.innerProperties() == null ? null : this.innerProperties().domainName();
}
/**
* Set the domainName property: The domain name for the forwarding rule.
*
* @param domainName the domainName value to set.
* @return the ForwardingRuleInner object itself.
*/
public ForwardingRuleInner withDomainName(String domainName) {
if (this.innerProperties() == null) {
this.innerProperties = new ForwardingRuleProperties();
}
this.innerProperties().withDomainName(domainName);
return this;
}
/**
* Get the targetDnsServers property: DNS servers to forward the DNS query to.
*
* @return the targetDnsServers value.
*/
public List targetDnsServers() {
return this.innerProperties() == null ? null : this.innerProperties().targetDnsServers();
}
/**
* Set the targetDnsServers property: DNS servers to forward the DNS query to.
*
* @param targetDnsServers the targetDnsServers value to set.
* @return the ForwardingRuleInner object itself.
*/
public ForwardingRuleInner withTargetDnsServers(List targetDnsServers) {
if (this.innerProperties() == null) {
this.innerProperties = new ForwardingRuleProperties();
}
this.innerProperties().withTargetDnsServers(targetDnsServers);
return this;
}
/**
* Get the metadata property: Metadata attached to the forwarding rule.
*
* @return the metadata value.
*/
public Map metadata() {
return this.innerProperties() == null ? null : this.innerProperties().metadata();
}
/**
* Set the metadata property: Metadata attached to the forwarding rule.
*
* @param metadata the metadata value to set.
* @return the ForwardingRuleInner object itself.
*/
public ForwardingRuleInner withMetadata(Map metadata) {
if (this.innerProperties() == null) {
this.innerProperties = new ForwardingRuleProperties();
}
this.innerProperties().withMetadata(metadata);
return this;
}
/**
* Get the forwardingRuleState property: The state of forwarding rule.
*
* @return the forwardingRuleState value.
*/
public ForwardingRuleState forwardingRuleState() {
return this.innerProperties() == null ? null : this.innerProperties().forwardingRuleState();
}
/**
* Set the forwardingRuleState property: The state of forwarding rule.
*
* @param forwardingRuleState the forwardingRuleState value to set.
* @return the ForwardingRuleInner object itself.
*/
public ForwardingRuleInner withForwardingRuleState(ForwardingRuleState forwardingRuleState) {
if (this.innerProperties() == null) {
this.innerProperties = new ForwardingRuleProperties();
}
this.innerProperties().withForwardingRuleState(forwardingRuleState);
return this;
}
/**
* Get the provisioningState property: The current provisioning state of the forwarding rule. 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.innerProperties() == null ? null : this.innerProperties().provisioningState();
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (innerProperties() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property innerProperties in model ForwardingRuleInner"));
} else {
innerProperties().validate();
}
}
private static final ClientLogger LOGGER = new ClientLogger(ForwardingRuleInner.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeJsonField("properties", this.innerProperties);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of ForwardingRuleInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ForwardingRuleInner 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 ForwardingRuleInner.
*/
public static ForwardingRuleInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ForwardingRuleInner deserializedForwardingRuleInner = new ForwardingRuleInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("id".equals(fieldName)) {
deserializedForwardingRuleInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedForwardingRuleInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedForwardingRuleInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedForwardingRuleInner.innerProperties = ForwardingRuleProperties.fromJson(reader);
} else if ("etag".equals(fieldName)) {
deserializedForwardingRuleInner.etag = reader.getString();
} else if ("systemData".equals(fieldName)) {
deserializedForwardingRuleInner.systemData = SystemData.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedForwardingRuleInner;
});
}
}