Skip to content

Commit 95435e1

Browse files
This release adds a GenerateMapping API to allow generation of JSONata or XSLT transformer code based on input and output samples.
1 parent aafcf1c commit 95435e1

File tree

18 files changed

+1078
-5
lines changed

18 files changed

+1078
-5
lines changed

docgenerator/AWSSDKDocSamples/B2bi.GeneratedSamples.extra.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,25 @@
171171
</example>
172172
</value>
173173
</doc>
174+
<doc>
175+
<members>
176+
<member name="M:Amazon.B2bi.IAmazonB2bi.GenerateMapping(Amazon.B2bi.Model.GenerateMappingRequest)" />
177+
<member name="M:Amazon.B2bi.AmazonB2biClient.GenerateMapping(Amazon.B2bi.Model.GenerateMappingRequest)" />
178+
<member name="T:Amazon.B2bi.Model.GenerateMappingRequest" />
179+
<member name="T:Amazon.B2bi.Model.GenerateMappingResponse" />
180+
</members>
181+
<value>
182+
<example>
183+
<para>
184+
185+
</para>
186+
<code
187+
title="Sample GenerateMapping call"
188+
source=".\AWSSDKDocSamples\B2bi\B2bi.GeneratedSamples.cs"
189+
region="example-1" />
190+
</example>
191+
</value>
192+
</doc>
174193
<doc>
175194
<members>
176195
<member name="M:Amazon.B2bi.IAmazonB2bi.GetCapability(Amazon.B2bi.Model.GetCapabilityRequest)" />

docgenerator/AWSSDKDocSamples/B2bi/B2bi.GeneratedSamples.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,24 @@ public void B2biDeleteTransformer()
256256
#endregion
257257
}
258258

