@pulumi/harness
Version:
A Pulumi package for creating and managing Harness resources.
214 lines • 7.74 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.SecurityGovernanceCondition = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for managing a Harness Chaos Security Governance Condition
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as harness from "@pulumi/harness";
*
* // Example of a Kubernetes Security Governance Condition
* const k8sCondition = new harness.chaos.SecurityGovernanceCondition("k8s_condition", {
* orgId: orgId,
* projectId: projectId,
* name: "k8s-security-condition",
* description: "Security governance condition for Kubernetes workloads",
* infraType: "KubernetesV2",
* faultSpec: {
* operator: "NOT_EQUAL_TO",
* faults: [
* {
* faultType: "FAULT",
* name: "pod-delete",
* },
* {
* faultType: "FAULT",
* name: "pod-dns",
* },
* ],
* },
* k8sSpec: {
* infraSpec: {
* operator: "EQUAL_TO",
* infraIds: [k8sInfraId],
* },
* applicationSpec: {
* operator: "EQUAL_TO",
* workloads: [{
* namespace: "default",
* kind: "deployment",
* label: "app=nginx",
* services: ["nginx-service"],
* applicationMapId: "nginx-app",
* }],
* },
* chaosServiceAccountSpec: {
* operator: "EQUAL_TO",
* serviceAccounts: [
* "default",
* "chaos-service-account",
* ],
* },
* },
* tags: [
* "env:prod",
* "team:security",
* "platform:k8s",
* ],
* });
* // Example of a Windows Security Governance Condition
* const windowsCondition = new harness.chaos.SecurityGovernanceCondition("windows_condition", {
* orgId: orgId,
* projectId: projectId,
* name: "windows-security-condition",
* description: "Security governance condition for Windows hosts",
* infraType: "Windows",
* faultSpec: {
* operator: "NOT_EQUAL_TO",
* faults: [
* {
* faultType: "FAULT",
* name: "process-kill",
* },
* {
* faultType: "FAULT",
* name: "cpu-hog",
* },
* ],
* },
* machineSpec: {
* infraSpec: {
* operator: "EQUAL_TO",
* infraIds: [windowsInfraId],
* },
* },
* tags: [
* "env:prod",
* "team:security",
* "platform:windows",
* ],
* });
* // Example of a Linux Security Governance Condition
* const linuxCondition = new harness.chaos.SecurityGovernanceCondition("linux_condition", {
* orgId: orgId,
* projectId: projectId,
* name: "linux-security-condition",
* description: "Security governance condition for Linux hosts",
* infraType: "Linux",
* faultSpec: {
* operator: "NOT_EQUAL_TO",
* faults: [
* {
* faultType: "FAULT",
* name: "process-kill",
* },
* {
* faultType: "FAULT",
* name: "memory-hog",
* },
* ],
* },
* machineSpec: {
* infraSpec: {
* operator: "EQUAL_TO",
* infraIds: [linuxInfraId],
* },
* },
* tags: [
* "env:prod",
* "team:security",
* "platform:linux",
* ],
* });
* export const k8sConditionId = k8sCondition.id;
* export const windowsConditionId = windowsCondition.id;
* export const linuxConditionId = linuxCondition.id;
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* Import Project level Chaos Security Governance Condition
*
* ```sh
* $ pulumi import harness:chaos/securityGovernanceCondition:SecurityGovernanceCondition example org_id/project_id/condition_id
* ```
*/
class SecurityGovernanceCondition extends pulumi.CustomResource {
/**
* Get an existing SecurityGovernanceCondition 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 SecurityGovernanceCondition(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of SecurityGovernanceCondition. 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'] === SecurityGovernanceCondition.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["description"] = state?.description;
resourceInputs["faultSpec"] = state?.faultSpec;
resourceInputs["infraType"] = state?.infraType;
resourceInputs["k8sSpec"] = state?.k8sSpec;
resourceInputs["machineSpec"] = state?.machineSpec;
resourceInputs["name"] = state?.name;
resourceInputs["orgId"] = state?.orgId;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["tags"] = state?.tags;
}
else {
const args = argsOrState;
if (args?.faultSpec === undefined && !opts.urn) {
throw new Error("Missing required property 'faultSpec'");
}
if (args?.infraType === undefined && !opts.urn) {
throw new Error("Missing required property 'infraType'");
}
if (args?.orgId === undefined && !opts.urn) {
throw new Error("Missing required property 'orgId'");
}
if (args?.projectId === undefined && !opts.urn) {
throw new Error("Missing required property 'projectId'");
}
resourceInputs["description"] = args?.description;
resourceInputs["faultSpec"] = args?.faultSpec;
resourceInputs["infraType"] = args?.infraType;
resourceInputs["k8sSpec"] = args?.k8sSpec;
resourceInputs["machineSpec"] = args?.machineSpec;
resourceInputs["name"] = args?.name;
resourceInputs["orgId"] = args?.orgId;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["tags"] = args?.tags;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(SecurityGovernanceCondition.__pulumiType, name, resourceInputs, opts);
}
}
exports.SecurityGovernanceCondition = SecurityGovernanceCondition;
/** @internal */
SecurityGovernanceCondition.__pulumiType = 'harness:chaos/securityGovernanceCondition:SecurityGovernanceCondition';
//# sourceMappingURL=securityGovernanceCondition.js.map