text: # coding=utf-8
  # --------------------------------------------------------------------------
  # 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.
  # --------------------------------------------------------------------------
  
  import uuid
  from msrest.pipeline import ClientRawResponse
  from msrestazure.azure_exceptions import CloudError
  from msrest.polling import LROPoller, NoPolling
  from msrestazure.polling.arm_polling import ARMPolling
  
  from .. import models
  
  
  class AppServicePlansOperations(object):
      """AppServicePlansOperations operations.
  
      :param client: Client for service requests.
      :param config: Configuration of service client.
      :param serializer: An object model serializer.
      :param deserializer: An object model deserializer.
      :ivar api_version: API Version. Constant value: "2018-02-01".
      """
  
      models = models
  
      def __init__(self, client, config, serializer, deserializer):
  
          self._client = client
          self._serialize = serializer
          self._deserialize = deserializer
          self.api_version = "2018-02-01"
  
          self.config = config
  
      def list(
              self, detailed=None, custom_headers=None, raw=False, **operation_config):
          """Get all App Service plans for a subscription.
  
          Get all App Service plans for a subscription.
  
          :param detailed: Specify <code>true</code> to return all App Service
           plan properties. The default is <code>false</code>, which returns a
           subset of the properties.
           Retrieval of all properties may increase the API latency.
          :type detailed: bool
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of AppServicePlan
          :rtype:
           ~azure.mgmt.web.models.AppServicePlanPaged[~azure.mgmt.web.models.AppServicePlan]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list.metadata['url']
                  path_format_arguments = {
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  if detailed is not None:
                      query_parameters['detailed'] = self._serialize.query("detailed", detailed, 'bool')
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Web/serverfarms'}
  
      def list_by_resource_group(
              self, resource_group_name, custom_headers=None, raw=False, **operation_config):
          """Get all App Service plans in a resource group.
  
          Get all App Service plans in a resource group.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of AppServicePlan
          :rtype:
           ~azure.mgmt.web.models.AppServicePlanPaged[~azure.mgmt.web.models.AppServicePlan]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_by_resource_group.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.AppServicePlanPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'}
  
      def get(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Get an App Service plan.
  
          Get an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: AppServicePlan or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.AppServicePlan or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.get.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('AppServicePlan', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'}
  
  
      def _create_or_update_initial(
              self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config):
          # Construct URL
          url = self.create_or_update.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct body
          body_content = self._serialize.body(app_service_plan, 'AppServicePlan')
  
          # Construct and send request
          request = self._client.put(url, query_parameters, header_parameters, body_content)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 201, 202]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('AppServicePlan', response)
          if response.status_code == 201:
              deserialized = self._deserialize('AppServicePlan', response)
          if response.status_code == 202:
              deserialized = self._deserialize('AppServicePlan', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def create_or_update(
              self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, polling=True, **operation_config):
          """Creates or updates an App Service Plan.
  
          Creates or updates an App Service Plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param app_service_plan: Details of the App Service plan.
          :type app_service_plan: ~azure.mgmt.web.models.AppServicePlan
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: The poller return type is ClientRawResponse, the
           direct response alongside the deserialized response
          :param polling: True for ARMPolling, False for no polling, or a
           polling object for personal polling strategy
          :return: An instance of LROPoller that returns AppServicePlan or
           ClientRawResponse<AppServicePlan> if raw==True
          :rtype:
           ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.web.models.AppServicePlan]
           or
           ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.web.models.AppServicePlan]]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          raw_result = self._create_or_update_initial(
              resource_group_name=resource_group_name,
              name=name,
              app_service_plan=app_service_plan,
              custom_headers=custom_headers,
              raw=True,
              **operation_config
          )
  
          def get_long_running_output(response):
              deserialized = self._deserialize('AppServicePlan', response)
  
              if raw:
                  client_raw_response = ClientRawResponse(deserialized, response)
                  return client_raw_response
  
              return deserialized
  
          lro_delay = operation_config.get(
              'long_running_operation_timeout',
              self.config.long_running_operation_timeout)
          if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
          elif polling is False: polling_method = NoPolling()
          else: polling_method = polling
          return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
      create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'}
  
      def delete(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Delete an App Service plan.
  
          Delete an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: None or ClientRawResponse if raw=true
          :rtype: None or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.delete.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.delete(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 204]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          if raw:
              client_raw_response = ClientRawResponse(None, response)
              return client_raw_response
      delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'}
  
      def update(
              self, resource_group_name, name, app_service_plan, custom_headers=None, raw=False, **operation_config):
          """Creates or updates an App Service Plan.
  
          Creates or updates an App Service Plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param app_service_plan: Details of the App Service plan.
          :type app_service_plan:
           ~azure.mgmt.web.models.AppServicePlanPatchResource
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: AppServicePlan or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.AppServicePlan or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.update.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct body
          body_content = self._serialize.body(app_service_plan, 'AppServicePlanPatchResource')
  
          # Construct and send request
          request = self._client.patch(url, query_parameters, header_parameters, body_content)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 202]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('AppServicePlan', response)
          if response.status_code == 202:
              deserialized = self._deserialize('AppServicePlan', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'}
  
      def list_capabilities(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """List all capabilities of an App Service plan.
  
          List all capabilities of an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: list or ClientRawResponse if raw=true
          :rtype: list[~azure.mgmt.web.models.Capability] or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.list_capabilities.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('[Capability]', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      list_capabilities.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/capabilities'}
  
      def get_hybrid_connection(
              self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config):
          """Retrieve a Hybrid Connection in use in an App Service plan.
  
          Retrieve a Hybrid Connection in use in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param namespace_name: Name of the Service Bus namespace.
          :type namespace_name: str
          :param relay_name: Name of the Service Bus relay.
          :type relay_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: HybridConnection or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.HybridConnection or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.get_hybrid_connection.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'),
              'relayName': self._serialize.url("relay_name", relay_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('HybridConnection', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'}
  
      def delete_hybrid_connection(
              self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config):
          """Delete a Hybrid Connection in use in an App Service plan.
  
          Delete a Hybrid Connection in use in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param namespace_name: Name of the Service Bus namespace.
          :type namespace_name: str
          :param relay_name: Name of the Service Bus relay.
          :type relay_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: None or ClientRawResponse if raw=true
          :rtype: None or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.delete_hybrid_connection.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'),
              'relayName': self._serialize.url("relay_name", relay_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.delete(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 204]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          if raw:
              client_raw_response = ClientRawResponse(None, response)
              return client_raw_response
      delete_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}'}
  
      def list_hybrid_connection_keys(
              self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config):
          """Get the send key name and value of a Hybrid Connection.
  
          Get the send key name and value of a Hybrid Connection.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param namespace_name: The name of the Service Bus namespace.
          :type namespace_name: str
          :param relay_name: The name of the Service Bus relay.
          :type relay_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: HybridConnectionKey or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.HybridConnectionKey or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.list_hybrid_connection_keys.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'),
              'relayName': self._serialize.url("relay_name", relay_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.post(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('HybridConnectionKey', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      list_hybrid_connection_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/listKeys'}
  
      def list_web_apps_by_hybrid_connection(
              self, resource_group_name, name, namespace_name, relay_name, custom_headers=None, raw=False, **operation_config):
          """Get all apps that use a Hybrid Connection in an App Service Plan.
  
          Get all apps that use a Hybrid Connection in an App Service Plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param namespace_name: Name of the Hybrid Connection namespace.
          :type namespace_name: str
          :param relay_name: Name of the Hybrid Connection relay.
          :type relay_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of str
          :rtype: ~azure.mgmt.web.models.StrPaged[str]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_web_apps_by_hybrid_connection.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'namespaceName': self._serialize.url("namespace_name", namespace_name, 'str'),
                      'relayName': self._serialize.url("relay_name", relay_name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.StrPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.StrPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_web_apps_by_hybrid_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionNamespaces/{namespaceName}/relays/{relayName}/sites'}
  
      def get_hybrid_connection_plan_limit(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Get the maximum number of Hybrid Connections allowed in an App Service
          plan.
  
          Get the maximum number of Hybrid Connections allowed in an App Service
          plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: HybridConnectionLimits or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.HybridConnectionLimits or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.get_hybrid_connection_plan_limit.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('HybridConnectionLimits', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_hybrid_connection_plan_limit.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionPlanLimits/limit'}
  
      def list_hybrid_connections(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Retrieve all Hybrid Connections in use in an App Service plan.
  
          Retrieve all Hybrid Connections in use in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of HybridConnection
          :rtype:
           ~azure.mgmt.web.models.HybridConnectionPaged[~azure.mgmt.web.models.HybridConnection]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_hybrid_connections.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.HybridConnectionPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_hybrid_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/hybridConnectionRelays'}
  
      def list_metric_defintions(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Get metrics that can be queried for an App Service plan, and their
          definitions.
  
          Get metrics that can be queried for an App Service plan, and their
          definitions.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of ResourceMetricDefinition
          :rtype:
           ~azure.mgmt.web.models.ResourceMetricDefinitionPaged[~azure.mgmt.web.models.ResourceMetricDefinition]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_metric_defintions.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.ResourceMetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_metric_defintions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'}
  
      def list_metrics(
              self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config):
          """Get metrics for an App Service plan.
  
          Get metrics for an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param details: Specify <code>true</code> to include instance details.
           The default is <code>false</code>.
          :type details: bool
          :param filter: Return only usages/metrics specified in the filter.
           Filter conforms to odata syntax. Example: $filter=(name.value eq
           'Metric1' or name.value eq 'Metric2') and startTime eq
           2014-01-01T00:00:00Z and endTime eq 2014-12-31T23:59:59Z and timeGrain
           eq duration'[Hour|Minute|Day]'.
          :type filter: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of ResourceMetric
          :rtype:
           ~azure.mgmt.web.models.ResourceMetricPaged[~azure.mgmt.web.models.ResourceMetric]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_metrics.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  if details is not None:
                      query_parameters['details'] = self._serialize.query("details", details, 'bool')
                  if filter is not None:
                      query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.ResourceMetricPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_metrics.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'}
  
      def restart_web_apps(
              self, resource_group_name, name, soft_restart=None, custom_headers=None, raw=False, **operation_config):
          """Restart all apps in an App Service plan.
  
          Restart all apps in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param soft_restart: Specify <code>true</code> to perform a soft
           restart, applies the configuration settings and restarts the apps if
           necessary. The default is <code>false</code>, which always restarts
           and reprovisions the apps
          :type soft_restart: bool
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: None or ClientRawResponse if raw=true
          :rtype: None or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.restart_web_apps.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          if soft_restart is not None:
              query_parameters['softRestart'] = self._serialize.query("soft_restart", soft_restart, 'bool')
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.post(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [204]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          if raw:
              client_raw_response = ClientRawResponse(None, response)
              return client_raw_response
      restart_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'}
  
      def list_web_apps(
              self, resource_group_name, name, skip_token=None, filter=None, top=None, custom_headers=None, raw=False, **operation_config):
          """Get all apps associated with an App Service plan.
  
          Get all apps associated with an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param skip_token: Skip to a web app in the list of webapps associated
           with app service plan. If specified, the resulting list will contain
           web apps starting from (including) the skipToken. Otherwise, the
           resulting list contains web apps from the start of the list
          :type skip_token: str
          :param filter: Supported filter: $filter=state eq running. Returns
           only web apps that are currently running
          :type filter: str
          :param top: List page size. If specified, results are paged.
          :type top: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of Site
          :rtype: ~azure.mgmt.web.models.SitePaged[~azure.mgmt.web.models.Site]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_web_apps.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  if skip_token is not None:
                      query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str')
                  if filter is not None:
                      query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
                  if top is not None:
                      query_parameters['$top'] = self._serialize.query("top", top, 'str')
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.SitePaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.SitePaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_web_apps.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'}
  
      def get_server_farm_skus(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Gets all selectable SKUs for a given App Service Plan.
  
          Gets all selectable SKUs for a given App Service Plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of App Service Plan
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: object or ClientRawResponse if raw=true
          :rtype: object or ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.get_server_farm_skus.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('object', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_server_farm_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/skus'}
  
      def list_usages(
              self, resource_group_name, name, filter=None, custom_headers=None, raw=False, **operation_config):
          """Gets server farm usage information.
  
          Gets server farm usage information.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of App Service Plan
          :type name: str
          :param filter: Return only usages/metrics specified in the filter.
           Filter conforms to odata syntax. Example: $filter=(name.value eq
           'Metric1' or name.value eq 'Metric2').
          :type filter: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: An iterator like instance of CsmUsageQuota
          :rtype:
           ~azure.mgmt.web.models.CsmUsageQuotaPaged[~azure.mgmt.web.models.CsmUsageQuota]
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = self.list_usages.metadata['url']
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
                      'name': self._serialize.url("name", name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  if filter is not None:
                      query_parameters['$filter'] = self._serialize.query("filter", filter, 'str', skip_quote=True)
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Accept'] = 'application/json'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters, header_parameters)
              response = self._client.send(request, stream=False, **operation_config)
  
              if response.status_code not in [200]:
                  raise models.DefaultErrorResponseException(self._deserialize, response)
  
              return response
  
          # Deserialize response
          deserialized = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.CsmUsageQuotaPaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
      list_usages.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/usages'}
  
      def list_vnets(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Get all Virtual Networks associated with an App Service plan.
  
          Get all Virtual Networks associated with an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: list or ClientRawResponse if raw=true
          :rtype: list[~azure.mgmt.web.models.VnetInfo] or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.list_vnets.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('[VnetInfo]', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      list_vnets.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'}
  
      def get_vnet_from_server_farm(
              self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config):
          """Get a Virtual Network associated with an App Service plan.
  
          Get a Virtual Network associated with an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: VnetInfo or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.VnetInfo or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.get_vnet_from_server_farm.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('VnetInfo', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_vnet_from_server_farm.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'}
  
      def get_vnet_gateway(
              self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config):
          """Get a Virtual Network gateway.
  
          Get a Virtual Network gateway.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param gateway_name: Name of the gateway. Only the 'primary' gateway
           is supported.
          :type gateway_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: VnetGateway or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.VnetGateway or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.get_vnet_gateway.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('VnetGateway', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'}
  
      def update_vnet_gateway(
              self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config):
          """Update a Virtual Network gateway.
  
          Update a Virtual Network gateway.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param gateway_name: Name of the gateway. Only the 'primary' gateway
           is supported.
          :type gateway_name: str
          :param connection_envelope: Definition of the gateway.
          :type connection_envelope: ~azure.mgmt.web.models.VnetGateway
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: VnetGateway or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.VnetGateway or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.update_vnet_gateway.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'gatewayName': self._serialize.url("gateway_name", gateway_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct body
          body_content = self._serialize.body(connection_envelope, 'VnetGateway')
  
          # Construct and send request
          request = self._client.put(url, query_parameters, header_parameters, body_content)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('VnetGateway', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      update_vnet_gateway.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'}
  
      def list_routes_for_vnet(
              self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config):
          """Get all routes that are associated with a Virtual Network in an App
          Service plan.
  
          Get all routes that are associated with a Virtual Network in an App
          Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: list or ClientRawResponse if raw=true
          :rtype: list[~azure.mgmt.web.models.VnetRoute] or
           ~msrest.pipeline.ClientRawResponse
          :raises:
           :class:`DefaultErrorResponseException<azure.mgmt.web.models.DefaultErrorResponseException>`
          """
          # Construct URL
          url = self.list_routes_for_vnet.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200]:
              raise models.DefaultErrorResponseException(self._deserialize, response)
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('[VnetRoute]', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      list_routes_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'}
  
      def get_route_for_vnet(
              self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config):
          """Get a Virtual Network route in an App Service plan.
  
          Get a Virtual Network route in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param route_name: Name of the Virtual Network route.
          :type route_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: list or ClientRawResponse if raw=true
          :rtype: list[~azure.mgmt.web.models.VnetRoute] or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.get_route_for_vnet.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'routeName': self._serialize.url("route_name", route_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('[VnetRoute]', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      get_route_for_vnet.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'}
  
      def create_or_update_vnet_route(
              self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config):
          """Create or update a Virtual Network route in an App Service plan.
  
          Create or update a Virtual Network route in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param route_name: Name of the Virtual Network route.
          :type route_name: str
          :param route: Definition of the Virtual Network route.
          :type route: ~azure.mgmt.web.models.VnetRoute
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: VnetRoute or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.VnetRoute or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.create_or_update_vnet_route.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'routeName': self._serialize.url("route_name", route_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct body
          body_content = self._serialize.body(route, 'VnetRoute')
  
          # Construct and send request
          request = self._client.put(url, query_parameters, header_parameters, body_content)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 400, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('VnetRoute', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      create_or_update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'}
  
      def delete_vnet_route(
              self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config):
          """Delete a Virtual Network route in an App Service plan.
  
          Delete a Virtual Network route in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param route_name: Name of the Virtual Network route.
          :type route_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: None or ClientRawResponse if raw=true
          :rtype: None or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.delete_vnet_route.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'routeName': self._serialize.url("route_name", route_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.delete(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          if raw:
              client_raw_response = ClientRawResponse(None, response)
              return client_raw_response
      delete_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'}
  
      def update_vnet_route(
              self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config):
          """Create or update a Virtual Network route in an App Service plan.
  
          Create or update a Virtual Network route in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param vnet_name: Name of the Virtual Network.
          :type vnet_name: str
          :param route_name: Name of the Virtual Network route.
          :type route_name: str
          :param route: Definition of the Virtual Network route.
          :type route: ~azure.mgmt.web.models.VnetRoute
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: VnetRoute or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.web.models.VnetRoute or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.update_vnet_route.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'vnetName': self._serialize.url("vnet_name", vnet_name, 'str'),
              'routeName': self._serialize.url("route_name", route_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Accept'] = 'application/json'
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct body
          body_content = self._serialize.body(route, 'VnetRoute')
  
          # Construct and send request
          request = self._client.patch(url, query_parameters, header_parameters, body_content)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [200, 400, 404]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('VnetRoute', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
      update_vnet_route.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'}
  
      def reboot_worker(
              self, resource_group_name, name, worker_name, custom_headers=None, raw=False, **operation_config):
          """Reboot a worker machine in an App Service plan.
  
          Reboot a worker machine in an App Service plan.
  
          :param resource_group_name: Name of the resource group to which the
           resource belongs.
          :type resource_group_name: str
          :param name: Name of the App Service plan.
          :type name: str
          :param worker_name: Name of worker machine, which typically starts
           with RD.
          :type worker_name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: None or ClientRawResponse if raw=true
          :rtype: None or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = self.reboot_worker.metadata['url']
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+[^\.]$'),
              'name': self._serialize.url("name", name, 'str'),
              'workerName': self._serialize.url("worker_name", worker_name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.post(url, query_parameters, header_parameters)
          response = self._client.send(request, stream=False, **operation_config)
  
          if response.status_code not in [204]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          if raw:
              client_raw_response = ClientRawResponse(None, response)
              return client_raw_response
      reboot_worker.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'}
  