Integration

class aws_cdk.aws_apigateway.Integration(*, type, integration_http_method=None, options=None, uri=None)

Bases: object

Base class for backend integrations for an API Gateway method.

Use one of the concrete classes such as MockIntegration, AwsIntegration, LambdaIntegration or implement on your own by specifying the set of props.

ExampleMetadata:

infused

Example:

# books: apigateway.Resource
# iam_user: iam.User


get_books = books.add_method("GET", apigateway.HttpIntegration("http://amazon.com"),
    authorization_type=apigateway.AuthorizationType.IAM
)

iam_user.attach_inline_policy(iam.Policy(self, "AllowBooks",
    statements=[
        iam.PolicyStatement(
            actions=["execute-api:Invoke"],
            effect=iam.Effect.ALLOW,
            resources=[get_books.method_arn]
        )
    ]
))
Parameters:
  • type (IntegrationType) – Specifies an API method integration type.

  • integration_http_method (Optional[str]) – The integration’s HTTP method type. Required unless you use a MOCK integration.

  • options (Union[IntegrationOptions, Dict[str, Any], None]) – Integration options.

  • uri (Optional[Any]) – The Uniform Resource Identifier (URI) for the integration. - If you specify HTTP for the type property, specify the API endpoint URL. - If you specify MOCK for the type property, don’t specify this property. - If you specify AWS for the type property, specify an AWS service that follows this form: arn:partition:apigateway:region:subdomain.service|service:path|action/service_api. For example, a Lambda function URI follows this form: arn:partition:apigateway:region:lambda:path/path. The path is usually in the form /2015-03-31/functions/LambdaFunctionARN/invocations.

Methods

bind(_method)

Can be overridden by subclasses to allow the integration to interact with the method being integrated, access the REST API object, method ARNs, etc.

Parameters:

_method (Method) –

Return type:

IntegrationConfig