@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
138 lines • 5.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.OrganizationSecurityPolicyRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* A rule for the OrganizationSecurityPolicy.
*
* To get more information about OrganizationSecurityPolicyRule, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/organizationSecurityPolicies/addRule)
* * How-to Guides
* * [Creating firewall rules](https://cloud.google.com/vpc/docs/using-firewall-policies#create-rules)
*
* ## Example Usage
*
* ### Organization Security Policy Rule Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
* displayName: "tf-test",
* parent: "organizations/123456789",
* });
* const policyOrganizationSecurityPolicyRule = new gcp.compute.OrganizationSecurityPolicyRule("policy", {
* policyId: policy.id,
* action: "allow",
* direction: "INGRESS",
* enableLogging: true,
* match: {
* config: {
* srcIpRanges: [
* "192.168.0.0/16",
* "10.0.0.0/8",
* ],
* layer4Configs: [
* {
* ipProtocol: "tcp",
* ports: ["22"],
* },
* {
* ipProtocol: "icmp",
* },
* ],
* },
* },
* priority: 100,
* });
* ```
*
* ## Import
*
* OrganizationSecurityPolicyRule can be imported using any of these accepted formats:
*
* * `{{policy_id}}/priority/{{priority}}`
*
* When using the `pulumi import` command, OrganizationSecurityPolicyRule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/organizationSecurityPolicyRule:OrganizationSecurityPolicyRule default {{policy_id}}/priority/{{priority}}
* ```
*/
class OrganizationSecurityPolicyRule extends pulumi.CustomResource {
/**
* Get an existing OrganizationSecurityPolicyRule 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 OrganizationSecurityPolicyRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of OrganizationSecurityPolicyRule. 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'] === OrganizationSecurityPolicyRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["action"] = state?.action;
resourceInputs["description"] = state?.description;
resourceInputs["direction"] = state?.direction;
resourceInputs["enableLogging"] = state?.enableLogging;
resourceInputs["match"] = state?.match;
resourceInputs["policyId"] = state?.policyId;
resourceInputs["preview"] = state?.preview;
resourceInputs["priority"] = state?.priority;
resourceInputs["targetResources"] = state?.targetResources;
resourceInputs["targetServiceAccounts"] = state?.targetServiceAccounts;
}
else {
const args = argsOrState;
if (args?.action === undefined && !opts.urn) {
throw new Error("Missing required property 'action'");
}
if (args?.match === undefined && !opts.urn) {
throw new Error("Missing required property 'match'");
}
if (args?.policyId === undefined && !opts.urn) {
throw new Error("Missing required property 'policyId'");
}
if (args?.priority === undefined && !opts.urn) {
throw new Error("Missing required property 'priority'");
}
resourceInputs["action"] = args?.action;
resourceInputs["description"] = args?.description;
resourceInputs["direction"] = args?.direction;
resourceInputs["enableLogging"] = args?.enableLogging;
resourceInputs["match"] = args?.match;
resourceInputs["policyId"] = args?.policyId;
resourceInputs["preview"] = args?.preview;
resourceInputs["priority"] = args?.priority;
resourceInputs["targetResources"] = args?.targetResources;
resourceInputs["targetServiceAccounts"] = args?.targetServiceAccounts;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(OrganizationSecurityPolicyRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.OrganizationSecurityPolicyRule = OrganizationSecurityPolicyRule;
/** @internal */
OrganizationSecurityPolicyRule.__pulumiType = 'gcp:compute/organizationSecurityPolicyRule:OrganizationSecurityPolicyRule';
//# sourceMappingURL=organizationSecurityPolicyRule.js.map
;