Skip to content

put_integration async

put_integration(
    rest_api_id: String,
    resource_id: String,
    http_method: String,
    type: IntegrationType,
    *,
    config_overrides: Optional[AsyncAPIGatewayClientConfig] = None,
    integration_http_method: Optional[String] = None,
    uri: Optional[String] = None,
    connection_type: Optional[ConnectionType] = None,
    connection_id: Optional[String] = None,
    credentials: Optional[String] = None,
    request_parameters: Optional[MapOfStringToString] = None,
    request_templates: Optional[MapOfStringToString] = None,
    passthrough_behavior: Optional[String] = None,
    cache_namespace: Optional[String] = None,
    cache_key_parameters: Optional[ListOfString] = None,
    content_handling: Optional[ContentHandlingStrategy] = None,
    timeout_in_millis: Optional[NullableInteger] = None,
    tls_config: Optional[TlsConfig] = None,
    response_transfer_mode: Optional[ResponseTransferMode] = None,
    integration_target: Optional[String] = None,
) -> Integration

Sets up a method's integration.

Parameters:

  • rest_api_id (String) –

    The string identifier of the associated RestApi.

  • resource_id (String) –

    Specifies a put integration request's resource ID.

  • http_method (String) –

    Specifies the HTTP method for the integration.

  • type (IntegrationType) –

    Specifies a put integration input's type.

  • integration_http_method (Optional[String], default: None ) –

    The HTTP method for the integration.

  • uri (Optional[String], default: None ) –

    Specifies Uniform Resource Identifier (URI) of the integration endpoint. For HTTP or HTTP_PROXY integrations, the URI must be a fully formed, encoded HTTP(S) URL according to the RFC-3986 specification, for either standard integration, where connectionType is not VPC_LINK, or private integration, where connectionType is VPC_LINK. For a private HTTP integration, the URI is not used for routing. For AWS or AWS_PROXY integrations, the URI is of the form arn:aws:apigateway:{region}:{subdomain.service|service}:path|action/{service_api}. Here, {Region} is the API Gateway region (e.g., us-east-1); {service} is the name of the integrated Amazon Web Services service (e.g., s3); and {subdomain} is a designated subdomain supported by certain Amazon Web Services service for fast host-name lookup. action can be used for an Amazon Web Services service action-based API, using an Action={name}&{p1}={v1}&p2={v2}... query string. The ensuing {service_api} refers to a supported action {name} plus any required input parameters. Alternatively, path can be used for an Amazon Web Services service path-based API. The ensuing service_api refers to the path to an Amazon Web Services service resource, including the region of the integrated Amazon Web Services service, if applicable. For example, for integration with the S3 API of GetObject, the uri can be either arn:aws:apigateway:us-west-2:s3:action/GetObject&Bucket={bucket}&Key={key} or arn:aws:apigateway:us-west-2:s3:path/{bucket}/{key}.

  • connection_type (Optional[ConnectionType], default: None ) –

    The type of the network connection to the integration endpoint. The valid value is INTERNET for connections through the public routable internet or VPC_LINK for private connections between API Gateway and a network load balancer in a VPC. The default value is INTERNET.

  • connection_id (Optional[String], default: None ) –

    The ID of the VpcLink used for the integration. Specify this value only if you specify VPC_LINK as the connection type.

  • credentials (Optional[String], default: None ) –

    Specifies whether credentials are required for a put integration.

  • request_parameters (Optional[MapOfStringToString], default: None ) –

    A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of method.request.{location}.{name}, where location is querystring, path, or header and name must be a valid and unique method request parameter name.

  • request_templates (Optional[MapOfStringToString], default: None ) –

    Represents a map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client. The content type value is the key in this map, and the template (as a String) is the value.

  • passthrough_behavior (Optional[String], default: None ) –

    Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the requestTemplates property on the Integration resource. There are three valid values: WHEN_NO_MATCH, WHEN_NO_TEMPLATES, and NEVER.

  • cache_namespace (Optional[String], default: None ) –

    Specifies a group of related cached parameters. By default, API Gateway uses the resource ID as the cacheNamespace. You can specify the same cacheNamespace across resources to return the same cached data for requests to different resources.

  • cache_key_parameters (Optional[ListOfString], default: None ) –

    A list of request parameters whose values API Gateway caches. To be valid values for cacheKeyParameters, these parameters must also be specified for Method requestParameters.

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

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

    If this property is not defined, the request payload will be passed through from the method request to integration request without modification, provided that the passthroughBehavior is configured to support payload pass-through.

  • timeout_in_millis (Optional[NullableInteger], default: None ) –

    Custom timeout between 50 and 29,000 milliseconds. The default value is 29,000 milliseconds or 29 seconds. You can increase the default value to longer than 29 seconds for Regional or private APIs only.

  • response_transfer_mode (Optional[ResponseTransferMode], default: None ) –

    The response transfer mode of the integration.

  • integration_target (Optional[String], default: None ) –

    The ALB or NLB listener to send the request to.

Raises:

  • BadRequestException –

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

  • ConflictException –

    The request configuration has conflicts. For details, see the accompanying error message.

  • LimitExceededException –

    The request exceeded the rate limit. Retry after the specified time period.

  • NotFoundException –

    The requested resource is not found. Make sure that the request URI is correct.

  • TooManyRequestsException –

    The request has reached its throttling limit. Retry after the specified time period.

  • UnauthorizedException –

    The request is denied because the caller has insufficient permissions.

  • UnknownServiceError –

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

Source code in docs_src/capo_api_gateway/_services/async_api_gateway.py
async def put_integration(
    self,
    rest_api_id: "capo_api_gateway.types.string.String",
    resource_id: "capo_api_gateway.types.string.String",
    http_method: "capo_api_gateway.types.string.String",
    type: "capo_api_gateway.types.integration_type.IntegrationType",
    *,
    config_overrides: Optional[AsyncAPIGatewayClientConfig] = None,
    integration_http_method: Optional[
        "capo_api_gateway.types.string.String"
    ] = None,
    uri: Optional["capo_api_gateway.types.string.String"] = None,
    connection_type: Optional[
        "capo_api_gateway.types.connection_type.ConnectionType"
    ] = None,
    connection_id: Optional["capo_api_gateway.types.string.String"] = None,
    credentials: Optional["capo_api_gateway.types.string.String"] = None,
    request_parameters: Optional[
        "capo_api_gateway.types.map_of_string_to_string.MapOfStringToString"
    ] = None,
    request_templates: Optional[
        "capo_api_gateway.types.map_of_string_to_string.MapOfStringToString"
    ] = None,
    passthrough_behavior: Optional["capo_api_gateway.types.string.String"] = None,
    cache_namespace: Optional["capo_api_gateway.types.string.String"] = None,
    cache_key_parameters: Optional[
        "capo_api_gateway.types.list_of_string.ListOfString"
    ] = None,
    content_handling: Optional[
        "capo_api_gateway.types.content_handling_strategy.ContentHandlingStrategy"
    ] = None,
    timeout_in_millis: Optional[
        "capo_api_gateway.types.nullable_integer.NullableInteger"
    ] = None,
    tls_config: Optional["capo_api_gateway.types.tls_config.TlsConfig"] = None,
    response_transfer_mode: Optional[
        "capo_api_gateway.types.response_transfer_mode.ResponseTransferMode"
    ] = None,
    integration_target: Optional["capo_api_gateway.types.string.String"] = None,
) -> "capo_api_gateway.types.integration.Integration":
    """<p>Sets up a method's integration.</p>

    Args:
        rest_api_id: <p>The string identifier of the associated RestApi.</p>
        resource_id: <p>Specifies a put integration request's resource ID.</p>
        http_method: <p>Specifies the HTTP method for the integration.</p>
        type: <p>Specifies a put integration input's type.</p>
        integration_http_method: <p>The HTTP method for the integration.</p>
        uri: <p>Specifies Uniform Resource Identifier (URI) of the integration endpoint. For HTTP or <code>HTTP_PROXY</code> integrations, the URI must be a fully formed, encoded HTTP(S) URL according to the RFC-3986 specification, for either standard integration, where <code>connectionType</code> is not <code>VPC_LINK</code>, or private integration, where <code>connectionType</code> is <code>VPC_LINK</code>. For a private HTTP integration, the URI is not used for routing. For <code>AWS</code> or <code>AWS_PROXY</code> integrations, the URI is of the form <code>arn:aws:apigateway:{region}:{subdomain.service|service}:path|action/{service_api</code>}. Here, {Region} is the API Gateway region (e.g., us-east-1); {service} is the name of the integrated Amazon Web Services service (e.g., s3); and {subdomain} is a designated subdomain supported by certain Amazon Web Services service for fast host-name lookup. action can be used for an Amazon Web Services service action-based API, using an Action={name}&{p1}={v1}&p2={v2}... query string. The ensuing {service_api} refers to a supported action {name} plus any required input parameters. Alternatively, path can be used for an Amazon Web Services service path-based API. The ensuing service_api refers to the path to an Amazon Web Services service resource, including the region of the integrated Amazon Web Services service, if applicable. For example, for integration with the S3 API of <code>GetObject</code>, the <code>uri</code> can be either <code>arn:aws:apigateway:us-west-2:s3:action/GetObject&Bucket={bucket}&Key={key}</code> or <code>arn:aws:apigateway:us-west-2:s3:path/{bucket}/{key}</code>.</p>
        connection_type: <p>The type of the network connection to the integration endpoint. The valid value is <code>INTERNET</code> for connections through the public routable internet or <code>VPC_LINK</code> for private connections between API Gateway and a network load balancer in a VPC. The default value is <code>INTERNET</code>.</p>
        connection_id: <p>The ID of the VpcLink used for the integration. Specify this value only if you specify <code>VPC_LINK</code> as the connection type.</p>
        credentials: <p>Specifies whether credentials are required for a put integration.</p>
        request_parameters: <p>A key-value map specifying request parameters that are passed from the method request to the back end. The key is an integration request parameter name and the associated value is a method request parameter value or static value that must be enclosed within single quotes and pre-encoded as required by the back end. The method request parameter value must match the pattern of <code>method.request.{location}.{name}</code>, where <code>location</code> is <code>querystring</code>, <code>path</code>, or <code>header</code> and <code>name</code> must be a valid and unique method request parameter name.</p>
        request_templates: <p>Represents a map of Velocity templates that are applied on the request payload based on the value of the Content-Type header sent by the client. The content type value is the key in this map, and the template (as a String) is the value.</p>
        passthrough_behavior: <p>Specifies the pass-through behavior for incoming requests based on the Content-Type header in the request, and the available mapping templates specified as the <code>requestTemplates</code> property on the Integration resource. There are three valid values: <code>WHEN_NO_MATCH</code>, <code>WHEN_NO_TEMPLATES</code>, and <code>NEVER</code>. </p>
        cache_namespace: <p>Specifies a group of related cached parameters. By default, API Gateway uses the resource ID as the <code>cacheNamespace</code>. You can specify the same <code>cacheNamespace</code> across resources to return the same cached data for requests to different resources.</p>
        cache_key_parameters: <p>A list of request parameters whose values API Gateway caches. To be valid values for <code>cacheKeyParameters</code>, these parameters must also be specified for Method <code>requestParameters</code>.</p>
        content_handling: <p>Specifies how to handle request payload content type conversions. Supported values are <code>CONVERT_TO_BINARY</code> and <code>CONVERT_TO_TEXT</code>, with the following behaviors:</p> <p>If this property is not defined, the request payload will be passed through from the method request to integration request without modification, provided that the <code>passthroughBehavior</code> is configured to support payload pass-through.</p>
        timeout_in_millis: <p>Custom timeout between 50 and 29,000 milliseconds. The default value is 29,000 milliseconds or 29 seconds. You can increase the default value to longer than 29 seconds for Regional or private APIs only.</p>
        response_transfer_mode: <p> The response transfer mode of the integration. </p>
        integration_target: <p> The ALB or NLB listener to send the request to. </p>

    Raises:
        capo_api_gateway.errors.bad_request_exception.BadRequestException: <p>The submitted request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.</p>
        capo_api_gateway.errors.conflict_exception.ConflictException: <p>The request configuration has conflicts. For details, see the accompanying error message.</p>
        capo_api_gateway.errors.limit_exceeded_exception.LimitExceededException: <p>The request exceeded the rate limit. Retry after the specified time period.</p>
        capo_api_gateway.errors.not_found_exception.NotFoundException: <p>The requested resource is not found. Make sure that the request URI is correct.</p>
        capo_api_gateway.errors.too_many_requests_exception.TooManyRequestsException: <p>The request has reached its throttling limit. Retry after the specified time period.</p>
        capo_api_gateway.errors.unauthorized_exception.UnauthorizedException: <p>The request is denied because the caller has insufficient permissions.</p>
        capo_api_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_api_gateway.types.put_integration_request.PutIntegrationRequest]",
    ) -> AsyncOperationResponse["capo_api_gateway.types.integration.Integration"]:
        import capo_api_gateway._operations.backplane_control_service.put_integration

        (
            output,
            http_response,
        ) = await capo_api_gateway._operations.backplane_control_service.put_integration.async_put_integration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutIntegration")
    )
    input_: capo_api_gateway.types.put_integration_request.PutIntegrationRequest = {
        "rest_api_id": rest_api_id,
        "resource_id": resource_id,
        "http_method": http_method,
        "type": type,
    }
    if integration_http_method is not None:
        input_["integration_http_method"] = integration_http_method
    if uri is not None:
        input_["uri"] = uri
    if connection_type is not None:
        input_["connection_type"] = connection_type
    if connection_id is not None:
        input_["connection_id"] = connection_id
    if credentials is not None:
        input_["credentials"] = credentials
    if request_parameters is not None:
        input_["request_parameters"] = request_parameters
    if request_templates is not None:
        input_["request_templates"] = request_templates
    if passthrough_behavior is not None:
        input_["passthrough_behavior"] = passthrough_behavior
    if cache_namespace is not None:
        input_["cache_namespace"] = cache_namespace
    if cache_key_parameters is not None:
        input_["cache_key_parameters"] = cache_key_parameters
    if content_handling is not None:
        input_["content_handling"] = content_handling
    if timeout_in_millis is not None:
        input_["timeout_in_millis"] = timeout_in_millis
    if tls_config is not None:
        input_["tls_config"] = tls_config
    if response_transfer_mode is not None:
        input_["response_transfer_mode"] = response_transfer_mode
    if integration_target is not None:
        input_["integration_target"] = integration_target

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