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

com.pulumi.azure.customip.kotlin.Prefix.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.15.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.azure.customip.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
import kotlin.collections.List
import kotlin.collections.Map

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

    public var args: PrefixArgs = PrefixArgs()

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

/**
 * Manages a custom IPv4 prefix or custom IPv6 prefix.
 * ## Example Usage
 * *IPv4 custom prefix*
 * 
 * ```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 examplePrefix = new azure.customip.Prefix("example", {
 *     name: "example-CustomIPPrefix",
 *     location: example.location,
 *     resourceGroupName: example.name,
 *     cidr: "1.2.3.4/22",
 *     zones: [
 *         "1",
 *         "2",
 *         "3",
 *     ],
 *     commissioningEnabled: true,
 *     roaValidityEndDate: "2099-12-12",
 *     wanValidationSignedMessage: "signed message for WAN validation",
 *     tags: {
 *         env: "test",
 *     },
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * example_prefix = azure.customip.Prefix("example",
 *     name="example-CustomIPPrefix",
 *     location=example.location,
 *     resource_group_name=example.name,
 *     cidr="1.2.3.4/22",
 *     zones=[
 *         "1",
 *         "2",
 *         "3",
 *     ],
 *     commissioning_enabled=True,
 *     roa_validity_end_date="2099-12-12",
 *     wan_validation_signed_message="signed message for WAN validation",
 *     tags={
 *         "env": "test",
 *     })
 * ```
 * ```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 examplePrefix = new Azure.CustomIp.Prefix("example", new()
 *     {
 *         Name = "example-CustomIPPrefix",
 *         Location = example.Location,
 *         ResourceGroupName = example.Name,
 *         Cidr = "1.2.3.4/22",
 *         Zones = new[]
 *         {
 *             "1",
 *             "2",
 *             "3",
 *         },
 *         CommissioningEnabled = true,
 *         RoaValidityEndDate = "2099-12-12",
 *         WanValidationSignedMessage = "signed message for WAN validation",
 *         Tags =
 *         {
 *             { "env", "test" },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/customip"
 * 	"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
 * 		}
 * 		_, err = customip.NewPrefix(ctx, "example", &customip.PrefixArgs{
 * 			Name:              pulumi.String("example-CustomIPPrefix"),
 * 			Location:          example.Location,
 * 			ResourceGroupName: example.Name,
 * 			Cidr:              pulumi.String("1.2.3.4/22"),
 * 			Zones: pulumi.StringArray{
 * 				pulumi.String("1"),
 * 				pulumi.String("2"),
 * 				pulumi.String("3"),
 * 			},
 * 			CommissioningEnabled:       pulumi.Bool(true),
 * 			RoaValidityEndDate:         pulumi.String("2099-12-12"),
 * 			WanValidationSignedMessage: pulumi.String("signed message for WAN validation"),
 * 			Tags: pulumi.StringMap{
 * 				"env": pulumi.String("test"),
 * 			},
 * 		})
 * 		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.customip.Prefix;
 * import com.pulumi.azure.customip.PrefixArgs;
 * 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());
 *         var examplePrefix = new Prefix("examplePrefix", PrefixArgs.builder()
 *             .name("example-CustomIPPrefix")
 *             .location(example.location())
 *             .resourceGroupName(example.name())
 *             .cidr("1.2.3.4/22")
 *             .zones(
 *                 "1",
 *                 "2",
 *                 "3")
 *             .commissioningEnabled(true)
 *             .roaValidityEndDate("2099-12-12")
 *             .wanValidationSignedMessage("signed message for WAN validation")
 *             .tags(Map.of("env", "test"))
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   examplePrefix:
 *     type: azure:customip:Prefix
 *     name: example
 *     properties:
 *       name: example-CustomIPPrefix
 *       location: ${example.location}
 *       resourceGroupName: ${example.name}
 *       cidr: 1.2.3.4/22
 *       zones:
 *         - '1'
 *         - '2'
 *         - '3'
 *       commissioningEnabled: true
 *       roaValidityEndDate: 2099-12-12
 *       wanValidationSignedMessage: signed message for WAN validation
 *       tags:
 *         env: test
 * ```
 * 
 * *IPv6 custom prefix*
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as azure from "@pulumi/azure";
 * import * as std from "@pulumi/std";
 * const example = new azure.core.ResourceGroup("example", {
 *     name: "example-resources",
 *     location: "West Europe",
 * });
 * const global = new azure.customip.Prefix("global", {
 *     name: "example-Global-CustomIPPrefix",
 *     location: test.location,
 *     resourceGroupName: test.name,
 *     cidr: "2001:db8:1::/48",
 *     roaValidityEndDate: "2199-12-12",
 *     wanValidationSignedMessage: "signed message for WAN validation",
 * });
 * const regional = new azure.customip.Prefix("regional", {
 *     name: "example-Regional-CustomIPPrefix",
 *     location: test.location,
 *     resourceGroupName: test.name,
 *     parentCustomIpPrefixId: global.id,
 *     cidr: global.cidr.apply(cidr => std.cidrsubnetOutput({
 *         input: cidr,
 *         newbits: 16,
 *         netnum: 1,
 *     })).apply(invoke => invoke.result),
 *     zones: ["1"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_azure as azure
 * import pulumi_std as std
 * example = azure.core.ResourceGroup("example",
 *     name="example-resources",
 *     location="West Europe")
 * global_ = azure.customip.Prefix("global",
 *     name="example-Global-CustomIPPrefix",
 *     location=test["location"],
 *     resource_group_name=test["name"],
 *     cidr="2001:db8:1::/48",
 *     roa_validity_end_date="2199-12-12",
 *     wan_validation_signed_message="signed message for WAN validation")
 * regional = azure.customip.Prefix("regional",
 *     name="example-Regional-CustomIPPrefix",
 *     location=test["location"],
 *     resource_group_name=test["name"],
 *     parent_custom_ip_prefix_id=global_.id,
 *     cidr=global_.cidr.apply(lambda cidr: std.cidrsubnet_output(input=cidr,
 *         newbits=16,
 *         netnum=1)).apply(lambda invoke: invoke.result),
 *     zones=["1"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Azure = Pulumi.Azure;
 * using Std = Pulumi.Std;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Azure.Core.ResourceGroup("example", new()
 *     {
 *         Name = "example-resources",
 *         Location = "West Europe",
 *     });
 *     var @global = new Azure.CustomIp.Prefix("global", new()
 *     {
 *         Name = "example-Global-CustomIPPrefix",
 *         Location = test.Location,
 *         ResourceGroupName = test.Name,
 *         Cidr = "2001:db8:1::/48",
 *         RoaValidityEndDate = "2199-12-12",
 *         WanValidationSignedMessage = "signed message for WAN validation",
 *     });
 *     var regional = new Azure.CustomIp.Prefix("regional", new()
 *     {
 *         Name = "example-Regional-CustomIPPrefix",
 *         Location = test.Location,
 *         ResourceGroupName = test.Name,
 *         ParentCustomIpPrefixId = @global.Id,
 *         Cidr = @global.Cidr.Apply(cidr => Std.Cidrsubnet.Invoke(new()
 *         {
 *             Input = cidr,
 *             Newbits = 16,
 *             Netnum = 1,
 *         })).Apply(invoke => invoke.Result),
 *         Zones = new[]
 *         {
 *             "1",
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
 * 	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/customip"
 * 	"github.com/pulumi/pulumi-std/sdk/go/std"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
 * 			Name:     pulumi.String("example-resources"),
 * 			Location: pulumi.String("West Europe"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		global, err := customip.NewPrefix(ctx, "global", &customip.PrefixArgs{
 * 			Name:                       pulumi.String("example-Global-CustomIPPrefix"),
 * 			Location:                   pulumi.Any(test.Location),
 * 			ResourceGroupName:          pulumi.Any(test.Name),
 * 			Cidr:                       pulumi.String("2001:db8:1::/48"),
 * 			RoaValidityEndDate:         pulumi.String("2199-12-12"),
 * 			WanValidationSignedMessage: pulumi.String("signed message for WAN validation"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = customip.NewPrefix(ctx, "regional", &customip.PrefixArgs{
 * 			Name:                   pulumi.String("example-Regional-CustomIPPrefix"),
 * 			Location:               pulumi.Any(test.Location),
 * 			ResourceGroupName:      pulumi.Any(test.Name),
 * 			ParentCustomIpPrefixId: global.ID(),
 * 			Cidr: global.Cidr.ApplyT(func(cidr string) (std.CidrsubnetResult, error) {
 * 				return std.CidrsubnetOutput(ctx, std.CidrsubnetOutputArgs{
 * 					Input:   cidr,
 * 					Newbits: 16,
 * 					Netnum:  1,
 * 				}, nil), nil
 * 			}).(std.CidrsubnetResultOutput).ApplyT(func(invoke std.CidrsubnetResult) (*string, error) {
 * 				return invoke.Result, nil
 * 			}).(pulumi.StringPtrOutput),
 * 			Zones: pulumi.StringArray{
 * 				pulumi.String("1"),
 * 			},
 * 		})
 * 		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.customip.Prefix;
 * import com.pulumi.azure.customip.PrefixArgs;
 * 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());
 *         var global = new Prefix("global", PrefixArgs.builder()
 *             .name("example-Global-CustomIPPrefix")
 *             .location(test.location())
 *             .resourceGroupName(test.name())
 *             .cidr("2001:db8:1::/48")
 *             .roaValidityEndDate("2199-12-12")
 *             .wanValidationSignedMessage("signed message for WAN validation")
 *             .build());
 *         var regional = new Prefix("regional", PrefixArgs.builder()
 *             .name("example-Regional-CustomIPPrefix")
 *             .location(test.location())
 *             .resourceGroupName(test.name())
 *             .parentCustomIpPrefixId(global.id())
 *             .cidr(global.cidr().applyValue(cidr -> StdFunctions.cidrsubnet()).applyValue(invoke -> invoke.result()))
 *             .zones("1")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: azure:core:ResourceGroup
 *     properties:
 *       name: example-resources
 *       location: West Europe
 *   global:
 *     type: azure:customip:Prefix
 *     properties:
 *       name: example-Global-CustomIPPrefix
 *       location: ${test.location}
 *       resourceGroupName: ${test.name}
 *       cidr: 2001:db8:1::/48
 *       roaValidityEndDate: 2199-12-12
 *       wanValidationSignedMessage: signed message for WAN validation
 *   regional:
 *     type: azure:customip:Prefix
 *     properties:
 *       name: example-Regional-CustomIPPrefix
 *       location: ${test.location}
 *       resourceGroupName: ${test.name}
 *       parentCustomIpPrefixId: ${global.id}
 *       cidr:
 *         fn::invoke:
 *           Function: std:cidrsubnet
 *           Arguments:
 *             input: ${global.cidr}
 *             newbits: 16
 *             netnum: 1
 *           Return: result
 *       zones:
 *         - '1'
 * ```
 * 
 * ## Import
 * A Custom IP Prefix can be imported using the `resource id`, e.g.
 * ```sh
 * $ pulumi import azure:customip/prefix:Prefix example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/customIPPrefixes/customIPPrefix1
 * ```
 */
