@Generated(value="jsii-pacmak/1.73.0 (build 6faeda3)", date="2023-01-31T18:36:58.245Z") public class Method extends Resource
LambdaIntegration integration; RestApi api = new RestApi(this, "hello-api"); Resource v1 = api.root.addResource("v1"); Resource echo = v1.addResource("echo"); Method echoMethod = echo.addMethod("GET", integration, MethodOptions.builder().apiKeyRequired(true).build()); UsagePlan plan = api.addUsagePlan("UsagePlan", UsagePlanProps.builder() .name("Easy") .throttle(ThrottleSettings.builder() .rateLimit(10) .burstLimit(2) .build()) .build()); IApiKey key = api.addApiKey("ApiKey"); plan.addApiKey(key);
Modifier and Type | Class and Description |
---|---|
static class |
Method.Builder
A fluent builder for
Method . |
IResource.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
Method(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Method(software.amazon.jsii.JsiiObjectRef objRef) |
|
Method(software.constructs.Construct scope,
java.lang.String id,
MethodProps props) |
Modifier and Type | Method and Description |
---|---|
void |
addMethodResponse(MethodResponse methodResponse)
Add a method response to this method.
|
IRestApi |
getApi()
The API Gateway RestApi associated with this method.
|
java.lang.String |
getHttpMethod() |
java.lang.String |
getMethodArn()
Returns an execute-api ARN for this method:.
|
java.lang.String |
getMethodId() |
IResource |
getResource() |
RestApi |
getRestApi()
Deprecated.
- Throws an error if this Resource is not associated with an instance of `RestApi`. Use `api` instead.
|
java.lang.String |
getTestMethodArn()
Returns an execute-api ARN for this method's "test-invoke-stage" stage.
|
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, getStack, isResource
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getNode
protected Method(software.amazon.jsii.JsiiObjectRef objRef)
protected Method(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
public Method(software.constructs.Construct scope, java.lang.String id, MethodProps props)
scope
- This parameter is required.id
- This parameter is required.props
- This parameter is required.public void addMethodResponse(MethodResponse methodResponse)
methodResponse
- This parameter is required.public IRestApi getApi()
public java.lang.String getHttpMethod()
public java.lang.String getMethodArn()
arn:aws:execute-api:{region}:{account}:{restApiId}/{stage}/{method}/{path}
NOTE: {stage} will refer to the restApi.deploymentStage
, which will
automatically set if auto-deploy is enabled, or can be explicitly assigned.
When not configured, {stage} will be set to '*', as a shorthand for 'all stages'.
public java.lang.String getMethodId()
public IResource getResource()
@Deprecated public RestApi getRestApi()
public java.lang.String getTestMethodArn()
This stage is used by the AWS Console UI when testing the method.