# Source code for azure.mgmt.iothub.operations.iot_hub_resource_operations

    # coding=utf-8
    # --------------------------------------------------------------------------
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License. See License.txt in the project root for
    # license information.
    #
    # Code generated by Microsoft (R) AutoRest Code Generator.
    # Changes may cause incorrect behavior and will be lost if the code is
    # regenerated.
    # --------------------------------------------------------------------------

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

    from .. import models

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

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

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

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

            self.config = config

        def get(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get an IotHub.

            Get an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubDescription
             <azure.mgmt.iothub.models.IotHubDescription>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('IotHubDescription', response)

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

            return deserialized

        def create_or_update(
                self, resource_group_name, resource_name, iot_hub_description, custom_headers=None, raw=False, **operation_config):
            """Create or update an IotHub.

            Create or update an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param iot_hub_description: The Iot hub description.
            :type iot_hub_description: :class:`IotHubDescription
             <azure.mgmt.iothub.models.IotHubDescription>`
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :rtype:
             :class:`AzureOperationPoller<msrestazure.azure_operation.AzureOperationPoller>`
             instance that returns :class:`IotHubDescription
             <azure.mgmt.iothub.models.IotHubDescription>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct body
            body_content = self._serialize.body(iot_hub_description, 'IotHubDescription')

            # Construct and send request
            def long_running_send():

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

            def get_long_running_status(status_link, headers=None):

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

            def get_long_running_output(response):

                if response.status_code not in [201]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                deserialized = None

                if response.status_code == 201:
                    deserialized = self._deserialize('IotHubDescription', response)

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

                return deserialized

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

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

        def delete(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Delete an IotHub.

            Delete an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :rtype:
             :class:`AzureOperationPoller<msrestazure.azure_operation.AzureOperationPoller>`
             instance that returns :class:`IotHubDescription
             <azure.mgmt.iothub.models.IotHubDescription>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            def long_running_send():

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

            def get_long_running_status(status_link, headers=None):

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

            def get_long_running_output(response):

                if response.status_code not in [202]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                deserialized = None

                if response.status_code == 202:
                    deserialized = self._deserialize('IotHubDescription', response)

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

                return deserialized

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

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

        def list_by_subscription(
                self, custom_headers=None, raw=False, **operation_config):
            """Get all IotHubs in a subscription.

            Get all IotHubs in a subscription.

            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubDescriptionPaged
             <azure.mgmt.iothub.models.IotHubDescriptionPaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def list_by_resource_group(
                self, resource_group_name, custom_headers=None, raw=False, **operation_config):
            """Get all IotHubs in a Resourcegroup.

            Get all IotHubs in a Resource group.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubDescriptionPaged
             <azure.mgmt.iothub.models.IotHubDescriptionPaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def get_stats(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get IotHub Stats.

            Get IotHub Stats.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`RegistryStatistics
             <azure.mgmt.iothub.models.RegistryStatistics>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubStats'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('RegistryStatistics', response)

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

            return deserialized

        def get_valid_skus(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get Valid Skus.

            Get Valid Skus.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubSkuDescriptionPaged
             <azure.mgmt.iothub.models.IotHubSkuDescriptionPaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def list_event_hub_consumer_groups(
                self, resource_group_name, resource_name, event_hub_endpoint_name, custom_headers=None, raw=False, **operation_config):
            """Get EventHub Consumer Groups for an IotHub.

            Get EventHub Consumer Groups for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param event_hub_endpoint_name: The name of the event hub endpoint.
            :type event_hub_endpoint_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`strPaged <azure.mgmt.iothub.models.strPaged>`
            """
            def internal_paging(next_link=None, raw=False):

                if not next_link:
                    # Construct URL
                    url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups'
                    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'),
                        'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str')
                    }
                    url = self._client.format_url(url, **path_format_arguments)

                    # Construct parameters
                    query_parameters = {}
                    query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def get_event_hub_consumer_group(
                self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
            """Get EventHub Consumer Group for an IotHub.

            Get EventHub Consumer Group for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param event_hub_endpoint_name: The name of the event hub endpoint.
            :type event_hub_endpoint_name: str
            :param name: The name of the consumer group.
            :type name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`EventHubConsumerGroupInfo
             <azure.mgmt.iothub.models.EventHubConsumerGroupInfo>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
            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'),
                'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'),
                'name': self._serialize.url("name", name, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('EventHubConsumerGroupInfo', response)

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

            return deserialized

        def create_event_hub_consumer_group(
                self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
            """Add an EventHub Consumer Group to an IotHub.

            Add an EventHub Consumer Group to an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param event_hub_endpoint_name: The name of the event hub endpoint.
            :type event_hub_endpoint_name: str
            :param name: The name of the consumer group.
            :type name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`EventHubConsumerGroupInfo
             <azure.mgmt.iothub.models.EventHubConsumerGroupInfo>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
            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'),
                'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'),
                'name': self._serialize.url("name", name, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.put(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('EventHubConsumerGroupInfo', response)

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

            return deserialized

        def delete_event_hub_consumer_group(
                self, resource_group_name, resource_name, event_hub_endpoint_name, name, custom_headers=None, raw=False, **operation_config):
            """Delete EventHub Consumer Group for an IotHub.

            Delete EventHub Consumer Group for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param event_hub_endpoint_name: The name of the event hub endpoint.
            :type event_hub_endpoint_name: str
            :param name: The name of the consumer group.
            :type name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: None
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/eventHubEndpoints/{eventHubEndpointName}/ConsumerGroups/{name}'
            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'),
                'eventHubEndpointName': self._serialize.url("event_hub_endpoint_name", event_hub_endpoint_name, 'str'),
                'name': self._serialize.url("name", name, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.delete(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

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

        def list_jobs(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get all the jobs in an IotHub.

            Get all the jobs in an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`JobResponsePaged
             <azure.mgmt.iothub.models.JobResponsePaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def get_job(
                self, resource_group_name, resource_name, job_id, custom_headers=None, raw=False, **operation_config):
            """Get a job in an IotHub.

            Get a job in an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param job_id: The job identifier.
            :type job_id: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`JobResponse <azure.mgmt.iothub.models.JobResponse>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/jobs/{jobId}'
            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'),
                'jobId': self._serialize.url("job_id", job_id, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.get(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('JobResponse', response)

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

            return deserialized

        def get_quota_metrics(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get quota metrics for an IotHub.

            Get quota metrics for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubQuotaMetricInfoPaged
             <azure.mgmt.iothub.models.IotHubQuotaMetricInfoPaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.get(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def check_name_availability(
                self, name, custom_headers=None, raw=False, **operation_config):
            """Check if an IotHub name is available.

            Check if an IotHub name is available.

            :param name: The name of the iot hub.
            :type name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`IotHubNameAvailabilityInfo
             <azure.mgmt.iothub.models.IotHubNameAvailabilityInfo>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            operation_inputs = models.OperationInputs(name=name)

            # Construct URL
            url = '/subscriptions/{subscriptionId}/providers/Microsoft.Devices/checkNameAvailability'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct body
            body_content = self._serialize.body(operation_inputs, 'OperationInputs')

            # Construct and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('IotHubNameAvailabilityInfo', response)

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

            return deserialized

        def list_keys(
                self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
            """Get all keys for an IotHub.

            Get all keys for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`SharedAccessSignatureAuthorizationRulePaged
             <azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRulePaged>`
            """
            def internal_paging(next_link=None, raw=False):

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

                else:
                    url = next_link
                    query_parameters = {}

                # Construct headers
                header_parameters = {}
                header_parameters['Content-Type'] = 'application/json; charset=utf-8'
                if self.config.generate_client_request_id:
                    header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
                if custom_headers:
                    header_parameters.update(custom_headers)
                if self.config.accept_language is not None:
                    header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

                # Construct and send request
                request = self._client.post(url, query_parameters)
                response = self._client.send(
                    request, header_parameters, **operation_config)

                if response.status_code not in [200]:
                    raise models.ErrorDetailsException(self._deserialize, response)

                return response

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

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

            return deserialized

        def get_keys_for_key_name(
                self, resource_group_name, resource_name, key_name, custom_headers=None, raw=False, **operation_config):
            """Get the Key given a specific KeyName for an IotHub.

            Get the Key given a specific KeyName for an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param key_name: The name of the key.
            :type key_name: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`SharedAccessSignatureAuthorizationRule
             <azure.mgmt.iothub.models.SharedAccessSignatureAuthorizationRule>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/IotHubKeys/{keyName}/listkeys'
            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'),
                'keyName': self._serialize.url("key_name", key_name, 'str')
            }
            url = self._client.format_url(url, **path_format_arguments)

            # Construct parameters
            query_parameters = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(request, header_parameters, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('SharedAccessSignatureAuthorizationRule', response)

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

            return deserialized

        def export_devices(
                self, resource_group_name, resource_name, export_blob_container_uri, exclude_keys, custom_headers=None, raw=False, **operation_config):
            """Export all the devices in an IotHub.

            Export all the devices in an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param export_blob_container_uri: The export BLOB container URI.
            :type export_blob_container_uri: str
            :param exclude_keys: The value indicating whether keys should be
             excluded during export.
            :type exclude_keys: bool
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`JobResponse <azure.mgmt.iothub.models.JobResponse>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            export_devices_parameters = models.ExportDevicesRequest(export_blob_container_uri=export_blob_container_uri, exclude_keys=exclude_keys)

            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/exportDevices'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct body
            body_content = self._serialize.body(export_devices_parameters, 'ExportDevicesRequest')

            # Construct and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('JobResponse', response)

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

            return deserialized

        def import_devices(
                self, resource_group_name, resource_name, input_blob_container_uri, output_blob_container_uri, custom_headers=None, raw=False, **operation_config):
            """Import all the devices in an IotHub.

            Import all the devices in an IotHub.

            :param resource_group_name: The name of the resource group.
            :type resource_group_name: str
            :param resource_name: The name of the resource.
            :type resource_name: str
            :param input_blob_container_uri: The input BLOB container URI.
            :type input_blob_container_uri: str
            :param output_blob_container_uri: The output BLOB container URI.
            :type output_blob_container_uri: str
            :param dict custom_headers: headers that will be added to the request
            :param bool raw: returns the direct response alongside the
             deserialized response
            :param operation_config: :ref:`Operation configuration
             overrides<msrest:optionsforoperations>`.
            :rtype: :class:`JobResponse <azure.mgmt.iothub.models.JobResponse>`
            :rtype: :class:`ClientRawResponse<msrest.pipeline.ClientRawResponse>`
             if raw=true
            """
            import_devices_parameters = models.ImportDevicesRequest(input_blob_container_uri=input_blob_container_uri, output_blob_container_uri=output_blob_container_uri)

            # Construct URL
            url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{resourceName}/importDevices'
            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 = {}
            query_parameters['api-version'] = self._serialize.query("self.config.api_version", self.config.api_version, 'str')

            # Construct headers
            header_parameters = {}
            header_parameters['Content-Type'] = 'application/json; charset=utf-8'
            if self.config.generate_client_request_id:
                header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
            if custom_headers:
                header_parameters.update(custom_headers)
            if self.config.accept_language is not None:
                header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')

            # Construct body
            body_content = self._serialize.body(import_devices_parameters, 'ImportDevicesRequest')

            # Construct and send request
            request = self._client.post(url, query_parameters)
            response = self._client.send(
                request, header_parameters, body_content, **operation_config)

            if response.status_code not in [200]:
                raise models.ErrorDetailsException(self._deserialize, response)

            deserialized = None

            if response.status_code == 200:
                deserialized = self._deserialize('JobResponse', response)

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

            return deserialized