IRestApi

class aws_cdk.aws_apigateway.IRestApi(*args, **kwds)

Bases: aws_cdk.core.IResource, typing_extensions.Protocol

Methods

arn_for_execute_api(method=None, path=None, stage=None)

Gets the “execute-api” ARN.

Parameters
  • method (Optional[str]) – The method (default *).

  • path (Optional[str]) – The resource path. Must start with ‘/’ (default *)

  • stage (Optional[str]) – The stage (default *).

Default

“*” returns the execute API ARN for all methods/resources in this API.

Return type

str

Returns

The “execute-api” ARN.

Attributes

deployment_stage

API Gateway stage that points to the latest deployment (if defined).

Return type

Stage

env

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.

Return type

ResourceEnvironment

latest_deployment

API Gateway deployment that represents the latest changes of the API.

This resource will be automatically updated every time the REST API model changes. undefined when no deployment is configured.

Return type

Optional[Deployment]

node

The construct tree node for this construct.

Return type

ConstructNode

rest_api_id

The ID of this API Gateway RestApi.

Attribute

true

Return type

str

rest_api_root_resource_id

The resource ID of the root resource.

Attribute

true

Return type

str

root

.

api.root.addMethod(‘ANY’, redirectToHomePage); // “ANY /” api.root.addResource(‘friends’).addMethod(‘GET’, getFriendsHandler); // “GET /friends”

Type

Represents the root resource (“/”) of this API. Use it to define the API model

Return type

IResource

stack

The stack in which this resource is defined.

Return type

Stack