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

com.azure.resourcemanager.dnsresolver.fluent.models.InboundEndpointProperties 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.fluent.models;

import com.azure.core.annotation.Fluent;
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.IpConfiguration;
import com.azure.resourcemanager.dnsresolver.models.ProvisioningState;
import java.io.IOException;
import java.util.List;

/**
 * Represents the properties of an inbound endpoint for a DNS resolver.
 */
@Fluent
public final class InboundEndpointProperties implements JsonSerializable {
    /*
     * IP configurations for the inbound endpoint.
     */
    private List ipConfigurations;

    /*
     * The current provisioning state of the inbound endpoint. This is a read-only property and any attempt to set this
     * value will be ignored.
     */
    private ProvisioningState provisioningState;

    /*
     * The resourceGuid property of the inbound endpoint resource.
     */
    private String resourceGuid;

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

    /**
     * Get the ipConfigurations property: IP configurations for the inbound endpoint.
     * 
     * @return the ipConfigurations value.
     */
    public List ipConfigurations() {
        return this.ipConfigurations;
    }

    /**
     * Set the ipConfigurations property: IP configurations for the inbound endpoint.
     * 
     * @param ipConfigurations the ipConfigurations value to set.
     * @return the InboundEndpointProperties object itself.
     */
    public InboundEndpointProperties withIpConfigurations(List ipConfigurations) {
        this.ipConfigurations = ipConfigurations;
        return this;
    }

    /**
     * Get the provisioningState property: The current provisioning state of the inbound endpoint. 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;
    }

    /**
     * Get the resourceGuid property: The resourceGuid property of the inbound endpoint resource.
     * 
     * @return the resourceGuid value.
     */
    public String resourceGuid() {
        return this.resourceGuid;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (ipConfigurations() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException(
                    "Missing required property ipConfigurations in model InboundEndpointProperties"));
        } else {
            ipConfigurations().forEach(e -> e.validate());
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(InboundEndpointProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("ipConfigurations", this.ipConfigurations,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("ipConfigurations".equals(fieldName)) {
                    List ipConfigurations
                        = reader.readArray(reader1 -> IpConfiguration.fromJson(reader1));
                    deserializedInboundEndpointProperties.ipConfigurations = ipConfigurations;
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedInboundEndpointProperties.provisioningState
                        = ProvisioningState.fromString(reader.getString());
                } else if ("resourceGuid".equals(fieldName)) {
                    deserializedInboundEndpointProperties.resourceGuid = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedInboundEndpointProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy