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

package com.azure.resourcemanager.devtestlabs.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Configuration for public IP address sharing. */
@Fluent
public final class SubnetSharedPublicIpAddressConfiguration {
    /*
     * Backend ports that virtual machines on this subnet are allowed to expose
     */
    @JsonProperty(value = "allowedPorts")
    private List<Port> allowedPorts;

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

    /**
     * Get the allowedPorts property: Backend ports that virtual machines on this subnet are allowed to expose.
     *
     * @return the allowedPorts value.
     */
    public List<Port> allowedPorts() {
        return this.allowedPorts;
    }

    /**
     * Set the allowedPorts property: Backend ports that virtual machines on this subnet are allowed to expose.
     *
     * @param allowedPorts the allowedPorts value to set.
     * @return the SubnetSharedPublicIpAddressConfiguration object itself.
     */
    public SubnetSharedPublicIpAddressConfiguration withAllowedPorts(List<Port> allowedPorts) {
        this.allowedPorts = allowedPorts;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (allowedPorts() != null) {
            allowedPorts().forEach(e -> e.validate());
        }
    }
}
