UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

114 lines 4.47 kB
"use strict"; // *** 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.Quickstart = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages a Grafana Assistant quickstart prompt shown to users. * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as grafana from "@pulumiverse/grafana"; * * const example = new grafana.assistant.Quickstart("example", { * scope: "tenant", * title: "SLO health", * prompt: "How healthy are my SLOs right now?", * }); * // A quickstart with a context item pre-attached. `context_items` is a * // JSON-encoded array of Assistant `ChatContextItem` objects. The example below * // attaches a Prometheus data source so the Assistant starts the conversation * // with that data source already in context. * // * // This is an advanced, internal-format field. The most reliable way to obtain a * // valid value is to create the quickstart with the desired context through the * // Assistant UI and copy the resulting `contextItems` JSON into `jsonencode(...)`. * const withContext = new grafana.assistant.Quickstart("with_context", { * scope: "tenant", * title: "Investigate Prometheus alerts", * prompt: "Which alerts are firing right now and why?", * contextItems: JSON.stringify([{ * node: { * id: "prometheus-uid", * name: "Prometheus", * icon: "database", * data: { * type: "datasource", * data: { * name: "Prometheus", * uid: "prometheus-uid", * type: "prometheus", * text: "Prometheus", * }, * }, * }, * }]), * }); * ``` * * ## Import * * ```sh * terraform import grafana_assistant_quickstart.name "{{ id }}" * ``` */ class Quickstart extends pulumi.CustomResource { /** * Get an existing Quickstart 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 Quickstart(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Quickstart. 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'] === Quickstart.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["contextItems"] = state?.contextItems; resourceInputs["enabled"] = state?.enabled; resourceInputs["prompt"] = state?.prompt; resourceInputs["scope"] = state?.scope; resourceInputs["title"] = state?.title; } else { const args = argsOrState; if (args?.prompt === undefined && !opts.urn) { throw new Error("Missing required property 'prompt'"); } if (args?.scope === undefined && !opts.urn) { throw new Error("Missing required property 'scope'"); } resourceInputs["contextItems"] = args?.contextItems; resourceInputs["enabled"] = args?.enabled; resourceInputs["prompt"] = args?.prompt; resourceInputs["scope"] = args?.scope; resourceInputs["title"] = args?.title; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Quickstart.__pulumiType, name, resourceInputs, opts); } } exports.Quickstart = Quickstart; /** @internal */ Quickstart.__pulumiType = 'grafana:assistant/quickstart:Quickstart'; //# sourceMappingURL=quickstart.js.map