text: # coding=utf-8
  # --------------------------------------------------------------------------
  # Copyright (c) Microsoft Corporation. All rights reserved.
  # Licensed under the MIT License. See License.txt in the project root for
  # license information.
  #
  # Code generated by Microsoft (R) AutoRest Code Generator.
  # Changes may cause incorrect behavior and will be lost if the code is
  # regenerated.
  # --------------------------------------------------------------------------
  
  import uuid
  from msrest.pipeline import ClientRawResponse
  from msrestazure.azure_exceptions import CloudError
  from msrestazure.azure_operation import AzureOperationPoller
  
  from .. import models
  
  
  class RedisOperations(object):
      """RedisOperations 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.
      :ivar api_version: Client Api Version. Constant value: "2016-04-01".
      """
  
      def __init__(self, client, config, serializer, deserializer):
  
          self._client = client
          self._serialize = serializer
          self._deserialize = deserializer
          self.api_version = "2016-04-01"
  
          self.config = config
  
      def create(
              self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config):
          """Create or replace (overwrite/recreate, with potential downtime) an
          existing Redis cache.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param parameters: Parameters supplied to the Create Redis operation.
          :type parameters: ~azure.mgmt.redis.models.RedisCreateParameters
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :return: An instance of AzureOperationPoller that returns
           RedisResource or ClientRawResponse if raw=true
          :rtype:
           ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.redis.models.RedisResource]
           or ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'RedisCreateParameters')
  
          # 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, 200]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              deserialized = None
  
              if response.status_code == 201:
                  deserialized = self._deserialize('RedisResource', response)
              if response.status_code == 200:
                  deserialized = self._deserialize('RedisResource', 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 update(
              self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config):
          """Update an existing Redis cache.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param parameters: Parameters supplied to the Update Redis operation.
          :type parameters: ~azure.mgmt.redis.models.RedisUpdateParameters
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: RedisResource or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.redis.models.RedisResource or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'RedisUpdateParameters')
  
          # Construct and send request
          request = self._client.patch(url, query_parameters)
          response = self._client.send(
              request, header_parameters, body_content, **operation_config)
  
          if response.status_code not in [200]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('RedisResource', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def delete(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Deletes a Redis cache.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :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
          :return: An instance of AzureOperationPoller that returns None or
           ClientRawResponse if raw=true
          :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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 [200, 204]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              if raw:
                  client_raw_response = ClientRawResponse(None, response)
                  return client_raw_response
  
          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 get(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Gets a Redis cache (resource description).
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: RedisResource or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.redis.models.RedisResource or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.get(url, query_parameters)
          response = self._client.send(request, header_parameters, **operation_config)
  
          if response.status_code not in [200]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('RedisResource', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def list_by_resource_group(
              self, resource_group_name, custom_headers=None, raw=False, **operation_config):
          """Lists all Redis caches 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>`.
          :return: An iterator like instance of RedisResource
          :rtype:
           ~azure.mgmt.redis.models.RedisResourcePaged[~azure.mgmt.redis.models.RedisResource]
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/'
                  path_format_arguments = {
                      'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
                      'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
                  }
                  url = self._client.format_url(url, **path_format_arguments)
  
                  # Construct parameters
                  query_parameters = {}
                  query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Content-Type'] = 'application/json; charset=utf-8'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters)
              response = self._client.send(
                  request, header_parameters, **operation_config)
  
              if response.status_code not in [200]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              return response
  
          # Deserialize response
          deserialized = models.RedisResourcePaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.RedisResourcePaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
  
      def list(
              self, custom_headers=None, raw=False, **operation_config):
          """Gets all Redis caches in the specified 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>`.
          :return: An iterator like instance of RedisResource
          :rtype:
           ~azure.mgmt.redis.models.RedisResourcePaged[~azure.mgmt.redis.models.RedisResource]
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          def internal_paging(next_link=None, raw=False):
  
              if not next_link:
                  # Construct URL
                  url = '/subscriptions/{subscriptionId}/providers/Microsoft.Cache/Redis/'
                  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.api_version", self.api_version, 'str')
  
              else:
                  url = next_link
                  query_parameters = {}
  
              # Construct headers
              header_parameters = {}
              header_parameters['Content-Type'] = 'application/json; charset=utf-8'
              if self.config.generate_client_request_id:
                  header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
              if custom_headers:
                  header_parameters.update(custom_headers)
              if self.config.accept_language is not None:
                  header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
              # Construct and send request
              request = self._client.get(url, query_parameters)
              response = self._client.send(
                  request, header_parameters, **operation_config)
  
              if response.status_code not in [200]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              return response
  
          # Deserialize response
          deserialized = models.RedisResourcePaged(internal_paging, self._deserialize.dependencies)
  
          if raw:
              header_dict = {}
              client_raw_response = models.RedisResourcePaged(internal_paging, self._deserialize.dependencies, header_dict)
              return client_raw_response
  
          return deserialized
  
      def list_keys(
              self, resource_group_name, name, custom_headers=None, raw=False, **operation_config):
          """Retrieve a Redis cache's access keys. This operation requires write
          permission to the cache resource.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: RedisAccessKeys or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.redis.models.RedisAccessKeys or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/listKeys'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
  
          # Construct headers
          header_parameters = {}
          header_parameters['Content-Type'] = 'application/json; charset=utf-8'
          if self.config.generate_client_request_id:
              header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
          if custom_headers:
              header_parameters.update(custom_headers)
          if self.config.accept_language is not None:
              header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
  
          # Construct and send request
          request = self._client.post(url, query_parameters)
          response = self._client.send(request, header_parameters, **operation_config)
  
          if response.status_code not in [200]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('RedisAccessKeys', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def regenerate_key(
              self, resource_group_name, name, key_type, custom_headers=None, raw=False, **operation_config):
          """Regenerate Redis cache's access keys. This operation requires write
          permission to the cache resource.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param key_type: The Redis access key to regenerate. Possible values
           include: 'Primary', 'Secondary'
          :type key_type: str or ~azure.mgmt.redis.models.RedisKeyType
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: RedisAccessKeys or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.redis.models.RedisAccessKeys or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          parameters = models.RedisRegenerateKeyParameters(key_type=key_type)
  
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/regenerateKey'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'RedisRegenerateKeyParameters')
  
          # 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]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('RedisAccessKeys', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def force_reboot(
              self, resource_group_name, name, reboot_type, shard_id=None, custom_headers=None, raw=False, **operation_config):
          """Reboot specified Redis node(s). This operation requires write
          permission to the cache resource. There can be potential data loss.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param reboot_type: Which Redis node(s) to reboot. Depending on this
           value data loss is possible. Possible values include: 'PrimaryNode',
           'SecondaryNode', 'AllNodes'
          :type reboot_type: str or ~azure.mgmt.redis.models.RebootType
          :param shard_id: If clustering is enabled, the ID of the shard to be
           rebooted.
          :type shard_id: int
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :param operation_config: :ref:`Operation configuration
           overrides<msrest:optionsforoperations>`.
          :return: RedisForceRebootResponse or ClientRawResponse if raw=true
          :rtype: ~azure.mgmt.redis.models.RedisForceRebootResponse or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          parameters = models.RedisRebootParameters(reboot_type=reboot_type, shard_id=shard_id)
  
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/forceReboot'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'RedisRebootParameters')
  
          # 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]:
              exp = CloudError(response)
              exp.request_id = response.headers.get('x-ms-request-id')
              raise exp
  
          deserialized = None
  
          if response.status_code == 200:
              deserialized = self._deserialize('RedisForceRebootResponse', response)
  
          if raw:
              client_raw_response = ClientRawResponse(deserialized, response)
              return client_raw_response
  
          return deserialized
  
      def import_data(
              self, resource_group_name, name, files, format=None, custom_headers=None, raw=False, **operation_config):
          """Import data into Redis cache.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param files: files to import.
          :type files: list[str]
          :param format: File format.
          :type format: str
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :return: An instance of AzureOperationPoller that returns None or
           ClientRawResponse if raw=true
          :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          parameters = models.ImportRDBParameters(format=format, files=files)
  
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/import'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'ImportRDBParameters')
  
          # Construct and send request
          def long_running_send():
  
              request = self._client.post(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 [202, 200, 204]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              if raw:
                  client_raw_response = ClientRawResponse(None, response)
                  return client_raw_response
  
          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 export_data(
              self, resource_group_name, name, parameters, custom_headers=None, raw=False, **operation_config):
          """Export data from the redis cache to blobs in a container.
  
          :param resource_group_name: The name of the resource group.
          :type resource_group_name: str
          :param name: The name of the Redis cache.
          :type name: str
          :param parameters: Parameters for Redis export operation.
          :type parameters: ~azure.mgmt.redis.models.ExportRDBParameters
          :param dict custom_headers: headers that will be added to the request
          :param bool raw: returns the direct response alongside the
           deserialized response
          :return: An instance of AzureOperationPoller that returns None or
           ClientRawResponse if raw=true
          :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
           ~msrest.pipeline.ClientRawResponse
          :raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
          """
          # Construct URL
          url = '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/Redis/{name}/export'
          path_format_arguments = {
              'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
              'name': self._serialize.url("name", name, 'str'),
              'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
          }
          url = self._client.format_url(url, **path_format_arguments)
  
          # Construct parameters
          query_parameters = {}
          query_parameters['api-version'] = self._serialize.query("self.api_version", self.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(parameters, 'ExportRDBParameters')
  
          # Construct and send request
          def long_running_send():
  
              request = self._client.post(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 [202, 200, 204]:
                  exp = CloudError(response)
                  exp.request_id = response.headers.get('x-ms-request-id')
                  raise exp
  
              if raw:
                  client_raw_response = ClientRawResponse(None, response)
                  return client_raw_response
  
          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)
  