updateCertificate method

Future<void> updateCertificate({
  1. required String certificateId,
  2. required CertificateStatus newStatus,
})

Updates the status of the specified certificate. This operation is idempotent.

Certificates must be in the ACTIVE state to authenticate devices that use a certificate to connect to AWS IoT.

Within a few minutes of updating a certificate from the ACTIVE state to any other state, AWS IoT disconnects all devices that used that certificate to connect. Devices cannot use a certificate that is not in the ACTIVE state to reconnect.

May throw ResourceNotFoundException. May throw CertificateStateException. May throw InvalidRequestException. 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 newStatus : The new status.

Note: Setting the status to PENDING_TRANSFER or PENDING_ACTIVATION will result in an exception being thrown. PENDING_TRANSFER and PENDING_ACTIVATION are statuses used internally by AWS IoT. They are not intended for developer use.

Note: The status value REGISTER_INACTIVE is deprecated and should not be used.

Implementation

Future<void> updateCertificate({
  required String certificateId,
  required CertificateStatus newStatus,
}) async {
  ArgumentError.checkNotNull(certificateId, 'certificateId');
  _s.validateStringLength(
    'certificateId',
    certificateId,
    64,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(newStatus, 'newStatus');
  final $query = <String, List<String>>{
    'newStatus': [newStatus.toValue()],
  };
  await _protocol.send(
    payload: null,
    method: 'PUT',
    requestUri: '/certificates/${Uri.encodeComponent(certificateId)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}