createSystemTemplate method

Future<CreateSystemTemplateResponse> createSystemTemplate({
  1. required DefinitionDocument definition,
  2. int? compatibleNamespaceVersion,
})

Creates a system. The system is validated against the entities in the latest version of the user's namespace unless another namespace version is specified in the request.

May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ThrottlingException. May throw InternalFailureException.

Parameter definition : The DefinitionDocument used to create the system.

Parameter compatibleNamespaceVersion : The namespace version in which the system is to be created.

If no value is specified, the latest version is used by default.

Implementation

Future<CreateSystemTemplateResponse> createSystemTemplate({
  required DefinitionDocument definition,
  int? compatibleNamespaceVersion,
}) async {
  ArgumentError.checkNotNull(definition, 'definition');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IotThingsGraphFrontEndService.CreateSystemTemplate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'definition': definition,
      if (compatibleNamespaceVersion != null)
        'compatibleNamespaceVersion': compatibleNamespaceVersion,
    },
  );

  return CreateSystemTemplateResponse.fromJson(jsonResponse.body);
}