@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
211 lines • 8.81 kB
JavaScript
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExternalAccessRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* External access firewall rules for filtering incoming traffic destined to `ExternalAddress` resources.
*
* To get more information about ExternalAccessRule, see:
*
* * [API documentation](https://cloud.google.com/vmware-engine/docs/reference/rest/v1/projects.locations.networkPolicies.externalAccessRules)
*
* ## Example Usage
*
* ### Vmware Engine External Access Rule Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const external_access_rule_nw = new gcp.vmwareengine.Network("external-access-rule-nw", {
* name: "sample-nw",
* location: "global",
* type: "STANDARD",
* description: "PC network description.",
* });
* const external_access_rule_np = new gcp.vmwareengine.NetworkPolicy("external-access-rule-np", {
* location: "us-west1",
* name: "sample-np",
* edgeServicesCidr: "192.168.30.0/26",
* vmwareEngineNetwork: external_access_rule_nw.id,
* });
* const vmw_engine_external_access_rule = new gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule", {
* name: "sample-external-access-rule",
* parent: external_access_rule_np.id,
* priority: 101,
* action: "DENY",
* ipProtocol: "TCP",
* sourceIpRanges: [{
* ipAddressRange: "0.0.0.0/0",
* }],
* sourcePorts: ["80"],
* destinationIpRanges: [{
* ipAddressRange: "0.0.0.0/0",
* }],
* destinationPorts: ["433"],
* });
* ```
* ### Vmware Engine External Access Rule Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const external_access_rule_nw = new gcp.vmwareengine.Network("external-access-rule-nw", {
* name: "sample-nw",
* location: "global",
* type: "STANDARD",
* description: "PC network description.",
* });
* const external_access_rule_pc = new gcp.vmwareengine.PrivateCloud("external-access-rule-pc", {
* location: "us-west1-a",
* name: "sample-pc",
* description: "Sample test PC.",
* networkConfig: {
* managementCidr: "192.168.50.0/24",
* vmwareEngineNetwork: external_access_rule_nw.id,
* },
* managementCluster: {
* clusterId: "sample-mgmt-cluster",
* nodeTypeConfigs: [{
* nodeTypeId: "standard-72",
* nodeCount: 3,
* }],
* },
* });
* const external_access_rule_np = new gcp.vmwareengine.NetworkPolicy("external-access-rule-np", {
* location: "us-west1",
* name: "sample-np",
* edgeServicesCidr: "192.168.30.0/26",
* vmwareEngineNetwork: external_access_rule_nw.id,
* });
* const external_access_rule_ea = new gcp.vmwareengine.ExternalAddress("external-access-rule-ea", {
* name: "sample-ea",
* parent: external_access_rule_pc.id,
* internalIp: "192.168.0.65",
* });
* const vmw_engine_external_access_rule = new gcp.vmwareengine.ExternalAccessRule("vmw-engine-external-access-rule", {
* name: "sample-external-access-rule",
* parent: external_access_rule_np.id,
* description: "Sample Description",
* priority: 101,
* action: "ALLOW",
* ipProtocol: "tcp",
* sourceIpRanges: [{
* ipAddressRange: "0.0.0.0/0",
* }],
* sourcePorts: ["80"],
* destinationIpRanges: [{
* externalAddress: external_access_rule_ea.id,
* }],
* destinationPorts: ["433"],
* });
* ```
*
* ## Import
*
* ExternalAccessRule can be imported using any of these accepted formats:
*
* * `{{parent}}/externalAccessRules/{{name}}`
*
* When using the `pulumi import` command, ExternalAccessRule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:vmwareengine/externalAccessRule:ExternalAccessRule default {{parent}}/externalAccessRules/{{name}}
* ```
*/
class ExternalAccessRule extends pulumi.CustomResource {
/**
* Get an existing ExternalAccessRule 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 ExternalAccessRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of ExternalAccessRule. 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'] === ExternalAccessRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["description"] = state?.description;
resourceInputs["destinationIpRanges"] = state?.destinationIpRanges;
resourceInputs["destinationPorts"] = state?.destinationPorts;
resourceInputs["ipProtocol"] = state?.ipProtocol;
resourceInputs["name"] = state?.name;
resourceInputs["parent"] = state?.parent;
resourceInputs["priority"] = state?.priority;
resourceInputs["sourceIpRanges"] = state?.sourceIpRanges;
resourceInputs["sourcePorts"] = state?.sourcePorts;
resourceInputs["state"] = state?.state;
resourceInputs["uid"] = state?.uid;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.action === undefined && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if (args?.destinationIpRanges === undefined && !opts.urn) {
throw new Error("Missing required property 'destinationIpRanges'");
}
if (args?.destinationPorts === undefined && !opts.urn) {
throw new Error("Missing required property 'destinationPorts'");
}
if (args?.ipProtocol === undefined && !opts.urn) {
throw new Error("Missing required property 'ipProtocol'");
}
if (args?.parent === undefined && !opts.urn) {
throw new Error("Missing required property 'parent'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if (args?.sourceIpRanges === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceIpRanges'");
}
if (args?.sourcePorts === undefined && !opts.urn) {
throw new Error("Missing required property 'sourcePorts'");
}
resourceInputs["action"] = args?.action;
resourceInputs["description"] = args?.description;
resourceInputs["destinationIpRanges"] = args?.destinationIpRanges;
resourceInputs["destinationPorts"] = args?.destinationPorts;
resourceInputs["ipProtocol"] = args?.ipProtocol;
resourceInputs["name"] = args?.name;
resourceInputs["parent"] = args?.parent;
resourceInputs["priority"] = args?.priority;
resourceInputs["sourceIpRanges"] = args?.sourceIpRanges;
resourceInputs["sourcePorts"] = args?.sourcePorts;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["state"] = undefined /*out*/;
resourceInputs["uid"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ExternalAccessRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.ExternalAccessRule = ExternalAccessRule;
/** @internal */
ExternalAccessRule.__pulumiType = 'gcp:vmwareengine/externalAccessRule:ExternalAccessRule';
//# sourceMappingURL=externalAccessRule.js.map
;