@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
174 lines • 8.06 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.GatewaySecurityPolicyRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The GatewaySecurityPolicyRule resource is in a nested collection within a GatewaySecurityPolicy and represents
* a traffic matching condition and associated action to perform.
*
* To get more information about GatewaySecurityPolicyRule, see:
*
* * [API documentation](https://cloud.google.com/secure-web-proxy/docs/reference/network-security/rest/v1/projects.locations.gatewaySecurityPolicies.rules)
*
* ## Example Usage
*
* ### Network Security Gateway Security Policy Rules Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networksecurity.GatewaySecurityPolicy("default", {
* name: "my-gateway-security-policy",
* location: "us-central1",
* description: "gateway security policy created to be used as reference by the rule.",
* });
* const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
* name: "my-gateway-security-policy-rule",
* location: "us-central1",
* gatewaySecurityPolicy: _default.name,
* enabled: true,
* description: "my description",
* priority: 0,
* sessionMatcher: "host() == 'example.com'",
* basicProfile: "ALLOW",
* });
* ```
* ### Network Security Gateway Security Policy Rules Advanced
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const _default = new gcp.networksecurity.GatewaySecurityPolicy("default", {
* name: "my-gateway-security-policy",
* location: "us-central1",
* description: "gateway security policy created to be used as reference by the rule.",
* });
* const defaultGatewaySecurityPolicyRule = new gcp.networksecurity.GatewaySecurityPolicyRule("default", {
* name: "my-gateway-security-policy-rule",
* location: "us-central1",
* gatewaySecurityPolicy: _default.name,
* enabled: true,
* description: "my description",
* priority: 0,
* sessionMatcher: "host() == 'example.com'",
* applicationMatcher: "request.method == 'POST'",
* tlsInspectionEnabled: false,
* basicProfile: "ALLOW",
* });
* ```
*
* ## Import
*
* GatewaySecurityPolicyRule can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules/{{name}}`
*
* * `{{project}}/{{location}}/{{gateway_security_policy}}/{{name}}`
*
* * `{{location}}/{{gateway_security_policy}}/{{name}}`
*
* When using the `pulumi import` command, GatewaySecurityPolicyRule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default projects/{{project}}/locations/{{location}}/gatewaySecurityPolicies/{{gateway_security_policy}}/rules/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default {{project}}/{{location}}/{{gateway_security_policy}}/{{name}}
* ```
*
* ```sh
* $ pulumi import gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule default {{location}}/{{gateway_security_policy}}/{{name}}
* ```
*/
class GatewaySecurityPolicyRule extends pulumi.CustomResource {
/**
* Get an existing GatewaySecurityPolicyRule 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 GatewaySecurityPolicyRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of GatewaySecurityPolicyRule. 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'] === GatewaySecurityPolicyRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["applicationMatcher"] = state?.applicationMatcher;
resourceInputs["basicProfile"] = state?.basicProfile;
resourceInputs["createTime"] = state?.createTime;
resourceInputs["description"] = state?.description;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["gatewaySecurityPolicy"] = state?.gatewaySecurityPolicy;
resourceInputs["location"] = state?.location;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
resourceInputs["project"] = state?.project;
resourceInputs["selfLink"] = state?.selfLink;
resourceInputs["sessionMatcher"] = state?.sessionMatcher;
resourceInputs["tlsInspectionEnabled"] = state?.tlsInspectionEnabled;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.basicProfile === undefined && !opts.urn) {
throw new Error("Missing required property 'basicProfile'");
}
if (args?.enabled === undefined && !opts.urn) {
throw new Error("Missing required property 'enabled'");
}
if (args?.gatewaySecurityPolicy === undefined && !opts.urn) {
throw new Error("Missing required property 'gatewaySecurityPolicy'");
}
if (args?.location === undefined && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if (args?.sessionMatcher === undefined && !opts.urn) {
throw new Error("Missing required property 'sessionMatcher'");
}
resourceInputs["applicationMatcher"] = args?.applicationMatcher;
resourceInputs["basicProfile"] = args?.basicProfile;
resourceInputs["description"] = args?.description;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["gatewaySecurityPolicy"] = args?.gatewaySecurityPolicy;
resourceInputs["location"] = args?.location;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
resourceInputs["project"] = args?.project;
resourceInputs["sessionMatcher"] = args?.sessionMatcher;
resourceInputs["tlsInspectionEnabled"] = args?.tlsInspectionEnabled;
resourceInputs["createTime"] = undefined /*out*/;
resourceInputs["selfLink"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(GatewaySecurityPolicyRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.GatewaySecurityPolicyRule = GatewaySecurityPolicyRule;
/** @internal */
GatewaySecurityPolicyRule.__pulumiType = 'gcp:networksecurity/gatewaySecurityPolicyRule:GatewaySecurityPolicyRule';
//# sourceMappingURL=gatewaySecurityPolicyRule.js.map
;