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

package com.azure.resourcemanager.apimanagement.models;

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

/** Definitions about the connectivity check origin. */
@Fluent
public final class ConnectivityCheckRequestSource {
    /*
     * The API Management service region from where to start the connectivity
     * check operation.
     */
    @JsonProperty(value = "region", required = true)
    private String region;

    /*
     * The particular VMSS instance from which to fire the request.
     */
    @JsonProperty(value = "instance")
    private Long instance;

    /**
     * Get the region property: The API Management service region from where to start the connectivity check operation.
     *
     * @return the region value.
     */
    public String region() {
        return this.region;
    }

    /**
     * Set the region property: The API Management service region from where to start the connectivity check operation.
     *
     * @param region the region value to set.
     * @return the ConnectivityCheckRequestSource object itself.
     */
    public ConnectivityCheckRequestSource withRegion(String region) {
        this.region = region;
        return this;
    }

    /**
     * Get the instance property: The particular VMSS instance from which to fire the request.
     *
     * @return the instance value.
     */
    public Long instance() {
        return this.instance;
    }

    /**
     * Set the instance property: The particular VMSS instance from which to fire the request.
     *
     * @param instance the instance value to set.
     * @return the ConnectivityCheckRequestSource object itself.
     */
    public ConnectivityCheckRequestSource withInstance(Long instance) {
        this.instance = instance;
        return this;
    }

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

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