:doc:`StorageGateway <../../storagegateway>` / Client / update_chap_credentials

***********************
update_chap_credentials
***********************



.. py:method:: StorageGateway.Client.update_chap_credentials(**kwargs)

  

  Updates the Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified iSCSI target. By default, a gateway does not have CHAP enabled; however, for added security, you might use it. This operation is supported in the volume and tape gateway types.

   

  .. warning::

     

    When you update CHAP credentials, all existing connections on the target are closed and initiators must reconnect with the new credentials.

    

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/storagegateway-2013-06-30/UpdateChapCredentials>`_  


  **Request Syntax**
  ::

    response = client.update_chap_credentials(
        TargetARN='string',
        SecretToAuthenticateInitiator='string',
        InitiatorName='string',
        SecretToAuthenticateTarget='string'
    )
    
  :type TargetARN: string
  :param TargetARN: **[REQUIRED]** 

    The Amazon Resource Name (ARN) of the iSCSI volume target. Use the  DescribeStorediSCSIVolumes operation to return the TargetARN for specified VolumeARN.

    

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

    The secret key that the initiator (for example, the Windows client) must provide to participate in mutual CHAP with the target.

     

    .. note::

      

      The secret key must be between 12 and 16 bytes when encoded in UTF-8.

      

    

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

    The iSCSI initiator that connects to the target.

    

  
  :type SecretToAuthenticateTarget: string
  :param SecretToAuthenticateTarget: 

    The secret key that the target must provide to participate in mutual CHAP with the initiator (e.g. Windows client).

     

    Byte constraints: Minimum bytes of 12. Maximum bytes of 16.

     

    .. note::

      

      The secret key must be between 12 and 16 bytes when encoded in UTF-8.

      

    

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

    
    ::

      {
          'TargetARN': 'string',
          'InitiatorName': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 

      A JSON object containing the following fields:

      
      

      - **TargetARN** *(string) --* 

        The Amazon Resource Name (ARN) of the target. This is the same target specified in the request.

        
      

      - **InitiatorName** *(string) --* 

        The iSCSI initiator that connects to the target. This is the same initiator name specified in the request.

        
  
  **Exceptions**
  
  *   :py:class:`StorageGateway.Client.exceptions.InvalidGatewayRequestException`

  
  *   :py:class:`StorageGateway.Client.exceptions.InternalServerError`

  

  **Examples**

  Updates the Challenge-Handshake Authentication Protocol (CHAP) credentials for a specified iSCSI target.
  ::

    response = client.update_chap_credentials(
        InitiatorName='iqn.1991-05.com.microsoft:computername.domain.example.com',
        SecretToAuthenticateInitiator='111111111111',
        SecretToAuthenticateTarget='222222222222',
        TargetARN='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume',
    )
    
    print(response)

  
  Expected Output:
  ::

    {
        'InitiatorName': 'iqn.1991-05.com.microsoft:computername.domain.example.com',
        'TargetARN': 'arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume',
        'ResponseMetadata': {
            '...': '...',
        },
    }

  