transferCertificate method

Future<TransferCertificateResponse> transferCertificate({
  1. required String certificateId,
  2. required String targetAwsAccount,
  3. String? transferMessage,
})

Transfers the specified certificate to the specified AWS account.

You can cancel the transfer until it is acknowledged by the recipient.

No notification is sent to the transfer destination's account. It is up to the caller to notify the transfer target.

The certificate being transferred must not be in the ACTIVE state. You can use the UpdateCertificate API to deactivate it.

The certificate must not have any policies attached to it. You can use the DetachPrincipalPolicy API to detach them.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw CertificateStateException. May throw TransferConflictException. May throw ThrottlingException. May throw UnauthorizedException. May throw ServiceUnavailableException. May throw InternalFailureException.

Parameter certificateId : The ID of the certificate. (The last part of the certificate ARN contains the certificate ID.)

Parameter targetAwsAccount : The AWS account.

Parameter transferMessage : The transfer message.

Implementation

Future<TransferCertificateResponse> transferCertificate({
  required String certificateId,
  required String targetAwsAccount,
  String? transferMessage,
}) async {
  ArgumentError.checkNotNull(certificateId, 'certificateId');
  _s.validateStringLength(
    'certificateId',
    certificateId,
    64,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(targetAwsAccount, 'targetAwsAccount');
  _s.validateStringLength(
    'targetAwsAccount',
    targetAwsAccount,
    12,
    12,
    isRequired: true,
  );
  _s.validateStringLength(
    'transferMessage',
    transferMessage,
    0,
    128,
  );
  final $query = <String, List<String>>{
    'targetAwsAccount': [targetAwsAccount],
  };
  final $payload = <String, dynamic>{
    if (transferMessage != null) 'transferMessage': transferMessage,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/transfer-certificate/${Uri.encodeComponent(certificateId)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return TransferCertificateResponse.fromJson(response);
}