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

com.pulumi.cloudflare.kotlin.StaticRoute.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.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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List

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

    public var args: StaticRouteArgs = StaticRouteArgs()

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

/**
 * Provides a resource, that manages Cloudflare static routes for Magic
 * Transit or Magic WAN. Static routes are used to route traffic
 * through GRE tunnels.
 * ## Example Usage
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as cloudflare from "@pulumi/cloudflare";
 * const example = new cloudflare.StaticRoute("example", {
 *     accountId: "f037e56e89293a057740de681ac9abbe",
 *     description: "New route for new prefix 192.0.2.0/24",
 *     prefix: "192.0.2.0/24",
 *     nexthop: "10.0.0.0",
 *     priority: 100,
 *     weight: 10,
 *     coloNames: ["den01"],
 *     coloRegions: ["APAC"],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_cloudflare as cloudflare
 * example = cloudflare.StaticRoute("example",
 *     account_id="f037e56e89293a057740de681ac9abbe",
 *     description="New route for new prefix 192.0.2.0/24",
 *     prefix="192.0.2.0/24",
 *     nexthop="10.0.0.0",
 *     priority=100,
 *     weight=10,
 *     colo_names=["den01"],
 *     colo_regions=["APAC"])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Cloudflare = Pulumi.Cloudflare;
 * return await Deployment.RunAsync(() =>
 * {
 *     var example = new Cloudflare.StaticRoute("example", new()
 *     {
 *         AccountId = "f037e56e89293a057740de681ac9abbe",
 *         Description = "New route for new prefix 192.0.2.0/24",
 *         Prefix = "192.0.2.0/24",
 *         Nexthop = "10.0.0.0",
 *         Priority = 100,
 *         Weight = 10,
 *         ColoNames = new[]
 *         {
 *             "den01",
 *         },
 *         ColoRegions = new[]
 *         {
 *             "APAC",
 *         },
 *     });
 * });
 * ```
 * ```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.NewStaticRoute(ctx, "example", &cloudflare.StaticRouteArgs{
 * 			AccountId:   pulumi.String("f037e56e89293a057740de681ac9abbe"),
 * 			Description: pulumi.String("New route for new prefix 192.0.2.0/24"),
 * 			Prefix:      pulumi.String("192.0.2.0/24"),
 * 			Nexthop:     pulumi.String("10.0.0.0"),
 * 			Priority:    pulumi.Int(100),
 * 			Weight:      pulumi.Int(10),
 * 			ColoNames: pulumi.StringArray{
 * 				pulumi.String("den01"),
 * 			},
 * 			ColoRegions: pulumi.StringArray{
 * 				pulumi.String("APAC"),
 * 			},
 * 		})
 * 		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.StaticRoute;
 * import com.pulumi.cloudflare.StaticRouteArgs;
 * 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 StaticRoute("example", StaticRouteArgs.builder()
 *             .accountId("f037e56e89293a057740de681ac9abbe")
 *             .description("New route for new prefix 192.0.2.0/24")
 *             .prefix("192.0.2.0/24")
 *             .nexthop("10.0.0.0")
 *             .priority(100)
 *             .weight(10)
 *             .coloNames("den01")
 *             .coloRegions("APAC")
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   example:
 *     type: cloudflare:StaticRoute
 *     properties:
 *       accountId: f037e56e89293a057740de681ac9abbe
 *       description: New route for new prefix 192.0.2.0/24
 *       prefix: 192.0.2.0/24
 *       nexthop: 10.0.0.0
 *       priority: 100
 *       weight: 10
 *       coloNames:
 *         - den01
 *       coloRegions:
 *         - APAC
 * ```
 * 
 * ## Import
 * ```sh
 * $ pulumi import cloudflare:index/staticRoute:StaticRoute example /
 * ```
 */
public class StaticRoute internal constructor(
    override val javaResource: com.pulumi.cloudflare.StaticRoute,
) : KotlinCustomResource(javaResource, StaticRouteMapper) {
    /**
     * The account identifier to target for the resource. **Modifying this attribute will force creation of a new resource.**
     */
    public val accountId: Output?
        get() = javaResource.accountId().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })

    /**
     * List of Cloudflare colocation regions for this static route.
     */
    public val coloNames: Output>?
        get() = javaResource.coloNames().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * List of Cloudflare colocation names for this static route.
     */
    public val coloRegions: Output>?
        get() = javaResource.coloRegions().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

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

    /**
     * The nexthop IP address where traffic will be routed to.
     */
    public val nexthop: Output
        get() = javaResource.nexthop().applyValue({ args0 -> args0 })

    /**
     * Your network prefix using CIDR notation.
     */
    public val prefix: Output
        get() = javaResource.prefix().applyValue({ args0 -> args0 })

    /**
     * The priority for the static route.
     */
    public val priority: Output
        get() = javaResource.priority().applyValue({ args0 -> args0 })

    /**
     * The optional weight for ECMP routes. **Modifying this attribute will force creation of a new resource.**
     */
    public val weight: Output?
        get() = javaResource.weight().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
}

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

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

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy