IRestApi¶
-
class
aws_cdk.aws_apigateway.
IRestApi
(*args, **kwds)¶ Bases:
aws_cdk.core.IResource
,typing_extensions.Protocol
Methods
-
apply_removal_policy
(policy)¶ Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
RemovalPolicy
) –- Return type
None
-
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
-
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
-
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
-
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
-