updateTransformer method

Future<UpdateTransformerResponse> updateTransformer({
  1. required String transformerId,
  2. EdiType? ediType,
  3. FileFormat? fileFormat,
  4. InputConversion? inputConversion,
  5. Mapping? mapping,
  6. String? mappingTemplate,
  7. String? name,
  8. OutputConversion? outputConversion,
  9. String? sampleDocument,
  10. SampleDocuments? sampleDocuments,
  11. TransformerStatus? status,
})

Updates the specified parameters for a transformer. A transformer can take an EDI file as input and transform it into a JSON-or XML-formatted document. Alternatively, a transformer can take a JSON-or XML-formatted document as input and transform it into an EDI file.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter transformerId : Specifies the system-assigned unique identifier for the transformer.

Parameter ediType : Specifies the details for the EDI standard that is being used for the transformer. Currently, only X12 is supported. X12 is a set of standards and corresponding messages that define specific business documents.

Parameter fileFormat : Specifies that the currently supported file formats for EDI transformations are JSON and XML.

Parameter inputConversion : To update, specify the InputConversion object, which contains the format options for the inbound transformation.

Parameter mapping : Specify the structure that contains the mapping template and its language (either XSLT or JSONATA).

Parameter mappingTemplate : Specifies the mapping template for the transformer. This template is used to map the parsed EDI file using JSONata or XSLT.

Parameter name : Specify a new name for the transformer, if you want to update it.

Parameter outputConversion : To update, specify the OutputConversion object, which contains the format options for the outbound transformation.

Parameter sampleDocument : Specifies a sample EDI document that is used by a transformer as a guide for processing the EDI data.

Parameter sampleDocuments : Specify a structure that contains the Amazon S3 bucket and an array of the corresponding keys used to identify the location for your sample documents.

Parameter status : Specifies the transformer's status. You can update the state of the transformer from inactive to active.

Implementation

Future<UpdateTransformerResponse> updateTransformer({
  required String transformerId,
  EdiType? ediType,
  FileFormat? fileFormat,
  InputConversion? inputConversion,
  Mapping? mapping,
  String? mappingTemplate,
  String? name,
  OutputConversion? outputConversion,
  String? sampleDocument,
  SampleDocuments? sampleDocuments,
  TransformerStatus? status,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'B2BI.UpdateTransformer'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'transformerId': transformerId,
      if (ediType != null) 'ediType': ediType,
      if (fileFormat != null) 'fileFormat': fileFormat.value,
      if (inputConversion != null) 'inputConversion': inputConversion,
      if (mapping != null) 'mapping': mapping,
      if (mappingTemplate != null) 'mappingTemplate': mappingTemplate,
      if (name != null) 'name': name,
      if (outputConversion != null) 'outputConversion': outputConversion,
      if (sampleDocument != null) 'sampleDocument': sampleDocument,
      if (sampleDocuments != null) 'sampleDocuments': sampleDocuments,
      if (status != null) 'status': status.value,
    },
  );

  return UpdateTransformerResponse.fromJson(jsonResponse.body);
}