cancelHandshake method

Future<CancelHandshakeResponse> cancelHandshake({
  1. required String handshakeId,
})

Cancels a handshake. Canceling a handshake sets the handshake state to CANCELED.

This operation can be called only from the account that originated the handshake. The recipient of the handshake can't cancel it, but can use DeclineHandshake instead. After a handshake is canceled, the recipient can no longer respond to that handshake.

After you cancel a handshake, it continues to appear in the results of relevant APIs for only 30 days. After that, it's deleted.

May throw AccessDeniedException. May throw ConcurrentModificationException. May throw HandshakeNotFoundException. May throw InvalidHandshakeTransitionException. May throw HandshakeAlreadyInStateException. May throw InvalidInputException. May throw ServiceException. May throw TooManyRequestsException.

Parameter handshakeId : The unique identifier (ID) of the handshake that you want to cancel. You can get the ID from the ListHandshakesForOrganization operation.

The regex pattern for handshake ID string requires "h-" followed by from 8 to 32 lowercase letters or digits.

Implementation

Future<CancelHandshakeResponse> cancelHandshake({
  required String handshakeId,
}) async {
  ArgumentError.checkNotNull(handshakeId, 'handshakeId');
  _s.validateStringLength(
    'handshakeId',
    handshakeId,
    0,
    34,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSOrganizationsV20161128.CancelHandshake'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'HandshakeId': handshakeId,
    },
  );

  return CancelHandshakeResponse.fromJson(jsonResponse.body);
}