1. Packages
  2. AWS
  3. API Docs
  4. apigateway
  5. getRestApi
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.apigateway.getRestApi

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

    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

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const myRestApi = aws.apigateway.getRestApi({
        name: "my-rest-api",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    my_rest_api = aws.apigateway.get_rest_api(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
    	})
    }
    
    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 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());
    
        }
    }
    
    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.
    Tags 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.
    Tags 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.
    tags 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.
    tags {[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.
    tags 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.
    tags Map<String>
    Key-value map of resource tags.

    getRestApi Result

    The following output properties are available:

    ApiKeySource string
    Source of the API key for requests.
    Arn string
    ARN of the REST API.
    BinaryMediaTypes List<string>
    List of binary media types supported by the REST API.
    Description string
    Description of the REST API.
    EndpointConfigurations List<GetRestApiEndpointConfiguration>
    The endpoint configuration of this RestApi showing the endpoint types of the API.
    ExecutionArn string
    Execution ARN part to be used in lambda_permission's source_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.
    MinimumCompressionSize string
    Minimum response size to compress for the REST API.
    Name string
    Policy string
    JSON formatted policy document that controls access to the API Gateway.
    RootResourceId string
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    Tags Dictionary<string, string>
    Key-value map of resource tags.
    ApiKeySource string
    Source of the API key for requests.
    Arn string
    ARN of the REST API.
    BinaryMediaTypes []string
    List of binary media types supported by the REST API.
    Description string
    Description of the REST API.
    EndpointConfigurations []GetRestApiEndpointConfiguration
    The endpoint configuration of this RestApi showing the endpoint types of the API.
    ExecutionArn string
    Execution ARN part to be used in lambda_permission's source_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.
    MinimumCompressionSize string
    Minimum response size to compress for the REST API.
    Name string
    Policy string
    JSON formatted policy document that controls access to the API Gateway.
    RootResourceId string
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    Tags map[string]string
    Key-value map of resource tags.
    apiKeySource String
    Source of the API key for requests.
    arn String
    ARN of the REST API.
    binaryMediaTypes List<String>
    List of binary media types supported by the REST API.
    description String
    Description of the REST API.
    endpointConfigurations List<GetRestApiEndpointConfiguration>
    The endpoint configuration of this RestApi showing the endpoint types of the API.
    executionArn String
    Execution ARN part to be used in lambda_permission's source_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.
    minimumCompressionSize String
    Minimum response size to compress for the REST API.
    name String
    policy String
    JSON formatted policy document that controls access to the API Gateway.
    rootResourceId String
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    tags Map<String,String>
    Key-value map of resource tags.
    apiKeySource string
    Source of the API key for requests.
    arn string
    ARN of the REST API.
    binaryMediaTypes string[]
    List of binary media types supported by the REST API.
    description string
    Description of the REST API.
    endpointConfigurations GetRestApiEndpointConfiguration[]
    The endpoint configuration of this RestApi showing the endpoint types of the API.
    executionArn string
    Execution ARN part to be used in lambda_permission's source_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.
    minimumCompressionSize string
    Minimum response size to compress for the REST API.
    name string
    policy string
    JSON formatted policy document that controls access to the API Gateway.
    rootResourceId string
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    tags {[key: string]: string}
    Key-value map of resource tags.
    api_key_source str
    Source of the API key for requests.
    arn str
    ARN of the REST API.
    binary_media_types Sequence[str]
    List of binary media types supported by the REST API.
    description str
    Description of the REST API.
    endpoint_configurations Sequence[GetRestApiEndpointConfiguration]
    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's source_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_size str
    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_id str
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    tags Mapping[str, str]
    Key-value map of resource tags.
    apiKeySource String
    Source of the API key for requests.
    arn String
    ARN of the REST API.
    binaryMediaTypes List<String>
    List of binary media types supported by the REST API.
    description String
    Description of the REST API.
    endpointConfigurations List<Property Map>
    The endpoint configuration of this RestApi showing the endpoint types of the API.
    executionArn String
    Execution ARN part to be used in lambda_permission's source_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.
    minimumCompressionSize String
    Minimum response size to compress for the REST API.
    name String
    policy String
    JSON formatted policy document that controls access to the API Gateway.
    rootResourceId String
    Set to the ID of the API Gateway Resource on the found REST API where the route matches '/'.
    tags Map<String>
    Key-value map of resource tags.

    Supporting Types

    GetRestApiEndpointConfiguration

    Types List<string>
    VpcEndpointIds List<string>
    Types []string
    VpcEndpointIds []string
    types List<String>
    vpcEndpointIds List<String>
    types string[]
    vpcEndpointIds string[]
    types Sequence[str]
    vpc_endpoint_ids Sequence[str]
    types List<String>
    vpcEndpointIds List<String>

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi