:doc:`S3 <../../s3>` / Client / get_bucket_versioning

*********************
get_bucket_versioning
*********************



.. py:method:: S3.Client.get_bucket_versioning(**kwargs)

  

  .. note::

    

    This operation is not supported for directory buckets.

    

   

  Returns the versioning state of a bucket.

   

  To retrieve the versioning state of a bucket, you must be the bucket owner.

   

  This implementation also returns the MFA Delete status of the versioning state. If the MFA Delete status is ``enabled``, the bucket owner must use an authentication device to change the versioning state of the bucket.

   

  The following operations are related to ``GetBucketVersioning``:

   

  
  * `GetObject <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html>`__
   
  * `PutObject <https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html>`__
   
  * `DeleteObject <https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObject.html>`__
  

   

  .. warning::

     

    You must URL encode any signed header values that contain spaces. For example, if your header value is ``my file.txt``, containing two spaces after ``my``, you must URL encode this value to ``my%20%20file.txt``.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning>`_  


  **Request Syntax**
  ::

    response = client.get_bucket_versioning(
        Bucket='string',
        ExpectedBucketOwner='string'
    )
    
  :type Bucket: string
  :param Bucket: **[REQUIRED]** 

    The name of the bucket for which to get the versioning information.

    

  
  :type ExpectedBucketOwner: string
  :param ExpectedBucketOwner: 

    The account ID of the expected bucket owner. If the account ID that you provide does not match the actual owner of the bucket, the request fails with the HTTP status code ``403 Forbidden`` (access denied).

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'Status': 'Enabled'|'Suspended',
          'MFADelete': 'Enabled'|'Disabled'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **Status** *(string) --* 

        The versioning state of the bucket.

        
      

      - **MFADelete** *(string) --* 

        Specifies whether MFA delete is enabled in the bucket versioning configuration. This element is only returned if the bucket has been configured with MFA delete. If the bucket has never been so configured, this element is not returned.

        
  

  **Examples**

  The following example retrieves bucket versioning configuration.
  ::

    response = client.get_bucket_versioning(
        Bucket='examplebucket',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'MFADelete': 'Disabled',
        'Status': 'Enabled',
        'ResponseMetadata': {
            '...': '...',
        },
    }

  