updateFlowTemplate method

Future<UpdateFlowTemplateResponse> updateFlowTemplate({
  1. required DefinitionDocument definition,
  2. required String id,
  3. int? compatibleNamespaceVersion,
})

Updates the specified workflow. All deployed systems and system instances that use the workflow will see the changes in the flow when it is redeployed. If you don't want this behavior, copy the workflow (creating a new workflow with a different ID), and update the copy. The workflow can contain only entities in the specified namespace.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalFailureException.

Parameter definition : The DefinitionDocument that contains the updated workflow definition.

Parameter id : The ID of the workflow to be updated.

The ID should be in the following format.

urn:tdm:REGION/ACCOUNT ID/default:workflow:WORKFLOWNAME

Parameter compatibleNamespaceVersion : The version of the user's namespace.

If no value is specified, the latest version is used by default. Use the GetFlowTemplateRevisions if you want to find earlier revisions of the flow to update.

Implementation

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

  return UpdateFlowTemplateResponse.fromJson(jsonResponse.body);
}