registerCACertificate method

Future<RegisterCACertificateResponse> registerCACertificate({
  1. required String caCertificate,
  2. bool? allowAutoRegistration,
  3. CertificateMode? certificateMode,
  4. RegistrationConfig? registrationConfig,
  5. bool? setAsActive,
  6. List<Tag>? tags,
  7. String? verificationCertificate,
})

Registers a CA certificate with Amazon Web Services IoT Core. There is no limit to the number of CA certificates you can register in your Amazon Web Services account. You can register up to 10 CA certificates with the same CA subject field per Amazon Web Services account.

Requires permission to access the RegisterCACertificate action.

May throw CertificateValidationException. May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw RegistrationCodeValidationException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter caCertificate : The CA certificate.

Parameter allowAutoRegistration : Allows this CA certificate to be used for auto registration of device certificates.

Parameter certificateMode : Describes the certificate mode in which the Certificate Authority (CA) will be registered. If the verificationCertificate field is not provided, set certificateMode to be SNI_ONLY. If the verificationCertificate field is provided, set certificateMode to be DEFAULT. When certificateMode is not provided, it defaults to DEFAULT. All the device certificates that are registered using this CA will be registered in the same certificate mode as the CA. For more information about certificate mode for device certificates, see certificate mode.

Parameter registrationConfig : Information about the registration configuration.

Parameter setAsActive : A boolean value that specifies if the CA certificate is set to active.

Valid values: ACTIVE | INACTIVE

Parameter tags : Metadata which can be used to manage the CA certificate.

For the CLI command-line parameter use format: &&tags "key1=value1&key2=value2..."

For the cli-input-json file use format: "tags": "key1=value1&key2=value2..."

Parameter verificationCertificate : The private key verification certificate. If certificateMode is SNI_ONLY, the verificationCertificate field must be empty. If certificateMode is DEFAULT or not provided, the verificationCertificate field must not be empty.

Implementation

Future<RegisterCACertificateResponse> registerCACertificate({
  required String caCertificate,
  bool? allowAutoRegistration,
  CertificateMode? certificateMode,
  RegistrationConfig? registrationConfig,
  bool? setAsActive,
  List<Tag>? tags,
  String? verificationCertificate,
}) async {
  final $query = <String, List<String>>{
    if (allowAutoRegistration != null)
      'allowAutoRegistration': [allowAutoRegistration.toString()],
    if (setAsActive != null) 'setAsActive': [setAsActive.toString()],
  };
  final $payload = <String, dynamic>{
    'caCertificate': caCertificate,
    if (certificateMode != null) 'certificateMode': certificateMode.value,
    if (registrationConfig != null) 'registrationConfig': registrationConfig,
    if (tags != null) 'tags': tags,
    if (verificationCertificate != null)
      'verificationCertificate': verificationCertificate,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/cacertificate',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return RegisterCACertificateResponse.fromJson(response);
}