Grafana

v0.0.3 published on Sunday, Sep 18, 2022 by lbrlabs

getDashboard

Example Usage

using System.Collections.Generic;
using System.Text.Json;
using Pulumi;
using Grafana = Lbrlabs.PulumiPackage.Grafana;
using Grafana = Pulumi.Grafana;

return await Deployment.RunAsync(() => 
{
    var test = new Grafana.Dashboard("test", new()
    {
        ConfigJson = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["id"] = 12345,
            ["uid"] = "test-ds-dashboard-uid",
            ["title"] = "Production Overview",
            ["tags"] = new[]
            {
                "templated",
            },
            ["timezone"] = "browser",
            ["schemaVersion"] = 16,
            ["version"] = 0,
            ["refresh"] = "25s",
        }),
    });

    var fromId = Grafana.GetDashboard.Invoke(new()
    {
        DashboardId = test.DashboardId,
    });

    var fromUid = Grafana.GetDashboard.Invoke(new()
    {
        Uid = "test-ds-dashboard-uid",
    });

});
package main

import (
	"encoding/json"

	"github.com/lbrlabs/pulumi-grafana/sdk/go/grafana"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"id":    12345,
			"uid":   "test-ds-dashboard-uid",
			"title": "Production Overview",
			"tags": []string{
				"templated",
			},
			"timezone":      "browser",
			"schemaVersion": 16,
			"version":       0,
			"refresh":       "25s",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		test, err := grafana.NewDashboard(ctx, "test", &grafana.DashboardArgs{
			ConfigJson: pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		_ = grafana.LookupDashboardOutput(ctx, GetDashboardOutputArgs{
			DashboardId: test.DashboardId,
		}, nil)
		_, err = grafana.LookupDashboard(ctx, &GetDashboardArgs{
			Uid: pulumi.StringRef("test-ds-dashboard-uid"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.Dashboard;
import com.pulumi.grafana.DashboardArgs;
import com.pulumi.grafana.GrafanaFunctions;
import com.pulumi.grafana.inputs.GetDashboardArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var test = new Dashboard("test", DashboardArgs.builder()        
            .configJson(serializeJson(
                jsonObject(
                    jsonProperty("id", 12345),
                    jsonProperty("uid", "test-ds-dashboard-uid"),
                    jsonProperty("title", "Production Overview"),
                    jsonProperty("tags", jsonArray("templated")),
                    jsonProperty("timezone", "browser"),
                    jsonProperty("schemaVersion", 16),
                    jsonProperty("version", 0),
                    jsonProperty("refresh", "25s")
                )))
            .build());

        final var fromId = GrafanaFunctions.getDashboard(GetDashboardArgs.builder()
            .dashboardId(test.dashboardId())
            .build());

        final var fromUid = GrafanaFunctions.getDashboard(GetDashboardArgs.builder()
            .uid("test-ds-dashboard-uid")
            .build());

    }
}
import pulumi
import json
import lbrlabs_pulumi_grafana as grafana
import pulumi_grafana as grafana

test = grafana.Dashboard("test", config_json=json.dumps({
    "id": 12345,
    "uid": "test-ds-dashboard-uid",
    "title": "Production Overview",
    "tags": ["templated"],
    "timezone": "browser",
    "schemaVersion": 16,
    "version": 0,
    "refresh": "25s",
}))
from_id = grafana.get_dashboard_output(dashboard_id=test.dashboard_id)
from_uid = grafana.get_dashboard(uid="test-ds-dashboard-uid")
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";
import * as grafana from "@pulumi/grafana";

const test = new grafana.Dashboard("test", {configJson: JSON.stringify({
    id: 12345,
    uid: "test-ds-dashboard-uid",
    title: "Production Overview",
    tags: ["templated"],
    timezone: "browser",
    schemaVersion: 16,
    version: 0,
    refresh: "25s",
})});
const fromId = grafana.getDashboardOutput({
    dashboardId: test.dashboardId,
});
const fromUid = grafana.getDashboard({
    uid: "test-ds-dashboard-uid",
});
resources:
  test:
    type: grafana:Dashboard
    properties:
      configJson:
        Fn::ToJSON:
          id: 12345
          uid: test-ds-dashboard-uid
          title: Production Overview
          tags:
            - templated
          timezone: browser
          schemaVersion: 16
          version: 0
          refresh: 25s
variables:
  fromId:
    Fn::Invoke:
      Function: grafana:getDashboard
      Arguments:
        dashboardId: ${test.dashboardId}
  fromUid:
    Fn::Invoke:
      Function: grafana:getDashboard
      Arguments:
        uid: test-ds-dashboard-uid

Using getDashboard

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getDashboard(args: GetDashboardArgs, opts?: InvokeOptions): Promise<GetDashboardResult>
function getDashboardOutput(args: GetDashboardOutputArgs, opts?: InvokeOptions): Output<GetDashboardResult>
def get_dashboard(dashboard_id: Optional[int] = None,
                  uid: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetDashboardResult
def get_dashboard_output(dashboard_id: Optional[pulumi.Input[int]] = None,
                  uid: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetDashboardResult]
func LookupDashboard(ctx *Context, args *LookupDashboardArgs, opts ...InvokeOption) (*LookupDashboardResult, error)
func LookupDashboardOutput(ctx *Context, args *LookupDashboardOutputArgs, opts ...InvokeOption) LookupDashboardResultOutput

> Note: This function is named LookupDashboard in the Go SDK.

public static class GetDashboard 
{
    public static Task<GetDashboardResult> InvokeAsync(GetDashboardArgs args, InvokeOptions? opts = null)
    public static Output<GetDashboardResult> Invoke(GetDashboardInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetDashboardResult> getDashboard(GetDashboardArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: grafana:index/getDashboard:getDashboard
  Arguments:
    # Arguments dictionary

The following arguments are supported:

DashboardId int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

Uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

DashboardId int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

Uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

dashboardId Integer

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid String

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

dashboardId number

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

dashboard_id int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid str

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

dashboardId Number

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid String

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

getDashboard Result

The following output properties are available:

ConfigJson string

The complete dashboard model JSON.

Folder int

The numerical ID of the folder where the Grafana dashboard is found.

Id string

The provider-assigned unique ID for this managed resource.

IsStarred bool

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

Slug string

URL slug of the dashboard (deprecated).

Title string

The title of the Grafana dashboard.

Url string

The full URL of the dashboard.

Version int

The numerical version of the Grafana dashboard.

DashboardId int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

Uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

ConfigJson string

The complete dashboard model JSON.

Folder int

The numerical ID of the folder where the Grafana dashboard is found.

Id string

The provider-assigned unique ID for this managed resource.

IsStarred bool

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

Slug string

URL slug of the dashboard (deprecated).

Title string

The title of the Grafana dashboard.

Url string

The full URL of the dashboard.

Version int

The numerical version of the Grafana dashboard.

DashboardId int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

Uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

configJson String

The complete dashboard model JSON.

folder Integer

The numerical ID of the folder where the Grafana dashboard is found.

id String

The provider-assigned unique ID for this managed resource.

isStarred Boolean

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

slug String

URL slug of the dashboard (deprecated).

title String

The title of the Grafana dashboard.

url String

The full URL of the dashboard.

version Integer

The numerical version of the Grafana dashboard.

dashboardId Integer

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid String

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

configJson string

The complete dashboard model JSON.

folder number

The numerical ID of the folder where the Grafana dashboard is found.

id string

The provider-assigned unique ID for this managed resource.

isStarred boolean

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

slug string

URL slug of the dashboard (deprecated).

title string

The title of the Grafana dashboard.

url string

The full URL of the dashboard.

version number

The numerical version of the Grafana dashboard.

dashboardId number

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid string

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

config_json str

The complete dashboard model JSON.

folder int

The numerical ID of the folder where the Grafana dashboard is found.

id str

The provider-assigned unique ID for this managed resource.

is_starred bool

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

slug str

URL slug of the dashboard (deprecated).

title str

The title of the Grafana dashboard.

url str

The full URL of the dashboard.

version int

The numerical version of the Grafana dashboard.

dashboard_id int

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid str

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

configJson String

The complete dashboard model JSON.

folder Number

The numerical ID of the folder where the Grafana dashboard is found.

id String

The provider-assigned unique ID for this managed resource.

isStarred Boolean

Whether or not the Grafana dashboard is starred. Starred Dashboards will show up on your own Home Dashboard by default, and are a convenient way to mark Dashboards that you’re interested in.

slug String

URL slug of the dashboard (deprecated).

title String

The title of the Grafana dashboard.

url String

The full URL of the dashboard.

version Number

The numerical version of the Grafana dashboard.

dashboardId Number

The numerical ID of the Grafana dashboard. Specify either this or uid. Defaults to -1.

uid String

The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

Package Details

Repository
https://github.com/lbrlabs/pulumi-grafana
License
Apache-2.0
Notes

This Pulumi package is based on the grafana Terraform Provider.