createTransformer method

Future<CreateTransformerResponse> createTransformer({
  1. required String name,
  2. String? clientToken,
  3. EdiType? ediType,
  4. FileFormat? fileFormat,
  5. InputConversion? inputConversion,
  6. Mapping? mapping,
  7. String? mappingTemplate,
  8. OutputConversion? outputConversion,
  9. String? sampleDocument,
  10. SampleDocuments? sampleDocuments,
  11. List<Tag>? tags,
})

Creates a transformer. Amazon Web Services B2B Data Interchange currently supports two scenarios:

  • Inbound EDI: the Amazon Web Services customer receives an EDI file from their trading partner. Amazon Web Services B2B Data Interchange converts this EDI file into a JSON or XML file with a service-defined structure. A mapping template provided by the customer, in JSONata or XSLT format, is optionally applied to this file to produce a JSON or XML file with the structure the customer requires.
  • Outbound EDI: the Amazon Web Services customer has a JSON or XML file containing data that they wish to use in an EDI file. A mapping template, provided by the customer (in either JSONata or XSLT format) is applied to this file to generate a JSON or XML file in the service-defined structure. This file is then converted to 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 name : Specifies the name of the transformer, used to identify it.

Parameter clientToken : Reserved for future use.

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 : 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 outputConversion : A structure that contains 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 tags : Specifies the key-value pairs assigned to ARNs that you can use to group and search for resources by type. You can attach this metadata to resources (capabilities, partnerships, and so on) for any purpose.

Implementation

Future<CreateTransformerResponse> createTransformer({
  required String name,
  String? clientToken,
  EdiType? ediType,
  FileFormat? fileFormat,
  InputConversion? inputConversion,
  Mapping? mapping,
  String? mappingTemplate,
  OutputConversion? outputConversion,
  String? sampleDocument,
  SampleDocuments? sampleDocuments,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'B2BI.CreateTransformer'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      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 (outputConversion != null) 'outputConversion': outputConversion,
      if (sampleDocument != null) 'sampleDocument': sampleDocument,
      if (sampleDocuments != null) 'sampleDocuments': sampleDocuments,
      if (tags != null) 'tags': tags,
    },
  );

  return CreateTransformerResponse.fromJson(jsonResponse.body);
}