# Source code for azure.mgmt.web.operations.server_farms_operations

    # 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.
    # --------------------------------------------------------------------------

    from msrest.pipeline import ClientRawResponse
    from msrestazure.azure_exceptions import CloudError
    from msrestazure.azure_operation import AzureOperationPoller
    import uuid

    from .. import models

    class ServerFarmsOperations(object):
        """ServerFarmsOperations operations.

        :param client: Client for service requests.
        :param config: Configuration of service client.
        :param serializer: An object model serializer.
        :param deserializer: An objec model deserializer.
        """

        def __init__(self, client, config, serializer, deserializer):

            self._client = client
            self._serialize = serializer
            self._deserialize = deserializer

            self.config = config

        def get_server_farms(
                self, resource_group_name, custom_headers=None, raw=False, **operation_config):
            """Gets collection of App Service Plans in a resource group for a given
            subscription.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: :class:`ServerFarmWithRichSkuPaged
             <azure.mgmt.web.models.ServerFarmWithRichSkuPaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms'
                    path_format_arguments = {
                        'resourceGroupName': self._serialize.url("resource_group_name", resource_group_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.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                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 and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    exp = CloudError(response)
                    exp.request_id = response.headers.get('x-ms-request-id')
                    raise exp

                return response

            # Deserialize response
            deserialized = models.ServerFarmWithRichSkuPaged(internal_paging, self._deserialize.dependencies)

            if raw:
                header_dict = {}
                client_raw_response = models.ServerFarmWithRichSkuPaged(internal_paging, self._deserialize.dependencies, header_dict)
                return client_raw_response

            return deserialized

        def get_server_farm(
                self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
            """Gets specified App Service Plan in a resource group.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: :class:`ServerFarmWithRichSku
             <azure.mgmt.web.models.ServerFarmWithRichSku>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('ServerFarmWithRichSku', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def create_or_update_server_farm(
                self, resource_group_name, name, server_farm_envelope, allow_pending_state=None, custom_headers=None, raw=False, **operation_config):
            """Creates or updates an App Service Plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param server_farm_envelope: Details of App Service Plan
            :type server_farm_envelope: :class:`ServerFarmWithRichSku
             <azure.mgmt.web.models.ServerFarmWithRichSku>`
            :param allow_pending_state: OBSOLETE: If true, allow pending state
             for App Service Plan
            :type allow_pending_state: bool
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :rtype:
             :class:`AzureOperationPoller<msrestazure.azure_operation.AzureOperationPoller>`
             instance that returns :class:`ServerFarmWithRichSku
             <azure.mgmt.web.models.ServerFarmWithRichSku>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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 allow_pending_state is not None:
                query_parameters['allowPendingState'] = self._serialize.query("allow_pending_state", allow_pending_state, 'bool')
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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(server_farm_envelope, 'ServerFarmWithRichSku')

            # Construct and send request
            def long_running_send():

                request = self._client.put(url, query_parameters)
                return self._client.send(
                    request, header_parameters, body_content, **operation_config)

            def get_long_running_status(status_link, headers=None):

                request = self._client.get(status_link)
                if headers:
                    request.headers.update(headers)
                return self._client.send(
                    request, header_parameters, **operation_config)

            def get_long_running_output(response):

                if response.status_code not in [200, 202]:
                    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('ServerFarmWithRichSku', response)
                if response.status_code == 202:
                    deserialized = self._deserialize('ServerFarmWithRichSku', response)

                if raw:
                    client_raw_response = ClientRawResponse(deserialized, response)
                    return client_raw_response

                return deserialized

            if raw:
                response = long_running_send()
                return get_long_running_output(response)

            long_running_operation_timeout = operation_config.get(
                'long_running_operation_timeout',
                self.config.long_running_operation_timeout)
            return AzureOperationPoller(
                long_running_send, get_long_running_output,
                get_long_running_status, long_running_operation_timeout)

        def delete_server_farm(
                self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
            """Deletes a App Service Plan.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: object
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.delete(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('object', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def get_server_farm_metrics(
                self, resource_group_name, name, details=None, filter=None, custom_headers=None, raw=False, **operation_config):
            """Queries for App Serice Plan metrics.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param details: If true, metrics are broken down per App Service Plan
             instance
            :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>`.
            :rtype: :class:`ResourceMetricPaged
             <azure.mgmt.web.models.ResourceMetricPaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metrics'
                    path_format_arguments = {
                        'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                        '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')
                    query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                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 and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    exp = CloudError(response)
                    exp.request_id = response.headers.get('x-ms-request-id')
                    raise exp

                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

        def get_server_farm_metric_defintions(
                self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
            """List of metrics that can be queried for an App Service Plan.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: :class:`MetricDefinitionPaged
             <azure.mgmt.web.models.MetricDefinitionPaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/metricdefinitions'
                    path_format_arguments = {
                        'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                        '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.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                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 and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    exp = CloudError(response)
                    exp.request_id = response.headers.get('x-ms-request-id')
                    raise exp

                return response

            # Deserialize response
            deserialized = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies)

            if raw:
                header_dict = {}
                client_raw_response = models.MetricDefinitionPaged(internal_paging, self._deserialize.dependencies, header_dict)
                return client_raw_response

            return deserialized

        def get_vnets_for_server_farm(
                self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
            """Gets list of vnets associated with App Service Plan.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: list of :class:`VnetInfo <azure.mgmt.web.models.VnetInfo>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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

        def get_vnet_from_server_farm(
                self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config):
            """Gets a vnet associated with an App Service Plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of 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>`.
            :rtype: :class:`VnetInfo <azure.mgmt.web.models.VnetInfo>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **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

        def get_routes_for_vnet(
                self, resource_group_name, name, vnet_name, custom_headers=None, raw=False, **operation_config):
            """Gets a list of all routes associated with a vnet, in an app service
            plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of 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>`.
            :rtype: list of :class:`VnetRoute <azure.mgmt.web.models.VnetRoute>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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

        def get_route_for_vnet(
                self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config):
            """Gets a specific route associated with a vnet, in an app service plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of 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>`.
            :rtype: list of :class:`VnetRoute <azure.mgmt.web.models.VnetRoute>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **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

        def create_or_update_vnet_route(
                self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config):
            """Creates a new route or updates an existing route for a vnet in an app
            service plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of virtual network
            :type vnet_name: str
            :param route_name: Name of the virtual network route
            :type route_name: str
            :param route: The route object
            :type route: :class:`VnetRoute <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>`.
            :rtype: :class:`VnetRoute <azure.mgmt.web.models.VnetRoute>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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)
            response = self._client.send(
                request, header_parameters, body_content, **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

        def delete_vnet_route(
                self, resource_group_name, name, vnet_name, route_name, custom_headers=None, raw=False, **operation_config):
            """Deletes an existing route for a vnet in an app service plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of 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>`.
            :rtype: object
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.delete(url, query_parameters)
            response = self._client.send(request, header_parameters, **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('object', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def update_vnet_route(
                self, resource_group_name, name, vnet_name, route_name, route, custom_headers=None, raw=False, **operation_config):
            """Creates a new route or updates an existing route for a vnet in an app
            service plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param vnet_name: Name of virtual network
            :type vnet_name: str
            :param route_name: Name of the virtual network route
            :type route_name: str
            :param route: The route object
            :type route: :class:`VnetRoute <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>`.
            :rtype: :class:`VnetRoute <azure.mgmt.web.models.VnetRoute>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/routes/{routeName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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)
            response = self._client.send(
                request, header_parameters, body_content, **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

        def get_server_farm_vnet_gateway(
                self, resource_group_name, name, vnet_name, gateway_name, custom_headers=None, raw=False, **operation_config):
            """Gets the vnet gateway.

            :param resource_group_name: Name of resource group
            :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>`.
            :rtype: :class:`VnetGateway <azure.mgmt.web.models.VnetGateway>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('VnetGateway', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def update_server_farm_vnet_gateway(
                self, resource_group_name, name, vnet_name, gateway_name, connection_envelope, custom_headers=None, raw=False, **operation_config):
            """Updates the vnet gateway.

            :param resource_group_name: The resource group
            :type resource_group_name: str
            :param name: The name of the App Service Plan
            :type name: str
            :param vnet_name: The name of the virtual network
            :type vnet_name: str
            :param gateway_name: The name of the gateway. Only 'primary' is
             supported.
            :type gateway_name: str
            :param connection_envelope: The gateway entity.
            :type connection_envelope: :class:`VnetGateway
             <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>`.
            :rtype: :class:`VnetGateway <azure.mgmt.web.models.VnetGateway>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/virtualNetworkConnections/{vnetName}/gateways/{gatewayName}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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)
            response = self._client.send(
                request, header_parameters, body_content, **operation_config)

            if response.status_code not in [200]:
                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('VnetGateway', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def get_server_farm_sites(
                self, resource_group_name, name, skip_token=None, filter=None, top=None, custom_headers=None, raw=False, **operation_config):
            """Gets list of Apps associated with an App Service Plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param skip_token: Skip to of web apps in a list. If specified, the
             resulting list will contain web apps starting from (including) the
             skipToken. Else, 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>`.
            :rtype: :class:`SitePaged <azure.mgmt.web.models.SitePaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/sites'
                    path_format_arguments = {
                        'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                        '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')
                    if top is not None:
                        query_parameters['$top'] = self._serialize.query("top", top, 'str')
                    query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                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 and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    exp = CloudError(response)
                    exp.request_id = response.headers.get('x-ms-request-id')
                    raise exp

                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

        def reboot_worker_for_server_farm(
                self, resource_group_name, name, worker_name, custom_headers=None, raw=False, **operation_config):
            """Submit a reboot request for a worker machine in the specified server
            farm.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of server farm
            :type name: str
            :param worker_name: Name of worker machine, 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>`.
            :rtype: object
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/workers/{workerName}/reboot'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('object', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def restart_sites_for_server_farm(
                self, resource_group_name, name, soft_restart=None, custom_headers=None, raw=False, **operation_config):
            """Restarts web apps in a specified App Service Plan.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of App Service Plan
            :type name: str
            :param soft_restart: Soft restart applies the configuration settings
             and restarts the apps if necessary. Hard restart 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>`.
            :rtype: object
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/restartSites'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('object', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized

        def get_server_farm_operation(
                self, resource_group_name, name, operation_id, custom_headers=None, raw=False, **operation_config):
            """Gets a server farm operation.

            :param resource_group_name: Name of resource group
            :type resource_group_name: str
            :param name: Name of server farm
            :type name: str
            :param operation_id: Id of Server farm operation"&gt;
            :type operation_id: 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>`.
            :rtype: :class:`ServerFarmWithRichSku
             <azure.mgmt.web.models.ServerFarmWithRichSku>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/serverfarms/{name}/operationresults/{operationId}'
            path_format_arguments = {
                'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                'name': self._serialize.url("name", name, 'str'),
                'operationId': self._serialize.url("operation_id", operation_id, '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.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            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 and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                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('ServerFarmWithRichSku', response)

            if raw:
                client_raw_response = ClientRawResponse(deserialized, response)
                return client_raw_response

            return deserialized