@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
205 lines • 7.68 kB
JavaScript
;
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.TargetHttpProxy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a TargetHttpProxy resource, which is used by one or more global
* forwarding rule to route incoming HTTP requests to a URL map.
*
* To get more information about TargetHttpProxy, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/v1/targetHttpProxies)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/compute/docs/load-balancing/http/target-proxies)
*
* ## Example Usage
*
* ### Target Http Proxy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpProxy("default", {
* name: "test-proxy",
* urlMap: defaultURLMap.id,
* });
* ```
* ### Target Http Proxy Http Keep Alive Timeout
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
* name: "http-health-check",
* requestPath: "/",
* checkIntervalSec: 1,
* timeoutSec: 1,
* });
* const defaultBackendService = new gcp.compute.BackendService("default", {
* name: "backend-service",
* portName: "http",
* protocol: "HTTP",
* timeoutSec: 10,
* loadBalancingScheme: "EXTERNAL_MANAGED",
* healthChecks: defaultHttpHealthCheck.id,
* });
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* defaultService: defaultBackendService.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: defaultBackendService.id,
* pathRules: [{
* paths: ["/*"],
* service: defaultBackendService.id,
* }],
* }],
* });
* const _default = new gcp.compute.TargetHttpProxy("default", {
* name: "test-http-keep-alive-timeout-proxy",
* httpKeepAliveTimeoutSec: 610,
* urlMap: defaultURLMap.id,
* });
* ```
* ### Target Http Proxy Https Redirect
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultURLMap = new gcp.compute.URLMap("default", {
* name: "url-map",
* defaultUrlRedirect: {
* httpsRedirect: true,
* stripQuery: false,
* },
* });
* const _default = new gcp.compute.TargetHttpProxy("default", {
* name: "test-https-redirect-proxy",
* urlMap: defaultURLMap.id,
* });
* ```
*
* ## Import
*
* TargetHttpProxy can be imported using any of these accepted formats:
*
* * `projects/{{project}}/global/targetHttpProxies/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, TargetHttpProxy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default projects/{{project}}/global/targetHttpProxies/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/targetHttpProxy:TargetHttpProxy default {{name}}
* ```
*/
class TargetHttpProxy extends pulumi.CustomResource {
/**
* Get an existing TargetHttpProxy resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new TargetHttpProxy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of TargetHttpProxy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === TargetHttpProxy.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["creationTimestamp"] = state ? state.creationTimestamp : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["httpKeepAliveTimeoutSec"] = state ? state.httpKeepAliveTimeoutSec : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["proxyBind"] = state ? state.proxyBind : undefined;
resourceInputs["proxyId"] = state ? state.proxyId : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["urlMap"] = state ? state.urlMap : undefined;
}
else {
const args = argsOrState;
if ((!args || args.urlMap === undefined) && !opts.urn) {
throw new Error("Missing required property 'urlMap'");
}
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["httpKeepAliveTimeoutSec"] = args ? args.httpKeepAliveTimeoutSec : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["proxyBind"] = args ? args.proxyBind : undefined;
resourceInputs["urlMap"] = args ? args.urlMap : undefined;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["proxyId"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TargetHttpProxy.__pulumiType, name, resourceInputs, opts);
}
}
exports.TargetHttpProxy = TargetHttpProxy;
/** @internal */
TargetHttpProxy.__pulumiType = 'gcp:compute/targetHttpProxy:TargetHttpProxy';
//# sourceMappingURL=targetHttpProxy.js.map