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

com.azure.resourcemanager.hdinsight.fluent.models.PrivateLinkConfigurationProperties Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for HDInsight Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. HDInsight Management Client. Package tag package-2024-08-preview.

The 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.hdinsight.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.hdinsight.models.IpConfiguration;
import com.azure.resourcemanager.hdinsight.models.PrivateLinkConfigurationProvisioningState;
import java.io.IOException;
import java.util.List;

/**
 * The private link configuration properties.
 */
@Fluent
public final class PrivateLinkConfigurationProperties implements JsonSerializable {
    /*
     * The HDInsight private linkable sub-resource name to apply the private link configuration to. For example,
     * 'headnode', 'gateway', 'edgenode'.
     */
    private String groupId;

    /*
     * The private link configuration provisioning state, which only appears in the response.
     */
    private PrivateLinkConfigurationProvisioningState provisioningState;

    /*
     * The IP configurations for the private link service.
     */
    private List ipConfigurations;

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

    /**
     * Get the groupId property: The HDInsight private linkable sub-resource name to apply the private link
     * configuration to. For example, 'headnode', 'gateway', 'edgenode'.
     * 
     * @return the groupId value.
     */
    public String groupId() {
        return this.groupId;
    }

    /**
     * Set the groupId property: The HDInsight private linkable sub-resource name to apply the private link
     * configuration to. For example, 'headnode', 'gateway', 'edgenode'.
     * 
     * @param groupId the groupId value to set.
     * @return the PrivateLinkConfigurationProperties object itself.
     */
    public PrivateLinkConfigurationProperties withGroupId(String groupId) {
        this.groupId = groupId;
        return this;
    }

    /**
     * Get the provisioningState property: The private link configuration provisioning state, which only appears in the
     * response.
     * 
     * @return the provisioningState value.
     */
    public PrivateLinkConfigurationProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the ipConfigurations property: The IP configurations for the private link service.
     * 
     * @return the ipConfigurations value.
     */
    public List ipConfigurations() {
        return this.ipConfigurations;
    }

    /**
     * Set the ipConfigurations property: The IP configurations for the private link service.
     * 
     * @param ipConfigurations the ipConfigurations value to set.
     * @return the PrivateLinkConfigurationProperties object itself.
     */
    public PrivateLinkConfigurationProperties withIpConfigurations(List ipConfigurations) {
        this.ipConfigurations = ipConfigurations;
        return this;
    }

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

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

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

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

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

            return deserializedPrivateLinkConfigurationProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy