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

com.azure.resourcemanager.hdinsight.models.IpConfiguration 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-2021-06.

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.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.fluent.models.IpConfigurationProperties;
import java.io.IOException;

/**
 * The ip configurations for the private link service.
 */
@Fluent
public final class IpConfiguration implements JsonSerializable {
    /*
     * The private link IP configuration id.
     */
    private String id;

    /*
     * The name of private link IP configuration.
     */
    private String name;

    /*
     * The type of the private link IP configuration.
     */
    private String type;

    /*
     * The private link ip configuration properties.
     */
    private IpConfigurationProperties innerProperties;

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

    /**
     * Get the id property: The private link IP configuration id.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: The name of private link IP configuration.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Set the name property: The name of private link IP configuration.
     * 
     * @param name the name value to set.
     * @return the IpConfiguration object itself.
     */
    public IpConfiguration withName(String name) {
        this.name = name;
        return this;
    }

    /**
     * Get the type property: The type of the private link IP configuration.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the innerProperties property: The private link ip configuration properties.
     * 
     * @return the innerProperties value.
     */
    private IpConfigurationProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * 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.innerProperties() == null ? null : this.innerProperties().provisioningState();
    }

    /**
     * Get the primary property: Indicates whether this IP configuration is primary for the corresponding NIC.
     * 
     * @return the primary value.
     */
    public Boolean primary() {
        return this.innerProperties() == null ? null : this.innerProperties().primary();
    }

    /**
     * Set the primary property: Indicates whether this IP configuration is primary for the corresponding NIC.
     * 
     * @param primary the primary value to set.
     * @return the IpConfiguration object itself.
     */
    public IpConfiguration withPrimary(Boolean primary) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpConfigurationProperties();
        }
        this.innerProperties().withPrimary(primary);
        return this;
    }

    /**
     * Get the privateIpAddress property: The IP address.
     * 
     * @return the privateIpAddress value.
     */
    public String privateIpAddress() {
        return this.innerProperties() == null ? null : this.innerProperties().privateIpAddress();
    }

    /**
     * Set the privateIpAddress property: The IP address.
     * 
     * @param privateIpAddress the privateIpAddress value to set.
     * @return the IpConfiguration object itself.
     */
    public IpConfiguration withPrivateIpAddress(String privateIpAddress) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpConfigurationProperties();
        }
        this.innerProperties().withPrivateIpAddress(privateIpAddress);
        return this;
    }

    /**
     * Get the privateIpAllocationMethod property: The method that private IP address is allocated.
     * 
     * @return the privateIpAllocationMethod value.
     */
    public PrivateIpAllocationMethod privateIpAllocationMethod() {
        return this.innerProperties() == null ? null : this.innerProperties().privateIpAllocationMethod();
    }

    /**
     * Set the privateIpAllocationMethod property: The method that private IP address is allocated.
     * 
     * @param privateIpAllocationMethod the privateIpAllocationMethod value to set.
     * @return the IpConfiguration object itself.
     */
    public IpConfiguration withPrivateIpAllocationMethod(PrivateIpAllocationMethod privateIpAllocationMethod) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpConfigurationProperties();
        }
        this.innerProperties().withPrivateIpAllocationMethod(privateIpAllocationMethod);
        return this;
    }

    /**
     * Get the subnet property: The subnet resource id.
     * 
     * @return the subnet value.
     */
    public ResourceId subnet() {
        return this.innerProperties() == null ? null : this.innerProperties().subnet();
    }

    /**
     * Set the subnet property: The subnet resource id.
     * 
     * @param subnet the subnet value to set.
     * @return the IpConfiguration object itself.
     */
    public IpConfiguration withSubnet(ResourceId subnet) {
        if (this.innerProperties() == null) {
            this.innerProperties = new IpConfigurationProperties();
        }
        this.innerProperties().withSubnet(subnet);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (name() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property name in model IpConfiguration"));
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("name", this.name);
        jsonWriter.writeJsonField("properties", this.innerProperties);
        return jsonWriter.writeEndObject();
    }

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

                if ("name".equals(fieldName)) {
                    deserializedIpConfiguration.name = reader.getString();
                } else if ("id".equals(fieldName)) {
                    deserializedIpConfiguration.id = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedIpConfiguration.type = reader.getString();
                } else if ("properties".equals(fieldName)) {
                    deserializedIpConfiguration.innerProperties = IpConfigurationProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedIpConfiguration;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy