com.pulumi.gcp.compute.kotlin.RegionTargetHttpProxy.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pulumi-gcp-kotlin Show documentation
Show all versions of pulumi-gcp-kotlin Show documentation
Build cloud applications and infrastructure by combining the safety and reliability of infrastructure as code with the power of the Kotlin programming language.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.gcp.compute.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
/**
* Builder for [RegionTargetHttpProxy].
*/
@PulumiTagMarker
public class RegionTargetHttpProxyResourceBuilder internal constructor() {
public var name: String? = null
public var args: RegionTargetHttpProxyArgs = RegionTargetHttpProxyArgs()
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 RegionTargetHttpProxyArgsBuilder.() -> Unit) {
val builder = RegionTargetHttpProxyArgsBuilder()
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(): RegionTargetHttpProxy {
val builtJavaResource = com.pulumi.gcp.compute.RegionTargetHttpProxy(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return RegionTargetHttpProxy(builtJavaResource)
}
}
/**
* Represents a RegionTargetHttpProxy resource, which is used by one or more
* forwarding rules to route incoming HTTP requests to a URL map.
* To get more information about RegionTargetHttpProxy, see:
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/regionTargetHttpProxies)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)
* ## Example Usage
* ### Region Target Http Proxy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const defaultRegionHealthCheck = new gcp.compute.RegionHealthCheck("default", {
* region: "us-central1",
* name: "http-health-check",
* httpHealthCheck: {
* port: 80,
* },
* });
* const defaultRegionBackendService = new gcp.compute.RegionBackendService("default", {
* region: "us-central1",
* name: "backend-service",
* protocol: "HTTP",
* timeoutSec: 10,
* loadBalancingScheme: "INTERNAL_MANAGED",
* healthChecks: defaultRegionHealthCheck.id,
* });
* const defaultRegionUrlMap = new gcp.compute.RegionUrlMap("default", {
* region: "us-central1",
* name: "url-map",
* defaultService: defaultRegionBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultRegionBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultRegionBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.RegionTargetHttpProxy("default", {
* region: "us-central1",
* name: "test-proxy",
* urlMap: defaultRegionUrlMap.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default_region_health_check = gcp.compute.RegionHealthCheck("default",
* region="us-central1",
* name="http-health-check",
* http_health_check=gcp.compute.RegionHealthCheckHttpHealthCheckArgs(
* port=80,
* ))
* default_region_backend_service = gcp.compute.RegionBackendService("default",
* region="us-central1",
* name="backend-service",
* protocol="HTTP",
* timeout_sec=10,
* load_balancing_scheme="INTERNAL_MANAGED",
* health_checks=default_region_health_check.id)
* default_region_url_map = gcp.compute.RegionUrlMap("default",
* region="us-central1",
* name="url-map",
* default_service=default_region_backend_service.id,
* host_rules=[gcp.compute.RegionUrlMapHostRuleArgs(
* hosts=["mysite.com"],
* path_matcher="allpaths",
* )],
* path_matchers=[gcp.compute.RegionUrlMapPathMatcherArgs(
* name="allpaths",
* default_service=default_region_backend_service.id,
* path_rules=[gcp.compute.RegionUrlMapPathMatcherPathRuleArgs(
* paths=["/*"],
* service=default_region_backend_service.id,
* )],
* )])
* default = gcp.compute.RegionTargetHttpProxy("default",
* region="us-central1",
* name="test-proxy",
* url_map=default_region_url_map.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var defaultRegionHealthCheck = new Gcp.Compute.RegionHealthCheck("default", new()
* {
* Region = "us-central1",
* Name = "http-health-check",
* HttpHealthCheck = new Gcp.Compute.Inputs.RegionHealthCheckHttpHealthCheckArgs
* {
* Port = 80,
* },
* });
* var defaultRegionBackendService = new Gcp.Compute.RegionBackendService("default", new()
* {
* Region = "us-central1",
* Name = "backend-service",
* Protocol = "HTTP",
* TimeoutSec = 10,
* LoadBalancingScheme = "INTERNAL_MANAGED",
* HealthChecks = defaultRegionHealthCheck.Id,
* });
* var defaultRegionUrlMap = new Gcp.Compute.RegionUrlMap("default", new()
* {
* Region = "us-central1",
* Name = "url-map",
* DefaultService = defaultRegionBackendService.Id,
* HostRules = new[]
* {
* new Gcp.Compute.Inputs.RegionUrlMapHostRuleArgs
* {
* Hosts = new[]
* {
* "mysite.com",
* },
* PathMatcher = "allpaths",
* },
* },
* PathMatchers = new[]
* {
* new Gcp.Compute.Inputs.RegionUrlMapPathMatcherArgs
* {
* Name = "allpaths",
* DefaultService = defaultRegionBackendService.Id,
* PathRules = new[]
* {
* new Gcp.Compute.Inputs.RegionUrlMapPathMatcherPathRuleArgs
* {
* Paths = new[]
* {
* "/*",
* },
* Service = defaultRegionBackendService.Id,
* },
* },
* },
* },
* });
* var @default = new Gcp.Compute.RegionTargetHttpProxy("default", new()
* {
* Region = "us-central1",
* Name = "test-proxy",
* UrlMap = defaultRegionUrlMap.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* defaultRegionHealthCheck, err := compute.NewRegionHealthCheck(ctx, "default", &compute.RegionHealthCheckArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("http-health-check"),
* HttpHealthCheck: &compute.RegionHealthCheckHttpHealthCheckArgs{
* Port: pulumi.Int(80),
* },
* })
* if err != nil {
* return err
* }
* defaultRegionBackendService, err := compute.NewRegionBackendService(ctx, "default", &compute.RegionBackendServiceArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("backend-service"),
* Protocol: pulumi.String("HTTP"),
* TimeoutSec: pulumi.Int(10),
* LoadBalancingScheme: pulumi.String("INTERNAL_MANAGED"),
* HealthChecks: defaultRegionHealthCheck.ID(),
* })
* if err != nil {
* return err
* }
* defaultRegionUrlMap, err := compute.NewRegionUrlMap(ctx, "default", &compute.RegionUrlMapArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("url-map"),
* DefaultService: defaultRegionBackendService.ID(),
* HostRules: compute.RegionUrlMapHostRuleArray{
* &compute.RegionUrlMapHostRuleArgs{
* Hosts: pulumi.StringArray{
* pulumi.String("mysite.com"),
* },
* PathMatcher: pulumi.String("allpaths"),
* },
* },
* PathMatchers: compute.RegionUrlMapPathMatcherArray{
* &compute.RegionUrlMapPathMatcherArgs{
* Name: pulumi.String("allpaths"),
* DefaultService: defaultRegionBackendService.ID(),
* PathRules: compute.RegionUrlMapPathMatcherPathRuleArray{
* &compute.RegionUrlMapPathMatcherPathRuleArgs{
* Paths: pulumi.StringArray{
* pulumi.String("/*"),
* },
* Service: defaultRegionBackendService.ID(),
* },
* },
* },
* },
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRegionTargetHttpProxy(ctx, "default", &compute.RegionTargetHttpProxyArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("test-proxy"),
* UrlMap: defaultRegionUrlMap.ID(),
* })
* 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.RegionHealthCheck;
* import com.pulumi.gcp.compute.RegionHealthCheckArgs;
* import com.pulumi.gcp.compute.inputs.RegionHealthCheckHttpHealthCheckArgs;
* import com.pulumi.gcp.compute.RegionBackendService;
* import com.pulumi.gcp.compute.RegionBackendServiceArgs;
* import com.pulumi.gcp.compute.RegionUrlMap;
* import com.pulumi.gcp.compute.RegionUrlMapArgs;
* import com.pulumi.gcp.compute.inputs.RegionUrlMapHostRuleArgs;
* import com.pulumi.gcp.compute.inputs.RegionUrlMapPathMatcherArgs;
* import com.pulumi.gcp.compute.RegionTargetHttpProxy;
* import com.pulumi.gcp.compute.RegionTargetHttpProxyArgs;
* 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 defaultRegionHealthCheck = new RegionHealthCheck("defaultRegionHealthCheck", RegionHealthCheckArgs.builder()
* .region("us-central1")
* .name("http-health-check")
* .httpHealthCheck(RegionHealthCheckHttpHealthCheckArgs.builder()
* .port(80)
* .build())
* .build());
* var defaultRegionBackendService = new RegionBackendService("defaultRegionBackendService", RegionBackendServiceArgs.builder()
* .region("us-central1")
* .name("backend-service")
* .protocol("HTTP")
* .timeoutSec(10)
* .loadBalancingScheme("INTERNAL_MANAGED")
* .healthChecks(defaultRegionHealthCheck.id())
* .build());
* var defaultRegionUrlMap = new RegionUrlMap("defaultRegionUrlMap", RegionUrlMapArgs.builder()
* .region("us-central1")
* .name("url-map")
* .defaultService(defaultRegionBackendService.id())
* .hostRules(RegionUrlMapHostRuleArgs.builder()
* .hosts("mysite.com")
* .pathMatcher("allpaths")
* .build())
* .pathMatchers(RegionUrlMapPathMatcherArgs.builder()
* .name("allpaths")
* .defaultService(defaultRegionBackendService.id())
* .pathRules(RegionUrlMapPathMatcherPathRuleArgs.builder()
* .paths("/*")
* .service(defaultRegionBackendService.id())
* .build())
* .build())
* .build());
* var default_ = new RegionTargetHttpProxy("default", RegionTargetHttpProxyArgs.builder()
* .region("us-central1")
* .name("test-proxy")
* .urlMap(defaultRegionUrlMap.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:RegionTargetHttpProxy
* properties:
* region: us-central1
* name: test-proxy
* urlMap: ${defaultRegionUrlMap.id}
* defaultRegionUrlMap:
* type: gcp:compute:RegionUrlMap
* name: default
* properties:
* region: us-central1
* name: url-map
* defaultService: ${defaultRegionBackendService.id}
* hostRules:
* - hosts:
* - mysite.com
* pathMatcher: allpaths
* pathMatchers:
* - name: allpaths
* defaultService: ${defaultRegionBackendService.id}
* pathRules:
* - paths:
* - /*
* service: ${defaultRegionBackendService.id}
* defaultRegionBackendService:
* type: gcp:compute:RegionBackendService
* name: default
* properties:
* region: us-central1
* name: backend-service
* protocol: HTTP
* timeoutSec: 10
* loadBalancingScheme: INTERNAL_MANAGED
* healthChecks: ${defaultRegionHealthCheck.id}
* defaultRegionHealthCheck:
* type: gcp:compute:RegionHealthCheck
* name: default
* properties:
* region: us-central1
* name: http-health-check
* httpHealthCheck:
* port: 80
* ```
*
* ### Region Target Http Proxy Https Redirect
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* const defaultRegionUrlMap = new gcp.compute.RegionUrlMap("default", {
* region: "us-central1",
* name: "url-map",
* defaultUrlRedirect: {
* httpsRedirect: true,
* stripQuery: false,
* },
* });
* const _default = new gcp.compute.RegionTargetHttpProxy("default", {
* region: "us-central1",
* name: "test-https-redirect-proxy",
* urlMap: defaultRegionUrlMap.id,
* });
* ```
* ```python
* import pulumi
* import pulumi_gcp as gcp
* default_region_url_map = gcp.compute.RegionUrlMap("default",
* region="us-central1",
* name="url-map",
* default_url_redirect=gcp.compute.RegionUrlMapDefaultUrlRedirectArgs(
* https_redirect=True,
* strip_query=False,
* ))
* default = gcp.compute.RegionTargetHttpProxy("default",
* region="us-central1",
* name="test-https-redirect-proxy",
* url_map=default_region_url_map.id)
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Gcp = Pulumi.Gcp;
* return await Deployment.RunAsync(() =>
* {
* var defaultRegionUrlMap = new Gcp.Compute.RegionUrlMap("default", new()
* {
* Region = "us-central1",
* Name = "url-map",
* DefaultUrlRedirect = new Gcp.Compute.Inputs.RegionUrlMapDefaultUrlRedirectArgs
* {
* HttpsRedirect = true,
* StripQuery = false,
* },
* });
* var @default = new Gcp.Compute.RegionTargetHttpProxy("default", new()
* {
* Region = "us-central1",
* Name = "test-https-redirect-proxy",
* UrlMap = defaultRegionUrlMap.Id,
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* defaultRegionUrlMap, err := compute.NewRegionUrlMap(ctx, "default", &compute.RegionUrlMapArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("url-map"),
* DefaultUrlRedirect: &compute.RegionUrlMapDefaultUrlRedirectArgs{
* HttpsRedirect: pulumi.Bool(true),
* StripQuery: pulumi.Bool(false),
* },
* })
* if err != nil {
* return err
* }
* _, err = compute.NewRegionTargetHttpProxy(ctx, "default", &compute.RegionTargetHttpProxyArgs{
* Region: pulumi.String("us-central1"),
* Name: pulumi.String("test-https-redirect-proxy"),
* UrlMap: defaultRegionUrlMap.ID(),
* })
* 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.RegionUrlMap;
* import com.pulumi.gcp.compute.RegionUrlMapArgs;
* import com.pulumi.gcp.compute.inputs.RegionUrlMapDefaultUrlRedirectArgs;
* import com.pulumi.gcp.compute.RegionTargetHttpProxy;
* import com.pulumi.gcp.compute.RegionTargetHttpProxyArgs;
* 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 defaultRegionUrlMap = new RegionUrlMap("defaultRegionUrlMap", RegionUrlMapArgs.builder()
* .region("us-central1")
* .name("url-map")
* .defaultUrlRedirect(RegionUrlMapDefaultUrlRedirectArgs.builder()
* .httpsRedirect(true)
* .stripQuery(false)
* .build())
* .build());
* var default_ = new RegionTargetHttpProxy("default", RegionTargetHttpProxyArgs.builder()
* .region("us-central1")
* .name("test-https-redirect-proxy")
* .urlMap(defaultRegionUrlMap.id())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* default:
* type: gcp:compute:RegionTargetHttpProxy
* properties:
* region: us-central1
* name: test-https-redirect-proxy
* urlMap: ${defaultRegionUrlMap.id}
* defaultRegionUrlMap:
* type: gcp:compute:RegionUrlMap
* name: default
* properties:
* region: us-central1
* name: url-map
* defaultUrlRedirect:
* httpsRedirect: true
* stripQuery: false
* ```
*
* ## Import
* RegionTargetHttpProxy can be imported using any of these accepted formats:
* * `projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}`
* * `{{project}}/{{region}}/{{name}}`
* * `{{region}}/{{name}}`
* * `{{name}}`
* When using the `pulumi import` command, RegionTargetHttpProxy can be imported using one of the formats above. For example:
* ```sh
* $ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default projects/{{project}}/regions/{{region}}/targetHttpProxies/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default {{project}}/{{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default {{region}}/{{name}}
* ```
* ```sh
* $ pulumi import gcp:compute/regionTargetHttpProxy:RegionTargetHttpProxy default {{name}}
* ```
* */*/*/*/*/*/
*/
public class RegionTargetHttpProxy internal constructor(
override val javaResource: com.pulumi.gcp.compute.RegionTargetHttpProxy,
) : KotlinCustomResource(javaResource, RegionTargetHttpProxyMapper) {
/**
* Creation timestamp in RFC3339 text format.
*/
public val creationTimestamp: Output
get() = javaResource.creationTimestamp().applyValue({ args0 -> args0 })
/**
* An optional description of this resource.
*/
public val description: Output?
get() = javaResource.description().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* Name of the resource. Provided by the client when the resource is
* created. The name must be 1-63 characters long, and comply with
* RFC1035. Specifically, the name must be 1-63 characters long and match
* the regular expression `a-z?` which means the
* first character must be a lowercase letter, and all following
* characters must be a dash, lowercase letter, or digit, except the last
* character, which cannot be a dash.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
public val project: Output
get() = javaResource.project().applyValue({ args0 -> args0 })
/**
* The unique identifier for the resource.
*/
public val proxyId: Output
get() = javaResource.proxyId().applyValue({ args0 -> args0 })
/**
* The Region in which the created target https proxy should reside.
* If it is not provided, the provider region is used.
*/
public val region: Output
get() = javaResource.region().applyValue({ args0 -> args0 })
/**
* The URI of the created resource.
*/
public val selfLink: Output
get() = javaResource.selfLink().applyValue({ args0 -> args0 })
/**
* A reference to the RegionUrlMap resource that defines the mapping from URL
* to the BackendService.
* - - -
*/
public val urlMap: Output
get() = javaResource.urlMap().applyValue({ args0 -> args0 })
}
public object RegionTargetHttpProxyMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.gcp.compute.RegionTargetHttpProxy::class == javaResource::class
override fun map(javaResource: Resource): RegionTargetHttpProxy =
RegionTargetHttpProxy(javaResource as com.pulumi.gcp.compute.RegionTargetHttpProxy)
}
/**
* @see [RegionTargetHttpProxy].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [RegionTargetHttpProxy].
*/
public suspend fun regionTargetHttpProxy(
name: String,
block: suspend RegionTargetHttpProxyResourceBuilder.() -> Unit,
): RegionTargetHttpProxy {
val builder = RegionTargetHttpProxyResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [RegionTargetHttpProxy].
* @param name The _unique_ name of the resulting resource.
*/
public fun regionTargetHttpProxy(name: String): RegionTargetHttpProxy {
val builder = RegionTargetHttpProxyResourceBuilder()
builder.name(name)
return builder.build()
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy