Try AWS Native preview for resources not in the classic version.
aws.apigateway.getRestApi
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Use this data source to get the id and root_resource_id of a REST API in API Gateway. To fetch the REST API you must provide a name to match against. As there is no unique name constraint on REST APIs this data source will error if there is more than one match.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var myRestApi = Aws.ApiGateway.GetRestApi.Invoke(new()
{
Name = "my-rest-api",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := apigateway.LookupRestApi(ctx, &apigateway.LookupRestApiArgs{
Name: "my-rest-api",
}, nil)
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.apigateway.ApigatewayFunctions;
import com.pulumi.aws.apigateway.inputs.GetRestApiArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var myRestApi = ApigatewayFunctions.getRestApi(GetRestApiArgs.builder()
.name("my-rest-api")
.build());
}
}
import pulumi
import pulumi_aws as aws
my_rest_api = aws.apigateway.get_rest_api(name="my-rest-api")
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const myRestApi = aws.apigateway.getRestApi({
name: "my-rest-api",
});
variables:
myRestApi:
fn::invoke:
Function: aws:apigateway:getRestApi
Arguments:
name: my-rest-api
Using getRestApi
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getRestApi(args: GetRestApiArgs, opts?: InvokeOptions): Promise<GetRestApiResult>
function getRestApiOutput(args: GetRestApiOutputArgs, opts?: InvokeOptions): Output<GetRestApiResult>
def get_rest_api(name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetRestApiResult
def get_rest_api_output(name: Optional[pulumi.Input[str]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetRestApiResult]
func LookupRestApi(ctx *Context, args *LookupRestApiArgs, opts ...InvokeOption) (*LookupRestApiResult, error)
func LookupRestApiOutput(ctx *Context, args *LookupRestApiOutputArgs, opts ...InvokeOption) LookupRestApiResultOutput
> Note: This function is named LookupRestApi
in the Go SDK.
public static class GetRestApi
{
public static Task<GetRestApiResult> InvokeAsync(GetRestApiArgs args, InvokeOptions? opts = null)
public static Output<GetRestApiResult> Invoke(GetRestApiInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetRestApiResult> getRestApi(GetRestApiArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:apigateway/getRestApi:getRestApi
arguments:
# arguments dictionary
The following arguments are supported:
- Name string
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- Dictionary<string, string>
Key-value map of resource tags.
- Name string
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- map[string]string
Key-value map of resource tags.
- name String
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- Map<String,String>
Key-value map of resource tags.
- name string
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- {[key: string]: string}
Key-value map of resource tags.
- name str
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- Mapping[str, str]
Key-value map of resource tags.
- name String
Name of the REST API to look up. If no REST API is found with this name, an error will be returned. If multiple REST APIs are found with this name, an error will be returned.
- Map<String>
Key-value map of resource tags.
getRestApi Result
The following output properties are available:
- Api
Key stringSource Source of the API key for requests.
- Arn string
ARN of the REST API.
- Binary
Media List<string>Types List of binary media types supported by the REST API.
- Description string
Description of the REST API.
- Endpoint
Configurations List<GetRest Api Endpoint Configuration> The endpoint configuration of this RestApi showing the endpoint types of the API.
- Execution
Arn string Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- Id string
The provider-assigned unique ID for this managed resource.
- Minimum
Compression stringSize Minimum response size to compress for the REST API.
- Name string
- Policy string
JSON formatted policy document that controls access to the API Gateway.
- Root
Resource stringId Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- Dictionary<string, string>
Key-value map of resource tags.
- Api
Key stringSource Source of the API key for requests.
- Arn string
ARN of the REST API.
- Binary
Media []stringTypes List of binary media types supported by the REST API.
- Description string
Description of the REST API.
- Endpoint
Configurations []GetRest Api Endpoint Configuration The endpoint configuration of this RestApi showing the endpoint types of the API.
- Execution
Arn string Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- Id string
The provider-assigned unique ID for this managed resource.
- Minimum
Compression stringSize Minimum response size to compress for the REST API.
- Name string
- Policy string
JSON formatted policy document that controls access to the API Gateway.
- Root
Resource stringId Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- map[string]string
Key-value map of resource tags.
- api
Key StringSource Source of the API key for requests.
- arn String
ARN of the REST API.
- binary
Media List<String>Types List of binary media types supported by the REST API.
- description String
Description of the REST API.
- endpoint
Configurations List<GetRest Api Endpoint Configuration> The endpoint configuration of this RestApi showing the endpoint types of the API.
- execution
Arn String Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- id String
The provider-assigned unique ID for this managed resource.
- minimum
Compression StringSize Minimum response size to compress for the REST API.
- name String
- policy String
JSON formatted policy document that controls access to the API Gateway.
- root
Resource StringId Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- Map<String,String>
Key-value map of resource tags.
- api
Key stringSource Source of the API key for requests.
- arn string
ARN of the REST API.
- binary
Media string[]Types List of binary media types supported by the REST API.
- description string
Description of the REST API.
- endpoint
Configurations GetRest Api Endpoint Configuration[] The endpoint configuration of this RestApi showing the endpoint types of the API.
- execution
Arn string Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- id string
The provider-assigned unique ID for this managed resource.
- minimum
Compression stringSize Minimum response size to compress for the REST API.
- name string
- policy string
JSON formatted policy document that controls access to the API Gateway.
- root
Resource stringId Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- {[key: string]: string}
Key-value map of resource tags.
- api_
key_ strsource Source of the API key for requests.
- arn str
ARN of the REST API.
- binary_
media_ Sequence[str]types List of binary media types supported by the REST API.
- description str
Description of the REST API.
- endpoint_
configurations Sequence[GetRest Api Endpoint Configuration] The endpoint configuration of this RestApi showing the endpoint types of the API.
- execution_
arn str Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- id str
The provider-assigned unique ID for this managed resource.
- minimum_
compression_ strsize Minimum response size to compress for the REST API.
- name str
- policy str
JSON formatted policy document that controls access to the API Gateway.
- root_
resource_ strid Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- Mapping[str, str]
Key-value map of resource tags.
- api
Key StringSource Source of the API key for requests.
- arn String
ARN of the REST API.
- binary
Media List<String>Types List of binary media types supported by the REST API.
- description String
Description of the REST API.
- endpoint
Configurations List<Property Map> The endpoint configuration of this RestApi showing the endpoint types of the API.
- execution
Arn String Execution ARN part to be used in
lambda_permission
'ssource_arn
when allowing API Gateway to invoke a Lambda function, e.g.,arn:aws:execute-api:eu-west-2:123456789012:z4675bid1j
, which can be concatenated with allowed stage, method and resource path.- id String
The provider-assigned unique ID for this managed resource.
- minimum
Compression StringSize Minimum response size to compress for the REST API.
- name String
- policy String
JSON formatted policy document that controls access to the API Gateway.
- root
Resource StringId Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
- Map<String>
Key-value map of resource tags.
Supporting Types
GetRestApiEndpointConfiguration
- Types List<string>
- Vpc
Endpoint List<string>Ids
- Types []string
- Vpc
Endpoint []stringIds
- types List<String>
- vpc
Endpoint List<String>Ids
- types string[]
- vpc
Endpoint string[]Ids
- types Sequence[str]
- vpc_
endpoint_ Sequence[str]ids
- types List<String>
- vpc
Endpoint List<String>Ids
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.