We recommend using Azure Native.
azure.apimanagement.ProductApi
Explore with Pulumi AI
Manages an API Management API Assignment to a Product.
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 exampleProduct = Azure.ApiManagement.GetProduct.Invoke(new()
{
ProductId = "my-product",
ApiManagementName = exampleService.Apply(getServiceResult => getServiceResult.Name),
ResourceGroupName = exampleService.Apply(getServiceResult => getServiceResult.ResourceGroupName),
});
var exampleProductApi = new Azure.ApiManagement.ProductApi("exampleProductApi", new()
{
ApiName = exampleApi.Apply(getApiResult => getApiResult.Name),
ProductId = exampleProduct.Apply(getProductResult => getProductResult.ProductId),
ApiManagementName = exampleService.Apply(getServiceResult => getServiceResult.Name),
ResourceGroupName = exampleService.Apply(getServiceResult => getServiceResult.ResourceGroupName),
});
});
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
}
exampleProduct, err := apimanagement.LookupProduct(ctx, &apimanagement.LookupProductArgs{
ProductId: "my-product",
ApiManagementName: exampleService.Name,
ResourceGroupName: exampleService.ResourceGroupName,
}, nil)
if err != nil {
return err
}
_, err = apimanagement.NewProductApi(ctx, "exampleProductApi", &apimanagement.ProductApiArgs{
ApiName: *pulumi.String(exampleApi.Name),
ProductId: *pulumi.String(exampleProduct.ProductId),
ApiManagementName: *pulumi.String(exampleService.Name),
ResourceGroupName: *pulumi.String(exampleService.ResourceGroupName),
})
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.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 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 exampleProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
.productId("my-product")
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
.resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
.build());
var exampleProductApi = new ProductApi("exampleProductApi", ProductApiArgs.builder()
.apiName(exampleApi.applyValue(getApiResult -> getApiResult.name()))
.productId(exampleProduct.applyValue(getProductResult -> getProductResult.productId()))
.apiManagementName(exampleService.applyValue(getServiceResult -> getServiceResult.name()))
.resourceGroupName(exampleService.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
.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_product = azure.apimanagement.get_product(product_id="my-product",
api_management_name=example_service.name,
resource_group_name=example_service.resource_group_name)
example_product_api = azure.apimanagement.ProductApi("exampleProductApi",
api_name=example_api.name,
product_id=example_product.product_id,
api_management_name=example_service.name,
resource_group_name=example_service.resource_group_name)
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 exampleProduct = Promise.all([exampleService, exampleService]).then(([exampleService, exampleService1]) => azure.apimanagement.getProduct({
productId: "my-product",
apiManagementName: exampleService.name,
resourceGroupName: exampleService1.resourceGroupName,
}));
const exampleProductApi = new azure.apimanagement.ProductApi("exampleProductApi", {
apiName: exampleApi.then(exampleApi => exampleApi.name),
productId: exampleProduct.then(exampleProduct => exampleProduct.productId),
apiManagementName: exampleService.then(exampleService => exampleService.name),
resourceGroupName: exampleService.then(exampleService => exampleService.resourceGroupName),
});
resources:
exampleProductApi:
type: azure:apimanagement:ProductApi
properties:
apiName: ${exampleApi.name}
productId: ${exampleProduct.productId}
apiManagementName: ${exampleService.name}
resourceGroupName: ${exampleService.resourceGroupName}
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'
exampleProduct:
fn::invoke:
Function: azure:apimanagement:getProduct
Arguments:
productId: my-product
apiManagementName: ${exampleService.name}
resourceGroupName: ${exampleService.resourceGroupName}
Create ProductApi Resource
new ProductApi(name: string, args: ProductApiArgs, opts?: CustomResourceOptions);
@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)
@overload
def ProductApi(resource_name: str,
args: ProductApiArgs,
opts: Optional[ResourceOptions] = 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.
- 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.
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
The ProductApi resource accepts the following input properties:
- Api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- Api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- Product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- Api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- Product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management StringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name String The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id String The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group StringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api_
management_ strname 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_ strname The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management StringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name String The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id String The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group StringName 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.
- Api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- Api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- Product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- Api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- Api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- Product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- Resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management StringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name String The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id String The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group StringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management stringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name string The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id string The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group stringName The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api_
management_ strname 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_ strname The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.
- api
Management StringName The name of the API Management Service. Changing this forces a new resource to be created.
- api
Name String The Name of the API Management API within the API Management Service. Changing this forces a new resource to be created.
- product
Id String The ID of the API Management Product within the API Management Service. Changing this forces a new resource to be created.
- resource
Group StringName 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
Package Details
- Repository
- Azure Classic pulumi/pulumi-azure
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
azurerm
Terraform Provider.