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

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.apimanagement.ProductGroup

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    Manages an API Management Product Assignment to a Group.

    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 exampleGetProduct = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getProduct({
        productId: "my-product",
        apiManagementName: example.name,
        resourceGroupName: example1.resourceGroupName,
    }));
    const exampleGetGroup = Promise.all([example, example]).then(([example, example1]) => azure.apimanagement.getGroup({
        name: "my-group",
        apiManagementName: example.name,
        resourceGroupName: example1.resourceGroupName,
    }));
    const exampleProductGroup = new azure.apimanagement.ProductGroup("example", {
        productId: exampleGetProduct.then(exampleGetProduct => exampleGetProduct.productId),
        groupName: exampleGetGroup.then(exampleGetGroup => exampleGetGroup.name),
        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_product = azure.apimanagement.get_product(product_id="my-product",
        api_management_name=example.name,
        resource_group_name=example.resource_group_name)
    example_get_group = azure.apimanagement.get_group(name="my-group",
        api_management_name=example.name,
        resource_group_name=example.resource_group_name)
    example_product_group = azure.apimanagement.ProductGroup("example",
        product_id=example_get_product.product_id,
        group_name=example_get_group.name,
        api_management_name=example.name,
        resource_group_name=example.resource_group_name)
    
    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 {
    		example, err := apimanagement.LookupService(ctx, &apimanagement.LookupServiceArgs{
    			Name:              "example-api",
    			ResourceGroupName: "example-resources",
    		}, 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
    		}
    		exampleGetGroup, err := apimanagement.LookupGroup(ctx, &apimanagement.LookupGroupArgs{
    			Name:              "my-group",
    			ApiManagementName: example.Name,
    			ResourceGroupName: example.ResourceGroupName,
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = apimanagement.NewProductGroup(ctx, "example", &apimanagement.ProductGroupArgs{
    			ProductId:         pulumi.String(exampleGetProduct.ProductId),
    			GroupName:         pulumi.String(exampleGetGroup.Name),
    			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 exampleGetProduct = Azure.ApiManagement.GetProduct.Invoke(new()
        {
            ProductId = "my-product",
            ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
        });
    
        var exampleGetGroup = Azure.ApiManagement.GetGroup.Invoke(new()
        {
            Name = "my-group",
            ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
            ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
        });
    
        var exampleProductGroup = new Azure.ApiManagement.ProductGroup("example", new()
        {
            ProductId = exampleGetProduct.Apply(getProductResult => getProductResult.ProductId),
            GroupName = exampleGetGroup.Apply(getGroupResult => getGroupResult.Name),
            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.GetProductArgs;
    import com.pulumi.azure.apimanagement.inputs.GetGroupArgs;
    import com.pulumi.azure.apimanagement.ProductGroup;
    import com.pulumi.azure.apimanagement.ProductGroupArgs;
    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 exampleGetProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
                .productId("my-product")
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .build());
    
            final var exampleGetGroup = ApimanagementFunctions.getGroup(GetGroupArgs.builder()
                .name("my-group")
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .build());
    
            var exampleProductGroup = new ProductGroup("exampleProductGroup", ProductGroupArgs.builder()
                .productId(exampleGetProduct.applyValue(getProductResult -> getProductResult.productId()))
                .groupName(exampleGetGroup.applyValue(getGroupResult -> getGroupResult.name()))
                .apiManagementName(example.applyValue(getServiceResult -> getServiceResult.name()))
                .resourceGroupName(example.applyValue(getServiceResult -> getServiceResult.resourceGroupName()))
                .build());
    
        }
    }
    
    resources:
      exampleProductGroup:
        type: azure:apimanagement:ProductGroup
        name: example
        properties:
          productId: ${exampleGetProduct.productId}
          groupName: ${exampleGetGroup.name}
          apiManagementName: ${example.name}
          resourceGroupName: ${example.resourceGroupName}
    variables:
      example:
        fn::invoke:
          Function: azure:apimanagement:getService
          Arguments:
            name: example-api
            resourceGroupName: example-resources
      exampleGetProduct:
        fn::invoke:
          Function: azure:apimanagement:getProduct
          Arguments:
            productId: my-product
            apiManagementName: ${example.name}
            resourceGroupName: ${example.resourceGroupName}
      exampleGetGroup:
        fn::invoke:
          Function: azure:apimanagement:getGroup
          Arguments:
            name: my-group
            apiManagementName: ${example.name}
            resourceGroupName: ${example.resourceGroupName}
    

    Create ProductGroup Resource

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

    Constructor syntax

    new ProductGroup(name: string, args: ProductGroupArgs, opts?: CustomResourceOptions);
    @overload
    def ProductGroup(resource_name: str,
                     args: ProductGroupArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProductGroup(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     api_management_name: Optional[str] = None,
                     group_name: Optional[str] = None,
                     product_id: Optional[str] = None,
                     resource_group_name: Optional[str] = None)
    func NewProductGroup(ctx *Context, name string, args ProductGroupArgs, opts ...ResourceOption) (*ProductGroup, error)
    public ProductGroup(string name, ProductGroupArgs args, CustomResourceOptions? opts = null)
    public ProductGroup(String name, ProductGroupArgs args)
    public ProductGroup(String name, ProductGroupArgs args, CustomResourceOptions options)
    
    type: azure:apimanagement:ProductGroup
    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 ProductGroupArgs
    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 ProductGroupArgs
    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 ProductGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProductGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProductGroupArgs
    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 productGroupResource = new Azure.ApiManagement.ProductGroup("productGroupResource", new()
    {
        ApiManagementName = "string",
        GroupName = "string",
        ProductId = "string",
        ResourceGroupName = "string",
    });
    
    example, err := apimanagement.NewProductGroup(ctx, "productGroupResource", &apimanagement.ProductGroupArgs{
    	ApiManagementName: pulumi.String("string"),
    	GroupName:         pulumi.String("string"),
    	ProductId:         pulumi.String("string"),
    	ResourceGroupName: pulumi.String("string"),
    })
    
    var productGroupResource = new ProductGroup("productGroupResource", ProductGroupArgs.builder()
        .apiManagementName("string")
        .groupName("string")
        .productId("string")
        .resourceGroupName("string")
        .build());
    
    product_group_resource = azure.apimanagement.ProductGroup("productGroupResource",
        api_management_name="string",
        group_name="string",
        product_id="string",
        resource_group_name="string")
    
    const productGroupResource = new azure.apimanagement.ProductGroup("productGroupResource", {
        apiManagementName: "string",
        groupName: "string",
        productId: "string",
        resourceGroupName: "string",
    });
    
    type: azure:apimanagement:ProductGroup
    properties:
        apiManagementName: string
        groupName: string
        productId: string
        resourceGroupName: string
    

    ProductGroup 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 ProductGroup resource accepts the following input properties:

    ApiManagementName string
    The name of the API Management Service. Changing this forces a new resource to be created.
    GroupName string
    The Name of the API Management Group 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.
    GroupName string
    The Name of the API Management Group 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.
    groupName String
    The Name of the API Management Group 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.
    groupName string
    The Name of the API Management Group 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.
    group_name str
    The Name of the API Management Group 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.
    groupName String
    The Name of the API Management Group 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 ProductGroup 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 ProductGroup Resource

    Get an existing ProductGroup 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?: ProductGroupState, opts?: CustomResourceOptions): ProductGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            api_management_name: Optional[str] = None,
            group_name: Optional[str] = None,
            product_id: Optional[str] = None,
            resource_group_name: Optional[str] = None) -> ProductGroup
    func GetProductGroup(ctx *Context, name string, id IDInput, state *ProductGroupState, opts ...ResourceOption) (*ProductGroup, error)
    public static ProductGroup Get(string name, Input<string> id, ProductGroupState? state, CustomResourceOptions? opts = null)
    public static ProductGroup get(String name, Output<String> id, ProductGroupState 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.
    GroupName string
    The Name of the API Management Group 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.
    GroupName string
    The Name of the API Management Group 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.
    groupName String
    The Name of the API Management Group 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.
    groupName string
    The Name of the API Management Group 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.
    group_name str
    The Name of the API Management Group 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.
    groupName String
    The Name of the API Management Group 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 Groups can be imported using the resource id, e.g.

    $ pulumi import azure:apimanagement/productGroup:ProductGroup example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/products/exampleId/groups/groupId
    

    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 Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi