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

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

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

package com.pulumi.azure.network.kotlin

import com.pulumi.azure.network.TrafficManagerProfileArgs.builder
import com.pulumi.azure.network.kotlin.inputs.TrafficManagerProfileDnsConfigArgs
import com.pulumi.azure.network.kotlin.inputs.TrafficManagerProfileDnsConfigArgsBuilder
import com.pulumi.azure.network.kotlin.inputs.TrafficManagerProfileMonitorConfigArgs
import com.pulumi.azure.network.kotlin.inputs.TrafficManagerProfileMonitorConfigArgsBuilder
import com.pulumi.core.Output
import com.pulumi.core.Output.of
import com.pulumi.kotlin.ConvertibleToJava
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.applySuspend
import kotlin.Boolean
import kotlin.Int
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.Map
import kotlin.jvm.JvmName

/**
 * Manages a Traffic Manager Profile to which multiple endpoints can be attached.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as random from "@pulumi/random";
 * const server = new random.RandomId("server", {
 *     keepers: {
 *         azi_id: "1",
 *     },
 *     byteLength: 8,
 * });
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "trafficmanagerProfile",
 *     location: "West Europe",
 * });
 * const exampleTrafficManagerProfile = new azure.network.TrafficManagerProfile("example", {
 *     name: server.hex,
 *     resourceGroupName: example.name,
 *     trafficRoutingMethod: "Weighted",
 *     dnsConfig: {
 *         relativeName: server.hex,
 *         ttl: 100,
 *     },
 *     monitorConfig: {
 *         protocol: "HTTP",
 *         port: 80,
 *         path: "/",
 *         intervalInSeconds: 30,
 *         timeoutInSeconds: 9,
 *         toleratedNumberOfFailures: 3,
 *     },
 *     tags: {
 *         environment: "Production",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_random as random
 * server = random.RandomId("server",
 *     keepers={
 *         "azi_id": "1",
 *     },
 *     byte_length=8)
 * example = azure.core.ResourceGroup("example",
 *     name="trafficmanagerProfile",
 *     location="West Europe")
 * example_traffic_manager_profile = azure.network.TrafficManagerProfile("example",
 *     name=server.hex,
 *     resource_group_name=example.name,
 *     traffic_routing_method="Weighted",
 *     dns_config={
 *         "relative_name": server.hex,
 *         "ttl": 100,
 *     },
 *     monitor_config={
 *         "protocol": "HTTP",
 *         "port": 80,
 *         "path": "/",
 *         "interval_in_seconds": 30,
 *         "timeout_in_seconds": 9,
 *         "tolerated_number_of_failures": 3,
 *     },
 *     tags={
 *         "environment": "Production",
 *     })
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Random = Pulumi.Random;
 * return await Deployment.RunAsync(() =>
 * {
 *     var server = new Random.RandomId("server", new()
 *     {
 *         Keepers =
 *         {
 *             { "azi_id", "1" },
 *         },
 *         ByteLength = 8,
 *     });
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "trafficmanagerProfile",
 *         Location = "West Europe",
 *     });
 *     var exampleTrafficManagerProfile = new Azure.Network.TrafficManagerProfile("example", new()
 *     {
 *         Name = server.Hex,
 *         ResourceGroupName = example.Name,
 *         TrafficRoutingMethod = "Weighted",
 *         DnsConfig = new Azure.Network.Inputs.TrafficManagerProfileDnsConfigArgs
 *         {
 *             RelativeName = server.Hex,
 *             Ttl = 100,
 *         },
 *         MonitorConfig = new Azure.Network.Inputs.TrafficManagerProfileMonitorConfigArgs
 *         {
 *             Protocol = "HTTP",
 *             Port = 80,
 *             Path = "/",
 *             IntervalInSeconds = 30,
 *             TimeoutInSeconds = 9,
 *             ToleratedNumberOfFailures = 3,
 *         },
 *         Tags =
 *         {
 *             { "environment", "Production" },
 *         },
 *     });
 * });
 * ```
 * ```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-random/sdk/v4/go/random"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		server, err := random.NewRandomId(ctx, "server", &random.RandomIdArgs{
 * 			Keepers: pulumi.StringMap{
 * 				"azi_id": pulumi.String("1"),
 * 			},
 * 			ByteLength: pulumi.Int(8),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("trafficmanagerProfile"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = network.NewTrafficManagerProfile(ctx, "example", &network.TrafficManagerProfileArgs{
 * 			Name:                 server.Hex,
 * 			ResourceGroupName:    example.Name,
 * 			TrafficRoutingMethod: pulumi.String("Weighted"),
 * 			DnsConfig: &network.TrafficManagerProfileDnsConfigArgs{
 * 				RelativeName: server.Hex,
 * 				Ttl:          pulumi.Int(100),
 * 			},
 * 			MonitorConfig: &network.TrafficManagerProfileMonitorConfigArgs{
 * 				Protocol:                  pulumi.String("HTTP"),
 * 				Port:                      pulumi.Int(80),
 * 				Path:                      pulumi.String("/"),
 * 				IntervalInSeconds:         pulumi.Int(30),
 * 				TimeoutInSeconds:          pulumi.Int(9),
 * 				ToleratedNumberOfFailures: pulumi.Int(3),
 * 			},
 * 			Tags: pulumi.StringMap{
 * 				"environment": pulumi.String("Production"),
 * 			},
 * 		})
 * 		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.random.RandomId;
 * import com.pulumi.random.RandomIdArgs;
 * import com.pulumi.azure.core.ResourceGroup;
 * import com.pulumi.azure.core.ResourceGroupArgs;
 * import com.pulumi.azure.network.TrafficManagerProfile;
 * import com.pulumi.azure.network.TrafficManagerProfileArgs;
 * import com.pulumi.azure.network.inputs.TrafficManagerProfileDnsConfigArgs;
 * import com.pulumi.azure.network.inputs.TrafficManagerProfileMonitorConfigArgs;
 * 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 server = new RandomId("server", RandomIdArgs.builder()
 *             .keepers(Map.of("azi_id", 1))
 *             .byteLength(8)
 *             .build());
 *         var example = new ResourceGroup("example", ResourceGroupArgs.builder()
 *             .name("trafficmanagerProfile")
 *             .location("West Europe")
 *             .build());
 *         var exampleTrafficManagerProfile = new TrafficManagerProfile("exampleTrafficManagerProfile", TrafficManagerProfileArgs.builder()
 *             .name(server.hex())
 *             .resourceGroupName(example.name())
 *             .trafficRoutingMethod("Weighted")
 *             .dnsConfig(TrafficManagerProfileDnsConfigArgs.builder()
 *                 .relativeName(server.hex())
 *                 .ttl(100)
 *                 .build())
 *             .monitorConfig(TrafficManagerProfileMonitorConfigArgs.builder()
 *                 .protocol("HTTP")
 *                 .port(80)
 *                 .path("/")
 *                 .intervalInSeconds(30)
 *                 .timeoutInSeconds(9)
 *                 .toleratedNumberOfFailures(3)
 *                 .build())
 *             .tags(Map.of("environment", "Production"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   server:
 *     type: random:RandomId
 *     properties:
 *       keepers:
 *         azi_id: 1
 *       byteLength: 8
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: trafficmanagerProfile
 *       location: West Europe
 *   exampleTrafficManagerProfile:
 *     type: azure:network:TrafficManagerProfile
 *     name: example
 *     properties:
 *       name: ${server.hex}
 *       resourceGroupName: ${example.name}
 *       trafficRoutingMethod: Weighted
 *       dnsConfig:
 *         relativeName: ${server.hex}
 *         ttl: 100
 *       monitorConfig:
 *         protocol: HTTP
 *         port: 80
 *         path: /
 *         intervalInSeconds: 30
 *         timeoutInSeconds: 9
 *         toleratedNumberOfFailures: 3
 *       tags:
 *         environment: Production
 * ```
 * 
 * ## Import
 * Traffic Manager Profiles can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:network/trafficManagerProfile:TrafficManagerProfile exampleProfile /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/trafficManagerProfiles/mytrafficmanagerprofile1
 * ```
 * @property dnsConfig This block specifies the DNS configuration of the Profile. One `dns_config` block as defined below.
 * @property maxReturn The amount of endpoints to return for DNS queries to this Profile. Possible values range from `1` to `8`.
 * > **NOTE:** `max_return` must be set when the `traffic_routing_method` is `MultiValue`.
 * @property monitorConfig This block specifies the Endpoint monitoring configuration for the Profile. One `monitor_config` block as defined below.
 * @property name The name of the Traffic Manager profile. Changing this forces a new resource to be created.
 * @property profileStatus The status of the profile, can be set to either `Enabled` or `Disabled`. Defaults to `Enabled`.
 * @property resourceGroupName The name of the resource group in which to create the Traffic Manager profile. Changing this forces a new resource to be created.
 * @property tags A mapping of tags to assign to the resource.
 * @property trafficRoutingMethod Specifies the algorithm used to route traffic. Possible values are `Geographic`, `Weighted`, `Performance`, `Priority`, `Subnet` and `MultiValue`.
 * * `Geographic` - Traffic is routed based on Geographic regions specified in the Endpoint.
 * * `MultiValue` - All healthy Endpoints are returned.  MultiValue routing method works only if all the endpoints of type `External` and are specified as IPv4 or IPv6 addresses.
 * * `Performance` - Traffic is routed via the User's closest Endpoint
 * * `Priority` - Traffic is routed to the Endpoint with the lowest `priority` value.
 * * `Subnet` - Traffic is routed based on a mapping of sets of end-user IP address ranges to a specific Endpoint within a Traffic Manager profile.
 * * `Weighted` - Traffic is spread across Endpoints proportional to their `weight` value.
 * @property trafficViewEnabled Indicates whether Traffic View is enabled for the Traffic Manager profile.
 */
public data class TrafficManagerProfileArgs(
    public val dnsConfig: Output? = null,
    public val maxReturn: Output? = null,
    public val monitorConfig: Output? = null,
    public val name: Output? = null,
    public val profileStatus: Output? = null,
    public val resourceGroupName: Output? = null,
    public val tags: Output>? = null,
    public val trafficRoutingMethod: Output? = null,
    public val trafficViewEnabled: Output? = null,
) : ConvertibleToJava {
    override fun toJava(): com.pulumi.azure.network.TrafficManagerProfileArgs =
        com.pulumi.azure.network.TrafficManagerProfileArgs.builder()
            .dnsConfig(dnsConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .maxReturn(maxReturn?.applyValue({ args0 -> args0 }))
            .monitorConfig(monitorConfig?.applyValue({ args0 -> args0.let({ args0 -> args0.toJava() }) }))
            .name(name?.applyValue({ args0 -> args0 }))
            .profileStatus(profileStatus?.applyValue({ args0 -> args0 }))
            .resourceGroupName(resourceGroupName?.applyValue({ args0 -> args0 }))
            .tags(tags?.applyValue({ args0 -> args0.map({ args0 -> args0.key.to(args0.value) }).toMap() }))
            .trafficRoutingMethod(trafficRoutingMethod?.applyValue({ args0 -> args0 }))
            .trafficViewEnabled(trafficViewEnabled?.applyValue({ args0 -> args0 })).build()
}

/**
 * Builder for [TrafficManagerProfileArgs].
 */
@PulumiTagMarker
public class TrafficManagerProfileArgsBuilder internal constructor() {
    private var dnsConfig: Output? = null

    private var maxReturn: Output? = null

    private var monitorConfig: Output? = null

    private var name: Output? = null

    private var profileStatus: Output? = null

    private var resourceGroupName: Output? = null

    private var tags: Output>? = null

    private var trafficRoutingMethod: Output? = null

    private var trafficViewEnabled: Output? = null

    /**
     * @param value This block specifies the DNS configuration of the Profile. One `dns_config` block as defined below.
     */
    @JvmName("mnnwoihmnceasvfj")
    public suspend fun dnsConfig(`value`: Output) {
        this.dnsConfig = value
    }

    /**
     * @param value The amount of endpoints to return for DNS queries to this Profile. Possible values range from `1` to `8`.
     * > **NOTE:** `max_return` must be set when the `traffic_routing_method` is `MultiValue`.
     */
    @JvmName("ugjteyqoxhraaswf")
    public suspend fun maxReturn(`value`: Output) {
        this.maxReturn = value
    }

    /**
     * @param value This block specifies the Endpoint monitoring configuration for the Profile. One `monitor_config` block as defined below.
     */
    @JvmName("qvxcaarviaaxnpqe")
    public suspend fun monitorConfig(`value`: Output) {
        this.monitorConfig = value
    }

    /**
     * @param value The name of the Traffic Manager profile. Changing this forces a new resource to be created.
     */
    @JvmName("lcimyspmeploysxr")
    public suspend fun name(`value`: Output) {
        this.name = value
    }

    /**
     * @param value The status of the profile, can be set to either `Enabled` or `Disabled`. Defaults to `Enabled`.
     */
    @JvmName("afcfedvfrmcafjwb")
    public suspend fun profileStatus(`value`: Output) {
        this.profileStatus = value
    }

    /**
     * @param value The name of the resource group in which to create the Traffic Manager profile. Changing this forces a new resource to be created.
     */
    @JvmName("ymxntfqrogargsux")
    public suspend fun resourceGroupName(`value`: Output) {
        this.resourceGroupName = value
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("txgkrcnlnjydmqcb")
    public suspend fun tags(`value`: Output>) {
        this.tags = value
    }

    /**
     * @param value Specifies the algorithm used to route traffic. Possible values are `Geographic`, `Weighted`, `Performance`, `Priority`, `Subnet` and `MultiValue`.
     * * `Geographic` - Traffic is routed based on Geographic regions specified in the Endpoint.
     * * `MultiValue` - All healthy Endpoints are returned.  MultiValue routing method works only if all the endpoints of type `External` and are specified as IPv4 or IPv6 addresses.
     * * `Performance` - Traffic is routed via the User's closest Endpoint
     * * `Priority` - Traffic is routed to the Endpoint with the lowest `priority` value.
     * * `Subnet` - Traffic is routed based on a mapping of sets of end-user IP address ranges to a specific Endpoint within a Traffic Manager profile.
     * * `Weighted` - Traffic is spread across Endpoints proportional to their `weight` value.
     */
    @JvmName("cuktaiabmmodcgfp")
    public suspend fun trafficRoutingMethod(`value`: Output) {
        this.trafficRoutingMethod = value
    }

    /**
     * @param value Indicates whether Traffic View is enabled for the Traffic Manager profile.
     */
    @JvmName("cpwngwhlectpmagu")
    public suspend fun trafficViewEnabled(`value`: Output) {
        this.trafficViewEnabled = value
    }

    /**
     * @param value This block specifies the DNS configuration of the Profile. One `dns_config` block as defined below.
     */
    @JvmName("kceyyxorwvlcpulr")
    public suspend fun dnsConfig(`value`: TrafficManagerProfileDnsConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.dnsConfig = mapped
    }

    /**
     * @param argument This block specifies the DNS configuration of the Profile. One `dns_config` block as defined below.
     */
    @JvmName("xvxxrnvtpbktqseg")
    public suspend fun dnsConfig(argument: suspend TrafficManagerProfileDnsConfigArgsBuilder.() -> Unit) {
        val toBeMapped = TrafficManagerProfileDnsConfigArgsBuilder().applySuspend { argument() }.build()
        val mapped = of(toBeMapped)
        this.dnsConfig = mapped
    }

    /**
     * @param value The amount of endpoints to return for DNS queries to this Profile. Possible values range from `1` to `8`.
     * > **NOTE:** `max_return` must be set when the `traffic_routing_method` is `MultiValue`.
     */
    @JvmName("ysitfwaqskulqebs")
    public suspend fun maxReturn(`value`: Int?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.maxReturn = mapped
    }

    /**
     * @param value This block specifies the Endpoint monitoring configuration for the Profile. One `monitor_config` block as defined below.
     */
    @JvmName("okqkrvsfljhfsqin")
    public suspend fun monitorConfig(`value`: TrafficManagerProfileMonitorConfigArgs?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.monitorConfig = mapped
    }

    /**
     * @param argument This block specifies the Endpoint monitoring configuration for the Profile. One `monitor_config` block as defined below.
     */
    @JvmName("drosftbdfbkkpqtj")
    public suspend fun monitorConfig(argument: suspend TrafficManagerProfileMonitorConfigArgsBuilder.() -> Unit) {
        val toBeMapped = TrafficManagerProfileMonitorConfigArgsBuilder().applySuspend {
            argument()
        }.build()
        val mapped = of(toBeMapped)
        this.monitorConfig = mapped
    }

    /**
     * @param value The name of the Traffic Manager profile. Changing this forces a new resource to be created.
     */
    @JvmName("iibivrqgkgvsatao")
    public suspend fun name(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.name = mapped
    }

    /**
     * @param value The status of the profile, can be set to either `Enabled` or `Disabled`. Defaults to `Enabled`.
     */
    @JvmName("wykmpldefajbqbtm")
    public suspend fun profileStatus(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.profileStatus = mapped
    }

    /**
     * @param value The name of the resource group in which to create the Traffic Manager profile. Changing this forces a new resource to be created.
     */
    @JvmName("pcombtbfueecbmii")
    public suspend fun resourceGroupName(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.resourceGroupName = mapped
    }

    /**
     * @param value A mapping of tags to assign to the resource.
     */
    @JvmName("akrqscfipgbplxgd")
    public suspend fun tags(`value`: Map?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param values A mapping of tags to assign to the resource.
     */
    @JvmName("bkkbmtlrysyjonsr")
    public fun tags(vararg values: Pair) {
        val toBeMapped = values.toMap()
        val mapped = toBeMapped.let({ args0 -> of(args0) })
        this.tags = mapped
    }

    /**
     * @param value Specifies the algorithm used to route traffic. Possible values are `Geographic`, `Weighted`, `Performance`, `Priority`, `Subnet` and `MultiValue`.
     * * `Geographic` - Traffic is routed based on Geographic regions specified in the Endpoint.
     * * `MultiValue` - All healthy Endpoints are returned.  MultiValue routing method works only if all the endpoints of type `External` and are specified as IPv4 or IPv6 addresses.
     * * `Performance` - Traffic is routed via the User's closest Endpoint
     * * `Priority` - Traffic is routed to the Endpoint with the lowest `priority` value.
     * * `Subnet` - Traffic is routed based on a mapping of sets of end-user IP address ranges to a specific Endpoint within a Traffic Manager profile.
     * * `Weighted` - Traffic is spread across Endpoints proportional to their `weight` value.
     */
    @JvmName("pdtstgadhrhdpkni")
    public suspend fun trafficRoutingMethod(`value`: String?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.trafficRoutingMethod = mapped
    }

    /**
     * @param value Indicates whether Traffic View is enabled for the Traffic Manager profile.
     */
    @JvmName("npfdluamdmwuqrvq")
    public suspend fun trafficViewEnabled(`value`: Boolean?) {
        val toBeMapped = value
        val mapped = toBeMapped?.let({ args0 -> of(args0) })
        this.trafficViewEnabled = mapped
    }

    internal fun build(): TrafficManagerProfileArgs = TrafficManagerProfileArgs(
        dnsConfig = dnsConfig,
        maxReturn = maxReturn,
        monitorConfig = monitorConfig,
        name = name,
        profileStatus = profileStatus,
        resourceGroupName = resourceGroupName,
        tags = tags,
        trafficRoutingMethod = trafficRoutingMethod,
        trafficViewEnabled = trafficViewEnabled,
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy