/**
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 */

package com.microsoft.azure.batch.protocol.models;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * The network configuration for a Pool.
 */
public class NetworkConfiguration {
    /**
     * The ARM resource identifier of the virtual network subnet which the
     * Compute Nodes of the Pool will join. This is of the form
     * /subscriptions/{subscription}/resourceGroups/{group}/providers/{provider}/virtualNetworks/{network}/subnets/{subnet}.
     * The virtual network must be in the same region and subscription as the
     * Azure Batch Account. The specified subnet should have enough free IP
     * addresses to accommodate the number of Compute Nodes in the Pool. If the
     * subnet doesn't have enough free IP addresses, the Pool will partially
     * allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch'
     * service principal must have the 'Classic Virtual Machine Contributor'
     * Role-Based Access Control (RBAC) role for the specified VNet. The
     * specified subnet must allow communication from the Azure Batch service
     * to be able to schedule Tasks on the Nodes. This can be verified by
     * checking if the specified VNet has any associated Network Security
     * Groups (NSG). If communication to the Nodes in the specified subnet is
     * denied by an NSG, then the Batch service will set the state of the
     * Compute Nodes to unusable. For Pools created with
     * virtualMachineConfiguration only ARM virtual networks
     * ('Microsoft.Network/virtualNetworks') are supported, but for Pools
     * created with cloudServiceConfiguration both ARM and classic virtual
     * networks are supported. If the specified VNet has any associated Network
     * Security Groups (NSG), then a few reserved system ports must be enabled
     * for inbound communication. For Pools created with a virtual machine
     * configuration, enable ports 29876 and 29877, as well as port 22 for
     * Linux and port 3389 for Windows. For Pools created with a cloud service
     * configuration, enable ports 10100, 20100, and 30100. Also enable
     * outbound connections to Azure Storage on port 443. For more details see:
     * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
     */
    @JsonProperty(value = "subnetId")
    private String subnetId;

    /**
     * The scope of dynamic vnet assignment.
     * Possible values include: 'none', 'job'.
     */
    @JsonProperty(value = "dynamicVNetAssignmentScope")
    private DynamicVNetAssignmentScope dynamicVNetAssignmentScope;

    /**
     * The configuration for endpoints on Compute Nodes in the Batch Pool.
     * Pool endpoint configuration is only supported on Pools with the
     * virtualMachineConfiguration property.
     */
    @JsonProperty(value = "endpointConfiguration")
    private PoolEndpointConfiguration endpointConfiguration;

    /**
     * The Public IPAddress configuration for Compute Nodes in the Batch Pool.
     * Public IP configuration property is only supported on Pools with the
     * virtualMachineConfiguration property.
     */
    @JsonProperty(value = "publicIPAddressConfiguration")
    private PublicIPAddressConfiguration publicIPAddressConfiguration;

    /**
     * Whether this pool should enable accelerated networking.
     * Accelerated networking enables single root I/O virtualization (SR-IOV)
     * to a VM, which may lead to improved networking performance. For more
     * details, see:
     * https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview.
     */
    @JsonProperty(value = "enableAcceleratedNetworking")
    private Boolean enableAcceleratedNetworking;

    /**
     * Get the virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes in the Pool. If the subnet doesn't have enough free IP addresses, the Pool will partially allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. For Pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for Pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For Pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For Pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
     *
     * @return the subnetId value
     */
    public String subnetId() {
        return this.subnetId;
    }

