UNPKG

@pulumiverse/grafana

Version:

A Pulumi package for creating and managing grafana.

241 lines (240 loc) 7.02 kB
import * as pulumi from "@pulumi/pulumi"; /** * 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, * }); * ``` */ export declare function getLibraryPanel(args?: GetLibraryPanelArgs, opts?: pulumi.InvokeOptions): Promise<GetLibraryPanelResult>; /** * A collection of arguments for invoking getLibraryPanel. */ export interface GetLibraryPanelArgs { /** * Name of the library panel. */ name?: string; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: string; /** * The unique identifier (UID) of the library panel. */ uid?: string; } /** * A collection of values returned by getLibraryPanel. */ export interface GetLibraryPanelResult { /** * Timestamp when the library panel was created. */ readonly created: string; /** * Numerical IDs of Grafana dashboards containing the library panel. */ readonly dashboardIds: number[]; /** * Description of the library panel. */ readonly description: string; /** * Name of the folder containing the library panel. */ readonly folderName: string; /** * Unique ID (UID) of the folder containing the library panel. */ readonly folderUid: string; /** * The provider-assigned unique ID for this managed resource. */ readonly id: string; /** * The JSON model for the library panel. */ readonly modelJson: string; /** * Name of the library panel. */ readonly name?: string; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ readonly orgId?: string; /** * The numeric ID of the library panel computed by Grafana. */ readonly panelId: number; /** * Type of the library panel (eg. text). */ readonly type: string; /** * The unique identifier (UID) of the library panel. */ readonly uid?: string; /** * Timestamp when the library panel was last modified. */ readonly updated: string; /** * Version of the library panel. */ readonly version: number; } /** * 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, * }); * ``` */ export declare function getLibraryPanelOutput(args?: GetLibraryPanelOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetLibraryPanelResult>; /** * A collection of arguments for invoking getLibraryPanel. */ export interface GetLibraryPanelOutputArgs { /** * Name of the library panel. */ name?: pulumi.Input<string>; /** * The Organization ID. If not set, the Org ID defined in the provider block will be used. */ orgId?: pulumi.Input<string>; /** * The unique identifier (UID) of the library panel. */ uid?: pulumi.Input<string>; }