@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
203 lines (202 loc) • 8.06 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as outputs from "../types/output";
/**
* Datasource for retrieving all dashboards. Specify list of folder IDs to search in for dashboards.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/)
* * [Dashboard HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
* import * as std from "@pulumi/std";
*
* const test = new grafana.oss.Organization("test", {name: "testing dashboards data source"});
* const dataSourceDashboards = new grafana.oss.Folder("data_source_dashboards", {
* orgId: test.id,
* title: "test folder data_source_dashboards",
* });
* const dataSourceDashboards1 = new grafana.oss.Dashboard("data_source_dashboards1", {
* orgId: test.id,
* folder: dataSourceDashboards.id,
* configJson: JSON.stringify({
* uid: "data-source-dashboards-1",
* title: "data_source_dashboards 1",
* tags: ["dev"],
* }),
* });
* const dataSourceDashboards2 = new grafana.oss.Dashboard("data_source_dashboards2", {
* orgId: test.id,
* configJson: JSON.stringify({
* uid: "data-source-dashboards-2",
* title: "data_source_dashboards 2",
* tags: ["prod"],
* }),
* });
* const tags = pulumi.all([test.id, dataSourceDashboards1.configJson]).apply(([id, configJson]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* tags: std.index.jsondecode({
* input: configJson,
* }).result.tags,
* }));
* const folderUids = pulumi.all([test.id, dataSourceDashboards1.folder]).apply(([id, folder]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* folderUids: [folder],
* }));
* const folderUidsTags = pulumi.all([test.id, dataSourceDashboards1.folder, dataSourceDashboards1.configJson]).apply(([id, folder, configJson]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* folderUids: [folder],
* tags: std.index.jsondecode({
* input: configJson,
* }).result.tags,
* }));
* // use depends_on to wait for dashboard resource to be created before searching
* const all = grafana.oss.getDashboardsOutput({
* orgId: test.id,
* });
* // get only one result
* const limitOne = test.id.apply(id => grafana.oss.getDashboardsOutput({
* orgId: id,
* limit: 1,
* }));
* // The dashboards are not in the default org so this should return an empty list
* const wrongOrg = grafana.oss.getDashboards({});
* ```
*/
export declare function getDashboards(args?: GetDashboardsArgs, opts?: pulumi.InvokeOptions): Promise<GetDashboardsResult>;
/**
* A collection of arguments for invoking getDashboards.
*/
export interface GetDashboardsArgs {
/**
* UIDs of Grafana folders containing dashboards. Specify to filter for dashboards by folder (eg. `["General"]` for General folder), or leave blank to get all dashboards in all folders.
*/
folderUids?: string[];
/**
* Maximum number of dashboard search results to return. Defaults to `5000`.
*/
limit?: number;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: string;
/**
* List of string Grafana dashboard tags to search for, eg. `["prod"]`. Used only as search input, i.e., attribute value will remain unchanged.
*/
tags?: string[];
}
/**
* A collection of values returned by getDashboards.
*/
export interface GetDashboardsResult {
readonly dashboards: outputs.oss.GetDashboardsDashboard[];
/**
* UIDs of Grafana folders containing dashboards. Specify to filter for dashboards by folder (eg. `["General"]` for General folder), or leave blank to get all dashboards in all folders.
*/
readonly folderUids?: string[];
/**
* The provider-assigned unique ID for this managed resource.
*/
readonly id: string;
/**
* Maximum number of dashboard search results to return. Defaults to `5000`.
*/
readonly limit?: number;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
readonly orgId?: string;
/**
* List of string Grafana dashboard tags to search for, eg. `["prod"]`. Used only as search input, i.e., attribute value will remain unchanged.
*/
readonly tags?: string[];
}
/**
* Datasource for retrieving all dashboards. Specify list of folder IDs to search in for dashboards.
*
* * [Official documentation](https://grafana.com/docs/grafana/latest/dashboards/)
* * [Dashboard HTTP API](https://grafana.com/docs/grafana/latest/developers/http_api/dashboard/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
* import * as std from "@pulumi/std";
*
* const test = new grafana.oss.Organization("test", {name: "testing dashboards data source"});
* const dataSourceDashboards = new grafana.oss.Folder("data_source_dashboards", {
* orgId: test.id,
* title: "test folder data_source_dashboards",
* });
* const dataSourceDashboards1 = new grafana.oss.Dashboard("data_source_dashboards1", {
* orgId: test.id,
* folder: dataSourceDashboards.id,
* configJson: JSON.stringify({
* uid: "data-source-dashboards-1",
* title: "data_source_dashboards 1",
* tags: ["dev"],
* }),
* });
* const dataSourceDashboards2 = new grafana.oss.Dashboard("data_source_dashboards2", {
* orgId: test.id,
* configJson: JSON.stringify({
* uid: "data-source-dashboards-2",
* title: "data_source_dashboards 2",
* tags: ["prod"],
* }),
* });
* const tags = pulumi.all([test.id, dataSourceDashboards1.configJson]).apply(([id, configJson]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* tags: std.index.jsondecode({
* input: configJson,
* }).result.tags,
* }));
* const folderUids = pulumi.all([test.id, dataSourceDashboards1.folder]).apply(([id, folder]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* folderUids: [folder],
* }));
* const folderUidsTags = pulumi.all([test.id, dataSourceDashboards1.folder, dataSourceDashboards1.configJson]).apply(([id, folder, configJson]) => grafana.oss.getDashboardsOutput({
* orgId: id,
* folderUids: [folder],
* tags: std.index.jsondecode({
* input: configJson,
* }).result.tags,
* }));
* // use depends_on to wait for dashboard resource to be created before searching
* const all = grafana.oss.getDashboardsOutput({
* orgId: test.id,
* });
* // get only one result
* const limitOne = test.id.apply(id => grafana.oss.getDashboardsOutput({
* orgId: id,
* limit: 1,
* }));
* // The dashboards are not in the default org so this should return an empty list
* const wrongOrg = grafana.oss.getDashboards({});
* ```
*/
export declare function getDashboardsOutput(args?: GetDashboardsOutputArgs, opts?: pulumi.InvokeOutputOptions): pulumi.Output<GetDashboardsResult>;
/**
* A collection of arguments for invoking getDashboards.
*/
export interface GetDashboardsOutputArgs {
/**
* UIDs of Grafana folders containing dashboards. Specify to filter for dashboards by folder (eg. `["General"]` for General folder), or leave blank to get all dashboards in all folders.
*/
folderUids?: pulumi.Input<pulumi.Input<string>[]>;
/**
* Maximum number of dashboard search results to return. Defaults to `5000`.
*/
limit?: pulumi.Input<number>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: pulumi.Input<string>;
/**
* List of string Grafana dashboard tags to search for, eg. `["prod"]`. Used only as search input, i.e., attribute value will remain unchanged.
*/
tags?: pulumi.Input<pulumi.Input<string>[]>;
}