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

****************
update_key_group
****************



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

  

  Updates a key group.

   

  When you update a key group, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update a key group:

   

   
  * Get the current key group with ``GetKeyGroup`` or ``GetKeyGroupConfig``.
   
  * Locally modify the fields in the key group that you want to update. For example, add or remove public key IDs.
   
  * Call ``UpdateKeyGroup`` with the entire key group object, including the fields that you modified and those that you didn't.
  

  

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


  **Request Syntax**
  ::

    response = client.update_key_group(
        KeyGroupConfig={
            'Name': 'string',
            'Items': [
                'string',
            ],
            'Comment': 'string'
        },
        Id='string',
        IfMatch='string'
    )
    
  :type KeyGroupConfig: dict
  :param KeyGroupConfig: **[REQUIRED]** 

    The key group configuration.

    

  
    - **Name** *(string) --* **[REQUIRED]** 

      A name to identify the key group.

      

    
    - **Items** *(list) --* **[REQUIRED]** 

      A list of the identifiers of the public keys in the key group.

      

    
      - *(string) --* 

      
  
    - **Comment** *(string) --* 

      A comment to describe the key group. The comment cannot be longer than 128 characters.

      

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

    The identifier of the key group that you are updating.

    

  
  :type IfMatch: string
  :param IfMatch: 

    The version of the key group that you are updating. The version is the key group's ``ETag`` value.

    

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

    
    ::

      {
          'KeyGroup': {
              'Id': 'string',
              'LastModifiedTime': datetime(2015, 1, 1),
              'KeyGroupConfig': {
                  'Name': 'string',
                  'Items': [
                      'string',
                  ],
                  'Comment': 'string'
              }
          },
          'ETag': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **KeyGroup** *(dict) --* 

        The key group that was just updated.

        
        

        - **Id** *(string) --* 

          The identifier for the key group.

          
        

        - **LastModifiedTime** *(datetime) --* 

          The date and time when the key group was last modified.

          
        

        - **KeyGroupConfig** *(dict) --* 

          The key group configuration.

          
          

          - **Name** *(string) --* 

            A name to identify the key group.

            
          

          - **Items** *(list) --* 

            A list of the identifiers of the public keys in the key group.

            
            

            - *(string) --* 
        
          

          - **Comment** *(string) --* 

            A comment to describe the key group. The comment cannot be longer than 128 characters.

            
      
    
      

      - **ETag** *(string) --* 

        The identifier for this version of the key group.

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

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

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

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

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

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

  