Class RestApiBase

java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.apigateway.RestApiBase
All Implemented Interfaces:
IResource, IRestApi, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable
Direct Known Subclasses:
RestApi, SpecRestApi

@Generated(value="jsii-pacmak/1.103.1 (build bef2dea)", date="2024-10-05T03:43:38.002Z") @Stability(Stable) public abstract class RestApiBase extends Resource implements IRestApi
Base implementation that are common to various implementations of IRestApi.

Example:

 RestApi api;
 Distribution.Builder.create(this, "Distribution")
         .defaultBehavior(BehaviorOptions.builder().origin(new RestApiOrigin(api)).build())
         .build();
 
  • Constructor Details

    • RestApiBase

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

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

      @Stability(Stable) protected RestApiBase(@NotNull software.constructs.Construct scope, @NotNull String id, @Nullable RestApiBaseProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props -
    • RestApiBase

      @Stability(Stable) protected RestApiBase(@NotNull software.constructs.Construct scope, @NotNull String id)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
  • Method Details

    • addApiKey

      @Stability(Stable) @NotNull public IApiKey addApiKey(@NotNull String id, @Nullable ApiKeyOptions options)
      Add an ApiKey to the deploymentStage.

      Parameters:
      id - This parameter is required.
      options -
    • addApiKey

      @Stability(Stable) @NotNull public IApiKey addApiKey(@NotNull String id)
      Add an ApiKey to the deploymentStage.

      Parameters:
      id - This parameter is required.
    • addDomainName

      @Stability(Stable) @NotNull public DomainName addDomainName(@NotNull String id, @NotNull DomainNameOptions options)
      Defines an API Gateway domain name and maps it to this API.

      Parameters:
      id - The construct id. This parameter is required.
      options - custom domain options. This parameter is required.
    • addGatewayResponse

      @Stability(Stable) @NotNull public GatewayResponse addGatewayResponse(@NotNull String id, @NotNull GatewayResponseOptions options)
      Adds a new gateway response.

      Parameters:
      id - This parameter is required.
      options - This parameter is required.
    • addUsagePlan

      @Stability(Stable) @NotNull public UsagePlan addUsagePlan(@NotNull String id, @Nullable UsagePlanProps props)
      Adds a usage plan.

      Parameters:
      id - This parameter is required.
      props -
    • addUsagePlan

      @Stability(Stable) @NotNull public UsagePlan addUsagePlan(@NotNull String id)
      Adds a usage plan.

      Parameters:
      id - This parameter is required.
    • arnForExecuteApi

      @Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path, @Nullable String stage)
      Gets the "execute-api" ARN.

      Specified by:
      arnForExecuteApi in interface IRestApi
      Parameters:
      method -
      path -
      stage -
      Returns:
      The "execute-api" ARN.
    • arnForExecuteApi

      @Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method, @Nullable String path)
      Gets the "execute-api" ARN.

      Specified by:
      arnForExecuteApi in interface IRestApi
      Parameters:
      method -
      path -
      Returns:
      The "execute-api" ARN.
    • arnForExecuteApi

      @Stability(Stable) @NotNull public String arnForExecuteApi(@Nullable String method)
      Gets the "execute-api" ARN.

      Specified by:
      arnForExecuteApi in interface IRestApi
      Parameters:
      method -
      Returns:
      The "execute-api" ARN.
    • arnForExecuteApi

      @Stability(Stable) @NotNull public String arnForExecuteApi()
      Gets the "execute-api" ARN.
      Specified by:
      arnForExecuteApi in interface IRestApi
      Returns:
      The "execute-api" ARN.
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName, @Nullable MetricOptions props)
      Returns the given named metric for this API.

      Parameters:
      metricName - This parameter is required.
      props -
    • metric

      @Stability(Stable) @NotNull public Metric metric(@NotNull String metricName)
      Returns the given named metric for this API.

      Parameters:
      metricName - This parameter is required.
    • metricCacheHitCount

      @Stability(Stable) @NotNull public Metric metricCacheHitCount(@Nullable MetricOptions props)
      Metric for the number of requests served from the API cache in a given period.

      Default: sum over 5 minutes

      Parameters:
      props -
    • metricCacheHitCount

      @Stability(Stable) @NotNull public Metric metricCacheHitCount()
      Metric for the number of requests served from the API cache in a given period.

      Default: sum over 5 minutes

    • metricCacheMissCount

      @Stability(Stable) @NotNull public Metric metricCacheMissCount(@Nullable MetricOptions props)
      Metric for the number of requests served from the backend in a given period, when API caching is enabled.

      Default: sum over 5 minutes

      Parameters:
      props -
    • metricCacheMissCount

      @Stability(Stable) @NotNull public Metric metricCacheMissCount()
      Metric for the number of requests served from the backend in a given period, when API caching is enabled.

      Default: sum over 5 minutes

    • metricClientError

      @Stability(Stable) @NotNull public Metric metricClientError(@Nullable MetricOptions props)
      Metric for the number of client-side errors captured in a given period.

      Default: sum over 5 minutes

      Parameters:
      props -
    • metricClientError

      @Stability(Stable) @NotNull public Metric metricClientError()
      Metric for the number of client-side errors captured in a given period.

      Default: sum over 5 minutes

    • metricCount

      @Stability(Stable) @NotNull public Metric metricCount(@Nullable MetricOptions props)
      Metric for the total number API requests in a given period.

      Default: sample count over 5 minutes

      Parameters:
      props -
    • metricCount

      @Stability(Stable) @NotNull public Metric metricCount()
      Metric for the total number API requests in a given period.

      Default: sample count over 5 minutes

    • metricIntegrationLatency

      @Stability(Stable) @NotNull public Metric metricIntegrationLatency(@Nullable MetricOptions props)
      Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.

      Default: average over 5 minutes.

      Parameters:
      props -
    • metricIntegrationLatency

      @Stability(Stable) @NotNull public Metric metricIntegrationLatency()
      Metric for the time between when API Gateway relays a request to the backend and when it receives a response from the backend.

      Default: average over 5 minutes.

    • metricLatency

      @Stability(Stable) @NotNull public Metric metricLatency(@Nullable MetricOptions props)
      The time between when API Gateway receives a request from a client and when it returns a response to the client.

      The latency includes the integration latency and other API Gateway overhead.

      Default: average over 5 minutes.

      Parameters:
      props -
    • metricLatency

      @Stability(Stable) @NotNull public Metric metricLatency()
      The time between when API Gateway receives a request from a client and when it returns a response to the client.

      The latency includes the integration latency and other API Gateway overhead.

      Default: average over 5 minutes.

    • metricServerError

      @Stability(Stable) @NotNull public Metric metricServerError(@Nullable MetricOptions props)
      Metric for the number of server-side errors captured in a given period.

      Default: sum over 5 minutes

      Parameters:
      props -
    • metricServerError

      @Stability(Stable) @NotNull public Metric metricServerError()
      Metric for the number of server-side errors captured in a given period.

      Default: sum over 5 minutes

    • urlForPath

      @Stability(Stable) @NotNull public String urlForPath(@Nullable String path)
      Returns the URL for an HTTP path.

      Fails if deploymentStage is not set either by deploy or explicitly.

      Parameters:
      path -
    • urlForPath

      @Stability(Stable) @NotNull public String urlForPath()
      Returns the URL for an HTTP path.

      Fails if deploymentStage is not set either by deploy or explicitly.

    • getRestApiId

      @Stability(Stable) @NotNull public abstract String getRestApiId()
      The ID of this API Gateway RestApi.
      Specified by:
      getRestApiId in interface IRestApi
    • getRestApiName

      @Stability(Stable) @NotNull public String getRestApiName()
      A human friendly name for this Rest API.

      Note that this is different from restApiId.

      Specified by:
      getRestApiName in interface IRestApi
    • getRestApiRootResourceId

      @Stability(Stable) @NotNull public abstract String getRestApiRootResourceId()
      The resource ID of the root resource.
      Specified by:
      getRestApiRootResourceId in interface IRestApi
    • getRoot

      @Stability(Stable) @NotNull public abstract IResource getRoot()
      Represents the root resource of this API endpoint ('/').

      Resources and Methods are added to this resource.

      Specified by:
      getRoot in interface IRestApi
    • getUrl

      @Stability(Stable) @NotNull public String getUrl()
      The deployed root URL of this REST API.
    • getDomainName

      @Stability(Stable) @Nullable public DomainName getDomainName()
      The first domain name mapped to this API, if defined through the domainName configuration prop, or added via addDomainName.
    • getLatestDeployment

      @Stability(Stable) @Nullable public Deployment getLatestDeployment()
      API Gateway deployment that represents the latest changes of the API.

      This resource will be automatically updated every time the REST API model changes. This will be undefined if deploy is false.

      Specified by:
      getLatestDeployment in interface IRestApi
    • getDeploymentStage

      @Stability(Stable) @NotNull public Stage getDeploymentStage()
      API Gateway stage that points to the latest deployment (if defined).

      If deploy is disabled, you will need to explicitly assign this value in order to set up integrations.

      Specified by:
      getDeploymentStage in interface IRestApi
    • setDeploymentStage

      @Stability(Stable) public void setDeploymentStage(@NotNull Stage value)
      API Gateway stage that points to the latest deployment (if defined).

      If deploy is disabled, you will need to explicitly assign this value in order to set up integrations.

      Specified by:
      setDeploymentStage in interface IRestApi
    • getCloudWatchAccount

      @Stability(Stable) @Nullable protected CfnAccount getCloudWatchAccount()
    • setCloudWatchAccount

      @Stability(Stable) protected void setCloudWatchAccount(@Nullable CfnAccount value)