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

'use strict';

var models = require('./index');

var util = require('util');

/**
 * @class
 * Initializes a new instance of the LoadBalancingRule class.
 * @constructor
 * Rules of the load balancer
 * @member {object} [frontendIPConfiguration] Gets or sets a reference to
 * frontend IP Addresses
 * 
 * @member {string} [frontendIPConfiguration.id] Resource Id
 * 
 * @member {object} [backendAddressPool] Gets or sets  a reference to a pool
 * of DIPs. Inbound traffic is randomly load balanced across IPs in the
 * backend IPs
 * 
 * @member {string} [backendAddressPool.id] Resource Id
 * 
 * @member {object} [probe] Gets or sets the reference of the load balancer
 * probe used by the Load Balancing rule.
 * 
 * @member {string} [probe.id] Resource Id
 * 
 * @member {string} protocol Gets or sets the transport protocol for the
 * external endpoint. Possible values are Udp or Tcp. Possible values
 * include: 'Udp', 'Tcp'
 * 
 * @member {string} [loadDistribution] Gets or sets the load distribution
 * policy for this rule. Possible values include: 'Default', 'SourceIP',
 * 'SourceIPProtocol'
 * 
 * @member {number} frontendPort Gets or sets the port for the external
 * endpoint. You can specify any port number you choose, but the port numbers
 * specified for each role in the service must be unique. Possible values
 * range between 1 and 65535, inclusive
 * 
 * @member {number} [backendPort] Gets or sets a port used for internal
 * connections on the endpoint. The localPort attribute maps the eternal port
 * of the endpoint to an internal port on a role. This is useful in scenarios
 * where a role must communicate to an internal compotnent on a port that is
 * different from the one that is exposed externally. If not specified, the
 * value of localPort is the same as the port attribute. Set the value of
 * localPort to '*' to automatically assign an unallocated port that is
 * discoverable using the runtime API
 * 
 * @member {number} [idleTimeoutInMinutes] Gets or sets the timeout for the
 * Tcp idle connection. The value can be set between 4 and 30 minutes. The
 * default value is 4 minutes. This emlement is only used when the protocol
 * is set to Tcp
 * 
 * @member {boolean} [enableFloatingIP] Configures a virtual machine's
 * endpoint for the floating IP capability required to configure a SQL
 * AlwaysOn availability Group. This setting is required when using the SQL
 * Always ON availability Groups in SQL server. This setting can't be changed
 * after you create the endpoint
 * 
 * @member {string} [provisioningState] Gets or sets Provisioning state of the
 * PublicIP resource Updating/Deleting/Failed
 * 
 * @member {string} [name] Gets name of the resource that is unique within a
 * resource group. This name can be used to access the resource
 * 
 * @member {string} [etag] A unique read-only string that changes whenever the
 * resource is updated
 * 
 */
function LoadBalancingRule() {
  LoadBalancingRule['super_'].call(this);
}

util.inherits(LoadBalancingRule, models['SubResource']);

/**
 * Defines the metadata of LoadBalancingRule
 *
 * @returns {object} metadata of LoadBalancingRule
 *
 */
LoadBalancingRule.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'LoadBalancingRule',
    type: {
      name: 'Composite',
      className: 'LoadBalancingRule',
      modelProperties: {
        id: {
          required: false,
          serializedName: 'id',
          type: {
            name: 'String'
          }
        },
        frontendIPConfiguration: {
          required: false,
          serializedName: 'properties.frontendIPConfiguration',
          type: {
            name: 'Composite',
            className: 'SubResource'
          }
        },
        backendAddressPool: {
          required: false,
          serializedName: 'properties.backendAddressPool',
          type: {
            name: 'Composite',
            className: 'SubResource'
          }
        },
        probe: {
          required: false,
          serializedName: 'properties.probe',
          type: {
            name: 'Composite',
            className: 'SubResource'
          }
        },
        protocol: {
          required: true,
          serializedName: 'properties.protocol',
          type: {
            name: 'String'
          }
        },
        loadDistribution: {
          required: false,
          serializedName: 'properties.loadDistribution',
          type: {
            name: 'String'
          }
        },
        frontendPort: {
          required: true,
          serializedName: 'properties.frontendPort',
          type: {
            name: 'Number'
          }
        },
        backendPort: {
          required: false,
          serializedName: 'properties.backendPort',
          type: {
            name: 'Number'
          }
        },
        idleTimeoutInMinutes: {
          required: false,
          serializedName: 'properties.idleTimeoutInMinutes',
          type: {
            name: 'Number'
          }
        },
        enableFloatingIP: {
          required: false,
          serializedName: 'properties.enableFloatingIP',
          type: {
            name: 'Boolean'
          }
        },
        provisioningState: {
          required: false,
          serializedName: 'properties.provisioningState',
          type: {
            name: 'String'
          }
        },
        name: {
          required: false,
          serializedName: 'name',
          type: {
            name: 'String'
          }
        },
        etag: {
          required: false,
          serializedName: 'etag',
          type: {
            name: 'String'
          }
        }
      }
    }
  };
};

module.exports = LoadBalancingRule;
