Skip to content

create_integration_response

create_integration_response(
    api_id: __string,
    integration_id: __string,
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = None,
    content_handling_strategy: Optional[ContentHandlingStrategy] = None,
    integration_response_key: Optional[SelectionKey] = None,
    response_parameters: Optional[IntegrationParameters] = None,
    response_templates: Optional[TemplateMap] = None,
    template_selection_expression: Optional[SelectionExpression] = None,
) -> CreateIntegrationResponseResponse

Creates an IntegrationResponses.

Parameters:

  • api_id (__string) –

    The API identifier.

  • content_handling_strategy (Optional[ContentHandlingStrategy], default: None ) –

    Specifies how to handle response payload content type conversions. Supported values are CONVERT_TO_BINARY and CONVERT_TO_TEXT, with the following behaviors:

    CONVERT_TO_BINARY: Converts a response payload from a Base64-encoded string to the corresponding binary blob.

    CONVERT_TO_TEXT: Converts a response payload from a binary blob to a Base64-encoded string.

    If this property is not defined, the response payload will be passed through from the integration response to the route response or method response without modification.

  • integration_id (__string) –

    The integration ID.

  • integration_response_key (Optional[SelectionKey], default: None ) –

    The integration response key.

  • response_parameters (Optional[IntegrationParameters], default: None ) –

    A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where {name} is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where {name} is a valid and unique response header name and {JSON-expression} is a valid JSON expression without the $ prefix.

  • response_templates (Optional[TemplateMap], default: None ) –

    The collection of response templates for the integration response as a string-to-string map of key-value pairs. Response templates are represented as a key/value map, with a content-type as the key and a template as the value.

  • template_selection_expression (Optional[SelectionExpression], default: None ) –

    The template selection expression for the integration response. Supported only for WebSocket APIs.

Raises:

  • BadRequestException –

    The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

  • ConflictException –

    The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.

  • NotFoundException –

    The resource specified in the request was not found. See the message field for more information.

  • TooManyRequestsException –

    A limit has been exceeded. See the accompanying error message for details.

  • UnknownServiceError –

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

Source code in docs_src/capo_apigatewayv2/_services/api_gateway_v2.py
def create_integration_response(
    self,
    api_id: "capo_apigatewayv2.types.__string.__string",
    integration_id: "capo_apigatewayv2.types.__string.__string",
    *,
    config_overrides: Optional[ApiGatewayV2ClientConfig] = None,
    content_handling_strategy: Optional[
        "capo_apigatewayv2.types.content_handling_strategy.ContentHandlingStrategy"
    ] = None,
    integration_response_key: Optional[
        "capo_apigatewayv2.types.selection_key.SelectionKey"
    ] = None,
    response_parameters: Optional[
        "capo_apigatewayv2.types.integration_parameters.IntegrationParameters"
    ] = None,
    response_templates: Optional[
        "capo_apigatewayv2.types.template_map.TemplateMap"
    ] = None,
    template_selection_expression: Optional[
        "capo_apigatewayv2.types.selection_expression.SelectionExpression"
    ] = None,
) -> "capo_apigatewayv2.types.create_integration_response_response.CreateIntegrationResponseResponse":
    """<p>Creates an IntegrationResponses.</p>

    Args:
        api_id: <p>The API identifier.</p>
        content_handling_strategy: <p>Specifies how to handle response payload content type conversions. Supported values are CONVERT_TO_BINARY and CONVERT_TO_TEXT, with the following behaviors:</p> <p>CONVERT_TO_BINARY: Converts a response payload from a Base64-encoded string to the corresponding binary blob.</p> <p>CONVERT_TO_TEXT: Converts a response payload from a binary blob to a Base64-encoded string.</p> <p>If this property is not defined, the response payload will be passed through from the integration response to the route response or method response without modification.</p>
        integration_id: <p>The integration ID.</p>
        integration_response_key: <p>The integration response key.</p>
        response_parameters: <p>A key-value map specifying response parameters that are passed to the method response from the backend. The key is a method response header parameter name and the mapped value is an integration response header value, a static value enclosed within a pair of single quotes, or a JSON expression from the integration response body. The mapping key must match the pattern of method.response.header.{name}, where {name} is a valid and unique header name. The mapped non-static value must match the pattern of integration.response.header.{name} or integration.response.body.{JSON-expression}, where {name} is a valid and unique response header name and {JSON-expression} is a valid JSON expression without the $ prefix.</p>
        response_templates: <p>The collection of response templates for the integration response as a string-to-string map of key-value pairs. Response templates are represented as a key/value map, with a content-type as the key and a template as the value.</p>
        template_selection_expression: <p>The template selection expression for the integration response. Supported only for WebSocket APIs.</p>

    Raises:
        capo_apigatewayv2.errors.bad_request_exception.BadRequestException: <p>The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.conflict_exception.ConflictException: <p>The requested operation would cause a conflict with the current state of a service resource associated with the request. Resolve the conflict before retrying this request. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.not_found_exception.NotFoundException: <p>The resource specified in the request was not found. See the message field for more information.</p>
        capo_apigatewayv2.errors.too_many_requests_exception.TooManyRequestsException: <p>A limit has been exceeded. See the accompanying error message for details.</p>
        capo_apigatewayv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_apigatewayv2.types.create_integration_response_request.CreateIntegrationResponseRequest]",
    ) -> OperationResponse[
        "capo_apigatewayv2.types.create_integration_response_response.CreateIntegrationResponseResponse"
    ]:
        import capo_apigatewayv2._operations.api_gateway_v2.create_integration_response

        output, http_response = (
            capo_apigatewayv2._operations.api_gateway_v2.create_integration_response.create_integration_response(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateIntegrationResponse")
    )
    input_: capo_apigatewayv2.types.create_integration_response_request.CreateIntegrationResponseRequest = {
        "api_id": api_id,
        "integration_id": integration_id,
    }
    if content_handling_strategy is not None:
        input_["content_handling_strategy"] = content_handling_strategy
    if integration_response_key is not None:
        input_["integration_response_key"] = integration_response_key
    if response_parameters is not None:
        input_["response_parameters"] = response_parameters
    if response_templates is not None:
        input_["response_templates"] = response_templates
    if template_selection_expression is not None:
        input_["template_selection_expression"] = template_selection_expression

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