Subscription

Manages a Subscription within a API Management Service.

Example Usage

using Pulumi;
using Azure = Pulumi.Azure;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleService = Output.Create(Azure.ApiManagement.GetService.InvokeAsync(new Azure.ApiManagement.GetServiceArgs
        {
            Name = "example-apim",
            ResourceGroupName = "example-resources",
        }));
        var exampleProduct = Output.Tuple(exampleService, exampleService).Apply(values =>
        {
            var exampleService = values.Item1;
            var exampleService1 = values.Item2;
            return Output.Create(Azure.ApiManagement.GetProduct.InvokeAsync(new Azure.ApiManagement.GetProductArgs
            {
                ProductId = "00000000-0000-0000-0000-000000000000",
                ApiManagementName = exampleService.Name,
                ResourceGroupName = exampleService1.ResourceGroupName,
            }));
        });
        var exampleUser = Output.Tuple(exampleService, exampleService).Apply(values =>
        {
            var exampleService = values.Item1;
            var exampleService1 = values.Item2;
            return Output.Create(Azure.ApiManagement.GetUser.InvokeAsync(new Azure.ApiManagement.GetUserArgs
            {
                UserId = "11111111-1111-1111-1111-111111111111",
                ApiManagementName = exampleService.Name,
                ResourceGroupName = exampleService1.ResourceGroupName,
            }));
        });
        var exampleSubscription = new Azure.ApiManagement.Subscription("exampleSubscription", new Azure.ApiManagement.SubscriptionArgs
        {
            ApiManagementName = exampleService.Apply(exampleService => exampleService.Name),
            ResourceGroupName = exampleService.Apply(exampleService => exampleService.ResourceGroupName),
            UserId = exampleUser.Apply(exampleUser => exampleUser.Id),
            ProductId = exampleProduct.Apply(exampleProduct => exampleProduct.Id),
            DisplayName = "Parser API",
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-azure/sdk/v3/go/azure/apimanagement"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        exampleService, err := apimanagement.LookupService(ctx, &apimanagement.LookupServiceArgs{
            Name:              "example-apim",
            ResourceGroupName: "example-resources",
        }, nil)
        if err != nil {
            return err
        }
        exampleProduct, err := apimanagement.LookupProduct(ctx, &apimanagement.LookupProductArgs{
            ProductId:         "00000000-0000-0000-0000-000000000000",
            ApiManagementName: exampleService.Name,
            ResourceGroupName: exampleService.ResourceGroupName,
        }, nil)
        if err != nil {
            return err
        }
        exampleUser, err := apimanagement.LookupUser(ctx, &apimanagement.LookupUserArgs{
            UserId:            "11111111-1111-1111-1111-111111111111",
            ApiManagementName: exampleService.Name,
            ResourceGroupName: exampleService.ResourceGroupName,
        }, nil)
        if err != nil {
            return err
        }
        _, err = apimanagement.NewSubscription(ctx, "exampleSubscription", &apimanagement.SubscriptionArgs{
            ApiManagementName: pulumi.String(exampleService.Name),
            ResourceGroupName: pulumi.String(exampleService.ResourceGroupName),
            UserId:            pulumi.String(exampleUser.Id),
            ProductId:         pulumi.String(exampleProduct.Id),
            DisplayName:       pulumi.String("Parser API"),
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_azure as azure

example_service = azure.apimanagement.get_service(name="example-apim",
    resource_group_name="example-resources")
example_product = azure.apimanagement.get_product(product_id="00000000-0000-0000-0000-000000000000",
    api_management_name=example_service.name,
    resource_group_name=example_service.resource_group_name)
example_user = azure.apimanagement.get_user(user_id="11111111-1111-1111-1111-111111111111",
    api_management_name=example_service.name,
    resource_group_name=example_service.resource_group_name)
example_subscription = azure.apimanagement.Subscription("exampleSubscription",
    api_management_name=example_service.name,
    resource_group_name=example_service.resource_group_name,
    user_id=example_user.id,
    product_id=example_product.id,
    display_name="Parser API")
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleService = azure.apimanagement.getService({
    name: "example-apim",
    resourceGroupName: "example-resources",
});
const exampleProduct = Promise.all([exampleService, exampleService]).then(([exampleService, exampleService1]) => azure.apimanagement.getProduct({
    productId: "00000000-0000-0000-0000-000000000000",
    apiManagementName: exampleService.name,
    resourceGroupName: exampleService1.resourceGroupName,
}));
const exampleUser = Promise.all([exampleService, exampleService]).then(([exampleService, exampleService1]) => azure.apimanagement.getUser({
    userId: "11111111-1111-1111-1111-111111111111",
    apiManagementName: exampleService.name,
    resourceGroupName: exampleService1.resourceGroupName,
}));
const exampleSubscription = new azure.apimanagement.Subscription("exampleSubscription", {
    apiManagementName: exampleService.then(exampleService => exampleService.name),
    resourceGroupName: exampleService.then(exampleService => exampleService.resourceGroupName),
    userId: exampleUser.then(exampleUser => exampleUser.id),
    productId: exampleProduct.then(exampleProduct => exampleProduct.id),
    displayName: "Parser API",
});

Create a Subscription Resource

def Subscription(resource_name, opts=None, api_management_name=None, display_name=None, primary_key=None, product_id=None, resource_group_name=None, secondary_key=None, state=None, subscription_id=None, user_id=None, __props__=None);
func NewSubscription(ctx *Context, name string, args SubscriptionArgs, opts ...ResourceOption) (*Subscription, error)
name string
The unique name of the resource.
args SubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args SubscriptionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args SubscriptionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Subscription Resource Properties

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

Inputs

The Subscription resource accepts the following input properties:

ApiManagementName string

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

DisplayName string

The display name of this Subscription.

ResourceGroupName string

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

UserId string

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

PrimaryKey string
ProductId string

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

SecondaryKey string
State string

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

SubscriptionId string

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.

ApiManagementName string

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

DisplayName string

The display name of this Subscription.

ResourceGroupName string

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

UserId string

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

PrimaryKey string
ProductId string

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

SecondaryKey string
State string

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

SubscriptionId string

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.

apiManagementName string

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

displayName string

The display name of this Subscription.

resourceGroupName string

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

userId string

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

primaryKey string
productId string

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

secondaryKey string
state string

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

subscriptionId string

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.

api_management_name str

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

display_name str

The display name of this Subscription.

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.

user_id str

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

primary_key str
product_id str

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

secondary_key str
state str

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

subscription_id str

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.

Outputs

All input properties are implicitly available as output properties. Additionally, the Subscription 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing Subscription Resource

Get an existing Subscription 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?: SubscriptionState, opts?: CustomResourceOptions): Subscription
static get(resource_name, id, opts=None, api_management_name=None, display_name=None, primary_key=None, product_id=None, resource_group_name=None, secondary_key=None, state=None, subscription_id=None, user_id=None, __props__=None);
func GetSubscription(ctx *Context, name string, id IDInput, state *SubscriptionState, opts ...ResourceOption) (*Subscription, error)
public static Subscription Get(string name, Input<string> id, SubscriptionState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

ApiManagementName string

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

DisplayName string

The display name of this Subscription.

PrimaryKey string
ProductId string

The ID of the Product which should be assigned to this Subscription. 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.

SecondaryKey string
State string

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

SubscriptionId string

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.

UserId string

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

ApiManagementName string

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

DisplayName string

The display name of this Subscription.

PrimaryKey string
ProductId string

The ID of the Product which should be assigned to this Subscription. 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.

SecondaryKey string
State string

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

SubscriptionId string

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.

UserId string

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

apiManagementName string

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

displayName string

The display name of this Subscription.

primaryKey string
productId string

The ID of the Product which should be assigned to this Subscription. 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.

secondaryKey string
state string

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

subscriptionId string

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.

userId string

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

api_management_name str

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

display_name str

The display name of this Subscription.

primary_key str
product_id str

The ID of the Product which should be assigned to this Subscription. 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.

secondary_key str
state str

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

subscription_id str

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.

user_id str

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

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes
This Pulumi package is based on the azurerm Terraform Provider.