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

com.pulumi.azurenative.cdn.kotlin.TunnelPolicy.kt Maven / Gradle / Ivy

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

package com.pulumi.azurenative.cdn.kotlin

import com.pulumi.azurenative.cdn.kotlin.outputs.ActivatedResourceReferenceResponse
import com.pulumi.azurenative.cdn.kotlin.outputs.ResourceReferenceResponse
import com.pulumi.azurenative.cdn.kotlin.outputs.SystemDataResponse
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 com.pulumi.azurenative.cdn.kotlin.outputs.ActivatedResourceReferenceResponse.Companion.toKotlin as activatedResourceReferenceResponseToKotlin
import com.pulumi.azurenative.cdn.kotlin.outputs.ResourceReferenceResponse.Companion.toKotlin as resourceReferenceResponseToKotlin
import com.pulumi.azurenative.cdn.kotlin.outputs.SystemDataResponse.Companion.toKotlin as systemDataResponseToKotlin

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

    public var args: TunnelPolicyArgs = TunnelPolicyArgs()

    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 TunnelPolicyArgsBuilder.() -> Unit) {
        val builder = TunnelPolicyArgsBuilder()
        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(): TunnelPolicy {
        val builtJavaResource = com.pulumi.azurenative.cdn.TunnelPolicy(
            this.name,
            this.args.toJava(),
            this.opts.toJava(),
        )
        return TunnelPolicy(builtJavaResource)
    }
}

/**
 * Tunnel Policy maps domains to target endpoints to process traffic over the tunnelling protocol.
 * Azure REST API version: 2024-06-01-preview.
 * ## Example Usage
 * ### TunnelPolicies_Create
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using AzureNative = Pulumi.AzureNative;
 * return await Deployment.RunAsync(() =>
 * {
 *     var tunnelPolicy = new AzureNative.Cdn.TunnelPolicy("tunnelPolicy", new()
 *     {
 *         Domains = new[]
 *         {
 *             new AzureNative.Cdn.Inputs.ActivatedResourceReferenceArgs
 *             {
 *                 Id = "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain1",
 *             },
 *             new AzureNative.Cdn.Inputs.ActivatedResourceReferenceArgs
 *             {
 *                 Id = "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain2",
 *             },
 *         },
 *         ProfileName = "profile1",
 *         ResourceGroupName = "RG",
 *         TargetGroups = new[]
 *         {
 *             new AzureNative.Cdn.Inputs.ResourceReferenceArgs
 *             {
 *                 Id = "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup1",
 *             },
 *             new AzureNative.Cdn.Inputs.ResourceReferenceArgs
 *             {
 *                 Id = "/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup2",
 *             },
 *         },
 *         TunnelPolicyName = "tunnelPolicy1",
 *         TunnelType = AzureNative.Cdn.TunnelType.HttpConnect,
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	cdn "github.com/pulumi/pulumi-azure-native-sdk/cdn/v2"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cdn.NewTunnelPolicy(ctx, "tunnelPolicy", &cdn.TunnelPolicyArgs{
 * 			Domains: cdn.ActivatedResourceReferenceArray{
 * 				&cdn.ActivatedResourceReferenceArgs{
 * 					Id: pulumi.String("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain1"),
 * 				},
 * 				&cdn.ActivatedResourceReferenceArgs{
 * 					Id: pulumi.String("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain2"),
 * 				},
 * 			},
 * 			ProfileName:       pulumi.String("profile1"),
 * 			ResourceGroupName: pulumi.String("RG"),
 * 			TargetGroups: cdn.ResourceReferenceArray{
 * 				&cdn.ResourceReferenceArgs{
 * 					Id: pulumi.String("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup1"),
 * 				},
 * 				&cdn.ResourceReferenceArgs{
 * 					Id: pulumi.String("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup2"),
 * 				},
 * 			},
 * 			TunnelPolicyName: pulumi.String("tunnelPolicy1"),
 * 			TunnelType:       pulumi.String(cdn.TunnelTypeHttpConnect),
 * 		})
 * 		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.azurenative.cdn.TunnelPolicy;
 * import com.pulumi.azurenative.cdn.TunnelPolicyArgs;
 * import com.pulumi.azurenative.cdn.inputs.ActivatedResourceReferenceArgs;
 * import com.pulumi.azurenative.cdn.inputs.ResourceReferenceArgs;
 * 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 tunnelPolicy = new TunnelPolicy("tunnelPolicy", TunnelPolicyArgs.builder()
 *             .domains(
 *                 ActivatedResourceReferenceArgs.builder()
 *                     .id("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain1")
 *                     .build(),
 *                 ActivatedResourceReferenceArgs.builder()
 *                     .id("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/customdomains/testdomain2")
 *                     .build())
 *             .profileName("profile1")
 *             .resourceGroupName("RG")
 *             .targetGroups(
 *                 ResourceReferenceArgs.builder()
 *                     .id("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup1")
 *                     .build(),
 *                 ResourceReferenceArgs.builder()
 *                     .id("/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/targetgroups/targetgroup2")
 *                     .build())
 *             .tunnelPolicyName("tunnelPolicy1")
 *             .tunnelType("HttpConnect")
 *             .build());
 *     }
 * }
 * ```
 * ## Import
 * An existing resource can be imported using its type token, name, and identifier, e.g.
 * ```sh
 * $ pulumi import azure-native:cdn:TunnelPolicy tunnelPolicy1 /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cdn/profiles/{profileName}/tunnelPolicies/{tunnelPolicyName}
 * ```
 */
public class TunnelPolicy internal constructor(
    override val javaResource: com.pulumi.azurenative.cdn.TunnelPolicy,
) : KotlinCustomResource(javaResource, TunnelPolicyMapper) {
    public val deploymentStatus: Output
        get() = javaResource.deploymentStatus().applyValue({ args0 -> args0 })

    /**
     * Domains referenced by this tunnel policy.
     */
    public val domains: Output>
        get() = javaResource.domains().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    activatedResourceReferenceResponseToKotlin(args0)
                })
            })
        })

    /**
     * Resource name.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    /**
     * Provisioning status
     */
    public val provisioningState: Output
        get() = javaResource.provisioningState().applyValue({ args0 -> args0 })

    /**
     * Read only system data
     */
    public val systemData: Output
        get() = javaResource.systemData().applyValue({ args0 ->
            args0.let({ args0 ->
                systemDataResponseToKotlin(args0)
            })
        })

    /**
     * Target Groups referenced by this tunnel policy.
     */
    public val targetGroups: Output>?
        get() = javaResource.targetGroups().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> resourceReferenceResponseToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Protocol this tunnel will use for allowing traffic to backends.
     */
    public val tunnelType: Output?
        get() = javaResource.tunnelType().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Resource type.
     */
    public val type: Output
        get() = javaResource.type().applyValue({ args0 -> args0 })
}

public object TunnelPolicyMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azurenative.cdn.TunnelPolicy::class == javaResource::class

    override fun map(javaResource: Resource): TunnelPolicy = TunnelPolicy(
        javaResource as
            com.pulumi.azurenative.cdn.TunnelPolicy,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy