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.
  # --------------------------------------------------------------------------
  from typing import Any, AsyncIterable, Callable, Dict, Generic, List, Optional, TypeVar, Union
  import warnings
  
  from azure.core.async_paging import AsyncItemPaged, AsyncList
  from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
  from azure.core.pipeline import PipelineResponse
  from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
  from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
  from azure.mgmt.core.exceptions import ARMErrorFormat
  from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
  
  from ... import models as _models
  
  T = TypeVar('T')
  ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
  
  class IotDpsResourceOperations:
      """IotDpsResourceOperations async 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: ~azure.mgmt.iothubprovisioningservices.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) -> None:
          self._client = client
          self._serialize = serializer
          self._deserialize = deserializer
          self._config = config
  
      async def get(
          self,
          provisioning_service_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> "_models.ProvisioningServiceDescription":
          """Get the non-security related metadata of the provisioning service.
  
          Get the metadata of the provisioning service without SAS keys.
  
          :param provisioning_service_name: Name of the provisioning service to retrieve.
          :type provisioning_service_name: str
          :param resource_group_name: Resource group name.
          :type resource_group_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: ProvisioningServiceDescription, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescription"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.get.metadata['url']  # type: ignore
          path_format_arguments = {
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def _create_or_update_initial(
          self,
          resource_group_name: str,
          provisioning_service_name: str,
          iot_dps_description: "_models.ProvisioningServiceDescription",
          **kwargs: Any
      ) -> "_models.ProvisioningServiceDescription":
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescription"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          content_type = kwargs.pop("content_type", "application/json")
          accept = "application/json"
  
          # Construct URL
          url = self._create_or_update_initial.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          body_content_kwargs = {}  # type: Dict[str, Any]
          body_content = self._serialize.body(iot_dps_description, 'ProvisioningServiceDescription')
          body_content_kwargs['content'] = body_content
          request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
          pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
          response = pipeline_response.http_response
  
          if response.status_code not in [200, 201]:
              map_error(status_code=response.status_code, response=response, error_map=error_map)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          if response.status_code == 200:
              deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
          if response.status_code == 201:
              deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def begin_create_or_update(
          self,
          resource_group_name: str,
          provisioning_service_name: str,
          iot_dps_description: "_models.ProvisioningServiceDescription",
          **kwargs: Any
      ) -> AsyncLROPoller["_models.ProvisioningServiceDescription"]:
          """Create or update the metadata of the provisioning service.
  
          Create or update the metadata of the provisioning service. The usual pattern to modify a
          property is to retrieve the provisioning service metadata and security metadata, and then
          combine them with the modified values in a new body to update the provisioning service.
  
          :param resource_group_name: Resource group identifier.
          :type resource_group_name: str
          :param provisioning_service_name: Name of provisioning service to create or update.
          :type provisioning_service_name: str
          :param iot_dps_description: Description of the provisioning service to create or update.
          :type iot_dps_description: ~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription
          :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 AsyncARMPolling.
           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.AsyncPollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
          :return: An instance of AsyncLROPoller that returns either ProvisioningServiceDescription or the result of cls(response)
          :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription]
          :raises ~azure.core.exceptions.HttpResponseError:
          """
          polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescription"]
          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 = await self._create_or_update_initial(
                  resource_group_name=resource_group_name,
                  provisioning_service_name=provisioning_service_name,
                  iot_dps_description=iot_dps_description,
                  cls=lambda x,y,z: x,
                  **kwargs
              )
  
          kwargs.pop('error_map', None)
          kwargs.pop('content_type', None)
  
          def get_long_running_output(pipeline_response):
              deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
              if cls:
                  return cls(pipeline_response, deserialized, {})
              return deserialized
  
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
          }
  
          if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
          elif polling is False: polling_method = AsyncNoPolling()
          else: polling_method = polling
          if cont_token:
              return AsyncLROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output
              )
          else:
              return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
      begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def _update_initial(
          self,
          resource_group_name: str,
          provisioning_service_name: str,
          provisioning_service_tags: "_models.TagsResource",
          **kwargs: Any
      ) -> "_models.ProvisioningServiceDescription":
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescription"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          content_type = kwargs.pop("content_type", "application/json")
          accept = "application/json"
  
          # Construct URL
          url = self._update_initial.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          body_content_kwargs = {}  # type: Dict[str, Any]
          body_content = self._serialize.body(provisioning_service_tags, 'TagsResource')
          body_content_kwargs['content'] = body_content
          request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
          pipeline_response = await 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, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def begin_update(
          self,
          resource_group_name: str,
          provisioning_service_name: str,
          provisioning_service_tags: "_models.TagsResource",
          **kwargs: Any
      ) -> AsyncLROPoller["_models.ProvisioningServiceDescription"]:
          """Update an existing provisioning service's tags.
  
          Update an existing provisioning service's tags. to update other fields use the CreateOrUpdate
          method.
  
          :param resource_group_name: Resource group identifier.
          :type resource_group_name: str
          :param provisioning_service_name: Name of provisioning service to create or update.
          :type provisioning_service_name: str
          :param provisioning_service_tags: Updated tag information to set into the provisioning service
           instance.
          :type provisioning_service_tags: ~azure.mgmt.iothubprovisioningservices.models.TagsResource
          :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 AsyncARMPolling.
           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.AsyncPollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
          :return: An instance of AsyncLROPoller that returns either ProvisioningServiceDescription or the result of cls(response)
          :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescription]
          :raises ~azure.core.exceptions.HttpResponseError:
          """
          polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescription"]
          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 = await self._update_initial(
                  resource_group_name=resource_group_name,
                  provisioning_service_name=provisioning_service_name,
                  provisioning_service_tags=provisioning_service_tags,
                  cls=lambda x,y,z: x,
                  **kwargs
              )
  
          kwargs.pop('error_map', None)
          kwargs.pop('content_type', None)
  
          def get_long_running_output(pipeline_response):
              deserialized = self._deserialize('ProvisioningServiceDescription', pipeline_response)
  
              if cls:
                  return cls(pipeline_response, deserialized, {})
              return deserialized
  
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
          }
  
          if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
          elif polling is False: polling_method = AsyncNoPolling()
          else: polling_method = polling
          if cont_token:
              return AsyncLROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output
              )
          else:
              return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
      begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def _delete_initial(
          self,
          provisioning_service_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> None:
          cls = kwargs.pop('cls', None)  # type: ClsType[None]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self._delete_initial.metadata['url']  # type: ignore
          path_format_arguments = {
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.delete(url, query_parameters, header_parameters)
          pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
          response = pipeline_response.http_response
  
          if response.status_code not in [200, 202, 204, 404]:
              map_error(status_code=response.status_code, response=response, error_map=error_map)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          if cls:
              return cls(pipeline_response, None, {})
  
      _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      async def begin_delete(
          self,
          provisioning_service_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> AsyncLROPoller[None]:
          """Delete the Provisioning Service.
  
          Deletes the Provisioning Service.
  
          :param provisioning_service_name: Name of provisioning service to delete.
          :type provisioning_service_name: str
          :param resource_group_name: Resource group identifier.
          :type resource_group_name: str
          :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 AsyncARMPolling.
           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.AsyncPollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
          :return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
          :rtype: ~azure.core.polling.AsyncLROPoller[None]
          :raises ~azure.core.exceptions.HttpResponseError:
          """
          polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
          cls = kwargs.pop('cls', None)  # type: ClsType[None]
          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 = await self._delete_initial(
                  provisioning_service_name=provisioning_service_name,
                  resource_group_name=resource_group_name,
                  cls=lambda x,y,z: x,
                  **kwargs
              )
  
          kwargs.pop('error_map', None)
          kwargs.pop('content_type', None)
  
          def get_long_running_output(pipeline_response):
              if cls:
                  return cls(pipeline_response, None, {})
  
          path_format_arguments = {
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
          }
  
          if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
          elif polling is False: polling_method = AsyncNoPolling()
          else: polling_method = polling
          if cont_token:
              return AsyncLROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output
              )
          else:
              return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
      begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}'}  # type: ignore
  
      def list_by_subscription(
          self,
          **kwargs: Any
      ) -> AsyncIterable["_models.ProvisioningServiceDescriptionListResult"]:
          """Get all the provisioning services in a subscription.
  
          List all the provisioning services for a given subscription id.
  
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response)
          :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescriptionListResult"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          def prepare_request(next_link=None):
              # Construct headers
              header_parameters = {}  # type: Dict[str, Any]
              header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
              if not next_link:
                  # Construct URL
                  url = self.list_by_subscription.metadata['url']  # type: ignore
                  path_format_arguments = {
                      'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
                  }
                  url = self._client.format_url(url, **path_format_arguments)
                  # Construct parameters
                  query_parameters = {}  # type: Dict[str, Any]
                  query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
                  request = self._client.get(url, query_parameters, header_parameters)
              else:
                  url = next_link
                  query_parameters = {}  # type: Dict[str, Any]
                  request = self._client.get(url, query_parameters, header_parameters)
              return request
  
          async def extract_data(pipeline_response):
              deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, AsyncList(list_of_elem)
  
          async def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
              return pipeline_response
  
          return AsyncItemPaged(
              get_next, extract_data
          )
      list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/provisioningServices'}  # type: ignore
  
      def list_by_resource_group(
          self,
          resource_group_name: str,
          **kwargs: Any
      ) -> AsyncIterable["_models.ProvisioningServiceDescriptionListResult"]:
          """Get a list of all provisioning services in the given resource group.
  
          :param resource_group_name: Resource group identifier.
          :type resource_group_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either ProvisioningServiceDescriptionListResult or the result of cls(response)
          :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.ProvisioningServiceDescriptionListResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.ProvisioningServiceDescriptionListResult"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          def prepare_request(next_link=None):
              # Construct headers
              header_parameters = {}  # type: Dict[str, Any]
              header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
              if not next_link:
                  # Construct URL
                  url = self.list_by_resource_group.metadata['url']  # type: ignore
                  path_format_arguments = {
                      'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                  }
                  url = self._client.format_url(url, **path_format_arguments)
                  # Construct parameters
                  query_parameters = {}  # type: Dict[str, Any]
                  query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
                  request = self._client.get(url, query_parameters, header_parameters)
              else:
                  url = next_link
                  query_parameters = {}  # type: Dict[str, Any]
                  request = self._client.get(url, query_parameters, header_parameters)
              return request
  
          async def extract_data(pipeline_response):
              deserialized = self._deserialize('ProvisioningServiceDescriptionListResult', pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, AsyncList(list_of_elem)
  
          async def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
              return pipeline_response
  
          return AsyncItemPaged(
              get_next, extract_data
          )
      list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices'}  # type: ignore
  
      async def get_operation_result(
          self,
          operation_id: str,
          resource_group_name: str,
          provisioning_service_name: str,
          asyncinfo: str = "true",
          **kwargs: Any
      ) -> "_models.AsyncOperationResult":
          """Gets the status of a long running operation, such as create, update or delete a provisioning
          service.
  
          :param operation_id: Operation id corresponding to long running operation. Use this to poll for
           the status.
          :type operation_id: str
          :param resource_group_name: Resource group identifier.
          :type resource_group_name: str
          :param provisioning_service_name: Name of provisioning service that the operation is running
           on.
          :type provisioning_service_name: str
          :param asyncinfo: Async header used to poll on the status of the operation, obtained while
           creating the long running operation.
          :type asyncinfo: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: AsyncOperationResult, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.AsyncOperationResult
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.AsyncOperationResult"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.get_operation_result.metadata['url']  # type: ignore
          path_format_arguments = {
              'operationId': self._serialize.url("operation_id", operation_id, 'str'),
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['asyncinfo'] = self._serialize.query("asyncinfo", asyncinfo, 'str')
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('AsyncOperationResult', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      get_operation_result.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/operationresults/{operationId}'}  # type: ignore
  
      def list_valid_skus(
          self,
          provisioning_service_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> AsyncIterable["_models.IotDpsSkuDefinitionListResult"]:
          """Get the list of valid SKUs for a provisioning service.
  
          Gets the list of valid SKUs and tiers for a provisioning service.
  
          :param provisioning_service_name: Name of provisioning service.
          :type provisioning_service_name: str
          :param resource_group_name: Name of resource group.
          :type resource_group_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either IotDpsSkuDefinitionListResult or the result of cls(response)
          :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.IotDpsSkuDefinitionListResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.IotDpsSkuDefinitionListResult"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          def prepare_request(next_link=None):
              # Construct headers
              header_parameters = {}  # type: Dict[str, Any]
              header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
              if not next_link:
                  # Construct URL
                  url = self.list_valid_skus.metadata['url']  # type: ignore
                  path_format_arguments = {
                      'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
                      'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                  }
                  url = self._client.format_url(url, **path_format_arguments)
                  # Construct parameters
                  query_parameters = {}  # type: Dict[str, Any]
                  query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
                  request = self._client.get(url, query_parameters, header_parameters)
              else:
                  url = next_link
                  query_parameters = {}  # type: Dict[str, Any]
                  request = self._client.get(url, query_parameters, header_parameters)
              return request
  
          async def extract_data(pipeline_response):
              deserialized = self._deserialize('IotDpsSkuDefinitionListResult', pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, AsyncList(list_of_elem)
  
          async def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
              return pipeline_response
  
          return AsyncItemPaged(
              get_next, extract_data
          )
      list_valid_skus.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/skus'}  # type: ignore
  
      async def check_provisioning_service_name_availability(
          self,
          arguments: "_models.OperationInputs",
          **kwargs: Any
      ) -> "_models.NameAvailabilityInfo":
          """Check if a provisioning service name is available.
  
          Check if a provisioning service name is available. This will validate if the name is
          syntactically valid and if the name is usable.
  
          :param arguments: Set the name parameter in the OperationInputs structure to the name of the
           provisioning service to check.
          :type arguments: ~azure.mgmt.iothubprovisioningservices.models.OperationInputs
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: NameAvailabilityInfo, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.NameAvailabilityInfo
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.NameAvailabilityInfo"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          content_type = kwargs.pop("content_type", "application/json")
          accept = "application/json"
  
          # Construct URL
          url = self.check_provisioning_service_name_availability.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          body_content_kwargs = {}  # type: Dict[str, Any]
          body_content = self._serialize.body(arguments, 'OperationInputs')
          body_content_kwargs['content'] = body_content
          request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('NameAvailabilityInfo', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      check_provisioning_service_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkProvisioningServiceNameAvailability'}  # type: ignore
  
      def list_keys(
          self,
          provisioning_service_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> AsyncIterable["_models.SharedAccessSignatureAuthorizationRuleListResult"]:
          """Get the security metadata for a provisioning service.
  
          List the primary and secondary keys for a provisioning service.
  
          :param provisioning_service_name: The provisioning service name to get the shared access keys
           for.
          :type provisioning_service_name: str
          :param resource_group_name: resource group name.
          :type resource_group_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: An iterator like instance of either SharedAccessSignatureAuthorizationRuleListResult or the result of cls(response)
          :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleListResult]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleListResult"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          def prepare_request(next_link=None):
              # Construct headers
              header_parameters = {}  # type: Dict[str, Any]
              header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
              if not next_link:
                  # Construct URL
                  url = self.list_keys.metadata['url']  # type: ignore
                  path_format_arguments = {
                      'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
                      'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                  }
                  url = self._client.format_url(url, **path_format_arguments)
                  # Construct parameters
                  query_parameters = {}  # type: Dict[str, Any]
                  query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
                  request = self._client.post(url, query_parameters, header_parameters)
              else:
                  url = next_link
                  query_parameters = {}  # type: Dict[str, Any]
                  request = self._client.get(url, query_parameters, header_parameters)
              return request
  
          async def extract_data(pipeline_response):
              deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleListResult', pipeline_response)
              list_of_elem = deserialized.value
              if cls:
                  list_of_elem = cls(list_of_elem)
              return deserialized.next_link or None, AsyncList(list_of_elem)
  
          async def get_next(next_link=None):
              request = prepare_request(next_link)
  
              pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
              response = pipeline_response.http_response
  
              if response.status_code not in [200]:
                  error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
                  map_error(status_code=response.status_code, response=response, error_map=error_map)
                  raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
              return pipeline_response
  
          return AsyncItemPaged(
              get_next, extract_data
          )
      list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/listkeys'}  # type: ignore
  
      async def list_keys_for_key_name(
          self,
          provisioning_service_name: str,
          key_name: str,
          resource_group_name: str,
          **kwargs: Any
      ) -> "_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription":
          """Get a shared access policy by name from a provisioning service.
  
          List primary and secondary keys for a specific key name.
  
          :param provisioning_service_name: Name of the provisioning service.
          :type provisioning_service_name: str
          :param key_name: Logical key name to get key-values for.
          :type key_name: str
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: SharedAccessSignatureAuthorizationRuleAccessRightsDescription, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.SharedAccessSignatureAuthorizationRuleAccessRightsDescription"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.list_keys_for_key_name.metadata['url']  # type: ignore
          path_format_arguments = {
              'provisioningServiceName': self._serialize.url("provisioning_service_name", provisioning_service_name, 'str'),
              'keyName': self._serialize.url("key_name", key_name, 'str'),
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.post(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('SharedAccessSignatureAuthorizationRuleAccessRightsDescription', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      list_keys_for_key_name.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{provisioningServiceName}/keys/{keyName}/listkeys'}  # type: ignore
  
      async def list_private_link_resources(
          self,
          resource_group_name: str,
          resource_name: str,
          **kwargs: Any
      ) -> "_models.PrivateLinkResources":
          """List private link resources.
  
          List private link resources for the given provisioning service.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: PrivateLinkResources, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateLinkResources
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.PrivateLinkResources"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.list_private_link_resources.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('PrivateLinkResources', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      list_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources'}  # type: ignore
  
      async def get_private_link_resources(
          self,
          resource_group_name: str,
          resource_name: str,
          group_id: str,
          **kwargs: Any
      ) -> "_models.GroupIdInformation":
          """Get the specified private link resource.
  
          Get the specified private link resource for the given provisioning service.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :param group_id: The name of the private link resource.
          :type group_id: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: GroupIdInformation, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.GroupIdInformation
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.GroupIdInformation"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.get_private_link_resources.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'groupId': self._serialize.url("group_id", group_id, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('GroupIdInformation', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      get_private_link_resources.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateLinkResources/{groupId}'}  # type: ignore
  
      async def list_private_endpoint_connections(
          self,
          resource_group_name: str,
          resource_name: str,
          **kwargs: Any
      ) -> List["_models.PrivateEndpointConnection"]:
          """List private endpoint connections.
  
          List private endpoint connection properties.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: list of PrivateEndpointConnection, or the result of cls(response)
          :rtype: list[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection]
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType[List["_models.PrivateEndpointConnection"]]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.list_private_endpoint_connections.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('[PrivateEndpointConnection]', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      list_private_endpoint_connections.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections'}  # type: ignore
  
      async def get_private_endpoint_connection(
          self,
          resource_group_name: str,
          resource_name: str,
          private_endpoint_connection_name: str,
          **kwargs: Any
      ) -> "_models.PrivateEndpointConnection":
          """Get private endpoint connection.
  
          Get private endpoint connection properties.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :param private_endpoint_connection_name: The name of the private endpoint connection.
          :type private_endpoint_connection_name: str
          :keyword callable cls: A custom type or function that will be passed the direct response
          :return: PrivateEndpointConnection, or the result of cls(response)
          :rtype: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection
          :raises: ~azure.core.exceptions.HttpResponseError
          """
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.PrivateEndpointConnection"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self.get_private_endpoint_connection.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.get(url, query_parameters, header_parameters)
          pipeline_response = await 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)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      get_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'}  # type: ignore
  
      async def _create_or_update_private_endpoint_connection_initial(
          self,
          resource_group_name: str,
          resource_name: str,
          private_endpoint_connection_name: str,
          private_endpoint_connection: "_models.PrivateEndpointConnection",
          **kwargs: Any
      ) -> "_models.PrivateEndpointConnection":
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.PrivateEndpointConnection"]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          content_type = kwargs.pop("content_type", "application/json")
          accept = "application/json"
  
          # Construct URL
          url = self._create_or_update_private_endpoint_connection_initial.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          body_content_kwargs = {}  # type: Dict[str, Any]
          body_content = self._serialize.body(private_endpoint_connection, 'PrivateEndpointConnection')
          body_content_kwargs['content'] = body_content
          request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
          pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
          response = pipeline_response.http_response
  
          if response.status_code not in [200, 201]:
              map_error(status_code=response.status_code, response=response, error_map=error_map)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          if response.status_code == 200:
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
          if response.status_code == 201:
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      _create_or_update_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'}  # type: ignore
  
      async def begin_create_or_update_private_endpoint_connection(
          self,
          resource_group_name: str,
          resource_name: str,
          private_endpoint_connection_name: str,
          private_endpoint_connection: "_models.PrivateEndpointConnection",
          **kwargs: Any
      ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]:
          """Create or update private endpoint connection.
  
          Create or update the status of a private endpoint connection with the specified name.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :param private_endpoint_connection_name: The name of the private endpoint connection.
          :type private_endpoint_connection_name: str
          :param private_endpoint_connection: The private endpoint connection with updated properties.
          :type private_endpoint_connection: ~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection
          :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 AsyncARMPolling.
           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.AsyncPollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
          :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response)
          :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection]
          :raises ~azure.core.exceptions.HttpResponseError:
          """
          polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.PrivateEndpointConnection"]
          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 = await self._create_or_update_private_endpoint_connection_initial(
                  resource_group_name=resource_group_name,
                  resource_name=resource_name,
                  private_endpoint_connection_name=private_endpoint_connection_name,
                  private_endpoint_connection=private_endpoint_connection,
                  cls=lambda x,y,z: x,
                  **kwargs
              )
  
          kwargs.pop('error_map', None)
          kwargs.pop('content_type', None)
  
          def get_long_running_output(pipeline_response):
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
              if cls:
                  return cls(pipeline_response, deserialized, {})
              return deserialized
  
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
          }
  
          if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
          elif polling is False: polling_method = AsyncNoPolling()
          else: polling_method = polling
          if cont_token:
              return AsyncLROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output
              )
          else:
              return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
      begin_create_or_update_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'}  # type: ignore
  
      async def _delete_private_endpoint_connection_initial(
          self,
          resource_group_name: str,
          resource_name: str,
          private_endpoint_connection_name: str,
          **kwargs: Any
      ) -> Optional["_models.PrivateEndpointConnection"]:
          cls = kwargs.pop('cls', None)  # type: ClsType[Optional["_models.PrivateEndpointConnection"]]
          error_map = {
              401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
          }
          error_map.update(kwargs.pop('error_map', {}))
          api_version = "2020-03-01"
          accept = "application/json"
  
          # Construct URL
          url = self._delete_private_endpoint_connection_initial.metadata['url']  # type: ignore
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}  # type: Dict[str, Any]
          query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
  
          # Construct headers
          header_parameters = {}  # type: Dict[str, Any]
          header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
  
          request = self._client.delete(url, query_parameters, header_parameters)
          pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
          response = pipeline_response.http_response
  
          if response.status_code not in [200, 202, 204]:
              map_error(status_code=response.status_code, response=response, error_map=error_map)
              error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, response)
              raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
  
          deserialized = None
          if response.status_code == 200:
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
          if response.status_code == 202:
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
          if cls:
              return cls(pipeline_response, deserialized, {})
  
          return deserialized
      _delete_private_endpoint_connection_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'}  # type: ignore
  
      async def begin_delete_private_endpoint_connection(
          self,
          resource_group_name: str,
          resource_name: str,
          private_endpoint_connection_name: str,
          **kwargs: Any
      ) -> AsyncLROPoller["_models.PrivateEndpointConnection"]:
          """Delete private endpoint connection.
  
          Delete private endpoint connection with the specified name.
  
          :param resource_group_name: The name of the resource group that contains the provisioning
           service.
          :type resource_group_name: str
          :param resource_name: The name of the provisioning service.
          :type resource_name: str
          :param private_endpoint_connection_name: The name of the private endpoint connection.
          :type private_endpoint_connection_name: str
          :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 AsyncARMPolling.
           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.AsyncPollingMethod
          :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
          :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the result of cls(response)
          :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.iothubprovisioningservices.models.PrivateEndpointConnection]
          :raises ~azure.core.exceptions.HttpResponseError:
          """
          polling = kwargs.pop('polling', True)  # type: Union[bool, AsyncPollingMethod]
          cls = kwargs.pop('cls', None)  # type: ClsType["_models.PrivateEndpointConnection"]
          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 = await self._delete_private_endpoint_connection_initial(
                  resource_group_name=resource_group_name,
                  resource_name=resource_name,
                  private_endpoint_connection_name=private_endpoint_connection_name,
                  cls=lambda x,y,z: x,
                  **kwargs
              )
  
          kwargs.pop('error_map', None)
          kwargs.pop('content_type', None)
  
          def get_long_running_output(pipeline_response):
              deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
  
              if cls:
                  return cls(pipeline_response, deserialized, {})
              return deserialized
  
          path_format_arguments = {
              'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'resourceName': self._serialize.url("resource_name", resource_name, 'str'),
              'privateEndpointConnectionName': self._serialize.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'),
          }
  
          if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments,  **kwargs)
          elif polling is False: polling_method = AsyncNoPolling()
          else: polling_method = polling
          if cont_token:
              return AsyncLROPoller.from_continuation_token(
                  polling_method=polling_method,
                  continuation_token=cont_token,
                  client=self._client,
                  deserialization_callback=get_long_running_output
              )
          else:
              return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
      begin_delete_private_endpoint_connection.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/provisioningServices/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}'}  # type: ignore
  