@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:36.209Z") @Stability(value=Stable) public class RestApi extends RestApiBase
Use addResource and addMethod to configure the API model.
By default, the API will automatically be deployed and accessible from a public endpoint.
Example:
StateMachine stateMachine = StateMachine.Builder.create(this, "MyStateMachine")
.stateMachineType(StateMachineType.EXPRESS)
.definition(Chain.start(new Pass(this, "Pass")))
.build();
RestApi api = RestApi.Builder.create(this, "Api")
.restApiName("MyApi")
.build();
api.root.addMethod("GET", StepFunctionsIntegration.startExecution(stateMachine));
| Modifier and Type | Class and Description |
|---|---|
static class |
RestApi.Builder
A fluent builder for
RestApi. |
software.amazon.jsii.JsiiObject.InitializationModeIRestApi.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
RestApi(software.constructs.Construct scope,
String id) |
|
RestApi(software.constructs.Construct scope,
String id,
RestApiProps props) |
protected |
RestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
RestApi(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Model |
addModel(String id,
ModelOptions props)
Adds a new model.
|
RequestValidator |
addRequestValidator(String id,
RequestValidatorOptions props)
Adds a new request validator.
|
static IRestApi |
fromRestApiAttributes(software.constructs.Construct scope,
String id,
RestApiAttributes attrs)
Import an existing RestApi that can be configured with additional Methods and Resources.
|
static IRestApi |
fromRestApiId(software.constructs.Construct scope,
String id,
String restApiId)
Import an existing RestApi.
|
List<Method> |
getMethods()
The list of methods bound to this RestApi.
|
String |
getRestApiId()
The ID of this API Gateway RestApi.
|
String |
getRestApiRootResourceId()
The resource ID of the root resource.
|
IResource |
getRoot()
Represents the root resource of this API endpoint ('/').
|
String |
getUrl()
The deployed root URL of this REST API.
|
addApiKey, addApiKey, addDomainName, addGatewayResponse, addUsagePlan, addUsagePlan, arnForExecuteApi, arnForExecuteApi, arnForExecuteApi, arnForExecuteApi, getCloudWatchAccount, getDeploymentStage, getDomainName, getLatestDeployment, getRestApiName, metric, metric, metricCacheHitCount, metricCacheHitCount, metricCacheMissCount, metricCacheMissCount, metricClientError, metricClientError, metricCount, metricCount, metricIntegrationLatency, metricIntegrationLatency, metricLatency, metricLatency, metricServerError, metricServerError, setCloudWatchAccount, setDeploymentStage, urlForPath, urlForPathapplyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isOwnedResource, isResourcejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitapplyRemovalPolicy, getEnv, getStackprotected RestApi(software.amazon.jsii.JsiiObjectRef objRef)
protected RestApi(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public RestApi(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
RestApiProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Stable)
public RestApi(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Stable) @NotNull public static IRestApi fromRestApiAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull RestApiAttributes attrs)
scope - This parameter is required.id - This parameter is required.attrs - This parameter is required.@Stability(value=Stable) @NotNull public static IRestApi fromRestApiId(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull String restApiId)
scope - This parameter is required.id - This parameter is required.restApiId - This parameter is required.@Stability(value=Stable) @NotNull public Model addModel(@NotNull String id, @NotNull ModelOptions props)
id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public RequestValidator addRequestValidator(@NotNull String id, @NotNull RequestValidatorOptions props)
id - This parameter is required.props - This parameter is required.@Stability(value=Stable) @NotNull public List<Method> getMethods()
@Stability(value=Stable) @NotNull public String getRestApiId()
getRestApiId in interface IRestApigetRestApiId in class RestApiBase@Stability(value=Stable) @NotNull public String getRestApiRootResourceId()
getRestApiRootResourceId in interface IRestApigetRestApiRootResourceId in class RestApiBase@Stability(value=Stable) @NotNull public IResource getRoot()
Resources and Methods are added to this resource.
getRoot in interface IRestApigetRoot in class RestApiBase@Stability(value=Stable) @NotNull public String getUrl()
Copyright © 2022. All rights reserved.