@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
321 lines • 13.4 kB
JavaScript
"use strict";
// *** 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.Gateway = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Gateway represents the configuration for a proxy, typically a load balancer.
* It captures the ip:port over which the services are exposed by the proxy,
* along with any policy configurations. Routes have reference to to Gateways
* to dictate how requests should be routed by this Gateway.
*
* To get more information about Gateway, see:
*
* * [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1/projects.locations.gateways)
*
* ## Example Usage
*
* ### Network Services Gateway Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.Gateway("default", {
* name: "my-gateway",
* scope: "default-scope-basic",
* type: "OPEN_MESH",
* ports: [443],
* });
* ```
* ### Network Services Gateway Advanced
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networkservices.Gateway("default", {
* name: "my-gateway",
* labels: {
* foo: "bar",
* },
* description: "my description",
* type: "OPEN_MESH",
* ports: [443],
* scope: "default-scope-advance",
* });
* ```
* ### Network Services Gateway Secure Web Proxy
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "my-certificate",
* location: "us-central1",
* selfManaged: {
* pemCertificate: std.file({
* input: "test-fixtures/cert.pem",
* }).then(invoke => invoke.result),
* pemPrivateKey: std.file({
* input: "test-fixtures/private-key.pem",
* }).then(invoke => invoke.result),
* },
* });
* const defaultNetwork = new gcp.compute.Network("default", {
* name: "my-network",
* routingMode: "REGIONAL",
* autoCreateSubnetworks: false,
* });
* const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
* name: "my-subnetwork-name",
* purpose: "PRIVATE",
* ipCidrRange: "10.128.0.0/20",
* region: "us-central1",
* network: defaultNetwork.id,
* role: "ACTIVE",
* });
* const proxyonlysubnet = new gcp.compute.Subnetwork("proxyonlysubnet", {
* name: "my-proxy-only-subnetwork",
* purpose: "REGIONAL_MANAGED_PROXY",
* ipCidrRange: "192.168.0.0/23",
* region: "us-central1",
* network: defaultNetwork.id,
* role: "ACTIVE",
* });
* const defaultGatewaySecurityPolicy = new gcp.networksecurity.GatewaySecurityPolicy("default", {
* name: "my-policy-name",
* location: "us-central1",
* });
* const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
* name: "my-policyrule-name",
* location: "us-central1",
* gatewaySecurityPolicy: defaultGatewaySecurityPolicy.name,
* enabled: true,
* priority: 1,
* sessionMatcher: "host() == 'example.com'",
* basicProfile: "ALLOW",
* });
* const defaultGateway = new gcp.networkservices.Gateway("default", {
* name: "my-gateway1",
* location: "us-central1",
* addresses: ["10.128.0.99"],
* type: "SECURE_WEB_GATEWAY",
* ports: [443],
* scope: "my-default-scope1",
* certificateUrls: [_default.id],
* gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
* network: defaultNetwork.id,
* subnetwork: defaultSubnetwork.id,
* deleteSwgAutogenRouterOnDestroy: true,
* }, {
* dependsOn: [proxyonlysubnet],
* });
* ```
* ### Network Services Gateway Multiple Swp Same Network
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
* import * as std from "@pulumi/std";
*
* const _default = new gcp.certificatemanager.Certificate("default", {
* name: "my-certificate",
* location: "us-south1",
* selfManaged: {
* pemCertificate: std.file({
* input: "test-fixtures/cert.pem",
* }).then(invoke => invoke.result),
* pemPrivateKey: std.file({
* input: "test-fixtures/private-key.pem",
* }).then(invoke => invoke.result),
* },
* });
* const defaultNetwork = new gcp.compute.Network("default", {
* name: "my-network",
* routingMode: "REGIONAL",
* autoCreateSubnetworks: false,
* });
* const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
* name: "my-subnetwork-name",
* purpose: "PRIVATE",
* ipCidrRange: "10.128.0.0/20",
* region: "us-south1",
* network: defaultNetwork.id,
* role: "ACTIVE",
* });
* const proxyonlysubnet = new gcp.compute.Subnetwork("proxyonlysubnet", {
* name: "my-proxy-only-subnetwork",
* purpose: "REGIONAL_MANAGED_PROXY",
* ipCidrRange: "192.168.0.0/23",
* region: "us-south1",
* network: defaultNetwork.id,
* role: "ACTIVE",
* });
* const defaultGatewaySecurityPolicy = new gcp.networksecurity.GatewaySecurityPolicy("default", {
* name: "my-policy-name",
* location: "us-south1",
* });
* const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
* name: "my-policyrule-name",
* location: "us-south1",
* gatewaySecurityPolicy: defaultGatewaySecurityPolicy.name,
* enabled: true,
* priority: 1,
* sessionMatcher: "host() == 'example.com'",
* basicProfile: "ALLOW",
* });
* const defaultGateway = new gcp.networkservices.Gateway("default", {
* name: "my-gateway1",
* location: "us-south1",
* addresses: ["10.128.0.99"],
* type: "SECURE_WEB_GATEWAY",
* ports: [443],
* scope: "my-default-scope1",
* certificateUrls: [_default.id],
* gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
* network: defaultNetwork.id,
* subnetwork: defaultSubnetwork.id,
* deleteSwgAutogenRouterOnDestroy: true,
* }, {
* dependsOn: [proxyonlysubnet],
* });
* const gateway2 = new gcp.networkservices.Gateway("gateway2", {
* name: "my-gateway2",
* location: "us-south1",
* addresses: ["10.128.0.98"],
* type: "SECURE_WEB_GATEWAY",
* ports: [443],
* scope: "my-default-scope2",
* certificateUrls: [_default.id],
* gatewaySecurityPolicy: defaultGatewaySecurityPolicy.id,
* network: defaultNetwork.id,
* subnetwork: defaultSubnetwork.id,
* deleteSwgAutogenRouterOnDestroy: true,
* }, {
* dependsOn: [proxyonlysubnet],
* });
* ```
*
* ## Import
*
* Gateway can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/gateways/{{name}}`
*
* * `{{project}}/{{location}}/{{name}}`
*
* * `{{location}}/{{name}}`
*
* When using the `pulumi import` command, Gateway can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:networkservices/gateway:Gateway default projects/{{project}}/locations/{{location}}/gateways/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkservices/gateway:Gateway default {{project}}/{{location}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networkservices/gateway:Gateway default {{location}}/{{name}}
* ```
*/
class Gateway extends pulumi.CustomResource {
/**
* Get an existing Gateway 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 Gateway(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Gateway. 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'] === Gateway.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["addresses"] = state ? state.addresses : undefined;
resourceInputs["certificateUrls"] = state ? state.certificateUrls : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["deleteSwgAutogenRouterOnDestroy"] = state ? state.deleteSwgAutogenRouterOnDestroy : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["effectiveLabels"] = state ? state.effectiveLabels : undefined;
resourceInputs["envoyHeaders"] = state ? state.envoyHeaders : undefined;
resourceInputs["gatewaySecurityPolicy"] = state ? state.gatewaySecurityPolicy : undefined;
resourceInputs["ipVersion"] = state ? state.ipVersion : undefined;
resourceInputs["labels"] = state ? state.labels : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["network"] = state ? state.network : undefined;
resourceInputs["ports"] = state ? state.ports : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["pulumiLabels"] = state ? state.pulumiLabels : undefined;
resourceInputs["routingMode"] = state ? state.routingMode : undefined;
resourceInputs["scope"] = state ? state.scope : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["serverTlsPolicy"] = state ? state.serverTlsPolicy : undefined;
resourceInputs["subnetwork"] = state ? state.subnetwork : undefined;
resourceInputs["type"] = state ? state.type : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.ports === undefined) && !opts.urn) {
throw new Error("Missing required property 'ports'");
}
if ((!args || args.type === undefined) && !opts.urn) {
throw new Error("Missing required property 'type'");
}
resourceInputs["addresses"] = args ? args.addresses : undefined;
resourceInputs["certificateUrls"] = args ? args.certificateUrls : undefined;
resourceInputs["deleteSwgAutogenRouterOnDestroy"] = args ? args.deleteSwgAutogenRouterOnDestroy : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["envoyHeaders"] = args ? args.envoyHeaders : undefined;
resourceInputs["gatewaySecurityPolicy"] = args ? args.gatewaySecurityPolicy : undefined;
resourceInputs["ipVersion"] = args ? args.ipVersion : undefined;
resourceInputs["labels"] = args ? args.labels : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["network"] = args ? args.network : undefined;
resourceInputs["ports"] = args ? args.ports : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["routingMode"] = args ? args.routingMode : undefined;
resourceInputs["scope"] = args ? args.scope : undefined;
resourceInputs["serverTlsPolicy"] = args ? args.serverTlsPolicy : undefined;
resourceInputs["subnetwork"] = args ? args.subnetwork : undefined;
resourceInputs["type"] = args ? args.type : undefined;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["effectiveLabels"] = undefined /*out*/;
resourceInputs["pulumiLabels"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
const secretOpts = { additionalSecretOutputs: ["effectiveLabels", "pulumiLabels"] };
opts = pulumi.mergeOptions(opts, secretOpts);
super(Gateway.__pulumiType, name, resourceInputs, opts);
}
}
exports.Gateway = Gateway;
/** @internal */
Gateway.__pulumiType = 'gcp:networkservices/gateway:Gateway';
//# sourceMappingURL=gateway.js.map