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

com.pulumi.gcp.networkservices.kotlin.TlsRoute.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: 8.10.0.0
Show newest version
@file:Suppress("NAME_SHADOWING", "DEPRECATION")

package com.pulumi.gcp.networkservices.kotlin

import com.pulumi.core.Output
import com.pulumi.gcp.networkservices.kotlin.outputs.TlsRouteRule
import com.pulumi.gcp.networkservices.kotlin.outputs.TlsRouteRule.Companion.toKotlin
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

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

    public var args: TlsRouteArgs = TlsRouteArgs()

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

/**
 * ## Example Usage
 * ### Network Services Tls Route Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
 *     name: "backend-service-health-check",
 *     requestPath: "/",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 * });
 * const _default = new gcp.compute.BackendService("default", {
 *     name: "my-backend-service",
 *     healthChecks: defaultHttpHealthCheck.id,
 * });
 * const defaultTlsRoute = new gcp.networkservices.TlsRoute("default", {
 *     name: "my-tls-route",
 *     description: "my description",
 *     rules: [{
 *         matches: [{
 *             sniHosts: ["example.com"],
 *             alpns: ["http/1.1"],
 *         }],
 *         action: {
 *             destinations: [{
 *                 serviceName: _default.id,
 *                 weight: 1,
 *             }],
 *         },
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_http_health_check = gcp.compute.HttpHealthCheck("default",
 *     name="backend-service-health-check",
 *     request_path="/",
 *     check_interval_sec=1,
 *     timeout_sec=1)
 * default = gcp.compute.BackendService("default",
 *     name="my-backend-service",
 *     health_checks=default_http_health_check.id)
 * default_tls_route = gcp.networkservices.TlsRoute("default",
 *     name="my-tls-route",
 *     description="my description",
 *     rules=[gcp.networkservices.TlsRouteRuleArgs(
 *         matches=[gcp.networkservices.TlsRouteRuleMatchArgs(
 *             sni_hosts=["example.com"],
 *             alpns=["http/1.1"],
 *         )],
 *         action=gcp.networkservices.TlsRouteRuleActionArgs(
 *             destinations=[gcp.networkservices.TlsRouteRuleActionDestinationArgs(
 *                 service_name=default.id,
 *                 weight=1,
 *             )],
 *         ),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
 *     {
 *         Name = "backend-service-health-check",
 *         RequestPath = "/",
 *         CheckIntervalSec = 1,
 *         TimeoutSec = 1,
 *     });
 *     var @default = new Gcp.Compute.BackendService("default", new()
 *     {
 *         Name = "my-backend-service",
 *         HealthChecks = defaultHttpHealthCheck.Id,
 *     });
 *     var defaultTlsRoute = new Gcp.NetworkServices.TlsRoute("default", new()
 *     {
 *         Name = "my-tls-route",
 *         Description = "my description",
 *         Rules = new[]
 *         {
 *             new Gcp.NetworkServices.Inputs.TlsRouteRuleArgs
 *             {
 *                 Matches = new[]
 *                 {
 *                     new Gcp.NetworkServices.Inputs.TlsRouteRuleMatchArgs
 *                     {
 *                         SniHosts = new[]
 *                         {
 *                             "example.com",
 *                         },
 *                         Alpns = new[]
 *                         {
 *                             "http/1.1",
 *                         },
 *                     },
 *                 },
 *                 Action = new Gcp.NetworkServices.Inputs.TlsRouteRuleActionArgs
 *                 {
 *                     Destinations = new[]
 *                     {
 *                         new Gcp.NetworkServices.Inputs.TlsRouteRuleActionDestinationArgs
 *                         {
 *                             ServiceName = @default.Id,
 *                             Weight = 1,
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkservices"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
 * 			Name:             pulumi.String("backend-service-health-check"),
 * 			RequestPath:      pulumi.String("/"),
 * 			CheckIntervalSec: pulumi.Int(1),
 * 			TimeoutSec:       pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
 * 			Name:         pulumi.String("my-backend-service"),
 * 			HealthChecks: defaultHttpHealthCheck.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkservices.NewTlsRoute(ctx, "default", &networkservices.TlsRouteArgs{
 * 			Name:        pulumi.String("my-tls-route"),
 * 			Description: pulumi.String("my description"),
 * 			Rules: networkservices.TlsRouteRuleArray{
 * 				&networkservices.TlsRouteRuleArgs{
 * 					Matches: networkservices.TlsRouteRuleMatchArray{
 * 						&networkservices.TlsRouteRuleMatchArgs{
 * 							SniHosts: pulumi.StringArray{
 * 								pulumi.String("example.com"),
 * 							},
 * 							Alpns: pulumi.StringArray{
 * 								pulumi.String("http/1.1"),
 * 							},
 * 						},
 * 					},
 * 					Action: &networkservices.TlsRouteRuleActionArgs{
 * 						Destinations: networkservices.TlsRouteRuleActionDestinationArray{
 * 							&networkservices.TlsRouteRuleActionDestinationArgs{
 * 								ServiceName: _default.ID(),
 * 								Weight:      pulumi.Int(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.gcp.compute.HttpHealthCheck;
 * import com.pulumi.gcp.compute.HttpHealthCheckArgs;
 * import com.pulumi.gcp.compute.BackendService;
 * import com.pulumi.gcp.compute.BackendServiceArgs;
 * import com.pulumi.gcp.networkservices.TlsRoute;
 * import com.pulumi.gcp.networkservices.TlsRouteArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleActionArgs;
 * 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 defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
 *             .name("backend-service-health-check")
 *             .requestPath("/")
 *             .checkIntervalSec(1)
 *             .timeoutSec(1)
 *             .build());
 *         var default_ = new BackendService("default", BackendServiceArgs.builder()
 *             .name("my-backend-service")
 *             .healthChecks(defaultHttpHealthCheck.id())
 *             .build());
 *         var defaultTlsRoute = new TlsRoute("defaultTlsRoute", TlsRouteArgs.builder()
 *             .name("my-tls-route")
 *             .description("my description")
 *             .rules(TlsRouteRuleArgs.builder()
 *                 .matches(TlsRouteRuleMatchArgs.builder()
 *                     .sniHosts("example.com")
 *                     .alpns("http/1.1")
 *                     .build())
 *                 .action(TlsRouteRuleActionArgs.builder()
 *                     .destinations(TlsRouteRuleActionDestinationArgs.builder()
 *                         .serviceName(default_.id())
 *                         .weight(1)
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:BackendService
 *     properties:
 *       name: my-backend-service
 *       healthChecks: ${defaultHttpHealthCheck.id}
 *   defaultHttpHealthCheck:
 *     type: gcp:compute:HttpHealthCheck
 *     name: default
 *     properties:
 *       name: backend-service-health-check
 *       requestPath: /
 *       checkIntervalSec: 1
 *       timeoutSec: 1
 *   defaultTlsRoute:
 *     type: gcp:networkservices:TlsRoute
 *     name: default
 *     properties:
 *       name: my-tls-route
 *       description: my description
 *       rules:
 *         - matches:
 *             - sniHosts:
 *                 - example.com
 *               alpns:
 *                 - http/1.1
 *           action:
 *             destinations:
 *               - serviceName: ${default.id}
 *                 weight: 1
 * ```
 * 
 * ### Network Services Tls Route Mesh Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
 *     name: "backend-service-health-check",
 *     requestPath: "/",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 * });
 * const _default = new gcp.compute.BackendService("default", {
 *     name: "my-backend-service",
 *     healthChecks: defaultHttpHealthCheck.id,
 * });
 * const defaultMesh = new gcp.networkservices.Mesh("default", {
 *     name: "my-tls-route",
 *     labels: {
 *         foo: "bar",
 *     },
 *     description: "my description",
 * });
 * const defaultTlsRoute = new gcp.networkservices.TlsRoute("default", {
 *     name: "my-tls-route",
 *     description: "my description",
 *     meshes: [defaultMesh.id],
 *     rules: [{
 *         matches: [{
 *             sniHosts: ["example.com"],
 *             alpns: ["http/1.1"],
 *         }],
 *         action: {
 *             destinations: [{
 *                 serviceName: _default.id,
 *                 weight: 1,
 *             }],
 *         },
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_http_health_check = gcp.compute.HttpHealthCheck("default",
 *     name="backend-service-health-check",
 *     request_path="/",
 *     check_interval_sec=1,
 *     timeout_sec=1)
 * default = gcp.compute.BackendService("default",
 *     name="my-backend-service",
 *     health_checks=default_http_health_check.id)
 * default_mesh = gcp.networkservices.Mesh("default",
 *     name="my-tls-route",
 *     labels={
 *         "foo": "bar",
 *     },
 *     description="my description")
 * default_tls_route = gcp.networkservices.TlsRoute("default",
 *     name="my-tls-route",
 *     description="my description",
 *     meshes=[default_mesh.id],
 *     rules=[gcp.networkservices.TlsRouteRuleArgs(
 *         matches=[gcp.networkservices.TlsRouteRuleMatchArgs(
 *             sni_hosts=["example.com"],
 *             alpns=["http/1.1"],
 *         )],
 *         action=gcp.networkservices.TlsRouteRuleActionArgs(
 *             destinations=[gcp.networkservices.TlsRouteRuleActionDestinationArgs(
 *                 service_name=default.id,
 *                 weight=1,
 *             )],
 *         ),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
 *     {
 *         Name = "backend-service-health-check",
 *         RequestPath = "/",
 *         CheckIntervalSec = 1,
 *         TimeoutSec = 1,
 *     });
 *     var @default = new Gcp.Compute.BackendService("default", new()
 *     {
 *         Name = "my-backend-service",
 *         HealthChecks = defaultHttpHealthCheck.Id,
 *     });
 *     var defaultMesh = new Gcp.NetworkServices.Mesh("default", new()
 *     {
 *         Name = "my-tls-route",
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Description = "my description",
 *     });
 *     var defaultTlsRoute = new Gcp.NetworkServices.TlsRoute("default", new()
 *     {
 *         Name = "my-tls-route",
 *         Description = "my description",
 *         Meshes = new[]
 *         {
 *             defaultMesh.Id,
 *         },
 *         Rules = new[]
 *         {
 *             new Gcp.NetworkServices.Inputs.TlsRouteRuleArgs
 *             {
 *                 Matches = new[]
 *                 {
 *                     new Gcp.NetworkServices.Inputs.TlsRouteRuleMatchArgs
 *                     {
 *                         SniHosts = new[]
 *                         {
 *                             "example.com",
 *                         },
 *                         Alpns = new[]
 *                         {
 *                             "http/1.1",
 *                         },
 *                     },
 *                 },
 *                 Action = new Gcp.NetworkServices.Inputs.TlsRouteRuleActionArgs
 *                 {
 *                     Destinations = new[]
 *                     {
 *                         new Gcp.NetworkServices.Inputs.TlsRouteRuleActionDestinationArgs
 *                         {
 *                             ServiceName = @default.Id,
 *                             Weight = 1,
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkservices"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
 * 			Name:             pulumi.String("backend-service-health-check"),
 * 			RequestPath:      pulumi.String("/"),
 * 			CheckIntervalSec: pulumi.Int(1),
 * 			TimeoutSec:       pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
 * 			Name:         pulumi.String("my-backend-service"),
 * 			HealthChecks: defaultHttpHealthCheck.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultMesh, err := networkservices.NewMesh(ctx, "default", &networkservices.MeshArgs{
 * 			Name: pulumi.String("my-tls-route"),
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Description: pulumi.String("my description"),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkservices.NewTlsRoute(ctx, "default", &networkservices.TlsRouteArgs{
 * 			Name:        pulumi.String("my-tls-route"),
 * 			Description: pulumi.String("my description"),
 * 			Meshes: pulumi.StringArray{
 * 				defaultMesh.ID(),
 * 			},
 * 			Rules: networkservices.TlsRouteRuleArray{
 * 				&networkservices.TlsRouteRuleArgs{
 * 					Matches: networkservices.TlsRouteRuleMatchArray{
 * 						&networkservices.TlsRouteRuleMatchArgs{
 * 							SniHosts: pulumi.StringArray{
 * 								pulumi.String("example.com"),
 * 							},
 * 							Alpns: pulumi.StringArray{
 * 								pulumi.String("http/1.1"),
 * 							},
 * 						},
 * 					},
 * 					Action: &networkservices.TlsRouteRuleActionArgs{
 * 						Destinations: networkservices.TlsRouteRuleActionDestinationArray{
 * 							&networkservices.TlsRouteRuleActionDestinationArgs{
 * 								ServiceName: _default.ID(),
 * 								Weight:      pulumi.Int(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.gcp.compute.HttpHealthCheck;
 * import com.pulumi.gcp.compute.HttpHealthCheckArgs;
 * import com.pulumi.gcp.compute.BackendService;
 * import com.pulumi.gcp.compute.BackendServiceArgs;
 * import com.pulumi.gcp.networkservices.Mesh;
 * import com.pulumi.gcp.networkservices.MeshArgs;
 * import com.pulumi.gcp.networkservices.TlsRoute;
 * import com.pulumi.gcp.networkservices.TlsRouteArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleActionArgs;
 * 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 defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
 *             .name("backend-service-health-check")
 *             .requestPath("/")
 *             .checkIntervalSec(1)
 *             .timeoutSec(1)
 *             .build());
 *         var default_ = new BackendService("default", BackendServiceArgs.builder()
 *             .name("my-backend-service")
 *             .healthChecks(defaultHttpHealthCheck.id())
 *             .build());
 *         var defaultMesh = new Mesh("defaultMesh", MeshArgs.builder()
 *             .name("my-tls-route")
 *             .labels(Map.of("foo", "bar"))
 *             .description("my description")
 *             .build());
 *         var defaultTlsRoute = new TlsRoute("defaultTlsRoute", TlsRouteArgs.builder()
 *             .name("my-tls-route")
 *             .description("my description")
 *             .meshes(defaultMesh.id())
 *             .rules(TlsRouteRuleArgs.builder()
 *                 .matches(TlsRouteRuleMatchArgs.builder()
 *                     .sniHosts("example.com")
 *                     .alpns("http/1.1")
 *                     .build())
 *                 .action(TlsRouteRuleActionArgs.builder()
 *                     .destinations(TlsRouteRuleActionDestinationArgs.builder()
 *                         .serviceName(default_.id())
 *                         .weight(1)
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:BackendService
 *     properties:
 *       name: my-backend-service
 *       healthChecks: ${defaultHttpHealthCheck.id}
 *   defaultHttpHealthCheck:
 *     type: gcp:compute:HttpHealthCheck
 *     name: default
 *     properties:
 *       name: backend-service-health-check
 *       requestPath: /
 *       checkIntervalSec: 1
 *       timeoutSec: 1
 *   defaultMesh:
 *     type: gcp:networkservices:Mesh
 *     name: default
 *     properties:
 *       name: my-tls-route
 *       labels:
 *         foo: bar
 *       description: my description
 *   defaultTlsRoute:
 *     type: gcp:networkservices:TlsRoute
 *     name: default
 *     properties:
 *       name: my-tls-route
 *       description: my description
 *       meshes:
 *         - ${defaultMesh.id}
 *       rules:
 *         - matches:
 *             - sniHosts:
 *                 - example.com
 *               alpns:
 *                 - http/1.1
 *           action:
 *             destinations:
 *               - serviceName: ${default.id}
 *                 weight: 1
 * ```
 * 
 * ### Network Services Tls Route Gateway Basic
 * 
 * ```typescript
 * import * as pulumi from "@pulumi/pulumi";
 * import * as gcp from "@pulumi/gcp";
 * const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
 *     name: "backend-service-health-check",
 *     requestPath: "/",
 *     checkIntervalSec: 1,
 *     timeoutSec: 1,
 * });
 * const _default = new gcp.compute.BackendService("default", {
 *     name: "my-backend-service",
 *     healthChecks: defaultHttpHealthCheck.id,
 * });
 * const defaultGateway = new gcp.networkservices.Gateway("default", {
 *     name: "my-tls-route",
 *     labels: {
 *         foo: "bar",
 *     },
 *     description: "my description",
 *     scope: "my-scope",
 *     type: "OPEN_MESH",
 *     ports: [443],
 * });
 * const defaultTlsRoute = new gcp.networkservices.TlsRoute("default", {
 *     name: "my-tls-route",
 *     description: "my description",
 *     gateways: [defaultGateway.id],
 *     rules: [{
 *         matches: [{
 *             sniHosts: ["example.com"],
 *             alpns: ["http/1.1"],
 *         }],
 *         action: {
 *             destinations: [{
 *                 serviceName: _default.id,
 *                 weight: 1,
 *             }],
 *         },
 *     }],
 * });
 * ```
 * ```python
 * import pulumi
 * import pulumi_gcp as gcp
 * default_http_health_check = gcp.compute.HttpHealthCheck("default",
 *     name="backend-service-health-check",
 *     request_path="/",
 *     check_interval_sec=1,
 *     timeout_sec=1)
 * default = gcp.compute.BackendService("default",
 *     name="my-backend-service",
 *     health_checks=default_http_health_check.id)
 * default_gateway = gcp.networkservices.Gateway("default",
 *     name="my-tls-route",
 *     labels={
 *         "foo": "bar",
 *     },
 *     description="my description",
 *     scope="my-scope",
 *     type="OPEN_MESH",
 *     ports=[443])
 * default_tls_route = gcp.networkservices.TlsRoute("default",
 *     name="my-tls-route",
 *     description="my description",
 *     gateways=[default_gateway.id],
 *     rules=[gcp.networkservices.TlsRouteRuleArgs(
 *         matches=[gcp.networkservices.TlsRouteRuleMatchArgs(
 *             sni_hosts=["example.com"],
 *             alpns=["http/1.1"],
 *         )],
 *         action=gcp.networkservices.TlsRouteRuleActionArgs(
 *             destinations=[gcp.networkservices.TlsRouteRuleActionDestinationArgs(
 *                 service_name=default.id,
 *                 weight=1,
 *             )],
 *         ),
 *     )])
 * ```
 * ```csharp
 * using System.Collections.Generic;
 * using System.Linq;
 * using Pulumi;
 * using Gcp = Pulumi.Gcp;
 * return await Deployment.RunAsync(() =>
 * {
 *     var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
 *     {
 *         Name = "backend-service-health-check",
 *         RequestPath = "/",
 *         CheckIntervalSec = 1,
 *         TimeoutSec = 1,
 *     });
 *     var @default = new Gcp.Compute.BackendService("default", new()
 *     {
 *         Name = "my-backend-service",
 *         HealthChecks = defaultHttpHealthCheck.Id,
 *     });
 *     var defaultGateway = new Gcp.NetworkServices.Gateway("default", new()
 *     {
 *         Name = "my-tls-route",
 *         Labels =
 *         {
 *             { "foo", "bar" },
 *         },
 *         Description = "my description",
 *         Scope = "my-scope",
 *         Type = "OPEN_MESH",
 *         Ports = new[]
 *         {
 *             443,
 *         },
 *     });
 *     var defaultTlsRoute = new Gcp.NetworkServices.TlsRoute("default", new()
 *     {
 *         Name = "my-tls-route",
 *         Description = "my description",
 *         Gateways = new[]
 *         {
 *             defaultGateway.Id,
 *         },
 *         Rules = new[]
 *         {
 *             new Gcp.NetworkServices.Inputs.TlsRouteRuleArgs
 *             {
 *                 Matches = new[]
 *                 {
 *                     new Gcp.NetworkServices.Inputs.TlsRouteRuleMatchArgs
 *                     {
 *                         SniHosts = new[]
 *                         {
 *                             "example.com",
 *                         },
 *                         Alpns = new[]
 *                         {
 *                             "http/1.1",
 *                         },
 *                     },
 *                 },
 *                 Action = new Gcp.NetworkServices.Inputs.TlsRouteRuleActionArgs
 *                 {
 *                     Destinations = new[]
 *                     {
 *                         new Gcp.NetworkServices.Inputs.TlsRouteRuleActionDestinationArgs
 *                         {
 *                             ServiceName = @default.Id,
 *                             Weight = 1,
 *                         },
 *                     },
 *                 },
 *             },
 *         },
 *     });
 * });
 * ```
 * ```go
 * package main
 * import (
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
 * 	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/networkservices"
 * 	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
 * )
 * func main() {
 * 	pulumi.Run(func(ctx *pulumi.Context) error {
 * 		defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
 * 			Name:             pulumi.String("backend-service-health-check"),
 * 			RequestPath:      pulumi.String("/"),
 * 			CheckIntervalSec: pulumi.Int(1),
 * 			TimeoutSec:       pulumi.Int(1),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = compute.NewBackendService(ctx, "default", &compute.BackendServiceArgs{
 * 			Name:         pulumi.String("my-backend-service"),
 * 			HealthChecks: defaultHttpHealthCheck.ID(),
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		defaultGateway, err := networkservices.NewGateway(ctx, "default", &networkservices.GatewayArgs{
 * 			Name: pulumi.String("my-tls-route"),
 * 			Labels: pulumi.StringMap{
 * 				"foo": pulumi.String("bar"),
 * 			},
 * 			Description: pulumi.String("my description"),
 * 			Scope:       pulumi.String("my-scope"),
 * 			Type:        pulumi.String("OPEN_MESH"),
 * 			Ports: pulumi.IntArray{
 * 				pulumi.Int(443),
 * 			},
 * 		})
 * 		if err != nil {
 * 			return err
 * 		}
 * 		_, err = networkservices.NewTlsRoute(ctx, "default", &networkservices.TlsRouteArgs{
 * 			Name:        pulumi.String("my-tls-route"),
 * 			Description: pulumi.String("my description"),
 * 			Gateways: pulumi.StringArray{
 * 				defaultGateway.ID(),
 * 			},
 * 			Rules: networkservices.TlsRouteRuleArray{
 * 				&networkservices.TlsRouteRuleArgs{
 * 					Matches: networkservices.TlsRouteRuleMatchArray{
 * 						&networkservices.TlsRouteRuleMatchArgs{
 * 							SniHosts: pulumi.StringArray{
 * 								pulumi.String("example.com"),
 * 							},
 * 							Alpns: pulumi.StringArray{
 * 								pulumi.String("http/1.1"),
 * 							},
 * 						},
 * 					},
 * 					Action: &networkservices.TlsRouteRuleActionArgs{
 * 						Destinations: networkservices.TlsRouteRuleActionDestinationArray{
 * 							&networkservices.TlsRouteRuleActionDestinationArgs{
 * 								ServiceName: _default.ID(),
 * 								Weight:      pulumi.Int(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.gcp.compute.HttpHealthCheck;
 * import com.pulumi.gcp.compute.HttpHealthCheckArgs;
 * import com.pulumi.gcp.compute.BackendService;
 * import com.pulumi.gcp.compute.BackendServiceArgs;
 * import com.pulumi.gcp.networkservices.Gateway;
 * import com.pulumi.gcp.networkservices.GatewayArgs;
 * import com.pulumi.gcp.networkservices.TlsRoute;
 * import com.pulumi.gcp.networkservices.TlsRouteArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleArgs;
 * import com.pulumi.gcp.networkservices.inputs.TlsRouteRuleActionArgs;
 * 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 defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
 *             .name("backend-service-health-check")
 *             .requestPath("/")
 *             .checkIntervalSec(1)
 *             .timeoutSec(1)
 *             .build());
 *         var default_ = new BackendService("default", BackendServiceArgs.builder()
 *             .name("my-backend-service")
 *             .healthChecks(defaultHttpHealthCheck.id())
 *             .build());
 *         var defaultGateway = new Gateway("defaultGateway", GatewayArgs.builder()
 *             .name("my-tls-route")
 *             .labels(Map.of("foo", "bar"))
 *             .description("my description")
 *             .scope("my-scope")
 *             .type("OPEN_MESH")
 *             .ports(443)
 *             .build());
 *         var defaultTlsRoute = new TlsRoute("defaultTlsRoute", TlsRouteArgs.builder()
 *             .name("my-tls-route")
 *             .description("my description")
 *             .gateways(defaultGateway.id())
 *             .rules(TlsRouteRuleArgs.builder()
 *                 .matches(TlsRouteRuleMatchArgs.builder()
 *                     .sniHosts("example.com")
 *                     .alpns("http/1.1")
 *                     .build())
 *                 .action(TlsRouteRuleActionArgs.builder()
 *                     .destinations(TlsRouteRuleActionDestinationArgs.builder()
 *                         .serviceName(default_.id())
 *                         .weight(1)
 *                         .build())
 *                     .build())
 *                 .build())
 *             .build());
 *     }
 * }
 * ```
 * ```yaml
 * resources:
 *   default:
 *     type: gcp:compute:BackendService
 *     properties:
 *       name: my-backend-service
 *       healthChecks: ${defaultHttpHealthCheck.id}
 *   defaultHttpHealthCheck:
 *     type: gcp:compute:HttpHealthCheck
 *     name: default
 *     properties:
 *       name: backend-service-health-check
 *       requestPath: /
 *       checkIntervalSec: 1
 *       timeoutSec: 1
 *   defaultGateway:
 *     type: gcp:networkservices:Gateway
 *     name: default
 *     properties:
 *       name: my-tls-route
 *       labels:
 *         foo: bar
 *       description: my description
 *       scope: my-scope
 *       type: OPEN_MESH
 *       ports:
 *         - 443
 *   defaultTlsRoute:
 *     type: gcp:networkservices:TlsRoute
 *     name: default
 *     properties:
 *       name: my-tls-route
 *       description: my description
 *       gateways:
 *         - ${defaultGateway.id}
 *       rules:
 *         - matches:
 *             - sniHosts:
 *                 - example.com
 *               alpns:
 *                 - http/1.1
 *           action:
 *             destinations:
 *               - serviceName: ${default.id}
 *                 weight: 1
 * ```
 * 
 * ## Import
 * TlsRoute can be imported using any of these accepted formats:
 * * `projects/{{project}}/locations/global/tlsRoutes/{{name}}`
 * * `{{project}}/{{name}}`
 * * `{{name}}`
 * When using the `pulumi import` command, TlsRoute can be imported using one of the formats above. For example:
 * ```sh
 * $ pulumi import gcp:networkservices/tlsRoute:TlsRoute default projects/{{project}}/locations/global/tlsRoutes/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkservices/tlsRoute:TlsRoute default {{project}}/{{name}}
 * ```
 * ```sh
 * $ pulumi import gcp:networkservices/tlsRoute:TlsRoute default {{name}}
 * ```
 */
