Skip to content

create_starter_mapping_template async

create_starter_mapping_template(
    mapping_type: MappingType,
    template_details: TemplateDetails,
    *,
    config_overrides: Optional[Asyncb2biClientConfig] = None,
    output_sample_location: Optional[S3Location] = None,
) -> CreateStarterMappingTemplateResponse

Amazon Web Services B2B Data Interchange uses a mapping template in JSONata or XSLT format to transform a customer input file into a JSON or XML file that can be converted to EDI.

If you provide a sample EDI file with the same structure as the EDI files that you wish to generate, then the service can generate a mapping template. The starter template contains placeholder values which you can replace with JSONata or XSLT expressions to take data from your input file and insert it into the JSON or XML file that is used to generate the EDI.

If you do not provide a sample EDI file, then the service can generate a mapping template based on the EDI settings in the templateDetails parameter.

Currently, we only support generating a template that can generate the input to produce an Outbound X12 EDI file.

Parameters:

  • output_sample_location (Optional[S3Location], default: None ) –

    Specify the location of the sample EDI file that is used to generate the mapping template.

  • mapping_type (MappingType) –

    Specify the format for the mapping template: either JSONATA or XSLT.

  • template_details (TemplateDetails) –

    Describes the details needed for generating the template. Specify the X12 transaction set and version for which the template is used: currently, we only support X12.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • InternalServerException –

    This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service.

  • ResourceNotFoundException –

    Occurs when the requested resource does not exist, or cannot be found. In some cases, the resource exists in a region other than the region specified in the API call.

  • ValidationException –

    Occurs when a B2BI object cannot be validated against a request from another object. This exception can be thrown during standard EDI validation or when custom validation rules fail, such as when element length constraints are violated, invalid codes are used in code list validations, or required elements are missing based on configured element requirement rules.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Sample CreateStarterMappingTemplate call

>>> await client.create_starter_mapping_template(mapping_type='JSONATA', template_details={'x12': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, output_sample_location={'bucketName': 'output-sample-bucket', 'key': 'output-sample-key'})
Source code in docs_src/capo_b2bi/_services/async_b2bi.py
async def create_starter_mapping_template(
    self,
    mapping_type: "capo_b2bi.types.mapping_type.MappingType",
    template_details: "capo_b2bi.types.template_details.TemplateDetails",
    *,
    config_overrides: Optional[Asyncb2biClientConfig] = None,
    output_sample_location: Optional[
        "capo_b2bi.types.s3_location.S3Location"
    ] = None,
) -> "capo_b2bi.types.create_starter_mapping_template_response.CreateStarterMappingTemplateResponse":
    """<p>Amazon Web Services B2B Data Interchange uses a mapping template in JSONata or XSLT format to transform a customer input file into a JSON or XML file that can be converted to EDI.</p> <p>If you provide a sample EDI file with the same structure as the EDI files that you wish to generate, then the service can generate a mapping template. The starter template contains placeholder values which you can replace with JSONata or XSLT expressions to take data from your input file and insert it into the JSON or XML file that is used to generate the EDI.</p> <p>If you do not provide a sample EDI file, then the service can generate a mapping template based on the EDI settings in the <code>templateDetails</code> parameter. </p> <p> Currently, we only support generating a template that can generate the input to produce an Outbound X12 EDI file.</p>

    Args:
        output_sample_location: <p>Specify the location of the sample EDI file that is used to generate the mapping template.</p>
        mapping_type: <p>Specify the format for the mapping template: either JSONATA or XSLT.</p>
        template_details: <p> Describes the details needed for generating the template. Specify the X12 transaction set and version for which the template is used: currently, we only support X12. </p>

    Raises:
        capo_b2bi.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_b2bi.errors.internal_server_exception.InternalServerException: <p>This exception is thrown when an error occurs in the Amazon Web Services B2B Data Interchange service.</p>
        capo_b2bi.errors.resource_not_found_exception.ResourceNotFoundException: <p>Occurs when the requested resource does not exist, or cannot be found. In some cases, the resource exists in a region other than the region specified in the API call.</p>
        capo_b2bi.errors.validation_exception.ValidationException: <p>Occurs when a B2BI object cannot be validated against a request from another object. This exception can be thrown during standard EDI validation or when custom validation rules fail, such as when element length constraints are violated, invalid codes are used in code list validations, or required elements are missing based on configured element requirement rules.</p>
        capo_b2bi.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Sample CreateStarterMappingTemplate call

        >>> await client.create_starter_mapping_template(mapping_type='JSONATA', template_details={'x12': {'transactionSet': 'X12_110', 'version': 'VERSION_4010'}}, output_sample_location={'bucketName': 'output-sample-bucket', 'key': 'output-sample-key'})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_b2bi.types.create_starter_mapping_template_request.CreateStarterMappingTemplateRequest]",
    ) -> AsyncOperationResponse[
        "capo_b2bi.types.create_starter_mapping_template_response.CreateStarterMappingTemplateResponse"
    ]:
        import capo_b2bi._operations.b2_bi.create_starter_mapping_template

        (
            output,
            http_response,
        ) = await capo_b2bi._operations.b2_bi.create_starter_mapping_template.async_create_starter_mapping_template(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStarterMappingTemplate")
    )
    input_: capo_b2bi.types.create_starter_mapping_template_request.CreateStarterMappingTemplateRequest = {
        "mapping_type": mapping_type,
        "template_details": template_details,
    }
    if output_sample_location is not None:
        input_["output_sample_location"] = output_sample_location

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output