updateProvisioningTemplate method

Future<void> updateProvisioningTemplate({
  1. required String templateName,
  2. int? defaultVersionId,
  3. String? description,
  4. bool? enabled,
  5. ProvisioningHook? preProvisioningHook,
  6. String? provisioningRoleArn,
  7. bool? removePreProvisioningHook,
})

Updates a fleet provisioning template.

May throw InternalFailureException. May throw InvalidRequestException. May throw ResourceNotFoundException. May throw UnauthorizedException. May throw ConflictingResourceUpdateException.

Parameter templateName : The name of the fleet provisioning template.

Parameter defaultVersionId : The ID of the default provisioning template version.

Parameter description : The description of the fleet provisioning template.

Parameter enabled : True to enable the fleet provisioning template, otherwise false.

Parameter preProvisioningHook : Updates the pre-provisioning hook template.

Parameter provisioningRoleArn : The ARN of the role associated with the provisioning template. This IoT role grants permission to provision a device.

Parameter removePreProvisioningHook : Removes pre-provisioning hook template.

Implementation

Future<void> updateProvisioningTemplate({
  required String templateName,
  int? defaultVersionId,
  String? description,
  bool? enabled,
  ProvisioningHook? preProvisioningHook,
  String? provisioningRoleArn,
  bool? removePreProvisioningHook,
}) async {
  ArgumentError.checkNotNull(templateName, 'templateName');
  _s.validateStringLength(
    'templateName',
    templateName,
    1,
    36,
    isRequired: true,
  );
  _s.validateStringLength(
    'description',
    description,
    0,
    500,
  );
  _s.validateStringLength(
    'provisioningRoleArn',
    provisioningRoleArn,
    20,
    2048,
  );
  final $payload = <String, dynamic>{
    if (defaultVersionId != null) 'defaultVersionId': defaultVersionId,
    if (description != null) 'description': description,
    if (enabled != null) 'enabled': enabled,
    if (preProvisioningHook != null)
      'preProvisioningHook': preProvisioningHook,
    if (provisioningRoleArn != null)
      'provisioningRoleArn': provisioningRoleArn,
    if (removePreProvisioningHook != null)
      'removePreProvisioningHook': removePreProvisioningHook,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/provisioning-templates/${Uri.encodeComponent(templateName)}',
    exceptionFnMap: _exceptionFns,
  );
}