@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
196 lines • 7.74 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.TargetGrpcProxy = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Represents a Target gRPC Proxy resource. A target gRPC proxy is a component
* of load balancers intended for load balancing gRPC traffic. Global forwarding
* rules reference a target gRPC proxy. The Target gRPC Proxy references
* a URL map which specifies how traffic routes to gRPC backend services.
*
* To get more information about TargetGrpcProxy, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/v1/targetGrpcProxies)
* * How-to Guides
* * [Using Target gRPC Proxies](https://cloud.google.com/traffic-director/docs/proxyless-overview)
*
* ## Example Usage
*
* ### Target Grpc Proxy Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const defaultHealthCheck = new gcp.compute.HealthCheck("default", {
* name: "healthcheck",
* timeoutSec: 1,
* checkIntervalSec: 1,
* grpcHealthCheck: {
* portName: "health-check-port",
* portSpecification: "USE_NAMED_PORT",
* grpcServiceName: "testservice",
* },
* });
* const home = new gcp.compute.BackendService("home", {
* name: "backend",
* portName: "grpc",
* protocol: "GRPC",
* timeoutSec: 10,
* healthChecks: defaultHealthCheck.id,
* loadBalancingScheme: "INTERNAL_SELF_MANAGED",
* });
* const urlmap = new gcp.compute.URLMap("urlmap", {
* name: "urlmap",
* description: "a description",
* defaultService: home.id,
* hostRules: [{
* hosts: ["mysite.com"],
* pathMatcher: "allpaths",
* }],
* pathMatchers: [{
* name: "allpaths",
* defaultService: home.id,
* routeRules: [{
* priority: 1,
* headerAction: {
* requestHeadersToRemoves: ["RemoveMe2"],
* requestHeadersToAdds: [{
* headerName: "AddSomethingElse",
* headerValue: "MyOtherValue",
* replace: true,
* }],
* responseHeadersToRemoves: ["RemoveMe3"],
* responseHeadersToAdds: [{
* headerName: "AddMe",
* headerValue: "MyValue",
* replace: false,
* }],
* },
* matchRules: [{
* fullPathMatch: "a full path",
* headerMatches: [{
* headerName: "someheader",
* exactMatch: "match this exactly",
* invertMatch: true,
* }],
* ignoreCase: true,
* metadataFilters: [{
* filterMatchCriteria: "MATCH_ANY",
* filterLabels: [{
* name: "PLANET",
* value: "MARS",
* }],
* }],
* queryParameterMatches: [{
* name: "a query parameter",
* presentMatch: true,
* }],
* }],
* urlRedirect: {
* hostRedirect: "A host",
* httpsRedirect: false,
* pathRedirect: "some/path",
* redirectResponseCode: "TEMPORARY_REDIRECT",
* stripQuery: true,
* },
* }],
* }],
* tests: [{
* service: home.id,
* host: "hi.com",
* path: "/home",
* }],
* });
* const _default = new gcp.compute.TargetGrpcProxy("default", {
* name: "proxy",
* urlMap: urlmap.id,
* validateForProxyless: true,
* });
* ```
*
* ## Import
*
* TargetGrpcProxy can be imported using any of these accepted formats:
*
* * `projects/{{project}}/global/targetGrpcProxies/{{name}}`
*
* * `{{project}}/{{name}}`
*
* * `{{name}}`
*
* When using the `pulumi import` command, TargetGrpcProxy can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default projects/{{project}}/global/targetGrpcProxies/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default {{project}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/targetGrpcProxy:TargetGrpcProxy default {{name}}
* ```
*/
class TargetGrpcProxy extends pulumi.CustomResource {
/**
* Get an existing TargetGrpcProxy 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 TargetGrpcProxy(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of TargetGrpcProxy. 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'] === TargetGrpcProxy.__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["fingerprint"] = state ? state.fingerprint : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["selfLinkWithId"] = state ? state.selfLinkWithId : undefined;
resourceInputs["urlMap"] = state ? state.urlMap : undefined;
resourceInputs["validateForProxyless"] = state ? state.validateForProxyless : undefined;
}
else {
const args = argsOrState;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["urlMap"] = args ? args.urlMap : undefined;
resourceInputs["validateForProxyless"] = args ? args.validateForProxyless : undefined;
resourceInputs["creationTimestamp"] = undefined /*out*/;
resourceInputs["fingerprint"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["selfLinkWithId"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(TargetGrpcProxy.__pulumiType, name, resourceInputs, opts);
}
}
exports.TargetGrpcProxy = TargetGrpcProxy;
/** @internal */
TargetGrpcProxy.__pulumiType = 'gcp:compute/targetGrpcProxy:TargetGrpcProxy';
//# sourceMappingURL=targetGrpcProxy.js.map