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

com.pulumi.azure.network.kotlin.Profile.kt Maven / Gradle / Ivy

Go to download

Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.

There is a newer version: 6.21.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.kotlin.outputs.ProfileContainerNetworkInterface
import com.pulumi.azure.network.kotlin.outputs.ProfileContainerNetworkInterface.Companion.toKotlin
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
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: ProfileArgs = ProfileArgs()

    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 ProfileArgsBuilder.() -> Unit) {
        val builder = ProfileArgsBuilder()
        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(): Profile {
        val builtJavaResource = com.pulumi.azure.network.Profile(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return Profile(builtJavaResource)
    }
}

/**
 * Manages a Network Profile.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "examplegroup",
 *     location: "West Europe",
 * });
 * const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
 *     name: "examplevnet",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     addressSpaces: ["10.1.0.0/16"],
 * });
 * const exampleSubnet = new azure.network.Subnet("example", {
 *     name: "examplesubnet",
 *     resourceGroupName: example.name,
 *     virtualNetworkName: exampleVirtualNetwork.name,
 *     addressPrefixes: ["10.1.0.0/24"],
 *     delegations: [{
 *         name: "delegation",
 *         serviceDelegation: {
 *             name: "Microsoft.ContainerInstance/containerGroups",
 *             actions: ["Microsoft.Network/virtualNetworks/subnets/action"],
 *         },
 *     }],
 * });
 * const exampleProfile = new azure.network.Profile("example", {
 *     name: "examplenetprofile",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     containerNetworkInterface: {
 *         name: "examplecnic",
 *         ipConfigurations: [{
 *             name: "exampleipconfig",
 *             subnetId: exampleSubnet.id,
 *         }],
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="examplegroup",
 *     location="West Europe")
 * example_virtual_network = azure.network.VirtualNetwork("example",
 *     name="examplevnet",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     address_spaces=["10.1.0.0/16"])
 * example_subnet = azure.network.Subnet("example",
 *     name="examplesubnet",
 *     resource_group_name=example.name,
 *     virtual_network_name=example_virtual_network.name,
 *     address_prefixes=["10.1.0.0/24"],
 *     delegations=[azure.network.SubnetDelegationArgs(
 *         name="delegation",
 *         service_delegation=azure.network.SubnetDelegationServiceDelegationArgs(
 *             name="Microsoft.ContainerInstance/containerGroups",
 *             actions=["Microsoft.Network/virtualNetworks/subnets/action"],
 *         ),
 *     )])
 * example_profile = azure.network.Profile("example",
 *     name="examplenetprofile",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     container_network_interface=azure.network.ProfileContainerNetworkInterfaceArgs(
 *         name="examplecnic",
 *         ip_configurations=[azure.network.ProfileContainerNetworkInterfaceIpConfigurationArgs(
 *             name="exampleipconfig",
 *             subnet_id=example_subnet.id,
 *         )],
 *     ))
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "examplegroup",
 *         Location = "West Europe",
 *     });
 *     var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
 *     {
 *         Name = "examplevnet",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         AddressSpaces = new[]
 *         {
 *             "10.1.0.0/16",
 *         },
 *     });
 *     var exampleSubnet = new Azure.Network.Subnet("example", new()
 *     {
 *         Name = "examplesubnet",
 *         ResourceGroupName = example.Name,
 *         VirtualNetworkName = exampleVirtualNetwork.Name,
 *         AddressPrefixes = new[]
 *         {
 *             "10.1.0.0/24",
 *         },
 *         Delegations = new[]
 *         {
 *             new Azure.Network.Inputs.SubnetDelegationArgs
 *             {
 *                 Name = "delegation",
 *                 ServiceDelegation = new Azure.Network.Inputs.SubnetDelegationServiceDelegationArgs
 *                 {
 *                     Name = "Microsoft.ContainerInstance/containerGroups",
 *                     Actions = new[]
 *                     {
 *                         "Microsoft.Network/virtualNetworks/subnets/action",
 *                     },
 *                 },
 *             },
 *         },
 *     });
 *     var exampleProfile = new Azure.Network.Profile("example", new()
 *     {
 *         Name = "examplenetprofile",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         ContainerNetworkInterface = new Azure.Network.Inputs.ProfileContainerNetworkInterfaceArgs
 *         {
 *             Name = "examplecnic",
 *             IpConfigurations = new[]
 *             {
 *                 new Azure.Network.Inputs.ProfileContainerNetworkInterfaceIpConfigurationArgs
 *                 {
 *                     Name = "exampleipconfig",
 *                     SubnetId = exampleSubnet.Id,
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("examplegroup"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
 * 			Name:              pulumi.String("examplevnet"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			AddressSpaces: pulumi.StringArray{
 * 				pulumi.String("10.1.0.0/16"),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
 * 			Name:               pulumi.String("examplesubnet"),
 * 			ResourceGroupName:  example.Name,
 * 			VirtualNetworkName: exampleVirtualNetwork.Name,
 * 			AddressPrefixes: pulumi.StringArray{
 * 				pulumi.String("10.1.0.0/24"),
 * 			},
 * 			Delegations: network.SubnetDelegationArray{
 * 				&network.SubnetDelegationArgs{
 * 					Name: pulumi.String("delegation"),
 * 					ServiceDelegation: &network.SubnetDelegationServiceDelegationArgs{
 * 						Name: pulumi.String("Microsoft.ContainerInstance/containerGroups"),
 * 						Actions: pulumi.StringArray{
 * 							pulumi.String("Microsoft.Network/virtualNetworks/subnets/action"),
 * 						},
 * 					},
 * 				},
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewProfile(ctx, "example", &network.ProfileArgs{
 * 			Name:              pulumi.String("examplenetprofile"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			ContainerNetworkInterface: &network.ProfileContainerNetworkInterfaceArgs{
 * 				Name: pulumi.String("examplecnic"),
 * 				IpConfigurations: network.ProfileContainerNetworkInterfaceIpConfigurationArray{
 * 					&network.ProfileContainerNetworkInterfaceIpConfigurationArgs{
 * 						Name:     pulumi.String("exampleipconfig"),
 * 						SubnetId: exampleSubnet.ID(),
 * 					},
 * 				},
 * 			},
 * 		})
 * 		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.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.VirtualNetwork;
 * import com.pulumi.azure.network.VirtualNetworkArgs;
 * import com.pulumi.azure.network.Subnet;
 * import com.pulumi.azure.network.SubnetArgs;
 * import com.pulumi.azure.network.inputs.SubnetDelegationArgs;
 * import com.pulumi.azure.network.inputs.SubnetDelegationServiceDelegationArgs;
 * import com.pulumi.azure.network.Profile;
 * import com.pulumi.azure.network.ProfileArgs;
 * import com.pulumi.azure.network.inputs.ProfileContainerNetworkInterfaceArgs;
 * 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 ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("examplegroup")
 *             .location("West Europe")
 *             .build());
 *         var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
 *             .name("examplevnet")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .addressSpaces("10.1.0.0/16")
 *             .build());
 *         var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
 *             .name("examplesubnet")
 *             .resourceGroupName(example.name())
 *             .virtualNetworkName(exampleVirtualNetwork.name())
 *             .addressPrefixes("10.1.0.0/24")
 *             .delegations(SubnetDelegationArgs.builder()
 *                 .name("delegation")
 *                 .serviceDelegation(SubnetDelegationServiceDelegationArgs.builder()
 *                     .name("Microsoft.ContainerInstance/containerGroups")
 *                     .actions("Microsoft.Network/virtualNetworks/subnets/action")
 *                     .build())
 *                 .build())
 *             .build());
 *         var exampleProfile = new Profile("exampleProfile", ProfileArgs.builder()
 *             .name("examplenetprofile")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .containerNetworkInterface(ProfileContainerNetworkInterfaceArgs.builder()
 *                 .name("examplecnic")
 *                 .ipConfigurations(ProfileContainerNetworkInterfaceIpConfigurationArgs.builder()
 *                     .name("exampleipconfig")
 *                     .subnetId(exampleSubnet.id())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: examplegroup
 *       location: West Europe
 *   exampleVirtualNetwork:
 *     type: azure:network:VirtualNetwork
 *     name: example
 *     properties:
 *       name: examplevnet
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       addressSpaces:
 *         - 10.1.0.0/16
 *   exampleSubnet:
 *     type: azure:network:Subnet
 *     name: example
 *     properties:
 *       name: examplesubnet
 *       resourceGroupName: ${example.name}
 *       virtualNetworkName: ${exampleVirtualNetwork.name}
 *       addressPrefixes:
 *         - 10.1.0.0/24
 *       delegations:
 *         - name: delegation
 *           serviceDelegation:
 *             name: Microsoft.ContainerInstance/containerGroups
 *             actions:
 *               - Microsoft.Network/virtualNetworks/subnets/action
 *   exampleProfile:
 *     type: azure:network:Profile
 *     name: example
 *     properties:
 *       name: examplenetprofile
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       containerNetworkInterface:
 *         name: examplecnic
 *         ipConfigurations:
 *           - name: exampleipconfig
 *             subnetId: ${exampleSubnet.id}
 * ```
 * 
 * ## Import
 * Network Profile can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/profile:Profile example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/networkProfiles/examplenetprofile
 * ```
 */
public class Profile internal constructor(
    override val javaResource: com.pulumi.azure.network.Profile,
) : KotlinCustomResource(javaResource, ProfileMapper) {
    /**
     * A `container_network_interface` block as documented below.
     */
    public val containerNetworkInterface: Output
        get() = javaResource.containerNetworkInterface().applyValue({ args0 ->
            args0.let({ args0 ->
                toKotlin(args0)
            })
        })

    /**
     * A list of Container Network Interface IDs.
     */
    public val containerNetworkInterfaceIds: Output>
        get() = javaResource.containerNetworkInterfaceIds().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            })
        })

    /**
     * Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Network Profile. Changing this forces a new resource to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A mapping of tags assigned to the resource.
     */
    public val tags: Output>?
        get() = javaResource.tags().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.key.to(args0.value)
                }).toMap()
            }).orElse(null)
        })
}

public object ProfileMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.network.Profile::class == javaResource::class

    override fun map(javaResource: Resource): Profile = Profile(
        javaResource as
            com.pulumi.azure.network.Profile,
    )
}

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy