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

package com.azure.resourcemanager.datalakestore.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The virtual network rule properties to use when creating a new virtual network rule. */
@Fluent
public final class CreateOrUpdateVirtualNetworkRuleProperties {
    /*
     * The resource identifier for the subnet.
     */
    @JsonProperty(value = "subnetId", required = true)
    private String subnetId;

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

    /**
     * Get the subnetId property: The resource identifier for the subnet.
     *
     * @return the subnetId value.
     */
    public String subnetId() {
        return this.subnetId;
    }

    /**
     * Set the subnetId property: The resource identifier for the subnet.
     *
     * @param subnetId the subnetId value to set.
     * @return the CreateOrUpdateVirtualNetworkRuleProperties object itself.
     */
    public CreateOrUpdateVirtualNetworkRuleProperties withSubnetId(String subnetId) {
        this.subnetId = subnetId;
        return this;
    }

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

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