public class TlsRoute internal constructor(
    override val javaResource: com.pulumi.gcp.networkservices.TlsRoute,
) : KotlinCustomResource(javaResource, TlsRouteMapper) {
    /**
     * Time the TlsRoute was created in UTC.
     */
    public val createTime: Output
        get() = javaResource.createTime().applyValue({ args0 -> args0 })

    /**
     * A free-text description of the resource. Max length 1024 characters.
     */
    public val description: Output?
        get() = javaResource.description().applyValue({ args0 ->
            args0.map({ args0 ->
                args0
            }).orElse(null)
        })

    /**
     * Gateways defines a list of gateways this TlsRoute is attached to, as one of the routing rules to route the requests
     * served by the gateway. Each gateway reference should match the pattern:
     * projects/*/locations/global/gateways/
     * */
     */
    public val gateways: Output>?
        get() = javaResource.gateways().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Meshes defines a list of meshes this TlsRoute is attached to, as one of the routing rules to route the requests served
     * by the mesh. Each mesh reference should match the pattern: projects/*/locations/global/meshes/ The attached
     * Mesh should be of a type SIDECAR
     * */
     */
    public val meshes: Output>?
        get() = javaResource.meshes().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.map({ args0 ->
                    args0
                })
            }).orElse(null)
        })

    /**
     * Name of the TlsRoute resource.
     */
    public val name: Output
        get() = javaResource.name().applyValue({ args0 -> args0 })

    public val project: Output
        get() = javaResource.project().applyValue({ args0 -> args0 })

    /**
     * Rules that define how traffic is routed and handled.
     * Structure is documented below.
     */
    public val rules: Output>
        get() = javaResource.rules().applyValue({ args0 ->
            args0.map({ args0 ->
                args0.let({ args0 ->
                    toKotlin(args0)
                })
            })
        })

    /**
     * Server-defined URL of this resource.
     */
    public val selfLink: Output
        get() = javaResource.selfLink().applyValue({ args0 -> args0 })

    /**
     * Time the TlsRoute was updated in UTC.
     */
    public val updateTime: Output
        get() = javaResource.updateTime().applyValue({ args0 -> args0 })
}

public object TlsRouteMapper : ResourceMapper {
    override fun supportsMappingOfType(javaResource: Resource): Boolean =
        com.pulumi.gcp.networkservices.TlsRoute::class == javaResource::class

    override fun map(javaResource: Resource): TlsRoute = TlsRoute(
        javaResource as
            com.pulumi.gcp.networkservices.TlsRoute,
    )
}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy