UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

194 lines 7.63 kB
"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.RegionSecurityPolicy = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * ## Example Usage * * ### Region Security Policy Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const region_sec_policy_basic = new gcp.compute.RegionSecurityPolicy("region-sec-policy-basic", { * name: "my-sec-policy-basic", * description: "basic region security policy", * type: "CLOUD_ARMOR", * }); * ``` * ### Region Security Policy With Ddos Protection Config * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const region_sec_policy_ddos_protection = new gcp.compute.RegionSecurityPolicy("region-sec-policy-ddos-protection", { * name: "my-sec-policy-ddos-protection", * description: "with ddos protection config", * type: "CLOUD_ARMOR_NETWORK", * ddosProtectionConfig: { * ddosProtection: "ADVANCED_PREVIEW", * }, * }); * ``` * ### Region Security Policy With User Defined Fields * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const region_sec_policy_user_defined_fields = new gcp.compute.RegionSecurityPolicy("region-sec-policy-user-defined-fields", { * name: "my-sec-policy-user-defined-fields", * description: "with user defined fields", * type: "CLOUD_ARMOR_NETWORK", * userDefinedFields: [ * { * name: "SIG1_AT_0", * base: "UDP", * offset: 8, * size: 2, * mask: "0x8F00", * }, * { * name: "SIG2_AT_8", * base: "UDP", * offset: 16, * size: 4, * mask: "0xFFFFFFFF", * }, * ], * }); * ``` * ### Region Security Policy With Rules * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const region_sec_policy_with_rules = new gcp.compute.RegionSecurityPolicy("region-sec-policy-with-rules", { * name: "my-sec-policy-with-rules", * description: "basic region security policy with multiple rules", * type: "CLOUD_ARMOR", * rules: [ * { * action: "deny", * priority: 1000, * match: { * expr: { * expression: "request.path.matches(\"/login.html\") && token.recaptcha_session.score < 0.2", * }, * }, * }, * { * action: "deny", * priority: 2147483647, * match: { * versionedExpr: "SRC_IPS_V1", * config: { * srcIpRanges: ["*"], * }, * }, * description: "default rule", * }, * ], * }); * ``` * * ## Import * * RegionSecurityPolicy can be imported using any of these accepted formats: * * * `projects/{{project}}/regions/{{region}}/securityPolicies/{{name}}` * * * `{{project}}/{{region}}/{{name}}` * * * `{{region}}/{{name}}` * * * `{{name}}` * * When using the `pulumi import` command, RegionSecurityPolicy can be imported using one of the formats above. For example: * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default projects/{{project}}/regions/{{region}}/securityPolicies/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{project}}/{{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{region}}/{{name}} * ``` * * ```sh * $ pulumi import gcp:compute/regionSecurityPolicy:RegionSecurityPolicy default {{name}} * ``` */ class RegionSecurityPolicy extends pulumi.CustomResource { /** * Get an existing RegionSecurityPolicy 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 RegionSecurityPolicy(name, state, Object.assign(Object.assign({}, opts), { id: id })); } /** * Returns true if the given object is an instance of RegionSecurityPolicy. 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'] === RegionSecurityPolicy.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["ddosProtectionConfig"] = state ? state.ddosProtectionConfig : undefined; resourceInputs["description"] = state ? state.description : undefined; resourceInputs["fingerprint"] = state ? state.fingerprint : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["policyId"] = state ? state.policyId : undefined; resourceInputs["project"] = state ? state.project : undefined; resourceInputs["region"] = state ? state.region : undefined; resourceInputs["rules"] = state ? state.rules : undefined; resourceInputs["selfLink"] = state ? state.selfLink : undefined; resourceInputs["selfLinkWithPolicyId"] = state ? state.selfLinkWithPolicyId : undefined; resourceInputs["type"] = state ? state.type : undefined; resourceInputs["userDefinedFields"] = state ? state.userDefinedFields : undefined; } else { const args = argsOrState; resourceInputs["ddosProtectionConfig"] = args ? args.ddosProtectionConfig : undefined; resourceInputs["description"] = args ? args.description : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["project"] = args ? args.project : undefined; resourceInputs["region"] = args ? args.region : undefined; resourceInputs["rules"] = args ? args.rules : undefined; resourceInputs["type"] = args ? args.type : undefined; resourceInputs["userDefinedFields"] = args ? args.userDefinedFields : undefined; resourceInputs["fingerprint"] = undefined /*out*/; resourceInputs["policyId"] = undefined /*out*/; resourceInputs["selfLink"] = undefined /*out*/; resourceInputs["selfLinkWithPolicyId"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(RegionSecurityPolicy.__pulumiType, name, resourceInputs, opts); } } exports.RegionSecurityPolicy = RegionSecurityPolicy; /** @internal */ RegionSecurityPolicy.__pulumiType = 'gcp:compute/regionSecurityPolicy:RegionSecurityPolicy'; //# sourceMappingURL=regionSecurityPolicy.js.map