createProvisioningTemplate method
Creates a fleet provisioning template.
May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ThrottlingException. May throw UnauthorizedException. May throw ResourceAlreadyExistsException.
Parameter provisioningRoleArn
:
The role ARN for the role associated with the fleet provisioning template.
This IoT role grants permission to provision a device.
Parameter templateBody
:
The JSON formatted contents of the fleet provisioning template.
Parameter templateName
:
The name of the fleet provisioning template.
Parameter description
:
The description of the fleet provisioning template.
Parameter enabled
:
True to enable the fleet provisioning template, otherwise false.
Parameter preProvisioningHook
:
Creates a pre-provisioning hook template.
Parameter tags
:
Metadata which can be used to manage the fleet 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..."
Implementation
Future<CreateProvisioningTemplateResponse> createProvisioningTemplate({
required String provisioningRoleArn,
required String templateBody,
required String templateName,
String? description,
bool? enabled,
ProvisioningHook? preProvisioningHook,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(provisioningRoleArn, 'provisioningRoleArn');
_s.validateStringLength(
'provisioningRoleArn',
provisioningRoleArn,
20,
2048,
isRequired: true,
);
ArgumentError.checkNotNull(templateBody, 'templateBody');
ArgumentError.checkNotNull(templateName, 'templateName');
_s.validateStringLength(
'templateName',
templateName,
1,
36,
isRequired: true,
);
_s.validateStringLength(
'description',
description,
0,
500,
);
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,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/provisioning-templates',
exceptionFnMap: _exceptionFns,
);
return CreateProvisioningTemplateResponse.fromJson(response);
}