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

com.pulumi.cloudflare.kotlin.AddressMap.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: 5.40.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.cloudflare.kotlin

import com.pulumi.cloudflare.kotlin.outputs.AddressMapIp
import com.pulumi.cloudflare.kotlin.outputs.AddressMapMembership
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.cloudflare.kotlin.outputs.AddressMapIp.Companion.toKotlin as addressMapIpToKotlin
import com.pulumi.cloudflare.kotlin.outputs.AddressMapMembership.Companion.toKotlin as addressMapMembershipToKotlin

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

    public var args: AddressMapArgs = AddressMapArgs()

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

/**
 * Provides the ability to manage IP addresses that can be used by DNS records when
 * they are proxied through Cloudflare.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const example = new cloudflare.AddressMap("example", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     description: "My address map",
 *     defaultSni: "*.example.com",
 *     enabled: true,
 *     ips: [
 *         {
 *             ip: "192.0.2.1",
 *         },
 *         {
 *             ip: "203.0.113.1",
 *         },
 *     ],
 *     memberships: [
 *         {
 *             identifier: "92f17202ed8bd63d69a66b86a49a8f6b",
 *             kind: "account",
 *         },
 *         {
 *             identifier: "023e105f4ecef8ad9ca31a8372d0c353",
 *             kind: "zone",
 *         },
 *     ],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * example = cloudflare.AddressMap("example",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     description="My address map",
 *     default_sni="*.example.com",
 *     enabled=True,
 *     ips=[
 *         {
 *             "ip": "192.0.2.1",
 *         },
 *         {
 *             "ip": "203.0.113.1",
 *         },
 *     ],
 *     memberships=[
 *         {
 *             "identifier": "92f17202ed8bd63d69a66b86a49a8f6b",
 *             "kind": "account",
 *         },
 *         {
 *             "identifier": "023e105f4ecef8ad9ca31a8372d0c353",
 *             "kind": "zone",
 *         },
 *     ])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Cloudflare.AddressMap("example", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Description = "My address map",
 *         DefaultSni = "*.example.com",
 *         Enabled = true,
 *         Ips = new[]
 *         {
 *             new Cloudflare.Inputs.AddressMapIpArgs
 *             {
 *                 Ip = "192.0.2.1",
 *             },
 *             new Cloudflare.Inputs.AddressMapIpArgs
 *             {
 *                 Ip = "203.0.113.1",
 *             },
 *         },
 *         Memberships = new[]
 *         {
 *             new Cloudflare.Inputs.AddressMapMembershipArgs
 *             {
 *                 Identifier = "92f17202ed8bd63d69a66b86a49a8f6b",
 *                 Kind = "account",
 *             },
 *             new Cloudflare.Inputs.AddressMapMembershipArgs
 *             {
 *                 Identifier = "023e105f4ecef8ad9ca31a8372d0c353",
 *                 Kind = "zone",
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		_, err := cloudflare.NewAddressMap(ctx, "example", &cloudflare.AddressMapArgs{
 * 			AccountId:   pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Description: pulumi.String("My address map"),
 * 			DefaultSni:  pulumi.String("*.example.com"),
 * 			Enabled:     pulumi.Bool(true),
 * 			Ips: cloudflare.AddressMapIpArray{
 * 				&cloudflare.AddressMapIpArgs{
 * 					Ip: pulumi.String("192.0.2.1"),
 * 				},
 * 				&cloudflare.AddressMapIpArgs{
 * 					Ip: pulumi.String("203.0.113.1"),
 * 				},
 * 			},
 * 			Memberships: cloudflare.AddressMapMembershipArray{
 * 				&cloudflare.AddressMapMembershipArgs{
 * 					Identifier: pulumi.String("92f17202ed8bd63d69a66b86a49a8f6b"),
 * 					Kind:       pulumi.String("account"),
 * 				},
 * 				&cloudflare.AddressMapMembershipArgs{
 * 					Identifier: pulumi.String("023e105f4ecef8ad9ca31a8372d0c353"),
 * 					Kind:       pulumi.String("zone"),
 * 				},
 * 			},
 * 		})
 * 		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.cloudflare.AddressMap;
 * import com.pulumi.cloudflare.AddressMapArgs;
 * import com.pulumi.cloudflare.inputs.AddressMapIpArgs;
 * import com.pulumi.cloudflare.inputs.AddressMapMembershipArgs;
 * 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 AddressMap("example", AddressMapArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .description("My address map")
 *             .defaultSni("*.example.com")
 *             .enabled(true)
 *             .ips(
 *                 AddressMapIpArgs.builder()
 *                     .ip("192.0.2.1")
 *                     .build(),
 *                 AddressMapIpArgs.builder()
 *                     .ip("203.0.113.1")
 *                     .build())
 *             .memberships(
 *                 AddressMapMembershipArgs.builder()
 *                     .identifier("92f17202ed8bd63d69a66b86a49a8f6b")
 *                     .kind("account")
 *                     .build(),
 *                 AddressMapMembershipArgs.builder()
 *                     .identifier("023e105f4ecef8ad9ca31a8372d0c353")
 *                     .kind("zone")
 *                     .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: cloudflare:AddressMap
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       description: My address map
 *       defaultSni: '*.example.com'
 *       enabled: true
 *       ips:
 *         - ip: 192.0.2.1
 *         - ip: 203.0.113.1
 *       memberships:
 *         - identifier: 92f17202ed8bd63d69a66b86a49a8f6b
 *           kind: account
 *         - identifier: 023e105f4ecef8ad9ca31a8372d0c353
 *           kind: zone
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/addressMap:AddressMap example /
 * ```
 */
public class AddressMap internal constructor(
    override val javaResource: com.pulumi.cloudflare.AddressMap,
) : KotlinCustomResource(javaResource, AddressMapMapper) {
    /**
     * The account identifier to target for the resource.
     */
    public val accountId: Output
        get() = javaResource.accountId().applyValue({ args0 -> args0 })

    /**
     * If set to false, then the Address Map cannot be deleted via API. This is true for Cloudflare-managed maps.
     */
    public val canDelete: Output
        get() = javaResource.canDelete().applyValue({ args0 -> args0 })

    /**
     * If set to false, then the IPs on the Address Map cannot be modified via the API. This is true for Cloudflare-managed maps.
     */
    public val canModifyIps: Output
        get() = javaResource.canModifyIps().applyValue({ args0 -> args0 })

    /**
     * If you have legacy TLS clients which do not send the TLS server name indicator, then you can specify one default SNI on the map.
     */
    public val defaultSni: Output?
        get() = javaResource.defaultSni().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

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

    /**
     * Whether the Address Map is enabled or not.
     */
    public val enabled: Output
        get() = javaResource.enabled().applyValue({ args0 -> args0 })

    /**
     * The set of IPs on the Address Map.
     */
    public val ips: Output>?
        get() = javaResource.ips().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> addressMapIpToKotlin(args0) })
                })
            }).orElse(null)
        })

    /**
     * Zones and Accounts which will be assigned IPs on this Address Map.
     */
    public val memberships: Output>?
        get() = javaResource.memberships().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0.let({ args0 -> addressMapMembershipToKotlin(args0) })
                })
            }).orElse(null)
        })
}

public object AddressMapMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.cloudflare.AddressMap::class == javaResource::class

    override fun map(javaResource: Resource): AddressMap = AddressMap(
        javaResource as
            com.pulumi.cloudflare.AddressMap,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy