createCertificateProvider method

Future<CreateCertificateProviderResponse> createCertificateProvider({
  1. required List<CertificateProviderOperation> accountDefaultForOperations,
  2. required String certificateProviderName,
  3. required String lambdaFunctionArn,
  4. String? clientToken,
  5. List<Tag>? tags,
})

Creates an Amazon Web Services IoT Core certificate provider. You can use Amazon Web Services IoT Core certificate provider to customize how to sign a certificate signing request (CSR) in IoT fleet provisioning. For more information, see Customizing certificate signing using Amazon Web Services IoT Core certificate provider from Amazon Web Services IoT Core Developer Guide.

Requires permission to access the CreateCertificateProvider action.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceAlreadyExistsException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException.

Parameter accountDefaultForOperations : A list of the operations that the certificate provider will use to generate certificates. Valid value: CreateCertificateFromCsr.

Parameter certificateProviderName : The name of the certificate provider.

Parameter lambdaFunctionArn : The ARN of the Lambda function that defines the authentication logic.

Parameter clientToken : A string that you can optionally pass in the CreateCertificateProvider request to make sure the request is idempotent.

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

Implementation

Future<CreateCertificateProviderResponse> createCertificateProvider({
  required List<CertificateProviderOperation> accountDefaultForOperations,
  required String certificateProviderName,
  required String lambdaFunctionArn,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final $payload = <String, dynamic>{
    'accountDefaultForOperations':
        accountDefaultForOperations.map((e) => e.value).toList(),
    'lambdaFunctionArn': lambdaFunctionArn,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/certificate-providers/${Uri.encodeComponent(certificateProviderName)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateCertificateProviderResponse.fromJson(response);
}