@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
174 lines • 8.64 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.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, Object.assign(Object.assign({}, 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 ? state.applicationMatcher : undefined;
resourceInputs["basicProfile"] = state ? state.basicProfile : undefined;
resourceInputs["createTime"] = state ? state.createTime : undefined;
resourceInputs["description"] = state ? state.description : undefined;
resourceInputs["enabled"] = state ? state.enabled : undefined;
resourceInputs["gatewaySecurityPolicy"] = state ? state.gatewaySecurityPolicy : undefined;
resourceInputs["location"] = state ? state.location : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["priority"] = state ? state.priority : undefined;
resourceInputs["project"] = state ? state.project : undefined;
resourceInputs["selfLink"] = state ? state.selfLink : undefined;
resourceInputs["sessionMatcher"] = state ? state.sessionMatcher : undefined;
resourceInputs["tlsInspectionEnabled"] = state ? state.tlsInspectionEnabled : undefined;
resourceInputs["updateTime"] = state ? state.updateTime : undefined;
}
else {
const args = argsOrState;
if ((!args || args.basicProfile === undefined) && !opts.urn) {
throw new Error("Missing required property 'basicProfile'");
}
if ((!args || args.enabled === undefined) && !opts.urn) {
throw new Error("Missing required property 'enabled'");
}
if ((!args || args.gatewaySecurityPolicy === undefined) && !opts.urn) {
throw new Error("Missing required property 'gatewaySecurityPolicy'");
}
if ((!args || args.location === undefined) && !opts.urn) {
throw new Error("Missing required property 'location'");
}
if ((!args || args.priority === undefined) && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
if ((!args || args.sessionMatcher === undefined) && !opts.urn) {
throw new Error("Missing required property 'sessionMatcher'");
}
resourceInputs["applicationMatcher"] = args ? args.applicationMatcher : undefined;
resourceInputs["basicProfile"] = args ? args.basicProfile : undefined;
resourceInputs["description"] = args ? args.description : undefined;
resourceInputs["enabled"] = args ? args.enabled : undefined;
resourceInputs["gatewaySecurityPolicy"] = args ? args.gatewaySecurityPolicy : undefined;
resourceInputs["location"] = args ? args.location : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["priority"] = args ? args.priority : undefined;
resourceInputs["project"] = args ? args.project : undefined;
resourceInputs["sessionMatcher"] = args ? args.sessionMatcher : undefined;
resourceInputs["tlsInspectionEnabled"] = args ? args.tlsInspectionEnabled : undefined;
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