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

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

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

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.kotlin.outputs.NetworkManagerCrossTenantScope
import com.pulumi.azure.network.kotlin.outputs.NetworkManagerScope
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
import com.pulumi.azure.network.kotlin.outputs.NetworkManagerCrossTenantScope.Companion.toKotlin as networkManagerCrossTenantScopeToKotlin
import com.pulumi.azure.network.kotlin.outputs.NetworkManagerScope.Companion.toKotlin as networkManagerScopeToKotlin

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

    public var args: NetworkManagerArgs = NetworkManagerArgs()

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

/**
 * Manages a Network Managers.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const current = azure.core.getSubscription({});
 * const exampleNetworkManager = new azure.network.NetworkManager("example", {
 *     name: "example-network-manager",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     scope: {
 *         subscriptionIds: [current.then(current => current.id)],
 *     },
 *     scopeAccesses: [
 *         "Connectivity",
 *         "SecurityAdmin",
 *     ],
 *     description: "example network manager",
 *     tags: {
 *         foo: "bar",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * current = azure.core.get_subscription()
 * example_network_manager = azure.network.NetworkManager("example",
 *     name="example-network-manager",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     scope={
 *         "subscription_ids": [current.id],
 *     },
 *     scope_accesses=[
 *         "Connectivity",
 *         "SecurityAdmin",
 *     ],
 *     description="example network manager",
 *     tags={
 *         "foo": "bar",
 *     })
 * ```
 * ```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 = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var current = Azure.Core.GetSubscription.Invoke();
 *     var exampleNetworkManager = new Azure.Network.NetworkManager("example", new()
 *     {
 *         Name = "example-network-manager",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Scope = new Azure.Network.Inputs.NetworkManagerScopeArgs
 *         {
 *             SubscriptionIds = new[]
 *             {
 *                 current.Apply(getSubscriptionResult => getSubscriptionResult.Id),
 *             },
 *         },
 *         ScopeAccesses = new[]
 *         {
 *             "Connectivity",
 *             "SecurityAdmin",
 *         },
 *         Description = "example network manager",
 *         Tags =
 *         {
 *             { "foo", "bar" },
 *         },
 *     });
 * });
 * ```
 * ```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("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		current, err := core.LookupSubscription(ctx, nil, nil)
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewNetworkManager(ctx, "example", &network.NetworkManagerArgs{
 * 			Name:              pulumi.String("example-network-manager"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Scope: &network.NetworkManagerScopeArgs{
 * 				SubscriptionIds: pulumi.StringArray{
 * 					pulumi.String(current.Id),
 * 				},
 * 			},
 * 			ScopeAccesses: pulumi.StringArray{
 * 				pulumi.String("Connectivity"),
 * 				pulumi.String("SecurityAdmin"),
 * 			},
 * 			Description: pulumi.String("example network manager"),
 * 			Tags: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 		})
 * 		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.core.CoreFunctions;
 * import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
 * import com.pulumi.azure.network.NetworkManager;
 * import com.pulumi.azure.network.NetworkManagerArgs;
 * import com.pulumi.azure.network.inputs.NetworkManagerScopeArgs;
 * 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("example-resources")
 *             .location("West Europe")
 *             .build());
 *         final var current = CoreFunctions.getSubscription();
 *         var exampleNetworkManager = new NetworkManager("exampleNetworkManager", NetworkManagerArgs.builder()
 *             .name("example-network-manager")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .scope(NetworkManagerScopeArgs.builder()
 *                 .subscriptionIds(current.applyValue(getSubscriptionResult -> getSubscriptionResult.id()))
 *                 .build())
 *             .scopeAccesses(
 *                 "Connectivity",
 *                 "SecurityAdmin")
 *             .description("example network manager")
 *             .tags(Map.of("foo", "bar"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   exampleNetworkManager:
 *     type: azure:network:NetworkManager
 *     name: example
 *     properties:
 *       name: example-network-manager
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       scope:
 *         subscriptionIds:
 *           - ${current.id}
 *       scopeAccesses:
 *         - Connectivity
 *         - SecurityAdmin
 *       description: example network manager
 *       tags:
 *         foo: bar
 * variables:
 *   current:
 *     fn::invoke:
 *       Function: azure:core:getSubscription
 *       Arguments: {}
 * ```
 * 
 * ## Import
 * Network Managers can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/networkManager:NetworkManager example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.Network/networkManagers/networkManager1
 * ```
 */
public class NetworkManager internal constructor(
    override val javaResource: com.pulumi.azure.network.NetworkManager,
) : KotlinCustomResource(javaResource, NetworkManagerMapper) {
    /**
     * One or more `cross_tenant_scopes` blocks as defined below.
     */
    public val crossTenantScopes: Output>
        get() = javaResource.crossTenantScopes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 -> networkManagerCrossTenantScopeToKotlin(args0) })
            })
        })

    /**
     * A description of the network manager.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * Specifies the name which should be used for this Network Managers. Changing this forces a new Network Managers to be created.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Specifies the name of the Resource Group where the Network Managers should exist. Changing this forces a new Network Managers to be created.
     */
    public val resourceGroupName: Output
        get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })

    /**
     * A `scope` block as defined below.
     */
    public val scope: Output
        get() = javaResource.scope().applyValue({ args0 ->
            args0.let({ args0 ->
                networkManagerScopeToKotlin(args0)
            })
        })

    /**
     * A list of configuration deployment type. Possible values are `Connectivity` and `SecurityAdmin`, corresponds to if Connectivity Configuration and Security Admin Configuration is allowed for the Network Manager.
     */
    public val scopeAccesses: Output>
        get() = javaResource.scopeAccesses().applyValue({ args0 -> args0.map({ args0 -> args0 }) })

    /**
     * A mapping of tags which should be assigned to the Network Managers.
     */
    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 NetworkManagerMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.network.NetworkManager::class == javaResource::class

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy