1. Packages
  2. Azure Classic
  3. API Docs
  4. apimanagement
  5. GatewayApi

We recommend using Azure Native.

Azure Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi

azure.apimanagement.GatewayApi

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi

    Manages a API Management Gateway API.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleService = Azure.ApiManagement.GetService.Invoke(new()
        {
            Name = "example-api",
            ResourceGroupName = "example-resources",
        });
    
        var exampleApi = Azure.ApiManagement.GetApi.Invoke(new()
        {
            Name = "search-api",
            ApiManagementName = exampleService.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = exampleService.Apply(getServiceResult => getServiceResult.ResourceGroupName),
            Revision = "2",
        });
    
        var exampleGateway = Azure.ApiManagement.GetGateway.Invoke(new()
        {
            Name = "example-gateway",
            ApiManagementId = exampleService.Apply(getServiceResult => getServiceResult.Id),
        });
    
        var exampleGatewayApi = new Azure.ApiManagement.GatewayApi("exampleGatewayApi", new()
        {
            GatewayId = exampleGateway.Apply(getGatewayResult => getGatewayResult.Id),
            ApiId = exampleApi.Apply(getApiResult => getApiResult.Id),
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleService, err := apimanagement.LookupService(ctx, &apimanagement.LookupServiceArgs{
    			Name:              "example-api",
    			ResourceGroupName: "example-resources",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleApi, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
    			Name:              "search-api",
    			ApiManagementName: exampleService.Name,
    			ResourceGroupName: exampleService.ResourceGroupName,
    			Revision:          "2",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGateway, err := apimanagement.LookupGateway(ctx, &apimanagement.LookupGatewayArgs{
    			Name:            "example-gateway",
    			ApiManagementId: exampleService.Id,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = apimanagement.NewGatewayApi(ctx, "exampleGatewayApi", &apimanagement.GatewayApiArgs{
    			GatewayId: *pulumi.String(exampleGateway.Id),
    			ApiId:     *pulumi.String(exampleApi.Id),
    		})
    		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.azure.apimanagement.ApimanagementFunctions;
    import com.pulumi.azure.apimanagement.inputs.GetServiceArgs;
    import com.pulumi.azure.apimanagement.inputs.GetApiArgs;
    import com.pulumi.azure.apimanagement.inputs.GetGatewayArgs;
    import com.pulumi.azure.apimanagement.GatewayApi;
    import com.pulumi.azure.apimanagement.GatewayApiArgs;
    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 exampleService = ApimanagementFunctions.getService(GetServiceArgs.builder()
                .name("example-api")
                .resourceGroupName("example-resources")
                .build());
    
            final var exampleApi = ApimanagementFunctions.getApi(GetApiArgs.builder()
                .name("search-api")
                .apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .revision("2")
                .build());
    
            final var exampleGateway = ApimanagementFunctions.getGateway(GetGatewayArgs.builder()
                .name("example-gateway")
                .apiManagementId(exampleService.applyValue(getServiceResult -> getServiceResult.id()))
                .build());
    
            var exampleGatewayApi = new GatewayApi("exampleGatewayApi", GatewayApiArgs.builder()        
                .gatewayId(exampleGateway.applyValue(getGatewayResult -> getGatewayResult.id()))
                .apiId(exampleApi.applyValue(getApiResult -> getApiResult.id()))
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example_service = azure.apimanagement.get_service(name="example-api",
        resource_group_name="example-resources")
    example_api = azure.apimanagement.get_api(name="search-api",
        api_management_name=example_service.name,
        resource_group_name=example_service.resource_group_name,
        revision="2")
    example_gateway = azure.apimanagement.get_gateway(name="example-gateway",
        api_management_id=example_service.id)
    example_gateway_api = azure.apimanagement.GatewayApi("exampleGatewayApi",
        gateway_id=example_gateway.id,
        api_id=example_api.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleService = azure.apimanagement.getService({
        name: "example-api",
        resourceGroupName: "example-resources",
    });
    const exampleApi = Promise.all([exampleService, exampleService]).then(([exampleService, exampleService1]) => azure.apimanagement.getApi({
        name: "search-api",
        apiManagementName: exampleService.name,
        resourceGroupName: exampleService1.resourceGroupName,
        revision: "2",
    }));
    const exampleGateway = exampleService.then(exampleService => azure.apimanagement.getGateway({
        name: "example-gateway",
        apiManagementId: exampleService.id,
    }));
    const exampleGatewayApi = new azure.apimanagement.GatewayApi("exampleGatewayApi", {
        gatewayId: exampleGateway.then(exampleGateway => exampleGateway.id),
        apiId: exampleApi.then(exampleApi => exampleApi.id),
    });
    
    resources:
      exampleGatewayApi:
        type: azure:apimanagement:GatewayApi
        properties:
          gatewayId: ${exampleGateway.id}
          apiId: ${exampleApi.id}
    variables:
      exampleService:
        fn::invoke:
          Function: azure:apimanagement:getService
          Arguments:
            name: example-api
            resourceGroupName: example-resources
      exampleApi:
        fn::invoke:
          Function: azure:apimanagement:getApi
          Arguments:
            name: search-api
            apiManagementName: ${exampleService.name}
            resourceGroupName: ${exampleService.resourceGroupName}
            revision: '2'
      exampleGateway:
        fn::invoke:
          Function: azure:apimanagement:getGateway
          Arguments:
            name: example-gateway
            apiManagementId: ${exampleService.id}
    

    Create GatewayApi Resource

    new GatewayApi(name: string, args: GatewayApiArgs, opts?: CustomResourceOptions);
    @overload
    def GatewayApi(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   api_id: Optional[str] = None,
                   gateway_id: Optional[str] = None)
    @overload
    def GatewayApi(resource_name: str,
                   args: GatewayApiArgs,
                   opts: Optional[ResourceOptions] = None)
    func NewGatewayApi(ctx *Context, name string, args GatewayApiArgs, opts ...ResourceOption) (*GatewayApi, error)
    public GatewayApi(string name, GatewayApiArgs args, CustomResourceOptions? opts = null)
    public GatewayApi(String name, GatewayApiArgs args)
    public GatewayApi(String name, GatewayApiArgs args, CustomResourceOptions options)
    
    type: azure:apimanagement:GatewayApi
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args GatewayApiArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args GatewayApiArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args GatewayApiArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GatewayApiArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GatewayApiArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    GatewayApi Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The GatewayApi resource accepts the following input properties:

    ApiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    GatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    ApiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    GatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId String
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId String
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    api_id str
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gateway_id str
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId String
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId String
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the GatewayApi resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing GatewayApi Resource

    Get an existing GatewayApi resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: GatewayApiState, opts?: CustomResourceOptions): GatewayApi
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_id: Optional[str] = None,
            gateway_id: Optional[str] = None) -> GatewayApi
    func GetGatewayApi(ctx *Context, name string, id IDInput, state *GatewayApiState, opts ...ResourceOption) (*GatewayApi, error)
    public static GatewayApi Get(string name, Input<string> id, GatewayApiState? state, CustomResourceOptions? opts = null)
    public static GatewayApi get(String name, Output<String> id, GatewayApiState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ApiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    GatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    ApiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    GatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId String
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId String
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId string
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId string
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    api_id str
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gateway_id str
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.
    apiId String
    The Identifier of the API Management API within the API Management Service. Changing this forces a new API Management Gateway API to be created.
    gatewayId String
    The Identifier for the API Management Gateway. Changing this forces a new API Management Gateway API to be created.

    Import

    API Management Gateway APIs can be imported using the resource id, e.g.

    $ pulumi import azure:apimanagement/gatewayApi:GatewayApi example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.ApiManagement/service/service1/gateways/gateway1/apis/api1
    

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.67.0 published on Wednesday, Feb 21, 2024 by Pulumi