GetRestApi
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 Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var myRestApi = Output.Create(Aws.ApiGateway.GetRestApi.InvokeAsync(new Aws.ApiGateway.GetRestApiArgs
{
Name = "my-rest-api",
}));
}
}
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/apigateway"
"github.com/pulumi/pulumi/sdk/v2/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
})
}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 = pulumi.output(aws.apigateway.getRestApi({
name: "my-rest-api",
}, { async: true }));Using GetRestApi
function getRestApi(args: GetRestApiArgs, opts?: InvokeOptions): Promise<GetRestApiResult>function get_rest_api(name=None, tags=None, opts=None)func LookupRestApi(ctx *Context, args *LookupRestApiArgs, opts ...InvokeOption) (*LookupRestApiResult, error)Note: This function is named
LookupRestApiin the Go SDK.
public static class GetRestApi {
public static Task<GetRestApiResult> InvokeAsync(GetRestApiArgs args, InvokeOptions? opts = null)
}The following arguments are supported:
GetRestApi Result
The following output properties are available:
- Api
Key stringSource The source of the API key for requests.
- Arn string
The ARN of the REST API.
- Binary
Media List<string>Types The list of binary media types supported by the REST API.
- Description string
The 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 The execution ARN part to be used in
lambda_permission’ssource_arnwhen 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 intSize 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 The source of the API key for requests.
- Arn string
The ARN of the REST API.
- Binary
Media []stringTypes The list of binary media types supported by the REST API.
- Description string
The 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 The execution ARN part to be used in
lambda_permission’ssource_arnwhen 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 intSize 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 The source of the API key for requests.
- arn string
The ARN of the REST API.
- binary
Media string[]Types The list of binary media types supported by the REST API.
- description string
The 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 The execution ARN part to be used in
lambda_permission’ssource_arnwhen 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 numberSize 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 The source of the API key for requests.
- arn str
The ARN of the REST API.
- binary_
media_ List[str]types The list of binary media types supported by the REST API.
- description str
The 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 str The execution ARN part to be used in
lambda_permission’ssource_arnwhen 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_ floatsize 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 ‘/’.
- Dict[str, str]
Key-value map of resource tags.
Supporting Types
GetRestApiEndpointConfiguration
See the output API doc for this type.
See the output API doc for this type.
See the output API doc for this type.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.