createProvisioningProfile method

Future<CreateProvisioningProfileResponse> createProvisioningProfile({
  1. required ProvisioningType provisioningType,
  2. String? caCertificate,
  3. String? claimCertificate,
  4. String? clientToken,
  5. String? name,
  6. Map<String, String>? tags,
})

Create a provisioning profile for executing device provisioning flows. The provisioning profile is a document that defines the set of resources and policies applied to a device during the provisioning process.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException. May throw UnauthorizedException. May throw ValidationException.

Parameter provisioningType : The type of provisioning workflow the device uses for onboarding to IoT managed integrations.

Parameter caCertificate : The body of the PEM-encoded certificate authority (CA) certificate.

Parameter claimCertificate : The body of the PEM-encoded claim certificate. If a claim certificate is provided, it will be used for the provisioning profile. Otherwise, a claim certificate will be generated.

Parameter clientToken : An idempotency token. If you retry a request that completed successfully initially using the same client token and parameters, then the retry attempt will succeed without performing any further actions.

Parameter name : The name of the provisioning profile.

Parameter tags : A set of key/value pairs that are used to manage the provisioning profile.

Implementation

Future<CreateProvisioningProfileResponse> createProvisioningProfile({
  required ProvisioningType provisioningType,
  String? caCertificate,
  String? claimCertificate,
  String? clientToken,
  String? name,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'ProvisioningType': provisioningType.value,
    if (caCertificate != null) 'CaCertificate': caCertificate,
    if (claimCertificate != null) 'ClaimCertificate': claimCertificate,
    'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (name != null) 'Name': name,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/provisioning-profiles',
    exceptionFnMap: _exceptionFns,
  );
  return CreateProvisioningProfileResponse.fromJson(response);
}