@pulumi/harness
Version:
A Pulumi package for creating and managing Harness resources.
185 lines • 6.46 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.NotificationRule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Resource for creating a Notification Rule.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as harness from "@pulumi/harness";
*
* // Sample resource for SLO
* const example = new harness.platform.NotificationRule("example", {
* orgId: "org_id",
* projectId: "project_id",
* identifier: "identifier",
* request: {
* name: "name",
* notificationMethod: {
* type: "Slack",
* spec: JSON.stringify({
* webhook_url: "http://myslackwebhookurl.com",
* user_groups: ["account.test"],
* }),
* },
* type: "ServiceLevelObjective",
* conditions: [
* {
* type: "ErrorBudgetBurnRate",
* spec: JSON.stringify({
* threshold: 1,
* }),
* },
* {
* type: "ErrorBudgetRemainingPercentage",
* spec: JSON.stringify({
* threshold: 30,
* }),
* },
* {
* type: "ErrorBudgetRemainingMinutes",
* spec: JSON.stringify({
* threshold: 300,
* }),
* },
* ],
* },
* });
* // Sample resource for Monitored Service
* const example1 = new harness.platform.NotificationRule("example1", {
* orgId: "org_id",
* projectId: "project_id",
* identifier: "identifier",
* request: {
* name: "name",
* notificationMethod: {
* type: "Slack",
* spec: JSON.stringify({
* webhook_url: "http://myslackwebhookurl.com",
* user_groups: ["account.test"],
* }),
* },
* type: "MonitoredService",
* conditions: [
* {
* type: "ChangeImpact",
* spec: JSON.stringify({
* threshold: 33,
* period: "30m",
* changeCategories: [
* "Deployment",
* "Infrastructure",
* ],
* }),
* },
* {
* type: "HealthScore",
* spec: JSON.stringify({
* threshold: 33,
* period: "30m",
* }),
* },
* {
* type: "ChangeObserved",
* spec: JSON.stringify({
* changeCategories: [
* "Deployment",
* "Alert",
* "ChaosExperiment",
* ],
* }),
* },
* {
* type: "DeploymentImpactReport",
* spec: JSON.stringify({}),
* },
* ],
* },
* });
* ```
*
* ## Import
*
* The `pulumi import` command can be used, for example:
*
* Import account level Notification Rule
*
* ```sh
* $ pulumi import harness:platform/notificationRule:NotificationRule example <notification_rule_id>
* ```
*
* Import organization level Notification Rule
*
* ```sh
* $ pulumi import harness:platform/notificationRule:NotificationRule example <org_id>/<notification_rule_id>
* ```
*
* Import project level Notification Rule
*
* ```sh
* $ pulumi import harness:platform/notificationRule:NotificationRule example <org_id>/<project_id>/<notification_rule_id>
* ```
*/
class NotificationRule extends pulumi.CustomResource {
/**
* Get an existing NotificationRule 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 NotificationRule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of NotificationRule. 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'] === NotificationRule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["identifier"] = state?.identifier;
resourceInputs["orgId"] = state?.orgId;
resourceInputs["projectId"] = state?.projectId;
resourceInputs["request"] = state?.request;
}
else {
const args = argsOrState;
if (args?.identifier === undefined && !opts.urn) {
throw new Error("Missing required property 'identifier'");
}
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["identifier"] = args?.identifier;
resourceInputs["orgId"] = args?.orgId;
resourceInputs["projectId"] = args?.projectId;
resourceInputs["request"] = args?.request;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(NotificationRule.__pulumiType, name, resourceInputs, opts);
}
}
exports.NotificationRule = NotificationRule;
/** @internal */
NotificationRule.__pulumiType = 'harness:platform/notificationRule:NotificationRule';
//# sourceMappingURL=notificationRule.js.map