    /**
     * Set the virtual network must be in the same region and subscription as the Azure Batch Account. The specified subnet should have enough free IP addresses to accommodate the number of Compute Nodes in the Pool. If the subnet doesn't have enough free IP addresses, the Pool will partially allocate Nodes and a resize error will occur. The 'MicrosoftAzureBatch' service principal must have the 'Classic Virtual Machine Contributor' Role-Based Access Control (RBAC) role for the specified VNet. The specified subnet must allow communication from the Azure Batch service to be able to schedule Tasks on the Nodes. This can be verified by checking if the specified VNet has any associated Network Security Groups (NSG). If communication to the Nodes in the specified subnet is denied by an NSG, then the Batch service will set the state of the Compute Nodes to unusable. For Pools created with virtualMachineConfiguration only ARM virtual networks ('Microsoft.Network/virtualNetworks') are supported, but for Pools created with cloudServiceConfiguration both ARM and classic virtual networks are supported. If the specified VNet has any associated Network Security Groups (NSG), then a few reserved system ports must be enabled for inbound communication. For Pools created with a virtual machine configuration, enable ports 29876 and 29877, as well as port 22 for Linux and port 3389 for Windows. For Pools created with a cloud service configuration, enable ports 10100, 20100, and 30100. Also enable outbound connections to Azure Storage on port 443. For more details see: https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration.
     *
     * @param subnetId the subnetId value to set
     * @return the NetworkConfiguration object itself.
     */
    public NetworkConfiguration withSubnetId(String subnetId) {
        this.subnetId = subnetId;
        return this;
    }

    /**
     * Get possible values include: 'none', 'job'.
     *
     * @return the dynamicVNetAssignmentScope value
     */
    public DynamicVNetAssignmentScope dynamicVNetAssignmentScope() {
        return this.dynamicVNetAssignmentScope;
    }

    /**
     * Set possible values include: 'none', 'job'.
     *
     * @param dynamicVNetAssignmentScope the dynamicVNetAssignmentScope value to set
     * @return the NetworkConfiguration object itself.
     */
    public NetworkConfiguration withDynamicVNetAssignmentScope(DynamicVNetAssignmentScope dynamicVNetAssignmentScope) {
        this.dynamicVNetAssignmentScope = dynamicVNetAssignmentScope;
        return this;
    }

    /**
     * Get pool endpoint configuration is only supported on Pools with the virtualMachineConfiguration property.
     *
     * @return the endpointConfiguration value
     */
    public PoolEndpointConfiguration endpointConfiguration() {
        return this.endpointConfiguration;
    }

    /**
     * Set pool endpoint configuration is only supported on Pools with the virtualMachineConfiguration property.
     *
     * @param endpointConfiguration the endpointConfiguration value to set
     * @return the NetworkConfiguration object itself.
     */
    public NetworkConfiguration withEndpointConfiguration(PoolEndpointConfiguration endpointConfiguration) {
        this.endpointConfiguration = endpointConfiguration;
        return this;
    }

    /**
     * Get public IP configuration property is only supported on Pools with the virtualMachineConfiguration property.
     *
     * @return the publicIPAddressConfiguration value
     */
    public PublicIPAddressConfiguration publicIPAddressConfiguration() {
        return this.publicIPAddressConfiguration;
    }

    /**
     * Set public IP configuration property is only supported on Pools with the virtualMachineConfiguration property.
     *
     * @param publicIPAddressConfiguration the publicIPAddressConfiguration value to set
     * @return the NetworkConfiguration object itself.
     */
    public NetworkConfiguration withPublicIPAddressConfiguration(PublicIPAddressConfiguration publicIPAddressConfiguration) {
        this.publicIPAddressConfiguration = publicIPAddressConfiguration;
        return this;
    }

    /**
     * Get accelerated networking enables single root I/O virtualization (SR-IOV) to a VM, which may lead to improved networking performance. For more details, see: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview.
     *
     * @return the enableAcceleratedNetworking value
     */
    public Boolean enableAcceleratedNetworking() {
        return this.enableAcceleratedNetworking;
    }

    /**
     * Set accelerated networking enables single root I/O virtualization (SR-IOV) to a VM, which may lead to improved networking performance. For more details, see: https://learn.microsoft.com/azure/virtual-network/accelerated-networking-overview.
     *
     * @param enableAcceleratedNetworking the enableAcceleratedNetworking value to set
     * @return the NetworkConfiguration object itself.
     */
    public NetworkConfiguration withEnableAcceleratedNetworking(Boolean enableAcceleratedNetworking) {
        this.enableAcceleratedNetworking = enableAcceleratedNetworking;
        return this;
    }

}
