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

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

azure.apimanagement.ProductApi

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Manages an API Management API Assignment to a Product.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = azure.apimanagement.getService({
        name: "example-api",
        resourceGroupName: "example-resources",
    });
    const exampleGetApi = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getApi({
        name: "search-api",
        apiManagementName: example.name,
        resourceGroupName: example1.resourceGroupName,
        revision: "2",
    }));
    const exampleGetProduct = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getProduct({
        productId: "my-product",
        apiManagementName: example.name,
        resourceGroupName: example1.resourceGroupName,
    }));
    const exampleProductApi = new azure.apimanagement.ProductApi("example", {
        apiName: exampleGetApi.then(exampleGetApi => exampleGetApi.name),
        productId: exampleGetProduct.then(exampleGetProduct => exampleGetProduct.productId),
        apiManagementName: example.then(example => example.name),
        resourceGroupName: example.then(example => example.resourceGroupName),
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.apimanagement.get_service(name="example-api",
        resource_group_name="example-resources")
    example_get_api = azure.apimanagement.get_api(name="search-api",
        api_management_name=example.name,
        resource_group_name=example.resource_group_name,
        revision="2")
    example_get_product = azure.apimanagement.get_product(product_id="my-product",
        api_management_name=example.name,
        resource_group_name=example.resource_group_name)
    example_product_api = azure.apimanagement.ProductApi("example",
        api_name=example_get_api.name,
        product_id=example_get_product.product_id,
        api_management_name=example.name,
        resource_group_name=example.resource_group_name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/apimanagement"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := apimanagement.LookupService(ctx, &apimanagement.LookupServiceArgs{
    			Name:              "example-api",
    			ResourceGroupName: "example-resources",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGetApi, err := apimanagement.LookupApi(ctx, &apimanagement.LookupApiArgs{
    			Name:              "search-api",
    			ApiManagementName: example.Name,
    			ResourceGroupName: example.ResourceGroupName,
    			Revision:          "2",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		exampleGetProduct, err := apimanagement.LookupProduct(ctx, &apimanagement.LookupProductArgs{
    			ProductId:         "my-product",
    			ApiManagementName: example.Name,
    			ResourceGroupName: example.ResourceGroupName,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = apimanagement.NewProductApi(ctx, "example", &apimanagement.ProductApiArgs{
    			ApiName:           pulumi.String(exampleGetApi.Name),
    			ProductId:         pulumi.String(exampleGetProduct.ProductId),
    			ApiManagementName: pulumi.String(example.Name),
    			ResourceGroupName: pulumi.String(example.ResourceGroupName),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Azure.ApiManagement.GetService.Invoke(new()
        {
            Name = "example-api",
            ResourceGroupName = "example-resources",
        });
    
        var exampleGetApi = Azure.ApiManagement.GetApi.Invoke(new()
        {
            Name = "search-api",
            ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
            Revision = "2",
        });
    
        var exampleGetProduct = Azure.ApiManagement.GetProduct.Invoke(new()
        {
            ProductId = "my-product",
            ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
        });
    
        var exampleProductApi = new Azure.ApiManagement.ProductApi("example", new()
        {
            ApiName = exampleGetApi.Apply(getApiResult => getApiResult.Name),
            ProductId = exampleGetProduct.Apply(getProductResult => getProductResult.ProductId),
            ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
        });
    
    });
    
    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.GetProductArgs;
    import com.pulumi.azure.apimanagement.ProductApi;
    import com.pulumi.azure.apimanagement.ProductApiArgs;
    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 = ApimanagementFunctions.getService(GetServiceArgs.builder()
                .name("example-api")
                .resourceGroupName("example-resources")
                .build());
    
            final var exampleGetApi = ApimanagementFunctions.getApi(GetApiArgs.builder()
                .name("search-api")
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .revision("2")
                .build());
    
            final var exampleGetProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
                .productId("my-product")
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .build());
    
            var exampleProductApi = new ProductApi("exampleProductApi", ProductApiArgs.builder()
                .apiName(exampleGetApi.applyValue(getApiResult -> getApiResult.name()))
                .productId(exampleGetProduct.applyValue(getProductResult -> getProductResult.productId()))
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .build());
    
        }
    }
    
    resources:
      exampleProductApi:
        type: azure:apimanagement:ProductApi
        name: example
        properties:
          apiName: ${exampleGetApi.name}
          productId: ${exampleGetProduct.productId}
          apiManagementName: ${example.name}
          resourceGroupName: ${example.resourceGroupName}
    variables:
      example:
        fn::invoke:
          Function: azure:apimanagement:getService
          Arguments:
            name: example-api
            resourceGroupName: example-resources
      exampleGetApi:
        fn::invoke:
          Function: azure:apimanagement:getApi
          Arguments:
            name: search-api
            apiManagementName: ${example.name}
            resourceGroupName: ${example.resourceGroupName}
            revision: '2'
      exampleGetProduct:
        fn::invoke:
          Function: azure:apimanagement:getProduct
          Arguments:
            productId: my-product
            apiManagementName: ${example.name}
            resourceGroupName: ${example.resourceGroupName}
    

    Create ProductApi Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProductApi(name: string, args: ProductApiArgs, opts?: CustomResourceOptions);
    @overload
    def ProductApi(resource_name: str,
                   args: ProductApiArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProductApi(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   api_management_name: Optional[str] = None,
                   api_name: Optional[str] = None,
                   product_id: Optional[str] = None,
                   resource_group_name: Optional[str] = None)
    func NewProductApi(ctx *Context, name string, args ProductApiArgs, opts ...ResourceOption) (*ProductApi, error)
    public ProductApi(string name, ProductApiArgs args, CustomResourceOptions? opts = null)
    public ProductApi(String name, ProductApiArgs args)
    public ProductApi(String name, ProductApiArgs args, CustomResourceOptions options)
    
    type: azure:apimanagement:ProductApi
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ProductApiArgs
    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 ProductApiArgs
    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 ProductApiArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProductApiArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProductApiArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var productApiResource = new Azure.ApiManagement.ProductApi("productApiResource", new()
    {
        ApiManagementName = "string",
        ApiName = "string",
        ProductId = "string",
        ResourceGroupName = "string",
    });
    
    example, err := apimanagement.NewProductApi(ctx, "productApiResource", &apimanagement.ProductApiArgs{
    	ApiManagementName: pulumi.String("string"),
    	ApiName:           pulumi.String("string"),
    	ProductId:         pulumi.String("string"),
    	ResourceGroupName: pulumi.String("string"),
    })
    
    var productApiResource = new ProductApi("productApiResource", ProductApiArgs.builder()
        .apiManagementName("string")
        .apiName("string")
        .productId("string")
        .resourceGroupName("string")
        .build());
    
    product_api_resource = azure.apimanagement.ProductApi("productApiResource",
        api_management_name="string",
        api_name="string",
        product_id="string",
        resource_group_name="string")
    
    const productApiResource = new azure.apimanagement.ProductApi("productApiResource", {
        apiManagementName: "string",
        apiName: "string",
        productId: "string",
        resourceGroupName: "string",
    });
    
    type: azure:apimanagement:ProductApi
    properties:
        apiManagementName: string
        apiName: string
        productId: string
        resourceGroupName: string
    

    ProductApi Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ProductApi resource accepts the following input properties:

    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    ApiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    ProductId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    ApiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    ProductId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName String
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName String
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId String
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    api_management_name str
    The name of the API Management Service. Changing this forces a new resource to be created.
    api_name str
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    product_id str
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName String
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName String
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId String
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProductApi 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 ProductApi Resource

    Get an existing ProductApi 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?: ProductApiState, opts?: CustomResourceOptions): ProductApi
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_management_name: Optional[str] = None,
            api_name: Optional[str] = None,
            product_id: Optional[str] = None,
            resource_group_name: Optional[str] = None) -> ProductApi
    func GetProductApi(ctx *Context, name string, id IDInput, state *ProductApiState, opts ...ResourceOption) (*ProductApi, error)
    public static ProductApi Get(string name, Input<string> id, ProductApiState? state, CustomResourceOptions? opts = null)
    public static ProductApi get(String name, Output<String> id, ProductApiState 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:
    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    ApiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    ProductId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    ApiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    ProductId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    ResourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName String
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName String
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId String
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName string
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId string
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName string
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    api_management_name str
    The name of the API Management Service. Changing this forces a new resource to be created.
    api_name str
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    product_id str
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resource_group_name str
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
    apiManagementName String
    The name of the API Management Service. Changing this forces a new resource to be created.
    apiName String
    The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
    productId String
    The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
    resourceGroupName String
    The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

    Import

    API Management Product API’s can be imported using the resource id, e.g.

    $ pulumi import azure:apimanagement/productApi:ProductApi example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId/apis/apiId
    

    To learn more about importing existing cloud resources, see Importing resources.

    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 v6.10.0 published on Tuesday, Nov 19, 2024 by Pulumi