259+
public void B2biGenerateMapping()
260+
{
261+
#region example-1
262+
263+
var client = new AmazonB2biClient();
264+
var response = client.GenerateMapping(new GenerateMappingRequest
265+
{
266+
InputFileContent = "Sample input file content",
267+
MappingType = "JSONATA",
268+
OutputFileContent = "Sample output file content"
269+
});
270+
271+
float mappingAccuracy = response.MappingAccuracy;
272+
string mappingTemplate = response.MappingTemplate;
273+
274+
#endregion
275+
}
276+
259277
public void B2biGetCapability()
260278
{
261279
#region example-1

generator/ServiceModels/b2bi/b2bi-2022-06-23.api.json

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@
175175
],
176176
"idempotent":true
177177
},
178+
"GenerateMapping":{
179+
"name":"GenerateMapping",
180+
"http":{
181+
"method":"POST",
182+
"requestUri":"/"
183+
},
184+
"input":{"shape":"GenerateMappingRequest"},
185+
"output":{"shape":"GenerateMappingResponse"},
186+
"errors":[
187+
{"shape":"AccessDeniedException"},
188+
{"shape":"ValidationException"},
189+
{"shape":"ThrottlingException"},
190+
{"shape":"InternalServerException"}
191+
],
192+
"idempotent":true
193+
},
178194
"GetCapability":{
179195
"name":"GetCapability",
180196
"http":{
@@ -941,6 +957,43 @@
941957
"type":"string",
942958
"enum":["X12"]
943959
},
960+
"GenerateMappingInputFileContent":{
961+
"type":"string",
962+
"max":5000000,
963+
"min":0
964+
},
965+
"GenerateMappingOutputFileContent":{
966+
"type":"string",
967+
"max":5000000,
968+
"min":0
969+
},
970+
"GenerateMappingRequest":{
971+
"type":"structure",
972+
"required":[
973+
"inputFileContent",
974+
"outputFileContent",
975+
"mappingType"
976+
],
977+
"members":{
978+
"inputFileContent":{"shape":"GenerateMappingInputFileContent"},
979+
"outputFileContent":{"shape":"GenerateMappingOutputFileContent"},
980+
"mappingType":{"shape":"MappingType"}
981+
}
982+
},
983+
"GenerateMappingResponse":{
984+
"type":"structure",
985+
"required":["mappingTemplate"],
986+
"members":{
987+
"mappingTemplate":{"shape":"String"},
988+
"mappingAccuracy":{"shape":"GenerateMappingResponseMappingAccuracyFloat"}
989+
}
990+
},
991+
"GenerateMappingResponseMappingAccuracyFloat":{
992+
"type":"float",
993+
"box":true,
994+
"max":1.0,
995+
"min":0.0
996+
},
944997
"GetCapabilityRequest":{
945998
"type":"structure",
946999
"required":["capabilityId"],

generator/ServiceModels/b2bi/b2bi-2022-06-23.docs.json

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"DeletePartnership": "<p>Deletes the specified partnership. A partnership represents the connection between you and your trading partner. It ties together a profile and one or more trading capabilities.</p>",
1212
"DeleteProfile": "<p>Deletes the specified profile. A profile is the mechanism used to create the concept of a private network.</p>",
1313
"DeleteTransformer": "<p>Deletes the specified 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.</p>",
14+
"GenerateMapping": "<p>Takes sample input and output documents and uses Amazon Bedrock to generate a mapping automatically. Depending on the accuracy and other factors, you can then edit the mapping for your needs.</p> <note> <p>Before you can use the AI-assisted feature for Amazon Web Services B2B Data Interchange you must enable models in Amazon Bedrock. For details, see <a href=\"https://docs.aws.amazon.com/b2bi/latest/userguide/ai-assisted-mapping.html#ai-assist-prereq\">AI-assisted template mapping prerequisites</a> in the <i>Amazon Web Services B2B Data Interchange User guide</i>.</p> </note>",
1415
"GetCapability": "<p>Retrieves the details for the specified capability. A trading capability contains the information required to transform incoming EDI documents into JSON or XML outputs.</p>",
1516
"GetPartnership": "<p>Retrieves the details for a partnership, based on the partner and profile IDs specified. A partnership represents the connection between you and your trading partner. It ties together a profile and one or more trading capabilities.</p>",
1617
"GetProfile": "<p>Retrieves the details for the profile specified by the profile ID. A profile is the mechanism used to create the concept of a private network.</p>",
@@ -345,6 +346,34 @@
345346
"InputConversion$fromFormat": "<p>The format for the transformer input: currently on <code>X12</code> is supported.</p>"
346347
}
347348
},
349+
"GenerateMappingInputFileContent": {
350+
"base": null,
351+
"refs": {
352+
"GenerateMappingRequest$inputFileContent": "<p>Provide the contents of a sample X12 EDI file (for inbound EDI) or JSON/XML file (for outbound EDI) to use as a starting point for the mapping.</p>"
353+
}
354+
},
355+
"GenerateMappingOutputFileContent": {
356+
"base": null,
357+
"refs": {
358+
"GenerateMappingRequest$outputFileContent": "<p>Provide the contents of a sample X12 EDI file (for outbound EDI) or JSON/XML file (for inbound EDI) to use as a target for the mapping.</p>"
359+
}
360+
},
361+
"GenerateMappingRequest": {
362+
"base": null,
363+
"refs": {
364+
}
365+
},
366+
"GenerateMappingResponse": {
367+
"base": null,
368+
"refs": {
369+
}
370+
},
371+
"GenerateMappingResponseMappingAccuracyFloat": {
372+
"base": null,
373+
"refs": {
374+
"GenerateMappingResponse$mappingAccuracy": "<p>Returns a percentage that estimates the accuracy of the generated mapping.</p>"
375+
}
376+
},
348377
"GetCapabilityRequest": {
349378
"base": null,
350379
"refs": {
@@ -548,7 +577,8 @@
548577
"MappingType": {
549578
"base": null,
550579
"refs": {
551-
"CreateStarterMappingTemplateRequest$mappingType": "<p>Specify the format for the mapping template: either JSONATA or XSLT.</p>"
580+
"CreateStarterMappingTemplateRequest$mappingType": "<p>Specify the format for the mapping template: either JSONATA or XSLT.</p>",
581+
"GenerateMappingRequest$mappingType": "<p>Specify the mapping type: either <code>JSONATA</code> or <code>XSLT.</code> </p>"
552582
}
553583
},
554584
"MaxResults": {
@@ -804,6 +834,7 @@
804834
"CreateProfileRequest$clientToken": "<p>Reserved for future use.</p>",
805835
"CreateStarterMappingTemplateResponse$mappingTemplate": "<p>Returns a string that represents the mapping template.</p>",
806836
"CreateTransformerRequest$clientToken": "<p>Reserved for future use.</p>",
837+
"GenerateMappingResponse$mappingTemplate": "<p>Returns a mapping template based on your inputs.</p>",
807838
"GetTransformerJobResponse$message": "<p>Returns an optional error message, which gets populated when the job is not run successfully.</p>",
808839
"ServiceQuotaExceededException$resourceId": "<p>The ID for the resource that exceeded the quota, which caused the exception.</p>",
809840
"ServiceQuotaExceededException$resourceType": "<p>The resource type (profile, partnership, transformer, or capability) that exceeded the quota, which caused the exception.</p>",
@@ -970,7 +1001,7 @@
9701001
"CreateTransformerResponse$status": "<p>Returns the state of the newly created transformer. The transformer can be either <code>active</code> or <code>inactive</code>. For the transformer to be used in a capability, its status must <code>active</code>.</p>",
9711002
"GetTransformerResponse$status": "<p>Returns the state of the newly created transformer. The transformer can be either <code>active</code> or <code>inactive</code>. For the transformer to be used in a capability, its status must <code>active</code>.</p>",
9721003
"TransformerSummary$status": "<p>Returns the state of the newly created transformer. The transformer can be either <code>active</code> or <code>inactive</code>. For the transformer to be used in a capability, its status must <code>active</code>.</p>",
973-
"UpdateTransformerRequest$status": "<p>Specifies the transformer's status. You can update the state of the transformer, from <code>active</code> to <code>inactive</code>, or <code>inactive</code> to <code>active</code>.</p>",
1004+
"UpdateTransformerRequest$status": "<p>Specifies the transformer's status. You can update the state of the transformer from <code>inactive</code> to <code>active</code>.</p>",
9741005
"UpdateTransformerResponse$status": "<p>Returns the state of the newly created transformer. The transformer can be either <code>active</code> or <code>inactive</code>. For the transformer to be used in a capability, its status must <code>active</code>.</p>"
9751006
}
9761007
},

generator/ServiceModels/b2bi/b2bi-2022-06-23.examples.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,21 @@
264264
"title": "Sample DeleteTransformer call"
265265
}
266266
],
267+
"GenerateMapping": [
268+
{
269+
"input": {
270+
"inputFileContent": "Sample input file content",
271+
"mappingType": "JSONATA",
272+
"outputFileContent": "Sample output file content"
273+
},
274+
"output": {
275+
"mappingAccuracy": 0.95,
276+
"mappingTemplate": "Sample mapping content"
277+
},
278+
"id": "example-1",
279+
"title": "Sample GenerateMapping call"
280+
}
281+
],
267282
"GetCapability": [
268283
{
269284
"input": {

generator/ServiceModels/b2bi/b2bi-2022-06-23.normal.json

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,23 @@
184184
"documentation":"<p>Deletes the specified 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.</p>",
185185
"idempotent":true
186186
},
187+
"GenerateMapping":{
188+
"name":"GenerateMapping",
189+
"http":{
190+
"method":"POST",
191+
"requestUri":"/"
192+
},
193+
"input":{"shape":"GenerateMappingRequest"},
194+
"output":{"shape":"GenerateMappingResponse"},
195+
"errors":[
196+
{"shape":"AccessDeniedException"},
197+
{"shape":"ValidationException"},
198+
{"shape":"ThrottlingException"},
199+
{"shape":"InternalServerException"}
200+
],
201+
"documentation":"<p>Takes sample input and output documents and uses Amazon Bedrock to generate a mapping automatically. Depending on the accuracy and other factors, you can then edit the mapping for your needs.</p> <note> <p>Before you can use the AI-assisted feature for Amazon Web Services B2B Data Interchange you must enable models in Amazon Bedrock. For details, see <a href=\"https://docs.aws.amazon.com/b2bi/latest/userguide/ai-assisted-mapping.html#ai-assist-prereq\">AI-assisted template mapping prerequisites</a> in the <i>Amazon Web Services B2B Data Interchange User guide</i>.</p> </note>",
202+
"idempotent":true
203+
},
187204
"GetCapability":{
188205
"name":"GetCapability",
189206
"http":{
@@ -1248,6 +1265,58 @@
12481265
"type":"string",
12491266
"enum":["X12"]
12501267
},
1268+
"GenerateMappingInputFileContent":{
1269+
"type":"string",
1270+
"max":5000000,
1271+
"min":0
1272+
},
1273+
"GenerateMappingOutputFileContent":{
1274+
"type":"string",
1275+
"max":5000000,
1276+
"min":0
1277+
},
1278+
"GenerateMappingRequest":{
1279+
"type":"structure",
1280+
"required":[
1281+
"inputFileContent",
1282+
"outputFileContent",
1283+
"mappingType"
1284+
],
1285+
"members":{
1286+
"inputFileContent":{
1287+
"shape":"GenerateMappingInputFileContent",
1288+
"documentation":"<p>Provide the contents of a sample X12 EDI file (for inbound EDI) or JSON/XML file (for outbound EDI) to use as a starting point for the mapping.</p>"
1289+
},
1290+
"outputFileContent":{
1291+
"shape":"GenerateMappingOutputFileContent",
1292+
"documentation":"<p>Provide the contents of a sample X12 EDI file (for outbound EDI) or JSON/XML file (for inbound EDI) to use as a target for the mapping.</p>"
1293+
},
1294+
"mappingType":{
1295+
"shape":"MappingType",
1296+
"documentation":"<p>Specify the mapping type: either <code>JSONATA</code> or <code>XSLT.</code> </p>"
1297+
}
1298+
}
1299+
},
1300+
"GenerateMappingResponse":{
1301+
"type":"structure",
1302+
"required":["mappingTemplate"],
1303+
"members":{
1304+
"mappingTemplate":{
1305+
"shape":"String",
1306+
"documentation":"<p>Returns a mapping template based on your inputs.</p>"
1307+
},
1308+
"mappingAccuracy":{
1309+
"shape":"GenerateMappingResponseMappingAccuracyFloat",
1310+
"documentation":"<p>Returns a percentage that estimates the accuracy of the generated mapping.</p>"
1311+
}
1312+
}
1313+
},
1314+
"GenerateMappingResponseMappingAccuracyFloat":{
1315+
"type":"float",
1316+
"box":true,
1317+
"max":1.0,
1318+
"min":0.0
1319+
},
12511320
"GetCapabilityRequest":{
12521321
"type":"structure",
12531322
"required":["capabilityId"],
@@ -2646,7 +2715,7 @@
26462715
},
26472716
"status":{
26482717
"shape":"TransformerStatus",
2649-
"documentation":"<p>Specifies the transformer's status. You can update the state of the transformer, from <code>active</code> to <code>inactive</code>, or <code>inactive</code> to <code>active</code>.</p>"
2718+
"documentation":"<p>Specifies the transformer's status. You can update the state of the transformer from <code>inactive</code> to <code>active</code>.</p>"
26502719
},
26512720
"fileFormat":{
26522721
"shape":"FileFormat",

sdk/code-analysis/ServiceAnalysis/B2bi/Generated/PropertyValueRules.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,21 @@
211211
<max>64</max>
212212
<pattern>[a-zA-Z0-9_-]+</pattern>
213213
</property-value-rule>
214+
<property-value-rule>
215+
<property>Amazon.B2bi.Model.GenerateMappingRequest.InputFileContent</property>
216+
<min>0</min>
217+
<max>5000000</max>
218+
</property-value-rule>
219+
<property-value-rule>
220+
<property>Amazon.B2bi.Model.GenerateMappingRequest.OutputFileContent</property>
221+
<min>0</min>
222+
<max>5000000</max>
223+
</property-value-rule>
224+
<property-value-rule>
225+
<property>Amazon.B2bi.Model.GenerateMappingResponse.MappingAccuracy</property>
226+
<min>0</min>
227+
<max>1</max>
228+
</property-value-rule>
214229
<property-value-rule>
215230
<property>Amazon.B2bi.Model.GetCapabilityRequest.CapabilityId</property>
216231
<min>1</min>

0 commit comments

Comments
 (0)