@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
170 lines • 5.47 kB
JavaScript
"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.getLibraryPanelOutput = exports.getLibraryPanel = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Data source for retrieving a single library panel by name or uid.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
* import * as std from "@pulumi/std";
*
* // create a minimal library panel inside the General folder
* const test = new grafana.oss.LibraryPanel("test", {
* name: "test name",
* modelJson: JSON.stringify({
* title: "test name",
* type: "text",
* version: 0,
* }),
* });
* const fromName = grafana.oss.getLibraryPanelOutput({
* name: test.name,
* });
* const fromUid = grafana.oss.getLibraryPanelOutput({
* uid: test.uid,
* });
* // create library panels to be added to a dashboard
* const dashboard = new grafana.oss.LibraryPanel("dashboard", {
* name: "panel",
* modelJson: JSON.stringify({
* gridPos: {
* x: 0,
* y: 0,
* h: 10,
* w: 10,
* },
* title: "panel",
* type: "text",
* version: 0,
* }),
* });
* // create a dashboard using the library panel
* // `merge()` will add `libraryPanel` attribute to each library panel JSON
* // Grafana will then connect any library panels found in dashboard JSON
* const withLibraryPanel = new grafana.oss.Dashboard("with_library_panel", {configJson: JSON.stringify({
* id: 12345,
* panels: [std.index.merge({
* input: [
* std.index.jsondecode({
* input: dashboard.modelJson,
* }).result,
* {
* libraryPanel: {
* name: dashboard.name,
* uid: dashboard.uid,
* },
* },
* ],
* }).result],
* title: "Production Overview",
* tags: ["templated"],
* timezone: "browser",
* schemaVersion: 16,
* version: 0,
* refresh: "25s",
* })});
* // dashboard_ids list attribute should contain dashboard id 12345
* const connectedToDashboard = grafana.oss.getLibraryPanelOutput({
* uid: dashboard.uid,
* });
* ```
*/
function getLibraryPanel(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invoke("grafana:oss/getLibraryPanel:getLibraryPanel", {
"name": args.name,
"orgId": args.orgId,
"uid": args.uid,
}, opts);
}
exports.getLibraryPanel = getLibraryPanel;
/**
* Data source for retrieving a single library panel by name or uid.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
* import * as std from "@pulumi/std";
*
* // create a minimal library panel inside the General folder
* const test = new grafana.oss.LibraryPanel("test", {
* name: "test name",
* modelJson: JSON.stringify({
* title: "test name",
* type: "text",
* version: 0,
* }),
* });
* const fromName = grafana.oss.getLibraryPanelOutput({
* name: test.name,
* });
* const fromUid = grafana.oss.getLibraryPanelOutput({
* uid: test.uid,
* });
* // create library panels to be added to a dashboard
* const dashboard = new grafana.oss.LibraryPanel("dashboard", {
* name: "panel",
* modelJson: JSON.stringify({
* gridPos: {
* x: 0,
* y: 0,
* h: 10,
* w: 10,
* },
* title: "panel",
* type: "text",
* version: 0,
* }),
* });
* // create a dashboard using the library panel
* // `merge()` will add `libraryPanel` attribute to each library panel JSON
* // Grafana will then connect any library panels found in dashboard JSON
* const withLibraryPanel = new grafana.oss.Dashboard("with_library_panel", {configJson: JSON.stringify({
* id: 12345,
* panels: [std.index.merge({
* input: [
* std.index.jsondecode({
* input: dashboard.modelJson,
* }).result,
* {
* libraryPanel: {
* name: dashboard.name,
* uid: dashboard.uid,
* },
* },
* ],
* }).result],
* title: "Production Overview",
* tags: ["templated"],
* timezone: "browser",
* schemaVersion: 16,
* version: 0,
* refresh: "25s",
* })});
* // dashboard_ids list attribute should contain dashboard id 12345
* const connectedToDashboard = grafana.oss.getLibraryPanelOutput({
* uid: dashboard.uid,
* });
* ```
*/
function getLibraryPanelOutput(args, opts) {
args = args || {};
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts || {});
return pulumi.runtime.invokeOutput("grafana:oss/getLibraryPanel:getLibraryPanel", {
"name": args.name,
"orgId": args.orgId,
"uid": args.uid,
}, opts);
}
exports.getLibraryPanelOutput = getLibraryPanelOutput;
//# sourceMappingURL=getLibraryPanel.js.map