:doc:`CloudFront <../../cloudfront>` / Client / delete_function

***************
delete_function
***************



.. py:method:: CloudFront.Client.delete_function(**kwargs)

  

  Deletes a CloudFront function.

   

  You cannot delete a function if it's associated with a cache behavior. First, update your distributions to remove the function association from all cache behaviors, then delete the function.

   

  To delete a function, you must provide the function's name and version ( ``ETag`` value). To get these values, you can use ``ListFunctions`` and ``DescribeFunction``.

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/cloudfront-2020-05-31/DeleteFunction>`_  


  **Request Syntax**
  ::

    response = client.delete_function(
        Name='string',
        IfMatch='string'
    )
    
  :type Name: string
  :param Name: **[REQUIRED]** 

    The name of the function that you are deleting.

    

  
  :type IfMatch: string
  :param IfMatch: **[REQUIRED]** 

    The current version ( ``ETag`` value) of the function that you are deleting, which you can get using ``DescribeFunction``.

    

  
  
  :returns: None
  **Exceptions**
  
  *   :py:class:`CloudFront.Client.exceptions.PreconditionFailed`

  
  *   :py:class:`CloudFront.Client.exceptions.UnsupportedOperation`

  
  *   :py:class:`CloudFront.Client.exceptions.FunctionInUse`

  
  *   :py:class:`CloudFront.Client.exceptions.NoSuchFunctionExists`

  
  *   :py:class:`CloudFront.Client.exceptions.InvalidIfMatchVersion`

  