code: def deployment_cancel(name, resource_group, **kwargs):
      '''
      .. versionadded:: 2019.2.0
  
      Cancel a deployment if in 'Accepted' or 'Running' state.
  
      :param name: The name of the deployment to cancel.
  
      :param resource_group: The resource group name assigned to the
          deployment.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt-call azurearm_resource.deployment_cancel testdeploy testgroup
  
      '''
      resconn = __utils__['azurearm.get_client']('resource', **kwargs)
      try:
          resconn.deployments.cancel(
              deployment_name=name,
              resource_group_name=resource_group
          )
          result = {'result': True}
      except CloudError as exc:
          __utils__['azurearm.log_cloud_error']('resource', str(exc), **kwargs)
          result = {
              'error': str(exc),
              'result': False
          }
  
      return resulf deployment_cancel(name, resource_group, **kwargs):
      '''
      .. versionadded:: 2019.2.0
  
      Cancel a deployment if in 'Accepted' or 'Running' state.
  
      :param name: The name of the deployment to cancel.
  
      :param resource_group: The resource group name assigned to the
          deployment.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt-call azurearm_resource.deployment_cancel testdeploy testgroup
  
      '''
      resconn = __utils__['azurearm.get_client']('resource', **kwargs)
      try:
          resconn.deployments.cancel(
              deployment_name=name,
              resource_group_name=resource_group
          )
          result = {'result': True}
      except CloudError as exc:
          __utils__['azurearm.log_cloud_error']('resource', str(exc), **kwargs)
          result = {
              'error': str(exc),
              'result': False
          }
  
      return result
docs: .. versionadded:: 2019.2.0
  
      Cancel a deployment if in 'Accepted' or 'Running' state.
  
      :param name: The name of the deployment to cancel.
  
      :param resource_group: The resource group name assigned to the
          deployment.
  
      CLI Example:
  
      .. code-block:: bash
  
          salt-call azurearm_resource.deployment_cancel testdeploy testgroup