cancelConnection method

Future<CancelConnectionResponse> cancelConnection({
  1. required String catalog,
  2. required ConnectionType connectionType,
  3. required String identifier,
  4. required String reason,
  5. String? clientToken,
})

Cancels an existing connection between partners, terminating the partnership relationship.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter catalog : The catalog identifier where the connection exists.

Parameter connectionType : The type of connection to cancel (e.g., reseller, distributor, technology partner).

Parameter identifier : The unique identifier of the connection to cancel.

Parameter reason : The reason for canceling the connection, providing context for the termination.

Parameter clientToken : A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Implementation

Future<CancelConnectionResponse> cancelConnection({
  required String catalog,
  required ConnectionType connectionType,
  required String identifier,
  required String reason,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'PartnerCentralAccount.CancelConnection'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'ConnectionType': connectionType.value,
      'Identifier': identifier,
      'Reason': reason,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CancelConnectionResponse.fromJson(jsonResponse.body);
}