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

com.azure.resourcemanager.recoveryservices.models.DnsZoneResponse Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.recoveryservices.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
 * DNSZone information for Microsoft.RecoveryServices.
 */
@Fluent
public final class DnsZoneResponse extends DnsZone {
    /*
     * The private link resource Private link DNS zone names.
     */
    private List requiredZoneNames;

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

    /**
     * Get the requiredZoneNames property: The private link resource Private link DNS zone names.
     * 
     * @return the requiredZoneNames value.
     */
    public List requiredZoneNames() {
        return this.requiredZoneNames;
    }

    /**
     * Set the requiredZoneNames property: The private link resource Private link DNS zone names.
     * 
     * @param requiredZoneNames the requiredZoneNames value to set.
     * @return the DnsZoneResponse object itself.
     */
    public DnsZoneResponse withRequiredZoneNames(List requiredZoneNames) {
        this.requiredZoneNames = requiredZoneNames;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public DnsZoneResponse withSubResource(VaultSubResourceType subResource) {
        super.withSubResource(subResource);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("subResource", subResource() == null ? null : subResource().toString());
        jsonWriter.writeArrayField("requiredZoneNames", this.requiredZoneNames,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("subResource".equals(fieldName)) {
                    deserializedDnsZoneResponse.withSubResource(VaultSubResourceType.fromString(reader.getString()));
                } else if ("requiredZoneNames".equals(fieldName)) {
                    List requiredZoneNames = reader.readArray(reader1 -> reader1.getString());
                    deserializedDnsZoneResponse.requiredZoneNames = requiredZoneNames;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDnsZoneResponse;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy