SubscriptionArgs

data class SubscriptionArgs(val allowTracing: Output<Boolean>? = null, val apiId: Output<String>? = null, val apiManagementName: Output<String>? = null, val displayName: Output<String>? = null, val primaryKey: Output<String>? = null, val productId: Output<String>? = null, val resourceGroupName: Output<String>? = null, val secondaryKey: Output<String>? = null, val state: Output<String>? = null, val subscriptionId: Output<String>? = null, val userId: Output<String>? = null) : ConvertibleToJava<SubscriptionArgs>

Manages a Subscription within a API Management Service.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.apimanagement.getService({
name: "example-apim",
resourceGroupName: "example-resources",
});
const exampleGetProduct = Promise.all([example, example])&#46;then(([example, example1]) => azure.apimanagement.getProduct({
productId: "00000000-0000-0000-0000-000000000000",
apiManagementName: example.name,
resourceGroupName: example1.resourceGroupName,
}));
const exampleGetUser = Promise.all([example, example])&#46;then(([example, example1]) => azure.apimanagement.getUser({
userId: "11111111-1111-1111-1111-111111111111",
apiManagementName: example.name,
resourceGroupName: example1.resourceGroupName,
}));
const exampleSubscription = new azure.apimanagement.Subscription("example", {
apiManagementName: example.then(example => example.name),
resourceGroupName: example.then(example => example.resourceGroupName),
userId: exampleGetUser.then(exampleGetUser => exampleGetUser.id),
productId: exampleGetProduct.then(exampleGetProduct => exampleGetProduct.id),
displayName: "Parser API",
});
import pulumi
import pulumi_azure as azure
example = azure.apimanagement.get_service(name="example-apim",
resource_group_name="example-resources")
example_get_product = azure.apimanagement.get_product(product_id="00000000-0000-0000-0000-000000000000",
api_management_name=example.name,
resource_group_name=example.resource_group_name)
example_get_user = azure.apimanagement.get_user(user_id="11111111-1111-1111-1111-111111111111",
api_management_name=example.name,
resource_group_name=example.resource_group_name)
example_subscription = azure.apimanagement.Subscription("example",
api_management_name=example.name,
resource_group_name=example.resource_group_name,
user_id=example_get_user.id,
product_id=example_get_product.id,
display_name="Parser API")
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-apim",
ResourceGroupName = "example-resources",
});
var exampleGetProduct = Azure.ApiManagement.GetProduct.Invoke(new()
{
ProductId = "00000000-0000-0000-0000-000000000000",
ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
});
var exampleGetUser = Azure.ApiManagement.GetUser.Invoke(new()
{
UserId = "11111111-1111-1111-1111-111111111111",
ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
});
var exampleSubscription = new Azure.ApiManagement.Subscription("example", new()
{
ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
ResourceGroupName = example.Apply(getServiceResult => getServiceResult.ResourceGroupName),
UserId = exampleGetUser.Apply(getUserResult => getUserResult.Id),
ProductId = exampleGetProduct.Apply(getProductResult => getProductResult.Id),
DisplayName = "Parser API",
});
});
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-apim",
ResourceGroupName: "example-resources",
}, nil)
if err != nil {
return err
}
exampleGetProduct, err := apimanagement.LookupProduct(ctx, &apimanagement.LookupProductArgs{
ProductId: "00000000-0000-0000-0000-000000000000",
ApiManagementName: example.Name,
ResourceGroupName: example.ResourceGroupName,
}, nil)
if err != nil {
return err
}
exampleGetUser, err := apimanagement.LookupUser(ctx, &apimanagement.LookupUserArgs{
UserId: "11111111-1111-1111-1111-111111111111",
ApiManagementName: example.Name,
ResourceGroupName: example.ResourceGroupName,
}, nil)
if err != nil {
return err
}
_, err = apimanagement.NewSubscription(ctx, "example", &apimanagement.SubscriptionArgs{
ApiManagementName: pulumi.String(example.Name),
ResourceGroupName: pulumi.String(example.ResourceGroupName),
UserId: pulumi.String(exampleGetUser.Id),
ProductId: pulumi.String(exampleGetProduct.Id),
DisplayName: pulumi.String("Parser API"),
})
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.GetProductArgs;
import com.pulumi.azure.apimanagement.inputs.GetUserArgs;
import com.pulumi.azure.apimanagement.Subscription;
import com.pulumi.azure.apimanagement.SubscriptionArgs;
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-apim")
.resourceGroupName("example-resources")
.build());
final var exampleGetProduct = ApimanagementFunctions.getProduct(GetProductArgs.builder()
.productId("00000000-0000-0000-0000-000000000000")
.apiManagementName(example.name())
.resourceGroupName(example.resourceGroupName())
.build());
final var exampleGetUser = ApimanagementFunctions.getUser(GetUserArgs.builder()
.userId("11111111-1111-1111-1111-111111111111")
.apiManagementName(example.name())
.resourceGroupName(example.resourceGroupName())
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.apiManagementName(example.name())
.resourceGroupName(example.resourceGroupName())
.userId(exampleGetUser.id())
.productId(exampleGetProduct.id())
.displayName("Parser API")
.build());
}
}
resources:
exampleSubscription:
type: azure:apimanagement:Subscription
name: example
properties:
apiManagementName: ${example.name}
resourceGroupName: ${example.resourceGroupName}
userId: ${exampleGetUser.id}
productId: ${exampleGetProduct.id}
displayName: Parser API
variables:
example:
fn::invoke:
function: azure:apimanagement:getService
arguments:
name: example-apim
resourceGroupName: example-resources
exampleGetProduct:
fn::invoke:
function: azure:apimanagement:getProduct
arguments:
productId: 00000000-0000-0000-0000-000000000000
apiManagementName: ${example.name}
resourceGroupName: ${example.resourceGroupName}
exampleGetUser:
fn::invoke:
function: azure:apimanagement:getUser
arguments:
userId: 11111111-1111-1111-1111-111111111111
apiManagementName: ${example.name}
resourceGroupName: ${example.resourceGroupName}

API Providers

This resource uses the following Azure API Providers:

  • Microsoft.ApiManagement: 2022-08-01

Import

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

$ pulumi import azure:apimanagement/subscription:Subscription example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-resources/providers/Microsoft.ApiManagement/service/example-apim/subscriptions/subscription-name

Constructors

Link copied to clipboard
constructor(allowTracing: Output<Boolean>? = null, apiId: Output<String>? = null, apiManagementName: Output<String>? = null, displayName: Output<String>? = null, primaryKey: Output<String>? = null, productId: Output<String>? = null, resourceGroupName: Output<String>? = null, secondaryKey: Output<String>? = null, state: Output<String>? = null, subscriptionId: Output<String>? = null, userId: Output<String>? = null)

Properties

Link copied to clipboard
val allowTracing: Output<Boolean>? = null

Determines whether tracing can be enabled. Defaults to true.

Link copied to clipboard
val apiId: Output<String>? = null

The ID of the API which should be assigned to this Subscription. Changing this forces a new resource to be created.

Link copied to clipboard
val apiManagementName: Output<String>? = null

The name of the API Management Service where this Subscription should be created. Changing this forces a new resource to be created.

Link copied to clipboard
val displayName: Output<String>? = null

The display name of this Subscription.

Link copied to clipboard
val primaryKey: Output<String>? = null

The primary subscription key to use for the subscription.

Link copied to clipboard
val productId: Output<String>? = null

The ID of the Product which should be assigned to this Subscription. Changing this forces a new resource to be created.

Link copied to clipboard
val resourceGroupName: Output<String>? = null

The name of the Resource Group in which the API Management Service exists. Changing this forces a new resource to be created.

Link copied to clipboard
val secondaryKey: Output<String>? = null

The secondary subscription key to use for the subscription.

Link copied to clipboard
val state: Output<String>? = null

The state of this Subscription. Possible values are active, cancelled, expired, rejected, submitted and suspended. Defaults to submitted.

Link copied to clipboard
val subscriptionId: Output<String>? = null

An Identifier which should used as the ID of this Subscription. If not specified a new Subscription ID will be generated. Changing this forces a new resource to be created.

Link copied to clipboard
val userId: Output<String>? = null

The ID of the User which should be assigned to this Subscription. Changing this forces a new resource to be created.

Functions

Link copied to clipboard
open override fun toJava(): SubscriptionArgs