createProvisioningTemplate method
Creates a provisioning template.
Requires permission to access the CreateProvisioningTemplate action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ThrottlingException.
May throw UnauthorizedException.
Parameter provisioningRoleArn :
The role ARN for the role associated with the provisioning template. This
IoT role grants permission to provision a device.
Parameter templateBody :
The JSON formatted contents of the provisioning template.
Parameter templateName :
The name of the provisioning template.
Parameter description :
The description of the provisioning template.
Parameter enabled :
True to enable the provisioning template, otherwise false.
Parameter preProvisioningHook :
Creates a pre-provisioning hook template. Only supports template of type
FLEET_PROVISIONING. For more information about provisioning
template types, see type.
Parameter tags :
Metadata which can be used to manage the provisioning template.
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 type :
The type you define in a provisioning template. You can create a template
with only one type. You can't change the template type after its creation.
The default value is FLEET_PROVISIONING. For more information
about provisioning template, see: Provisioning
template.
Implementation
Future<CreateProvisioningTemplateResponse> createProvisioningTemplate({
required String provisioningRoleArn,
required String templateBody,
required String templateName,
String? description,
bool? enabled,
ProvisioningHook? preProvisioningHook,
List<Tag>? tags,
TemplateType? type,
}) async {
final $payload = <String, dynamic>{
'provisioningRoleArn': provisioningRoleArn,
'templateBody': templateBody,
'templateName': templateName,
if (description != null) 'description': description,
if (enabled != null) 'enabled': enabled,
if (preProvisioningHook != null)
'preProvisioningHook': preProvisioningHook,
if (tags != null) 'tags': tags,
if (type != null) 'type': type.value,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/provisioning-templates',
exceptionFnMap: _exceptionFns,
);
return CreateProvisioningTemplateResponse.fromJson(response);
}