Skip to content

test_mapping

test_mapping(
    input_file_content: TestMappingInputFileContent,
    mapping_template: MappingTemplate,
    file_format: FileFormat,
    *,
    config_overrides: Optional[b2biClientConfig] = None,
) -> TestMappingResponse

Maps the input file according to the provided template file. The API call downloads the file contents from the Amazon S3 location, and passes the contents in as a string, to the inputFileContent parameter.

Parameters:

  • input_file_content (TestMappingInputFileContent) –

    Specify the contents of the EDI (electronic data interchange) XML or JSON file that is used as input for the transform.

  • mapping_template (MappingTemplate) –

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

    This parameter is available for backwards compatibility. Use the Mapping data type instead.

  • file_format (FileFormat) –

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

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.

  • ThrottlingException –

    The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.

  • 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 TestMapping call

>>> client.test_mapping(file_format='JSON', input_file_content='Sample file content', mapping_template='$')
Source code in docs_src/capo_b2bi/_services/b2bi.py
def test_mapping(
    self,
    input_file_content: "capo_b2bi.types.test_mapping_input_file_content.TestMappingInputFileContent",
    mapping_template: "capo_b2bi.types.mapping_template.MappingTemplate",
    file_format: "capo_b2bi.types.file_format.FileFormat",
    *,
    config_overrides: Optional[b2biClientConfig] = None,
) -> "capo_b2bi.types.test_mapping_response.TestMappingResponse":
    """<p>Maps the input file according to the provided template file. The API call downloads the file contents from the Amazon S3 location, and passes the contents in as a string, to the <code>inputFileContent</code> parameter.</p>

    Args:
        input_file_content: <p>Specify the contents of the EDI (electronic data interchange) XML or JSON file that is used as input for the transform.</p>
        mapping_template: <p>Specifies the mapping template for the transformer. This template is used to map the parsed EDI file using JSONata or XSLT.</p> <note> <p>This parameter is available for backwards compatibility. Use the <a href="https://docs.aws.amazon.com/b2bi/latest/APIReference/API_Mapping.html">Mapping</a> data type instead.</p> </note>
        file_format: <p>Specifies that the currently supported file formats for EDI transformations are <code>JSON</code> and <code>XML</code>.</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.throttling_exception.ThrottlingException: <p>The request was denied due to throttling: the data speed and rendering may be limited depending on various parameters and conditions.</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 TestMapping call

        >>> client.test_mapping(file_format='JSON', input_file_content='Sample file content', mapping_template='$')
    """

    def _handler(
        req: "OperationRequest[capo_b2bi.types.test_mapping_request.TestMappingRequest]",
    ) -> OperationResponse[
        "capo_b2bi.types.test_mapping_response.TestMappingResponse"
    ]:
        import capo_b2bi._operations.b2_bi.test_mapping

        output, http_response = (
            capo_b2bi._operations.b2_bi.test_mapping.test_mapping(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TestMapping")
    )
    input_: capo_b2bi.types.test_mapping_request.TestMappingRequest = {
        "input_file_content": input_file_content,
        "mapping_template": mapping_template,
        "file_format": file_format,
    }

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output