Skip to content

update_chap_credentials

update_chap_credentials(
    target_arn: TargetARN,
    secret_to_authenticate_initiator: ChapSecret,
    initiator_name: IqnName,
    *,
    config_overrides: Optional[StorageGatewayClientConfig] = None,
    secret_to_authenticate_target: Optional[ChapSecret] = None,
) -> UpdateChapCredentialsOutput

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.

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

Parameters:

  • target_arn (TargetARN) –

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

  • secret_to_authenticate_initiator (ChapSecret) –

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

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

  • initiator_name (IqnName) –

    The iSCSI initiator that connects to the target.

  • secret_to_authenticate_target (Optional[ChapSecret], default: None ) –

    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.

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

Raises:

  • InternalServerError –

    An internal server error has occurred during the request. For more information, see the error and message fields.

  • InvalidGatewayRequestException –

    An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

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

>>> client.update_chap_credentials(target_arn='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume', secret_to_authenticate_initiator='111111111111', initiator_name='iqn.1991-05.com.microsoft:computername.domain.example.com', secret_to_authenticate_target='222222222222')
Source code in docs_src/capo_storage_gateway/_services/storage_gateway.py
def update_chap_credentials(
    self,
    target_arn: "capo_storage_gateway.types.target_arn.TargetARN",
    secret_to_authenticate_initiator: "capo_storage_gateway.types.chap_secret.ChapSecret",
    initiator_name: "capo_storage_gateway.types.iqn_name.IqnName",
    *,
    config_overrides: Optional[StorageGatewayClientConfig] = None,
    secret_to_authenticate_target: Optional[
        "capo_storage_gateway.types.chap_secret.ChapSecret"
    ] = None,
) -> "capo_storage_gateway.types.update_chap_credentials_output.UpdateChapCredentialsOutput":
    """<p>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.</p> <important> <p>When you update CHAP credentials, all existing connections on the target are closed and initiators must reconnect with the new credentials.</p> </important>

    Args:
        target_arn: <p>The Amazon Resource Name (ARN) of the iSCSI volume target. Use the <a>DescribeStorediSCSIVolumes</a> operation to return the TargetARN for specified VolumeARN.</p>
        secret_to_authenticate_initiator: <p>The secret key that the initiator (for example, the Windows client) must provide to participate in mutual CHAP with the target.</p> <note> <p>The secret key must be between 12 and 16 bytes when encoded in UTF-8.</p> </note>
        initiator_name: <p>The iSCSI initiator that connects to the target.</p>
        secret_to_authenticate_target: <p>The secret key that the target must provide to participate in mutual CHAP with the initiator (e.g. Windows client).</p> <p>Byte constraints: Minimum bytes of 12. Maximum bytes of 16.</p> <note> <p>The secret key must be between 12 and 16 bytes when encoded in UTF-8.</p> </note>

    Raises:
        capo_storage_gateway.errors.internal_server_error.InternalServerError: <p>An internal server error has occurred during the request. For more information, see the error and message fields.</p>
        capo_storage_gateway.errors.invalid_gateway_request_exception.InvalidGatewayRequestException: <p>An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.</p>
        capo_storage_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.

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

        >>> client.update_chap_credentials(target_arn='arn:aws:storagegateway:us-east-1:111122223333:gateway/sgw-12A3456B/target/iqn.1997-05.com.amazon:myvolume', secret_to_authenticate_initiator='111111111111', initiator_name='iqn.1991-05.com.microsoft:computername.domain.example.com', secret_to_authenticate_target='222222222222')
    """

    def _handler(
        req: "OperationRequest[capo_storage_gateway.types.update_chap_credentials_input.UpdateChapCredentialsInput]",
    ) -> OperationResponse[
        "capo_storage_gateway.types.update_chap_credentials_output.UpdateChapCredentialsOutput"
    ]:
        import capo_storage_gateway._operations.storage_gateway_20130630.update_chap_credentials

        output, http_response = (
            capo_storage_gateway._operations.storage_gateway_20130630.update_chap_credentials.update_chap_credentials(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_storage_gateway.types.update_chap_credentials_input.UpdateChapCredentialsInput",
    ) -> dict[str, Any]:
        import capo_storage_gateway.types.update_chap_credentials_input

        return capo_storage_gateway.types.update_chap_credentials_input.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateChapCredentials", redact_input=_redact_input),
    )
    input_: capo_storage_gateway.types.update_chap_credentials_input.UpdateChapCredentialsInput = {
        "target_arn": target_arn,
        "secret_to_authenticate_initiator": secret_to_authenticate_initiator,
        "initiator_name": initiator_name,
    }
    if secret_to_authenticate_target is not None:
        input_["secret_to_authenticate_target"] = secret_to_authenticate_target

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output