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

com.azure.resourcemanager.devcenter.fluent.models.NetworkProperties 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.devcenter.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.models.DomainJoinType;
import com.azure.resourcemanager.devcenter.models.HealthCheckStatus;
import com.azure.resourcemanager.devcenter.models.ProvisioningState;
import java.io.IOException;

/**
 * Network properties.
 */
@Fluent
public final class NetworkProperties extends NetworkConnectionUpdateProperties {
    /*
     * The provisioning state of the resource.
     */
    private ProvisioningState provisioningState;

    /*
     * Overall health status of the network connection. Health checks are run on creation, update, and periodically to
     * validate the network connection.
     */
    private HealthCheckStatus healthCheckStatus;

    /*
     * The name for resource group where NICs will be placed.
     */
    private String networkingResourceGroupName;

    /*
     * AAD Join type.
     */
    private DomainJoinType domainJoinType;

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

    /**
     * Get the provisioningState property: The provisioning state of the resource.
     * 
     * @return the provisioningState value.
     */
    public ProvisioningState provisioningState() {
        return this.provisioningState;
    }

    /**
     * Get the healthCheckStatus property: Overall health status of the network connection. Health checks are run on
     * creation, update, and periodically to validate the network connection.
     * 
     * @return the healthCheckStatus value.
     */
    public HealthCheckStatus healthCheckStatus() {
        return this.healthCheckStatus;
    }

    /**
     * Get the networkingResourceGroupName property: The name for resource group where NICs will be placed.
     * 
     * @return the networkingResourceGroupName value.
     */
    public String networkingResourceGroupName() {
        return this.networkingResourceGroupName;
    }

    /**
     * Set the networkingResourceGroupName property: The name for resource group where NICs will be placed.
     * 
     * @param networkingResourceGroupName the networkingResourceGroupName value to set.
     * @return the NetworkProperties object itself.
     */
    public NetworkProperties withNetworkingResourceGroupName(String networkingResourceGroupName) {
        this.networkingResourceGroupName = networkingResourceGroupName;
        return this;
    }

    /**
     * Get the domainJoinType property: AAD Join type.
     * 
     * @return the domainJoinType value.
     */
    public DomainJoinType domainJoinType() {
        return this.domainJoinType;
    }

    /**
     * Set the domainJoinType property: AAD Join type.
     * 
     * @param domainJoinType the domainJoinType value to set.
     * @return the NetworkProperties object itself.
     */
    public NetworkProperties withDomainJoinType(DomainJoinType domainJoinType) {
        this.domainJoinType = domainJoinType;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NetworkProperties withSubnetId(String subnetId) {
        super.withSubnetId(subnetId);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NetworkProperties withDomainName(String domainName) {
        super.withDomainName(domainName);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NetworkProperties withOrganizationUnit(String organizationUnit) {
        super.withOrganizationUnit(organizationUnit);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NetworkProperties withDomainUsername(String domainUsername) {
        super.withDomainUsername(domainUsername);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public NetworkProperties withDomainPassword(String domainPassword) {
        super.withDomainPassword(domainPassword);
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("subnetId", subnetId());
        jsonWriter.writeStringField("domainName", domainName());
        jsonWriter.writeStringField("organizationUnit", organizationUnit());
        jsonWriter.writeStringField("domainUsername", domainUsername());
        jsonWriter.writeStringField("domainPassword", domainPassword());
        jsonWriter.writeStringField("domainJoinType",
            this.domainJoinType == null ? null : this.domainJoinType.toString());
        jsonWriter.writeStringField("networkingResourceGroupName", this.networkingResourceGroupName);
        return jsonWriter.writeEndObject();
    }

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

                if ("subnetId".equals(fieldName)) {
                    deserializedNetworkProperties.withSubnetId(reader.getString());
                } else if ("domainName".equals(fieldName)) {
                    deserializedNetworkProperties.withDomainName(reader.getString());
                } else if ("organizationUnit".equals(fieldName)) {
                    deserializedNetworkProperties.withOrganizationUnit(reader.getString());
                } else if ("domainUsername".equals(fieldName)) {
                    deserializedNetworkProperties.withDomainUsername(reader.getString());
                } else if ("domainPassword".equals(fieldName)) {
                    deserializedNetworkProperties.withDomainPassword(reader.getString());
                } else if ("domainJoinType".equals(fieldName)) {
                    deserializedNetworkProperties.domainJoinType = DomainJoinType.fromString(reader.getString());
                } else if ("provisioningState".equals(fieldName)) {
                    deserializedNetworkProperties.provisioningState = ProvisioningState.fromString(reader.getString());
                } else if ("healthCheckStatus".equals(fieldName)) {
                    deserializedNetworkProperties.healthCheckStatus = HealthCheckStatus.fromString(reader.getString());
                } else if ("networkingResourceGroupName".equals(fieldName)) {
                    deserializedNetworkProperties.networkingResourceGroupName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedNetworkProperties;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy