/*
 * 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.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

/**
 * The network configuration for a pool.
 *
 */
class NetworkConfiguration {
  /**
   * Create a NetworkConfiguration.
   * @property {string} [subnetId] 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 nodes in the pool. If the subnet
   * doesn't have enough free IP addresses, the pool will partially allocate
   * compute 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 compute nodes. This can be verified by
   * checking if the specified VNet has any associated Network Security Groups
   * (NSG). If communication to the compute nodes in the specified subnet is
   * denied by an NSG, then the Batch service will set the state of the compute
   * nodes to unusable. 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 cloudServiceConfiguration
   * pools, only 'classic' VNETs are supported. For more details see:
   * https://docs.microsoft.com/en-us/azure/batch/batch-api-basics#virtual-network-vnet-and-firewall-configuration
   * @property {object} [endpointConfiguration] The configuration for endpoints
   * on compute nodes in the Batch pool. Pool endpoint configuration is only
   * supported on pools with the virtualMachineConfiguration property.
   * @property {array} [endpointConfiguration.inboundNatPools] The maximum
   * number of inbound NAT pools per Batch pool is 5. If the maximum number of
   * inbound NAT pools is exceeded the request fails with HTTP status code 400.
   * @property {object} [publicIPAddressConfiguration] The Public IPAddress
   * configuration for Compute Nodes in the Batch Pool. This property is only
   * supported on Pools with the virtualMachineConfiguration property.
   * @property {string} [publicIPAddressConfiguration.provision] The default
   * value is BatchManaged. Possible values include: 'BatchManaged',
   * 'UserManaged', 'NoPublicIPAddresses'
   * @property {array} [publicIPAddressConfiguration.ipAddressIds] The number
   * of IPs specified here limits the maximum size of the Pool - 50 dedicated
   * nodes or 20 low-priority nodes can be allocated for each public IP. For
   * example, a pool needing 150 dedicated VMs would need at least 3 public IPs
   * specified. Each element of this collection is of the form:
   * /subscriptions/{subscription}/resourceGroups/{group}/providers/Microsoft.Network/publicIPAddresses/{ip}.
   */
  constructor() {
  }

  /**
   * Defines the metadata of NetworkConfiguration
   *
   * @returns {object} metadata of NetworkConfiguration
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'NetworkConfiguration',
      type: {
        name: 'Composite',
        className: 'NetworkConfiguration',
        modelProperties: {
          subnetId: {
            required: false,
            serializedName: 'subnetId',
            type: {
              name: 'String'
            }
          },
          endpointConfiguration: {
            required: false,
            serializedName: 'endpointConfiguration',
            type: {
              name: 'Composite',
              className: 'PoolEndpointConfiguration'
            }
          },
          publicIPAddressConfiguration: {
            required: false,
            serializedName: 'publicIPAddressConfiguration',
            type: {
              name: 'Composite',
              className: 'PublicIPAddressConfiguration'
            }
          }
        }
      }
    };
  }
}

module.exports = NetworkConfiguration;
