updateCertificate method

Future<UpdateCertificateResponse> updateCertificate({
  1. required String certificateId,
  2. DateTime? activeDate,
  3. String? description,
  4. DateTime? inactiveDate,
})

Updates the active and inactive dates for a certificate.

May throw InternalServiceError. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter certificateId : The identifier of the certificate object that you are updating.

Parameter activeDate : An optional date that specifies when the certificate becomes active. If you do not specify a value, ActiveDate takes the same value as NotBeforeDate, which is specified by the CA.

Parameter description : A short description to help identify the certificate.

Parameter inactiveDate : An optional date that specifies when the certificate becomes inactive. If you do not specify a value, InactiveDate takes the same value as NotAfterDate, which is specified by the CA.

Implementation

Future<UpdateCertificateResponse> updateCertificate({
  required String certificateId,
  DateTime? activeDate,
  String? description,
  DateTime? inactiveDate,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'TransferService.UpdateCertificate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CertificateId': certificateId,
      if (activeDate != null) 'ActiveDate': unixTimestampToJson(activeDate),
      if (description != null) 'Description': description,
      if (inactiveDate != null)
        'InactiveDate': unixTimestampToJson(inactiveDate),
    },
  );

  return UpdateCertificateResponse.fromJson(jsonResponse.body);
}