All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.dnsresolver.models.DnsResolverDomainListPatch Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 1.0.0-beta.3
Show newest version
// 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.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 com.azure.resourcemanager.dnsresolver.fluent.models.DnsResolverDomainListPatchProperties;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * Describes a DNS resolver domain list for PATCH operation.
 */
@Fluent
public final class DnsResolverDomainListPatch implements JsonSerializable {
    /*
     * Updatable properties of the DNS resolver policy virtual network link.
     */
    private DnsResolverDomainListPatchProperties innerProperties;

    /*
     * Tags for DNS resolver domain list.
     */
    private Map tags;

    /**
     * Creates an instance of DnsResolverDomainListPatch class.
     */
    public DnsResolverDomainListPatch() {
    }

    /**
     * Get the innerProperties property: Updatable properties of the DNS resolver policy virtual network link.
     * 
     * @return the innerProperties value.
     */
    private DnsResolverDomainListPatchProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the tags property: Tags for DNS resolver domain list.
     * 
     * @return the tags value.
     */
    public Map tags() {
        return this.tags;
    }

    /**
     * Set the tags property: Tags for DNS resolver domain list.
     * 
     * @param tags the tags value to set.
     * @return the DnsResolverDomainListPatch object itself.
     */
    public DnsResolverDomainListPatch withTags(Map tags) {
        this.tags = tags;
        return this;
    }

    /**
     * Get the domains property: The domains in the domain list.
     * 
     * @return the domains value.
     */
    public List domains() {
        return this.innerProperties() == null ? null : this.innerProperties().domains();
    }

    /**
     * Set the domains property: The domains in the domain list.
     * 
     * @param domains the domains value to set.
     * @return the DnsResolverDomainListPatch object itself.
     */
    public DnsResolverDomainListPatch withDomains(List domains) {
        if (this.innerProperties() == null) {
            this.innerProperties = new DnsResolverDomainListPatchProperties();
        }
        this.innerProperties().withDomains(domains);
        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.writeJsonField("properties", this.innerProperties);
        jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DnsResolverDomainListPatch from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DnsResolverDomainListPatch 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 DnsResolverDomainListPatch.
     */
    public static DnsResolverDomainListPatch fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DnsResolverDomainListPatch deserializedDnsResolverDomainListPatch = new DnsResolverDomainListPatch();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("properties".equals(fieldName)) {
                    deserializedDnsResolverDomainListPatch.innerProperties
                        = DnsResolverDomainListPatchProperties.fromJson(reader);
                } else if ("tags".equals(fieldName)) {
                    Map tags = reader.readMap(reader1 -> reader1.getString());
                    deserializedDnsResolverDomainListPatch.tags = tags;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDnsResolverDomainListPatch;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy