All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.pulumi.azure.management.kotlin.PrivateLinkAssociation.kt Maven / Gradle / Ivy

@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.management.kotlin

import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit

/**
 * Builder for [PrivateLinkAssociation].
 */
@PulumiTagMarker
public class PrivateLinkAssociationResourceBuilder internal constructor() {
    public var name: String? = null

    public var args: PrivateLinkAssociationArgs = PrivateLinkAssociationArgs()

    public var opts: CustomResourceOptions = CustomResourceOptions()

    /**
     * @param name The _unique_ name of the resulting resource.
     */
    public fun name(`value`: String) {
        this.name = value
    }

    /**
     * @param block The arguments to use to populate this resource's properties.
     */
    public suspend fun args(block: suspend PrivateLinkAssociationArgsBuilder.() -> Unit) {
        val builder = PrivateLinkAssociationArgsBuilder()
        block(builder)
        this.args = builder.build()
    }

    /**
     * @param block A bag of options that control this resource's behavior.
     */
    public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
        this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
    }

    internal fun build(): PrivateLinkAssociation {
        val builtJavaResource =
            com.pulumi.azure.management.PrivateLinkAssociation(
                this.name,
                this.args.toJava(),
                this.opts.toJava(),
            )
        return PrivateLinkAssociation(builtJavaResource)
    }
}

/**
 * Manages a Resource Management Private Link Association.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as random from "@pulumi/random";
 * const example = azure.core.getClientConfig({});
 * const exampleGetGroup = example.then(example => azure.management.getGroup({
 *     name: example.tenantId,
 * }));
 * const exampleResourceGroup = new azure.core.ResourceGroup("example", {
 *     name: "example",
 *     location: "West Europe",
 * });
 * const examplePrivateLink = new azure.management.PrivateLink("example", {
 *     name: "example",
 *     resourceGroupName: exampleResourceGroup.name,
 *     location: exampleResourceGroup.location,
 * });
 * const exampleRandomUuid = new random.RandomUuid("example", {});
 * const examplePrivateLinkAssociation = new azure.management.PrivateLinkAssociation("example", {
 *     name: exampleRandomUuid.result,
 *     managementGroupId: exampleAzurermManagementGroup.id,
 *     resourceManagementPrivateLinkId: examplePrivateLink.id,
 *     publicNetworkAccessEnabled: true,
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_random as random
 * example = azure.core.get_client_config()
 * example_get_group = azure.management.get_group(name=example.tenant_id)
 * example_resource_group = azure.core.ResourceGroup("example",
 *     name="example",
 *     location="West Europe")
 * example_private_link = azure.management.PrivateLink("example",
 *     name="example",
 *     resource_group_name=example_resource_group.name,
 *     location=example_resource_group.location)
 * example_random_uuid = random.RandomUuid("example")
 * example_private_link_association = azure.management.PrivateLinkAssociation("example",
 *     name=example_random_uuid.result,
 *     management_group_id=example_azurerm_management_group["id"],
 *     resource_management_private_link_id=example_private_link.id,
 *     public_network_access_enabled=True)
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Random = Pulumi.Random;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = Azure.Core.GetClientConfig.Invoke();
 *     var exampleGetGroup = Azure.Management.GetGroup.Invoke(new()
 *     {
 *         Name = example.Apply(getClientConfigResult => getClientConfigResult.TenantId),
 *     });
 *     var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example",
 *         Location = "West Europe",
 *     });
 *     var examplePrivateLink = new Azure.Management.PrivateLink("example", new()
 *     {
 *         Name = "example",
 *         ResourceGroupName = exampleResourceGroup.Name,
 *         Location = exampleResourceGroup.Location,
 *     });
 *     var exampleRandomUuid = new Random.RandomUuid("example");
 *     var examplePrivateLinkAssociation = new Azure.Management.PrivateLinkAssociation("example", new()
 *     {
 *         Name = exampleRandomUuid.Result,
 *         ManagementGroupId = exampleAzurermManagementGroup.Id,
 *         ResourceManagementPrivateLinkId = examplePrivateLink.Id,
 *         PublicNetworkAccessEnabled = true,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
 * 	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.GetClientConfig(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = management.LookupGroup(ctx, &management.LookupGroupArgs{
 * 			Name: pulumi.StringRef(example.TenantId),
 * 		}, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		examplePrivateLink, err := management.NewPrivateLink(ctx, "example", &management.PrivateLinkArgs{
 * 			Name:              pulumi.String("example"),
 * 			ResourceGroupName: exampleResourceGroup.Name,
 * 			Location:          exampleResourceGroup.Location,
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleRandomUuid, err := random.NewRandomUuid(ctx, "example", nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = management.NewPrivateLinkAssociation(ctx, "example", &management.PrivateLinkAssociationArgs{
 * 			Name:                            exampleRandomUuid.Result,
 * 			ManagementGroupId:               pulumi.Any(exampleAzurermManagementGroup.Id),
 * 			ResourceManagementPrivateLinkId: examplePrivateLink.ID(),
 * 			PublicNetworkAccessEnabled:      pulumi.Bool(true),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		return nil
 * 	})
 * }
 * ```
 * ```java
 * package generated_program;
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.azure.core.CoreFunctions;
 * import com.pulumi.azure.management.ManagementFunctions;
 * import com.pulumi.azure.management.inputs.GetGroupArgs;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.management.PrivateLink;
 * import com.pulumi.azure.management.PrivateLinkArgs;
 * import com.pulumi.random.RandomUuid;
 * import com.pulumi.azure.management.PrivateLinkAssociation;
 * import com.pulumi.azure.management.PrivateLinkAssociationArgs;
 * 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 = CoreFunctions.getClientConfig();
 *         final var exampleGetGroup = ManagementFunctions.getGroup(GetGroupArgs.builder()
 *             .name(example.applyValue(getClientConfigResult -> getClientConfigResult.tenantId()))
 *             .build());
 *         var exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
 *             .name("example")
 *             .location("West Europe")
 *             .build());
 *         var examplePrivateLink = new PrivateLink("examplePrivateLink", PrivateLinkArgs.builder()
 *             .name("example")
 *             .resourceGroupName(exampleResourceGroup.name())
 *             .location(exampleResourceGroup.location())
 *             .build());
 *         var exampleRandomUuid = new RandomUuid("exampleRandomUuid");
 *         var examplePrivateLinkAssociation = new PrivateLinkAssociation("examplePrivateLinkAssociation", PrivateLinkAssociationArgs.builder()
 *             .name(exampleRandomUuid.result())
 *             .managementGroupId(exampleAzurermManagementGroup.id())
 *             .resourceManagementPrivateLinkId(examplePrivateLink.id())
 *             .publicNetworkAccessEnabled(true)
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   exampleResourceGroup:
 *     type: azure:core:ResourceGroup
 *     name: example
 *     properties:
 *       name: example
 *       location: West Europe
 *   examplePrivateLink:
 *     type: azure:management:PrivateLink
 *     name: example
 *     properties:
 *       name: example
 *       resourceGroupName: ${exampleResourceGroup.name}
 *       location: ${exampleResourceGroup.location}
 *   exampleRandomUuid:
 *     type: random:RandomUuid
 *     name: example
 *   examplePrivateLinkAssociation:
 *     type: azure:management:PrivateLinkAssociation
 *     name: example
 *     properties:
 *       name: ${exampleRandomUuid.result}
 *       managementGroupId: ${exampleAzurermManagementGroup.id}
 *       resourceManagementPrivateLinkId: ${examplePrivateLink.id}
 *       publicNetworkAccessEnabled: true
 * variables:
 *   example:
 *     fn::invoke:
 *       Function: azure:core:getClientConfig
 *       Arguments: {}
 *   exampleGetGroup:
 *     fn::invoke:
 *       Function: azure:management:getGroup
 *       Arguments:
 *         name: ${example.tenantId}
 * ```
 * 
 * ## Import
 * An existing Private Link Association can be imported into Terraform using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:management/privateLinkAssociation:PrivateLinkAssociation example /providers/Microsoft.Management/managementGroups/00000000-0000-0000-0000-000000000000/providers/Microsoft.Authorization/privateLinkAssociations/00000000-0000-0000-0000-000000000000
 * ```
 */
public class PrivateLinkAssociation internal constructor(
    override val javaResource: com.pulumi.azure.management.PrivateLinkAssociation,
) : KotlinCustomResource(javaResource, PrivateLinkAssociationMapper) {
    /**
     * Specifies the Management Group ID within which this Private Link Association should exist. Changing this forces a new Private Link Association to be created.
     * > **Note:** For now, `management_group_id` must be the ID of [Root Management Group](https://learn.microsoft.com/en-us/azure/governance/management-groups/overview#root-management-group-for-each-directory).
     */
    public val managementGroupId: Output
        get() = javaResource.managementGroupId().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of this Private Link Association, which should be a UUID. If `name` is not provided, a UUID will be generated, you should use the `ignore_changes` attribute to ignore changes to this field. Changing this forces a new Private Link Association to be created.
     * 
     * ```typescript
     * import * as pulumi from "@pulumi/pulumi";
     * import * as azure from "@pulumi/azure";
     * const example = new azure.management.PrivateLinkAssociation("example", {
     *     managementGroupId: exampleAzurermManagementGroup.id,
     *     resourceManagementPrivateLinkId: exampleAzurermResourceManagementPrivateLink.id,
     *     publicNetworkAccessEnabled: true,
     * });
     * ```
     * ```python
     * import pulumi
     * import pulumi_azure as azure
     * example = azure.management.PrivateLinkAssociation("example",
     *     management_group_id=example_azurerm_management_group["id"],
     *     resource_management_private_link_id=example_azurerm_resource_management_private_link["id"],
     *     public_network_access_enabled=True)
     * ```
     * ```csharp
     * using System.Collections.Generic;
     * using System.Linq;
     * using Pulumi;
     * using Azure = Pulumi.Azure;
     * return await Deployment.RunAsync(() =>
     * {
     *     var example = new Azure.Management.PrivateLinkAssociation("example", new()
     *     {
     *         ManagementGroupId = exampleAzurermManagementGroup.Id,
     *         ResourceManagementPrivateLinkId = exampleAzurermResourceManagementPrivateLink.Id,
     *         PublicNetworkAccessEnabled = true,
     *     });
     * });
     * ```
     * ```go
     * package main
     * import (
     * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/management"
     * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
     * )
     * func main() {
     * 	pulumi.Run(func(ctx *pulumi.Context) error {
     * 		_, err := management.NewPrivateLinkAssociation(ctx, "example", &management.PrivateLinkAssociationArgs{
     * 			ManagementGroupId:               pulumi.Any(exampleAzurermManagementGroup.Id),
     * 			ResourceManagementPrivateLinkId: pulumi.Any(exampleAzurermResourceManagementPrivateLink.Id),
     * 			PublicNetworkAccessEnabled:      pulumi.Bool(true),
     * 		})
     * 		if err != nil {
     * 			return err
     * 		}
     * 		return nil
     * 	})
     * }
     * ```
     * ```java
     * package generated_program;
     * import com.pulumi.Context;
     * import com.pulumi.Pulumi;
     * import com.pulumi.core.Output;
     * import com.pulumi.azure.management.PrivateLinkAssociation;
     * import com.pulumi.azure.management.PrivateLinkAssociationArgs;
     * 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 example = new PrivateLinkAssociation("example", PrivateLinkAssociationArgs.builder()
     *             .managementGroupId(exampleAzurermManagementGroup.id())
     *             .resourceManagementPrivateLinkId(exampleAzurermResourceManagementPrivateLink.id())
     *             .publicNetworkAccessEnabled(true)
     *             .build());
     *     }
     * }
     * ```
     * ```yaml
     * resources:
     *   example:
     *     type: azure:management:PrivateLinkAssociation
     *     properties:
     *       managementGroupId: ${exampleAzurermManagementGroup.id}
     *       resourceManagementPrivateLinkId: ${exampleAzurermResourceManagementPrivateLink.id}
     *       publicNetworkAccessEnabled: true
     * ```
     * 
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Whether public network access is allowed. Changing this forces a new Private Link Association to be created.
     */
    public val publicNetworkAccessEnabled: Output
        get() = javaResource.publicNetworkAccessEnabled().applyValue({ args0 -> args0 })

    /**
     * The Resource ID of Resource Management Private Link. Changing this forces a new Private Link Association to be created.
     */
    public val resourceManagementPrivateLinkId: Output
        get() = javaResource.resourceManagementPrivateLinkId().applyValue({ args0 -> args0 })

    /**
     * The Tenant ID.
     */
    public val tenantId: Output
        get() = javaResource.tenantId().applyValue({ args0 -> args0 })
}

public object PrivateLinkAssociationMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.management.PrivateLinkAssociation::class == javaResource::class

    override fun map(javaResource: Resource): PrivateLinkAssociation =
        PrivateLinkAssociation(javaResource as com.pulumi.azure.management.PrivateLinkAssociation)
}

/**
 * @see [PrivateLinkAssociation].
 * @param name The _unique_ name of the resulting resource.
 * @param block Builder for [PrivateLinkAssociation].
 */
public suspend fun privateLinkAssociation(
    name: String,
    block: suspend PrivateLinkAssociationResourceBuilder.() -> Unit,
): PrivateLinkAssociation {
    val builder = PrivateLinkAssociationResourceBuilder()
    builder.name(name)
    block(builder)
    return builder.build()
}

/**
 * @see [PrivateLinkAssociation].
 * @param name The _unique_ name of the resulting resource.
 */
public fun privateLinkAssociation(name: String): PrivateLinkAssociation {
    val builder = PrivateLinkAssociationResourceBuilder()
    builder.name(name)
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy