java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.core.Construct
software.amazon.awscdk.core.Resource
software.amazon.awscdk.services.apigateway.Method
All Implemented Interfaces:
IConstruct, IDependable, IResource, software.amazon.jsii.JsiiSerializable, 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
Example:

 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);
 
  • Constructor Details

    • Method

      protected Method(software.amazon.jsii.JsiiObjectRef objRef)
    • Method

      protected Method(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Method

      @Stability(Stable) public Method(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull MethodProps props)
      Parameters:
      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.

      Parameters:
      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:.

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

    • getMethodId

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

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

      @Stability(Deprecated) @Deprecated @NotNull public RestApi getRestApi()
      Deprecated.
      • 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.