@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
91 lines • 3.51 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.Rule = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Grafana Assistant rule that is injected into the assistant system prompt.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const example = new grafana.assistant.Rule("example", {
* name: "Prefer RED metrics",
* ruleContent: "When summarizing service health, prefer RED metrics.",
* scope: "tenant",
* priority: 10,
* applications: ["assistant"],
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_assistant_rule.name "{{ id }}"
* ```
*/
class Rule extends pulumi.CustomResource {
/**
* Get an existing Rule 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 Rule(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of Rule. 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'] === Rule.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["applications"] = state?.applications;
resourceInputs["description"] = state?.description;
resourceInputs["enabled"] = state?.enabled;
resourceInputs["name"] = state?.name;
resourceInputs["priority"] = state?.priority;
resourceInputs["ruleContent"] = state?.ruleContent;
resourceInputs["scope"] = state?.scope;
}
else {
const args = argsOrState;
if (args?.ruleContent === undefined && !opts.urn) {
throw new Error("Missing required property 'ruleContent'");
}
if (args?.scope === undefined && !opts.urn) {
throw new Error("Missing required property 'scope'");
}
resourceInputs["applications"] = args?.applications;
resourceInputs["description"] = args?.description;
resourceInputs["enabled"] = args?.enabled;
resourceInputs["name"] = args?.name;
resourceInputs["priority"] = args?.priority;
resourceInputs["ruleContent"] = args?.ruleContent;
resourceInputs["scope"] = args?.scope;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Rule.__pulumiType, name, resourceInputs, opts);
}
}
exports.Rule = Rule;
/** @internal */
Rule.__pulumiType = 'grafana:assistant/rule:Rule';
//# sourceMappingURL=rule.js.map