public class Prefix internal constructor(
    override val javaResource: com.pulumi.azure.customip.Prefix,
) : KotlinCustomResource(javaResource, PrefixMapper) {
    /**
     * The `cidr` of the Custom IP Prefix, either IPv4 or IPv6. Changing this forces a new resource to be created.
     */
    public val cidr: Output
        get() = javaResource.cidr().applyValue({ args0 -> args0 })

    /**
     * Specifies that the custom IP prefix should be commissioned after provisioning in Azure. Defaults to `false`.
     * !> **Warning** Changing the value of `commissioning_enabled` from `true` to `false` causes the IP prefix to stop being advertised by Azure and is functionally equivalent to deleting it when used in a production setting.
     */
    public val commissioningEnabled: Output?
        get() = javaResource.commissioningEnabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies that the custom IP prefix should not be publicly advertised on the Internet when commissioned (regional commissioning feature). Defaults to `false`.
     * !> **Warning** Changing the value of `internet_advertising_disabled` from `true` to `false` causes the IP prefix to stop being advertised by Azure and is functionally equivalent to deleting it when used in a production setting.
     */
    public val internetAdvertisingDisabled: Output?
        get() = javaResource.internetAdvertisingDisabled().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * The location where the Custom IP Prefix should exist. Changing this forces a new resource to be created.
     */
    public val location: Output
        get() = javaResource.location().applyValue({ args0 -> args0 })

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

    /**
     * Specifies the ID of the parent prefix. Only needed when creating a regional/child IPv6 prefix. Changing this forces a new resource to be created.
     */
    public val parentCustomIpPrefixId: Output?
        get() = javaResource.parentCustomIpPrefixId().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The expiration date of the Route Origin Authorization (ROA) document which has been filed with the Routing Internet Registry (RIR) for this prefix. The expected format is `YYYY-MM-DD`. Required when provisioning an IPv4 prefix or IPv6 global prefix. Changing this forces a new resource to be created.
     */
    public val roaValidityEndDate: Output?
        get() = javaResource.roaValidityEndDate().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * The signed base64-encoded authorization message, which will be sent to Microsoft for WAN verification. Required when provisioning an IPv4 prefix or IPv6 global prefix. Refer to [Azure documentation](https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/create-custom-ip-address-prefix-cli#certificate-readiness) for more details about the process for your RIR. Changing this forces a new resource to be created.
     */
    public val wanValidationSignedMessage: Output?
        get() = javaResource.wanValidationSignedMessage().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Specifies a list of Availability Zones in which this Custom IP Prefix should be located. Should not be specified when creating an IPv6 global prefix. Changing this forces a new resource to be created.
     * > **Note:** In regions with [availability zones](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview), the Custom IP Prefix must be specified as either `Zone-redundant` or assigned to a specific zone. It can't be created with no zone specified in these regions. All IPs from the prefix must have the same zonal properties.
     */
    public val zones: Output>?
        get() = javaResource.zones().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })
}

public object PrefixMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.azure.customip.Prefix::class == javaResource::class

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy