All Implemented Interfaces:
IConstruct, IDependable, IResource,, software.constructs.IConstruct

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:45.004Z") @Stability(Stable) 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()
 IApiKey key = api.addApiKey("ApiKey");
  • Constructor Details

    • Method

      protected Method( objRef)
    • Method

      protected Method( initializationMode)
    • Method

      @Stability(Stable) public Method(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull MethodProps props)
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • addMethodResponse

      @Stability(Stable) public void addMethodResponse(@NotNull MethodResponse methodResponse)
      Add a method response to this method.

      methodResponse - This parameter is required.
    • getApi

      @Stability(Stable) @NotNull public IRestApi getApi()
      The API Gateway RestApi associated with this method.
    • getHttpMethod

      @Stability(Stable) @NotNull public String getHttpMethod()
    • getMethodArn

      @Stability(Stable) @NotNull public String getMethodArn()
      Returns an execute-api ARN for this method:.


      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'.

    • getMethodId

      @Stability(Stable) @NotNull public String getMethodId()
    • getResource

      @Stability(Stable) @NotNull public IResource getResource()
    • getRestApi

      @Stability(Deprecated) @Deprecated @NotNull public RestApi getRestApi()
      • Throws an error if this Resource is not associated with an instance of RestApi. Use api instead.
      (deprecated) The RestApi associated with this Method.

    • getTestMethodArn

      @Stability(Stable) @NotNull public String getTestMethodArn()
      Returns an execute-api ARN for this method's "test-invoke-stage" stage.

      This stage is used by the AWS Console UI when testing the method.