createTransformer

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.

The following fields are provided for backwards compatibility only: fileFormat, mappingTemplate, ediType, and sampleDocument.

  • Use the mapping data type in place of mappingTemplate and fileFormat

  • Use the sampleDocuments data type in place of sampleDocument

  • Use either the inputConversion or outputConversion in place of ediType

Samples

import aws.sdk.kotlin.services.b2bi.model.FormatOptions
import aws.sdk.kotlin.services.b2bi.model.FromFormat
import aws.sdk.kotlin.services.b2bi.model.InputConversion
import aws.sdk.kotlin.services.b2bi.model.Mapping
import aws.sdk.kotlin.services.b2bi.model.MappingTemplateLanguage
import aws.sdk.kotlin.services.b2bi.model.SampleDocumentKeys
import aws.sdk.kotlin.services.b2bi.model.SampleDocuments
import aws.sdk.kotlin.services.b2bi.model.Tag
import aws.sdk.kotlin.services.b2bi.model.X12Details
import aws.sdk.kotlin.services.b2bi.model.X12TransactionSet
import aws.sdk.kotlin.services.b2bi.model.X12Version

fun main() { 
   //sampleStart 
   // Sample CreateTransformer call
val resp = b2BiClient.createTransformer {
    clientToken = "foo"
    name = "transformX12"
    inputConversion = InputConversion {
        fromFormat = FromFormat.fromValue("X12")
        formatOptions = FormatOptions.X12(X12Details {
            transactionSet = X12TransactionSet.fromValue("X12_110")
            version = X12Version.fromValue("VERSION_4010")
        }
        )
    }
    mapping = Mapping {
        templateLanguage = MappingTemplateLanguage.fromValue("JSONATA")
        template = "{}"
    }
    sampleDocuments = SampleDocuments {
        bucketName = "test-bucket"
        keys = listOf<SampleDocumentKeys>(
            SampleDocumentKeys {
                input = "sampleDoc.txt"
            }                
        )
    }
    tags = listOf<Tag>(
        Tag {
            key = "sampleKey"
            value = "sampleValue"
        }            
    )
} 
   //sampleEnd
}