1. Packages
  2. Ionoscloud
  3. API Docs
  4. apigateway
  5. getRoute
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

ionoscloud.apigateway.getRoute

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

    The API Gateway Route data source can be used to search for and return an existing API Gateway route. You can provide a string for the name parameter which will be compared with provisioned API Gateway routes. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.apigateway.getRoute({
        id: "your_apigateway_route_id",
        gatewayId: "your_gateway_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.apigateway.get_route(id="your_apigateway_route_id",
        gateway_id="your_gateway_id")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apigateway.LookupRoute(ctx, &apigateway.LookupRouteArgs{
    			Id:        pulumi.StringRef("your_apigateway_route_id"),
    			GatewayId: "your_gateway_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Apigateway.GetRoute.Invoke(new()
        {
            Id = "your_apigateway_route_id",
            GatewayId = "your_gateway_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.apigateway.ApigatewayFunctions;
    import com.pulumi.ionoscloud.apigateway.inputs.GetRouteArgs;
    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 example = ApigatewayFunctions.getRoute(GetRouteArgs.builder()
                .id("your_apigateway_route_id")
                .gatewayId("your_gateway_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:apigateway:getRoute
          arguments:
            id: your_apigateway_route_id
            gatewayId: your_gateway_id
    

    By Name

    Needs to have the resource be previously created, or a depends_on clause to ensure that the resource is created before this data source is called.

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.apigateway.getRoute({
        name: "apigateway-route",
        gatewayId: "your_gateway_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.apigateway.get_route(name="apigateway-route",
        gateway_id="your_gateway_id")
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/apigateway"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := apigateway.LookupRoute(ctx, &apigateway.LookupRouteArgs{
    			Name:      pulumi.StringRef("apigateway-route"),
    			GatewayId: "your_gateway_id",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.Apigateway.GetRoute.Invoke(new()
        {
            Name = "apigateway-route",
            GatewayId = "your_gateway_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.apigateway.ApigatewayFunctions;
    import com.pulumi.ionoscloud.apigateway.inputs.GetRouteArgs;
    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 example = ApigatewayFunctions.getRoute(GetRouteArgs.builder()
                .name("apigateway-route")
                .gatewayId("your_gateway_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:apigateway:getRoute
          arguments:
            name: apigateway-route
            gatewayId: your_gateway_id
    

    Using getRoute

    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 getRoute(args: GetRouteArgs, opts?: InvokeOptions): Promise<GetRouteResult>
    function getRouteOutput(args: GetRouteOutputArgs, opts?: InvokeOptions): Output<GetRouteResult>
    def get_route(gateway_id: Optional[str] = None,
                  id: Optional[str] = None,
                  name: Optional[str] = None,
                  partial_match: Optional[bool] = None,
                  opts: Optional[InvokeOptions] = None) -> GetRouteResult
    def get_route_output(gateway_id: Optional[pulumi.Input[str]] = None,
                  id: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  partial_match: Optional[pulumi.Input[bool]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetRouteResult]
    func LookupRoute(ctx *Context, args *LookupRouteArgs, opts ...InvokeOption) (*LookupRouteResult, error)
    func LookupRouteOutput(ctx *Context, args *LookupRouteOutputArgs, opts ...InvokeOption) LookupRouteResultOutput

    > Note: This function is named LookupRoute in the Go SDK.

    public static class GetRoute 
    {
        public static Task<GetRouteResult> InvokeAsync(GetRouteArgs args, InvokeOptions? opts = null)
        public static Output<GetRouteResult> Invoke(GetRouteInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRouteResult> getRoute(GetRouteArgs args, InvokeOptions options)
    public static Output<GetRouteResult> getRoute(GetRouteArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:apigateway/getRoute:getRoute
      arguments:
        # arguments dictionary

    The following arguments are supported:

    GatewayId string
    The ID of the API Gateway that the route belongs to.
    Id string
    ID of an existing API Gateway Route that you want to search for.
    Name string
    Name of an existing API Gateway Route that you want to search for.
    PartialMatch bool
    GatewayId string
    The ID of the API Gateway that the route belongs to.
    Id string
    ID of an existing API Gateway Route that you want to search for.
    Name string
    Name of an existing API Gateway Route that you want to search for.
    PartialMatch bool
    gatewayId String
    The ID of the API Gateway that the route belongs to.
    id String
    ID of an existing API Gateway Route that you want to search for.
    name String
    Name of an existing API Gateway Route that you want to search for.
    partialMatch Boolean
    gatewayId string
    The ID of the API Gateway that the route belongs to.
    id string
    ID of an existing API Gateway Route that you want to search for.
    name string
    Name of an existing API Gateway Route that you want to search for.
    partialMatch boolean
    gateway_id str
    The ID of the API Gateway that the route belongs to.
    id str
    ID of an existing API Gateway Route that you want to search for.
    name str
    Name of an existing API Gateway Route that you want to search for.
    partial_match bool
    gatewayId String
    The ID of the API Gateway that the route belongs to.
    id String
    ID of an existing API Gateway Route that you want to search for.
    name String
    Name of an existing API Gateway Route that you want to search for.
    partialMatch Boolean

    getRoute Result

    The following output properties are available:

    GatewayId string
    Id string
    ID of the API Gateway Route.
    Methods List<string>
    The HTTP methods that the route should match.
    Name string
    The name of the API Gateway Route.
    Paths List<string>
    The paths that the route should match.
    Type string
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    Upstreams List<Ionoscloud.GetRouteUpstream>
    Websocket bool
    Shows whether websocket support is enabled or disabled.
    PartialMatch bool
    GatewayId string
    Id string
    ID of the API Gateway Route.
    Methods []string
    The HTTP methods that the route should match.
    Name string
    The name of the API Gateway Route.
    Paths []string
    The paths that the route should match.
    Type string
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    Upstreams []GetRouteUpstream
    Websocket bool
    Shows whether websocket support is enabled or disabled.
    PartialMatch bool
    gatewayId String
    id String
    ID of the API Gateway Route.
    methods List<String>
    The HTTP methods that the route should match.
    name String
    The name of the API Gateway Route.
    paths List<String>
    The paths that the route should match.
    type String
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    upstreams List<GetRouteUpstream>
    websocket Boolean
    Shows whether websocket support is enabled or disabled.
    partialMatch Boolean
    gatewayId string
    id string
    ID of the API Gateway Route.
    methods string[]
    The HTTP methods that the route should match.
    name string
    The name of the API Gateway Route.
    paths string[]
    The paths that the route should match.
    type string
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    upstreams GetRouteUpstream[]
    websocket boolean
    Shows whether websocket support is enabled or disabled.
    partialMatch boolean
    gateway_id str
    id str
    ID of the API Gateway Route.
    methods Sequence[str]
    The HTTP methods that the route should match.
    name str
    The name of the API Gateway Route.
    paths Sequence[str]
    The paths that the route should match.
    type str
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    upstreams Sequence[GetRouteUpstream]
    websocket bool
    Shows whether websocket support is enabled or disabled.
    partial_match bool
    gatewayId String
    id String
    ID of the API Gateway Route.
    methods List<String>
    The HTTP methods that the route should match.
    name String
    The name of the API Gateway Route.
    paths List<String>
    The paths that the route should match.
    type String
    This field specifies the protocol used by the ingress to route traffic to the backend service.
    upstreams List<Property Map>
    websocket Boolean
    Shows whether websocket support is enabled or disabled.
    partialMatch Boolean

    Supporting Types

    GetRouteUpstream

    Host string
    The host of the upstream.
    Loadbalancer string
    The load balancer algorithm.
    Port int
    The port of the upstream.
    Scheme string
    The target URL of the upstream.
    Weight int
    Weight with which to split traffic to the upstream.
    Host string
    The host of the upstream.
    Loadbalancer string
    The load balancer algorithm.
    Port int
    The port of the upstream.
    Scheme string
    The target URL of the upstream.
    Weight int
    Weight with which to split traffic to the upstream.
    host String
    The host of the upstream.
    loadbalancer String
    The load balancer algorithm.
    port Integer
    The port of the upstream.
    scheme String
    The target URL of the upstream.
    weight Integer
    Weight with which to split traffic to the upstream.
    host string
    The host of the upstream.
    loadbalancer string
    The load balancer algorithm.
    port number
    The port of the upstream.
    scheme string
    The target URL of the upstream.
    weight number
    Weight with which to split traffic to the upstream.
    host str
    The host of the upstream.
    loadbalancer str
    The load balancer algorithm.
    port int
    The port of the upstream.
    scheme str
    The target URL of the upstream.
    weight int
    Weight with which to split traffic to the upstream.
    host String
    The host of the upstream.
    loadbalancer String
    The load balancer algorithm.
    port Number
    The port of the upstream.
    scheme String
    The target URL of the upstream.
    weight Number
    Weight with which to split traffic to the upstream.

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud