createFlowTemplate method

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

Creates a workflow template. Workflows can be created only in the user's namespace. (The public namespace contains only entities.) The workflow can contain only entities in the specified namespace. The workflow 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 LimitExceededException. May throw InternalFailureException.

Parameter definition : The workflow DefinitionDocument.

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

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

Implementation

Future<CreateFlowTemplateResponse> createFlowTemplate({
  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.CreateFlowTemplate'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'definition': definition,
      if (compatibleNamespaceVersion != null)
        'compatibleNamespaceVersion': compatibleNamespaceVersion,
    },
  );

  return CreateFlowTemplateResponse.fromJson(jsonResponse.body);
}