1. Packages
  2. Grafana Cloud
  3. API Docs
  4. getDashboard
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

grafana.getDashboard

Explore with Pulumi AI

grafana logo
Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as grafana from "@pulumi/grafana";
    import * as grafana from "@pulumiverse/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",
    });
    
    import pulumi
    import json
    import pulumi_grafana as grafana
    import pulumiverse_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")
    
    package main
    
    import (
    	"encoding/json"
    
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana"
    )
    
    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, grafana.GetDashboardOutputArgs{
    			DashboardId: test.DashboardId,
    		}, nil)
    		_, err = grafana.LookupDashboard(ctx, &grafana.LookupDashboardArgs{
    			Uid: pulumi.StringRef("test-ds-dashboard-uid"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.Json;
    using Pulumi;
    using Grafana = Pulumi.Grafana;
    using Grafana = Pulumiverse.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 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());
    
        }
    }
    
    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,
                      org_id: Optional[str] = None,
                      uid: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetDashboardResult
    def get_dashboard_output(dashboard_id: Optional[pulumi.Input[int]] = None,
                      org_id: Optional[pulumi.Input[str]] = 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.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    FolderUid string
    The UID 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.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    FolderUid string
    The UID 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.
    OrgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    folderUid String
    The UID 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.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    folderUid string
    The UID 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.
    orgId string
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    folder_uid str
    The UID 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.
    org_id str
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    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
    Deprecated. Use folder_uid instead

    Deprecated: Use folder_uid instead

    folderUid String
    The UID 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.
    orgId String
    The Organization ID. If not set, the Org ID defined in the provider block will be used.
    uid String
    The uid of the Grafana dashboard. Specify either this or dashboard_id. Defaults to ``.

    Package Details

    Repository
    grafana pulumiverse/pulumi-grafana
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the grafana Terraform Provider.
    grafana logo
    Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse