updateChapCredentials method
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.
May throw InvalidGatewayRequestException. May throw InternalServerError.
Parameter initiatorName
:
The iSCSI initiator that connects to the target.
Parameter secretToAuthenticateInitiator
:
The secret key that the initiator (for example, the Windows client) must
provide to participate in mutual CHAP with the target.
Parameter targetARN
:
The Amazon Resource Name (ARN) of the iSCSI volume target. Use the
DescribeStorediSCSIVolumes operation to return the TargetARN for
specified VolumeARN.
Parameter 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.
Implementation
Future<UpdateChapCredentialsOutput> updateChapCredentials({
required String initiatorName,
required String secretToAuthenticateInitiator,
required String targetARN,
String? secretToAuthenticateTarget,
}) async {
ArgumentError.checkNotNull(initiatorName, 'initiatorName');
_s.validateStringLength(
'initiatorName',
initiatorName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(
secretToAuthenticateInitiator, 'secretToAuthenticateInitiator');
_s.validateStringLength(
'secretToAuthenticateInitiator',
secretToAuthenticateInitiator,
1,
100,
isRequired: true,
);
ArgumentError.checkNotNull(targetARN, 'targetARN');
_s.validateStringLength(
'targetARN',
targetARN,
50,
800,
isRequired: true,
);
_s.validateStringLength(
'secretToAuthenticateTarget',
secretToAuthenticateTarget,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'StorageGateway_20130630.UpdateChapCredentials'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'InitiatorName': initiatorName,
'SecretToAuthenticateInitiator': secretToAuthenticateInitiator,
'TargetARN': targetARN,
if (secretToAuthenticateTarget != null)
'SecretToAuthenticateTarget': secretToAuthenticateTarget,
},
);
return UpdateChapCredentialsOutput.fromJson(jsonResponse.body);
}