We recommend using Azure Native.
azure.apimanagement.ApiTag
Explore with Pulumi AI
Manages the Assignment of an API Management API Tag to an API.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const exampleResourceGroup = new azure.core.ResourceGroup("example", {
name: "example-resources",
location: "West Europe",
});
const example = azure.apimanagement.getServiceOutput({
name: "example-apim",
resourceGroupName: exampleResourceGroup.name,
});
const exampleApi = new azure.apimanagement.Api("example", {
name: "example-api",
resourceGroupName: exampleResourceGroup.name,
apiManagementName: example.apply(example => example.name),
revision: "1",
});
const exampleTag = new azure.apimanagement.Tag("example", {
apiManagementId: example.apply(example => example.id),
name: "example-tag",
});
const exampleApiTag = new azure.apimanagement.ApiTag("example", {
apiId: exampleApi.id,
name: exampleTag.name,
});
import pulumi
import pulumi_azure as azure
example_resource_group = azure.core.ResourceGroup("example",
name="example-resources",
location="West Europe")
example = azure.apimanagement.get_service_output(name="example-apim",
resource_group_name=example_resource_group.name)
example_api = azure.apimanagement.Api("example",
name="example-api",
resource_group_name=example_resource_group.name,
api_management_name=example.name,
revision="1")
example_tag = azure.apimanagement.Tag("example",
api_management_id=example.id,
name="example-tag")
example_api_tag = azure.apimanagement.ApiTag("example",
api_id=example_api.id,
name=example_tag.name)
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/apimanagement"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
Name: pulumi.String("example-resources"),
Location: pulumi.String("West Europe"),
})
if err != nil {
return err
}
example := apimanagement.LookupServiceOutput(ctx, apimanagement.GetServiceOutputArgs{
Name: pulumi.String("example-apim"),
ResourceGroupName: exampleResourceGroup.Name,
}, nil)
exampleApi, err := apimanagement.NewApi(ctx, "example", &apimanagement.ApiArgs{
Name: pulumi.String("example-api"),
ResourceGroupName: exampleResourceGroup.Name,
ApiManagementName: example.ApplyT(func(example apimanagement.GetServiceResult) (*string, error) {
return &example.Name, nil
}).(pulumi.StringPtrOutput),
Revision: pulumi.String("1"),
})
if err != nil {
return err
}
exampleTag, err := apimanagement.NewTag(ctx, "example", &apimanagement.TagArgs{
ApiManagementId: example.ApplyT(func(example apimanagement.GetServiceResult) (*string, error) {
return &example.Id, nil
}).(pulumi.StringPtrOutput),
Name: pulumi.String("example-tag"),
})
if err != nil {
return err
}
_, err = apimanagement.NewApiTag(ctx, "example", &apimanagement.ApiTagArgs{
ApiId: exampleApi.ID(),
Name: exampleTag.Name,
})
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 exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
{
Name = "example-resources",
Location = "West Europe",
});
var example = Azure.ApiManagement.GetService.Invoke(new()
{
Name = "example-apim",
ResourceGroupName = exampleResourceGroup.Name,
});
var exampleApi = new Azure.ApiManagement.Api("example", new()
{
Name = "example-api",
ResourceGroupName = exampleResourceGroup.Name,
ApiManagementName = example.Apply(getServiceResult => getServiceResult.Name),
Revision = "1",
});
var exampleTag = new Azure.ApiManagement.Tag("example", new()
{
ApiManagementId = example.Apply(getServiceResult => getServiceResult.Id),
Name = "example-tag",
});
var exampleApiTag = new Azure.ApiManagement.ApiTag("example", new()
{
ApiId = exampleApi.Id,
Name = exampleTag.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.apimanagement.ApimanagementFunctions;
import com.pulumi.azure.apimanagement.inputs.GetServiceArgs;
import com.pulumi.azure.apimanagement.Api;
import com.pulumi.azure.apimanagement.ApiArgs;
import com.pulumi.azure.apimanagement.Tag;
import com.pulumi.azure.apimanagement.TagArgs;
import com.pulumi.azure.apimanagement.ApiTag;
import com.pulumi.azure.apimanagement.ApiTagArgs;
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) {
var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
.name("example-resources")
.location("West Europe")
.build());
final var example = ApimanagementFunctions.getService(GetServiceArgs.builder()
.name("example-apim")
.resourceGroupName(exampleResourceGroup.name())
.build());
var exampleApi = new Api("exampleApi", ApiArgs.builder()
.name("example-api")
.resourceGroupName(exampleResourceGroup.name())
.apiManagementName(example.applyValue(getServiceResult -> getServiceResult).applyValue(example -> example.applyValue(getServiceResult -> getServiceResult.name())))
.revision("1")
.build());
var exampleTag = new Tag("exampleTag", TagArgs.builder()
.apiManagementId(example.applyValue(getServiceResult -> getServiceResult).applyValue(example -> example.applyValue(getServiceResult -> getServiceResult.id())))
.name("example-tag")
.build());
var exampleApiTag = new ApiTag("exampleApiTag", ApiTagArgs.builder()
.apiId(exampleApi.id())
.name(exampleTag.name())
.build());
}
}
resources:
exampleResourceGroup:
type: azure:core:ResourceGroup
name: example
properties:
name: example-resources
location: West Europe
exampleApi:
type: azure:apimanagement:Api
name: example
properties:
name: example-api
resourceGroupName: ${exampleResourceGroup.name}
apiManagementName: ${example.name}
revision: '1'
exampleTag:
type: azure:apimanagement:Tag
name: example
properties:
apiManagementId: ${example.id}
name: example-tag
exampleApiTag:
type: azure:apimanagement:ApiTag
name: example
properties:
apiId: ${exampleApi.id}
name: ${exampleTag.name}
variables:
example:
fn::invoke:
Function: azure:apimanagement:getService
Arguments:
name: example-apim
resourceGroupName: ${exampleResourceGroup.name}
Create ApiTag Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ApiTag(name: string, args: ApiTagArgs, opts?: CustomResourceOptions);
@overload
def ApiTag(resource_name: str,
args: ApiTagArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ApiTag(resource_name: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
name: Optional[str] = None)
func NewApiTag(ctx *Context, name string, args ApiTagArgs, opts ...ResourceOption) (*ApiTag, error)
public ApiTag(string name, ApiTagArgs args, CustomResourceOptions? opts = null)
public ApiTag(String name, ApiTagArgs args)
public ApiTag(String name, ApiTagArgs args, CustomResourceOptions options)
type: azure:apimanagement:ApiTag
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 ApiTagArgs
- 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 ApiTagArgs
- 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 ApiTagArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ApiTagArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ApiTagArgs
- 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 apiTagResource = new Azure.ApiManagement.ApiTag("apiTagResource", new()
{
ApiId = "string",
Name = "string",
});
example, err := apimanagement.NewApiTag(ctx, "apiTagResource", &apimanagement.ApiTagArgs{
ApiId: pulumi.String("string"),
Name: pulumi.String("string"),
})
var apiTagResource = new ApiTag("apiTagResource", ApiTagArgs.builder()
.apiId("string")
.name("string")
.build());
api_tag_resource = azure.apimanagement.ApiTag("apiTagResource",
api_id="string",
name="string")
const apiTagResource = new azure.apimanagement.ApiTag("apiTagResource", {
apiId: "string",
name: "string",
});
type: azure:apimanagement:ApiTag
properties:
apiId: string
name: string
ApiTag 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 ApiTag resource accepts the following input properties:
Outputs
All input properties are implicitly available as output properties. Additionally, the ApiTag 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 ApiTag Resource
Get an existing ApiTag 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?: ApiTagState, opts?: CustomResourceOptions): ApiTag
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
api_id: Optional[str] = None,
name: Optional[str] = None) -> ApiTag
func GetApiTag(ctx *Context, name string, id IDInput, state *ApiTagState, opts ...ResourceOption) (*ApiTag, error)
public static ApiTag Get(string name, Input<string> id, ApiTagState? state, CustomResourceOptions? opts = null)
public static ApiTag get(String name, Output<String> id, ApiTagState 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.
Import
API Management API Tags can be imported using the resource id
, e.g.
$ pulumi import azure:apimanagement/apiTag:ApiTag example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ApiManagement/service/service1/apis/api1/tags/tag1
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.