@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
187 lines • 8.3 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! ***
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProjectCustomModule = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const utilities = __importStar(require("../utilities"));
/**
* Represents an instance of a Security Health Analytics custom module, including
* its full module name, display name, enablement state, and last updated time.
* You can create a custom module at the organization, folder, or project level.
* Custom modules that you create at the organization or folder level are inherited
* by the child folders and projects.
*
* To get more information about ProjectCustomModule, see:
*
* * [API documentation](https://cloud.google.com/security-command-center/docs/reference/rest/v1/projects.securityHealthAnalyticsSettings.customModules)
* * How-to Guides
* * [Overview of custom modules for Security Health Analytics](https://cloud.google.com/security-command-center/docs/custom-modules-sha-overview)
*
* ## Example Usage
*
* ### Scc Project Custom Module Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.securitycenter.ProjectCustomModule("example", {
* displayName: "basic_custom_module",
* enablementState: "ENABLED",
* customConfig: {
* predicate: {
* expression: "resource.rotationPeriod > duration(\"2592000s\")",
* },
* resourceSelector: {
* resourceTypes: ["cloudkms.googleapis.com/CryptoKey"],
* },
* description: "The rotation period of the identified cryptokey resource exceeds 30 days.",
* recommendation: "Set the rotation period to at most 30 days.",
* severity: "MEDIUM",
* },
* });
* ```
* ### Scc Project Custom Module Full
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const example = new gcp.securitycenter.ProjectCustomModule("example", {
* displayName: "full_custom_module",
* enablementState: "ENABLED",
* customConfig: {
* predicate: {
* expression: "resource.rotationPeriod > duration(\"2592000s\")",
* title: "Purpose of the expression",
* description: "description of the expression",
* location: "location of the expression",
* },
* customOutput: {
* properties: [{
* name: "duration",
* valueExpression: {
* expression: "resource.rotationPeriod",
* title: "Purpose of the expression",
* description: "description of the expression",
* location: "location of the expression",
* },
* }],
* },
* resourceSelector: {
* resourceTypes: ["cloudkms.googleapis.com/CryptoKey"],
* },
* severity: "LOW",
* description: "Description of the custom module",
* recommendation: "Steps to resolve violation",
* },
* });
* ```
*
* ## Import
*
* ProjectCustomModule can be imported using any of these accepted formats:
*
* * `projects/{{project}}/securityHealthAnalyticsSettings/customModules/{{name}}`
* * `{{project}}/{{name}}`
* * `{{name}}`
*
* When using the `pulumi import` command, ProjectCustomModule can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default projects/{{project}}/securityHealthAnalyticsSettings/customModules/{{name}}
* $ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default {{project}}/{{name}}
* $ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default {{name}}
* ```
*/
class ProjectCustomModule extends pulumi.CustomResource {
/**
* Get an existing ProjectCustomModule 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 ProjectCustomModule(name, state, { ...opts, id: id });
}
/** @internal */
static __pulumiType = 'gcp:securitycenter/projectCustomModule:ProjectCustomModule';
/**
* Returns true if the given object is an instance of ProjectCustomModule. 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'] === ProjectCustomModule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["ancestorModule"] = state?.ancestorModule;
resourceInputs["customConfig"] = state?.customConfig;
resourceInputs["deletionPolicy"] = state?.deletionPolicy;
resourceInputs["displayName"] = state?.displayName;
resourceInputs["enablementState"] = state?.enablementState;
resourceInputs["lastEditor"] = state?.lastEditor;
resourceInputs["name"] = state?.name;
resourceInputs["project"] = state?.project;
resourceInputs["updateTime"] = state?.updateTime;
}
else {
const args = argsOrState;
if (args?.customConfig === undefined && !opts.urn) {
throw new Error("Missing required property 'customConfig'");
}
if (args?.displayName === undefined && !opts.urn) {
throw new Error("Missing required property 'displayName'");
}
if (args?.enablementState === undefined && !opts.urn) {
throw new Error("Missing required property 'enablementState'");
}
resourceInputs["customConfig"] = args?.customConfig;
resourceInputs["deletionPolicy"] = args?.deletionPolicy;
resourceInputs["displayName"] = args?.displayName;
resourceInputs["enablementState"] = args?.enablementState;
resourceInputs["project"] = args?.project;
resourceInputs["ancestorModule"] = undefined /*out*/;
resourceInputs["lastEditor"] = undefined /*out*/;
resourceInputs["name"] = undefined /*out*/;
resourceInputs["updateTime"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(ProjectCustomModule.__pulumiType, name, resourceInputs, opts);
}
}
exports.ProjectCustomModule = ProjectCustomModule;
//# sourceMappingURL=projectCustomModule.js.map