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 functools
  from typing import TYPE_CHECKING
  import warnings
  
  from azure.core.exceptions import (
      ClientAuthenticationError,
      HttpResponseError,
      ResourceExistsError,
      ResourceNotFoundError,
      map_error,
  )
  from azure.core.paging import ItemPaged
  from azure.core.pipeline import PipelineResponse
  from azure.core.pipeline.transport import HttpResponse
  from azure.core.polling import LROPoller, NoPolling, PollingMethod
  from azure.core.polling.base_polling import LROBasePolling
  from azure.core.rest import HttpRequest
  from azure.core.tracing.decorator import distributed_trace
  from msrest import Serializer
  
  from .. import models as _models
  from .._vendor import _convert_request, _format_url_section
  
  if TYPE_CHECKING:
      # pylint: disable=unused-import,ungrouped-imports
      from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union
  
      T = TypeVar("T")
      ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
  
  _SERIALIZER = Serializer()
  _SERIALIZER.client_side_validation = False
  # fmt: off
  
  def build_get_no_item_name_pages_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/noitemname')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_null_next_link_name_pages_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/nullnextlink')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_single_pages_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/single')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_first_response_empty_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/firstResponseEmpty/1')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      client_request_id = kwargs.pop('client_request_id', None)  # type: Optional[str]
      maxresults = kwargs.pop('maxresults', None)  # type: Optional[int]
      timeout = kwargs.pop('timeout', 30)  # type: Optional[int]
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      if client_request_id is not None:
          header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str')
      if maxresults is not None:
          header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int')
      if timeout is not None:
          header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int')
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_with_query_params_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      query_constant = kwargs.pop('query_constant', True)  # type: bool
      required_query_parameter = kwargs.pop('required_query_parameter')  # type: int
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/getWithQueryParams')
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['requiredQueryParameter'] = _SERIALIZER.query("required_query_parameter", required_query_parameter, 'int')
      query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_next_operation_with_query_params_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      query_constant = kwargs.pop('query_constant', True)  # type: bool
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/nextOperationWithQueryParams')
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['queryConstant'] = _SERIALIZER.query("query_constant", query_constant, 'bool')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_odata_multiple_pages_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      client_request_id = kwargs.pop('client_request_id', None)  # type: Optional[str]
      maxresults = kwargs.pop('maxresults', None)  # type: Optional[int]
      timeout = kwargs.pop('timeout', 30)  # type: Optional[int]
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/odata')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      if client_request_id is not None:
          header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str')
      if maxresults is not None:
          header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int')
      if timeout is not None:
          header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int')
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_with_offset_request(
      offset,  # type: int
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      client_request_id = kwargs.pop('client_request_id', None)  # type: Optional[str]
      maxresults = kwargs.pop('maxresults', None)  # type: Optional[int]
      timeout = kwargs.pop('timeout', 30)  # type: Optional[int]
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/withpath/{offset}')
      path_format_arguments = {
          "offset": _SERIALIZER.url("offset", offset, 'int'),
      }
  
      url = _format_url_section(url, **path_format_arguments)
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      if client_request_id is not None:
          header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str')
      if maxresults is not None:
          header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int')
      if timeout is not None:
          header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int')
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_retry_first_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/retryfirst')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_retry_second_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/retrysecond')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_single_pages_failure_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/single/failure')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_failure_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/failure')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_failure_uri_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/failureuri')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_fragment_next_link_request(
      tenant,  # type: str
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      api_version = kwargs.pop('api_version')  # type: str
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/fragment/{tenant}')
      path_format_arguments = {
          "tenant": _SERIALIZER.url("tenant", tenant, 'str'),
      }
  
      url = _format_url_section(url, **path_format_arguments)
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_fragment_with_grouping_next_link_request(
      tenant,  # type: str
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      api_version = kwargs.pop('api_version')  # type: str
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/fragmentwithgrouping/{tenant}')
      path_format_arguments = {
          "tenant": _SERIALIZER.url("tenant", tenant, 'str'),
      }
  
      url = _format_url_section(url, **path_format_arguments)
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_multiple_pages_lro_request_initial(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      client_request_id = kwargs.pop('client_request_id', None)  # type: Optional[str]
      maxresults = kwargs.pop('maxresults', None)  # type: Optional[int]
      timeout = kwargs.pop('timeout', 30)  # type: Optional[int]
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/lro')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      if client_request_id is not None:
          header_parameters['client-request-id'] = _SERIALIZER.header("client_request_id", client_request_id, 'str')
      if maxresults is not None:
          header_parameters['maxresults'] = _SERIALIZER.header("maxresults", maxresults, 'int')
      if timeout is not None:
          header_parameters['timeout'] = _SERIALIZER.header("timeout", timeout, 'int')
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="POST",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_next_fragment_request(
      tenant,  # type: str
      next_link,  # type: str
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      api_version = kwargs.pop('api_version')  # type: str
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/fragment/{tenant}/{nextLink}')
      path_format_arguments = {
          "tenant": _SERIALIZER.url("tenant", tenant, 'str'),
          "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True),
      }
  
      url = _format_url_section(url, **path_format_arguments)
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_next_fragment_with_grouping_request(
      tenant,  # type: str
      next_link,  # type: str
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      api_version = kwargs.pop('api_version')  # type: str
  
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}')
      path_format_arguments = {
          "tenant": _SERIALIZER.url("tenant", tenant, 'str'),
          "nextLink": _SERIALIZER.url("next_link", next_link, 'str', skip_quote=True),
      }
  
      url = _format_url_section(url, **path_format_arguments)
  
      # Construct parameters
      query_parameters = kwargs.pop("params", {})  # type: Dict[str, Any]
      query_parameters['api_version'] = _SERIALIZER.query("api_version", api_version, 'str')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          params=query_parameters,
          headers=header_parameters,
          **kwargs
      )
  
  
  def build_get_paging_model_with_item_name_with_xms_client_name_request(
      **kwargs  # type: Any
  ):
      # type: (...) -> HttpRequest
      accept = "application/json"
      # Construct URL
      url = kwargs.pop("template_url", '/paging/itemNameWithXMSClientName')
  
      # Construct headers
      header_parameters = kwargs.pop("headers", {})  # type: Dict[str, Any]
      header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str')
  
      return HttpRequest(
          method="GET",
          url=url,
          headers=header_parameters,
          **kwargs
      )
  
  # fmt: on
  class PagingOperations(object):
      """PagingOperations operations.
  
      You should not instantiate this class directly. Instead, you should create a Client instance that
      instantiates it for you and attaches it as an attribute.
  
      :ivar models: Alias to model classes used in this operation group.
      :type models: ~paging.models
      :param client: Client for service requests.
      :param config: Configuration of service client.
      :param serializer: An object model serializer.
      :param deserializer: An object model deserializer.
      """
  
      models = _models
  
      def __init__(self, client, config, serializer, deserializer):
          self._client = client
          self._serialize = serializer
          self._deserialize = deserializer
          self._config = config
  
      @distributed_trace
      def get_no_item_name_pages(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResultValue"]
          """A paging operation that must return result of the default 'value' node.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResultValue or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValue]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResultValue"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_no_item_name_pages_request(
                      template_url=self.get_no_item_name_pages.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_no_item_name_pages_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResultValue", pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_no_item_name_pages.metadata = {"url": "/paging/noitemname"}  # type: ignore
  
      @distributed_trace
      def get_null_next_link_name_pages(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that must ignore any kind of nextLink, and stop after page 1.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_null_next_link_name_pages_request(
                      template_url=self.get_null_next_link_name_pages.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_null_next_link_name_pages_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_null_next_link_name_pages.metadata = {"url": "/paging/nullnextlink"}  # type: ignore
  
      @distributed_trace
      def get_single_pages(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that finishes on the first call without a nextlink.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_single_pages_request(
                      template_url=self.get_single_pages.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_single_pages_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_single_pages.metadata = {"url": "/paging/single"}  # type: ignore
  
      @distributed_trace
      def first_response_empty(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResultValue"]
          """A paging operation whose first response's items list is empty, but still returns a next link.
          Second (and final) call, will give you an items list of 1.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResultValue or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValue]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResultValue"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_first_response_empty_request(
                      template_url=self.first_response_empty.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_first_response_empty_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResultValue", pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      first_response_empty.metadata = {"url": "/paging/firstResponseEmpty/1"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages(
          self,
          client_request_id=None,  # type: Optional[str]
          paging_get_multiple_pages_options=None,  # type: Optional["_models.PagingGetMultiplePagesOptions"]
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that includes a nextLink that has 10 pages.
  
          :param client_request_id:
          :type client_request_id: str
          :param paging_get_multiple_pages_options: Parameter group.
          :type paging_get_multiple_pages_options: ~paging.models.PagingGetMultiplePagesOptions
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
                  _maxresults = None
                  _timeout = None
                  if paging_get_multiple_pages_options is not None:
                      _maxresults = paging_get_multiple_pages_options.maxresults
                      _timeout = paging_get_multiple_pages_options.timeout
  
                  request = build_get_multiple_pages_request(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=self.get_multiple_pages.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
                  _maxresults = None
                  _timeout = None
                  if paging_get_multiple_pages_options is not None:
                      _maxresults = paging_get_multiple_pages_options.maxresults
                      _timeout = paging_get_multiple_pages_options.timeout
  
                  request = build_get_multiple_pages_request(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages.metadata = {"url": "/paging/multiple"}  # type: ignore
  
      @distributed_trace
      def get_with_query_params(
          self,
          required_query_parameter,  # type: int
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that includes a next operation. It has a different query parameter from it's
          next operation nextOperationWithQueryParams. Returns a ProductResult.
  
          :param required_query_parameter: A required integer query parameter. Put in value '100' to pass
           test.
          :type required_query_parameter: int
          :keyword query_constant: A constant. Must be True and will be passed as a query parameter to
           nextOperationWithQueryParams. The default value is True. Note that overriding this default
           value may result in unsupported behavior.
          :paramtype query_constant: bool
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          query_constant = kwargs.pop("query_constant", True)  # type: bool
  
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_with_query_params_request(
                      query_constant=query_constant,
                      required_query_parameter=required_query_parameter,
                      template_url=self.get_with_query_params.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_next_operation_with_query_params_request(
                      query_constant=query_constant,
                      template_url="/paging/multiple/nextOperationWithQueryParams",
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_with_query_params.metadata = {"url": "/paging/multiple/getWithQueryParams"}  # type: ignore
  
      @distributed_trace
      def get_odata_multiple_pages(
          self,
          client_request_id=None,  # type: Optional[str]
          paging_get_odata_multiple_pages_options=None,  # type: Optional["_models.PagingGetOdataMultiplePagesOptions"]
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.OdataProductResult"]
          """A paging operation that includes a nextLink in odata format that has 10 pages.
  
          :param client_request_id:
          :type client_request_id: str
          :param paging_get_odata_multiple_pages_options: Parameter group.
          :type paging_get_odata_multiple_pages_options:
           ~paging.models.PagingGetOdataMultiplePagesOptions
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either OdataProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.OdataProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
                  _maxresults = None
                  _timeout = None
                  if paging_get_odata_multiple_pages_options is not None:
                      _maxresults = paging_get_odata_multiple_pages_options.maxresults
                      _timeout = paging_get_odata_multiple_pages_options.timeout
  
                  request = build_get_odata_multiple_pages_request(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=self.get_odata_multiple_pages.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
                  _maxresults = None
                  _timeout = None
                  if paging_get_odata_multiple_pages_options is not None:
                      _maxresults = paging_get_odata_multiple_pages_options.maxresults
                      _timeout = paging_get_odata_multiple_pages_options.timeout
  
                  request = build_get_odata_multiple_pages_request(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("OdataProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.odata_next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_odata_multiple_pages.metadata = {"url": "/paging/multiple/odata"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_with_offset(
          self,
          paging_get_multiple_pages_with_offset_options,  # type: "_models.PagingGetMultiplePagesWithOffsetOptions"
          client_request_id=None,  # type: Optional[str]
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that includes a nextLink that has 10 pages.
  
          :param paging_get_multiple_pages_with_offset_options: Parameter group.
          :type paging_get_multiple_pages_with_offset_options:
           ~paging.models.PagingGetMultiplePagesWithOffsetOptions
          :param client_request_id:
          :type client_request_id: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
                  _maxresults = None
                  _offset = None
                  _timeout = None
                  if paging_get_multiple_pages_with_offset_options is not None:
                      _maxresults = paging_get_multiple_pages_with_offset_options.maxresults
                      _offset = paging_get_multiple_pages_with_offset_options.offset
                      _timeout = paging_get_multiple_pages_with_offset_options.timeout
  
                  request = build_get_multiple_pages_with_offset_request(
                      offset=_offset,
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=self.get_multiple_pages_with_offset.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
                  _maxresults = None
                  _offset = None
                  _timeout = None
                  if paging_get_multiple_pages_with_offset_options is not None:
                      _maxresults = paging_get_multiple_pages_with_offset_options.maxresults
                      _offset = paging_get_multiple_pages_with_offset_options.offset
                      _timeout = paging_get_multiple_pages_with_offset_options.timeout
  
                  request = build_get_multiple_pages_with_offset_request(
                      offset=_offset,
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_with_offset.metadata = {"url": "/paging/multiple/withpath/{offset}"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_retry_first(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that fails on the first call with 500 and then retries and then get a
          response including a nextLink that has 10 pages.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_multiple_pages_retry_first_request(
                      template_url=self.get_multiple_pages_retry_first.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_multiple_pages_retry_first_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_retry_first.metadata = {"url": "/paging/multiple/retryfirst"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_retry_second(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that includes a nextLink that has 10 pages, of which the 2nd call fails
          first with 500. The client should retry and finish all 10 pages eventually.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_multiple_pages_retry_second_request(
                      template_url=self.get_multiple_pages_retry_second.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_multiple_pages_retry_second_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_retry_second.metadata = {"url": "/paging/multiple/retrysecond"}  # type: ignore
  
      @distributed_trace
      def get_single_pages_failure(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that receives a 400 on the first call.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_single_pages_failure_request(
                      template_url=self.get_single_pages_failure.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_single_pages_failure_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_single_pages_failure.metadata = {"url": "/paging/single/failure"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_failure(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that receives a 400 on the second call.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_multiple_pages_failure_request(
                      template_url=self.get_multiple_pages_failure.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_multiple_pages_failure_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_failure.metadata = {"url": "/paging/multiple/failure"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_failure_uri(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResult"]
          """A paging operation that receives an invalid nextLink.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_multiple_pages_failure_uri_request(
                      template_url=self.get_multiple_pages_failure_uri.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_multiple_pages_failure_uri_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_failure_uri.metadata = {"url": "/paging/multiple/failureuri"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_fragment_next_link(
          self,
          api_version,  # type: str
          tenant,  # type: str
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.OdataProductResult"]
          """A paging operation that doesn't return a full URL, just a fragment.
  
          :param api_version: Sets the api version to use.
          :type api_version: str
          :param tenant: Sets the tenant to use.
          :type tenant: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either OdataProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.OdataProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_multiple_pages_fragment_next_link_request(
                      tenant=tenant,
                      api_version=api_version,
                      template_url=self.get_multiple_pages_fragment_next_link.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_next_fragment_request(
                      tenant=tenant,
                      next_link=next_link,
                      api_version=api_version,
                      template_url="/paging/multiple/fragment/{tenant}/{nextLink}",
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("OdataProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.odata_next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_fragment_next_link.metadata = {"url": "/paging/multiple/fragment/{tenant}"}  # type: ignore
  
      @distributed_trace
      def get_multiple_pages_fragment_with_grouping_next_link(
          self,
          custom_parameter_group,  # type: "_models.CustomParameterGroup"
          **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.OdataProductResult"]
          """A paging operation that doesn't return a full URL, just a fragment with parameters grouped.
  
          :param custom_parameter_group: Parameter group.
          :type custom_parameter_group: ~paging.models.CustomParameterGroup
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either OdataProductResult or the result of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.OdataProductResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.OdataProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
                  _api_version = None
                  _tenant = None
                  if custom_parameter_group is not None:
                      _api_version = custom_parameter_group.api_version
                      _tenant = custom_parameter_group.tenant
  
                  request = build_get_multiple_pages_fragment_with_grouping_next_link_request(
                      tenant=_tenant,
                      api_version=_api_version,
                      template_url=self.get_multiple_pages_fragment_with_grouping_next_link.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
                  _api_version = None
                  _tenant = None
                  if custom_parameter_group is not None:
                      _api_version = custom_parameter_group.api_version
                      _tenant = custom_parameter_group.tenant
  
                  request = build_next_fragment_with_grouping_request(
                      tenant=_tenant,
                      next_link=next_link,
                      api_version=_api_version,
                      template_url="/paging/multiple/fragmentwithgrouping/{tenant}/{nextLink}",
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("OdataProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.odata_next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_multiple_pages_fragment_with_grouping_next_link.metadata = {"url": "/paging/multiple/fragmentwithgrouping/{tenant}"}  # type: ignore
  
      def _get_multiple_pages_lro_initial(
          self,
          client_request_id=None,  # type: Optional[str]
          paging_get_multiple_pages_lro_options=None,  # type: Optional["_models.PagingGetMultiplePagesLroOptions"]
          **kwargs  # type: Any
      ):
          # type: (...) -> "_models.ProductResult"
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          _maxresults = None
          _timeout = None
          if paging_get_multiple_pages_lro_options is not None:
              _maxresults = paging_get_multiple_pages_lro_options.maxresults
              _timeout = paging_get_multiple_pages_lro_options.timeout
  
          request = build_get_multiple_pages_lro_request_initial(
              client_request_id=client_request_id,
              maxresults=_maxresults,
              timeout=_timeout,
              template_url=self._get_multiple_pages_lro_initial.metadata["url"],
          )
          request = _convert_request(request)
          request.url = self._client.format_url(request.url)
  
          pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
          response = pipeline_response.http_response
  
          if response.status_code not in [202]:
              map_error(status_code=response.status_code, response=response, error_map=error_map)
              raise HttpResponseError(response=response)
  
          deserialized = self._deserialize("ProductResult", pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
  
      _get_multiple_pages_lro_initial.metadata = {"url": "/paging/multiple/lro"}  # type: ignore
  
      @distributed_trace
      def begin_get_multiple_pages_lro(
          self,
          client_request_id=None,  # type: Optional[str]
          paging_get_multiple_pages_lro_options=None,  # type: Optional["_models.PagingGetMultiplePagesLroOptions"]
          **kwargs  # type: Any
      ):
          # type: (...) -> LROPoller[ItemPaged["_models.ProductResult"]]
          """A long-running paging operation that includes a nextLink that has 10 pages.
  
          :param client_request_id:
          :type client_request_id: str
          :param paging_get_multiple_pages_lro_options: Parameter group.
          :type paging_get_multiple_pages_lro_options: ~paging.models.PagingGetMultiplePagesLroOptions
          :keyword callable cls: A custom type or function that will be passed the direct response
          :keyword str continuation_token: A continuation token to restart a poller from a saved state.
          :keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
           this operation to not poll, or pass in your own initialized polling object for a personal
           polling strategy.
          :paramtype polling: bool or ~azure.core.polling.PollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
           Retry-After header is present.
          :return: An instance of LROPoller that returns an iterator like instance of either
           ProductResult or the result of cls(response)
          :rtype:
           ~azure.core.polling.LROPoller[~azure.core.paging.ItemPaged[~paging.models.ProductResult]]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
  
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
                  _maxresults = None
                  _timeout = None
                  if paging_get_multiple_pages_lro_options is not None:
                      _maxresults = paging_get_multiple_pages_lro_options.maxresults
                      _timeout = paging_get_multiple_pages_lro_options.timeout
  
                  request = build_get_multiple_pages_lro_request_initial(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=self.begin_get_multiple_pages_lro.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
                  _maxresults = None
                  _timeout = None
                  if paging_get_multiple_pages_lro_options is not None:
                      _maxresults = paging_get_multiple_pages_lro_options.maxresults
                      _timeout = paging_get_multiple_pages_lro_options.timeout
  
                  request = build_get_multiple_pages_lro_request_initial(
                      client_request_id=client_request_id,
                      maxresults=_maxresults,
                      timeout=_timeout,
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResult", pipeline_response)
              list_of_elem = deserialized.values
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          polling = kwargs.pop("polling", True)  # type: Union[bool, azure.core.polling.PollingMethod]
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResult"]
          lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
          cont_token = kwargs.pop("continuation_token", None)  # type: Optional[str]
          if cont_token is None:
              raw_result = self._get_multiple_pages_lro_initial(
                  client_request_id=client_request_id,
                  paging_get_multiple_pages_lro_options=paging_get_multiple_pages_lro_options,
                  cls=lambda x, y, z: x,
                  **kwargs
              )
          kwargs.pop("error_map", None)
  
          def get_long_running_output(pipeline_response):
              def internal_get_next(next_link=None):
                  if next_link is None:
                      return pipeline_response
                  else:
                      return get_next(next_link)
  
              return ItemPaged(internal_get_next, extract_data)
  
          if polling is True:
              polling_method = LROBasePolling(lro_delay, **kwargs)
          elif polling is False:
              polling_method = NoPolling()
          else:
              polling_method = polling
          if cont_token:
              return LROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output,
              )
          else:
              return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
  
      begin_get_multiple_pages_lro.metadata = {"url": "/paging/multiple/lro"}  # type: ignore
  
      @distributed_trace
      def get_paging_model_with_item_name_with_xms_client_name(
          self, **kwargs  # type: Any
      ):
          # type: (...) -> Iterable["_models.ProductResultValueWithXMSClientName"]
          """A paging operation that returns a paging model whose item name is is overriden by
          x-ms-client-name 'indexes'.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProductResultValueWithXMSClientName or the result
           of cls(response)
          :rtype: ~azure.core.paging.ItemPaged[~paging.models.ProductResultValueWithXMSClientName]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop("cls", None)  # type: ClsType["_models.ProductResultValueWithXMSClientName"]
          error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
          error_map.update(kwargs.pop("error_map", {}))
  
          def prepare_request(next_link=None):
              if not next_link:
  
                  request = build_get_paging_model_with_item_name_with_xms_client_name_request(
                      template_url=self.get_paging_model_with_item_name_with_xms_client_name.metadata["url"],
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
  
              else:
  
                  request = build_get_paging_model_with_item_name_with_xms_client_name_request(
                      template_url=next_link,
                  )
                  request = _convert_request(request)
                  request.url = self._client.format_url(request.url)
                  request.method = "GET"
              return request
  
          def extract_data(pipeline_response):
              deserialized = self._deserialize("ProductResultValueWithXMSClientName", pipeline_response)
              list_of_elem = deserialized.indexes
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, iter(list_of_elem)
  
          def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response)
  
              return pipeline_response
  
          return ItemPaged(get_next, extract_data)
  
      get_paging_model_with_item_name_with_xms_client_name.metadata = {"url": "/paging/itemNameWithXMSClientName"}  # type: ignore
  