Grafana

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

Folder

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var testFolderFolder = new Grafana.Folder("testFolderFolder", new()
    {
        Title = "Terraform Test Folder",
    });

    var testFolderDashboard = new Grafana.Dashboard("testFolderDashboard", new()
    {
        Folder = testFolderFolder.Id,
        ConfigJson = @"{
  ""title"": ""Dashboard in folder"",
  ""uid"": ""dashboard-in-folder""
}
",
    });

    var testFolderWithUid = new Grafana.Folder("testFolderWithUid", new()
    {
        Uid = "test-folder-uid",
        Title = "Terraform Test Folder With UID",
    });

});
package main

import (
	"fmt"

	"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 {
		testFolderFolder, err := grafana.NewFolder(ctx, "testFolderFolder", &grafana.FolderArgs{
			Title: pulumi.String("Terraform Test Folder"),
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewDashboard(ctx, "testFolderDashboard", &grafana.DashboardArgs{
			Folder:     testFolderFolder.ID(),
			ConfigJson: pulumi.String(fmt.Sprintf("{\n  \"title\": \"Dashboard in folder\",\n  \"uid\": \"dashboard-in-folder\"\n}\n")),
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewFolder(ctx, "testFolderWithUid", &grafana.FolderArgs{
			Uid:   pulumi.String("test-folder-uid"),
			Title: pulumi.String("Terraform Test Folder With UID"),
		})
		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.Folder;
import com.pulumi.grafana.FolderArgs;
import com.pulumi.grafana.Dashboard;
import com.pulumi.grafana.DashboardArgs;
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 testFolderFolder = new Folder("testFolderFolder", FolderArgs.builder()        
            .title("Terraform Test Folder")
            .build());

        var testFolderDashboard = new Dashboard("testFolderDashboard", DashboardArgs.builder()        
            .folder(testFolderFolder.id())
            .configJson("""
{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
            """)
            .build());

        var testFolderWithUid = new Folder("testFolderWithUid", FolderArgs.builder()        
            .uid("test-folder-uid")
            .title("Terraform Test Folder With UID")
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

test_folder_folder = grafana.Folder("testFolderFolder", title="Terraform Test Folder")
test_folder_dashboard = grafana.Dashboard("testFolderDashboard",
    folder=test_folder_folder.id,
    config_json="""{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
""")
test_folder_with_uid = grafana.Folder("testFolderWithUid",
    uid="test-folder-uid",
    title="Terraform Test Folder With UID")
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const testFolderFolder = new grafana.Folder("testFolderFolder", {title: "Terraform Test Folder"});
const testFolderDashboard = new grafana.Dashboard("testFolderDashboard", {
    folder: testFolderFolder.id,
    configJson: `{
  "title": "Dashboard in folder",
  "uid": "dashboard-in-folder"
}
`,
});
const testFolderWithUid = new grafana.Folder("testFolderWithUid", {
    uid: "test-folder-uid",
    title: "Terraform Test Folder With UID",
});
resources:
  testFolderFolder:
    type: grafana:Folder
    properties:
      title: Terraform Test Folder
  testFolderDashboard:
    type: grafana:Dashboard
    properties:
      folder: ${testFolderFolder.id}
      configJson: |
        {
          "title": "Dashboard in folder",
          "uid": "dashboard-in-folder"
        }        
  testFolderWithUid:
    type: grafana:Folder
    properties:
      uid: test-folder-uid
      title: Terraform Test Folder With UID

Create a Folder Resource

new Folder(name: string, args: FolderArgs, opts?: CustomResourceOptions);
@overload
def Folder(resource_name: str,
           opts: Optional[ResourceOptions] = None,
           title: Optional[str] = None,
           uid: Optional[str] = None)
@overload
def Folder(resource_name: str,
           args: FolderArgs,
           opts: Optional[ResourceOptions] = None)
func NewFolder(ctx *Context, name string, args FolderArgs, opts ...ResourceOption) (*Folder, error)
public Folder(string name, FolderArgs args, CustomResourceOptions? opts = null)
public Folder(String name, FolderArgs args)
public Folder(String name, FolderArgs args, CustomResourceOptions options)
type: grafana:Folder
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args FolderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args FolderArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args FolderArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args FolderArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args FolderArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Folder Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Folder resource accepts the following input properties:

Title string

The title of the folder.

Uid string

Unique identifier.

Title string

The title of the folder.

Uid string

Unique identifier.

title String

The title of the folder.

uid String

Unique identifier.

title string

The title of the folder.

uid string

Unique identifier.

title str

The title of the folder.

uid str

Unique identifier.

title String

The title of the folder.

uid String

Unique identifier.

Outputs

All input properties are implicitly available as output properties. Additionally, the Folder resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Url string

The full URL of the folder.

Id string

The provider-assigned unique ID for this managed resource.

Url string

The full URL of the folder.

id String

The provider-assigned unique ID for this managed resource.

url String

The full URL of the folder.

id string

The provider-assigned unique ID for this managed resource.

url string

The full URL of the folder.

id str

The provider-assigned unique ID for this managed resource.

url str

The full URL of the folder.

id String

The provider-assigned unique ID for this managed resource.

url String

The full URL of the folder.

Look up an Existing Folder Resource

Get an existing Folder resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: FolderState, opts?: CustomResourceOptions): Folder
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        title: Optional[str] = None,
        uid: Optional[str] = None,
        url: Optional[str] = None) -> Folder
func GetFolder(ctx *Context, name string, id IDInput, state *FolderState, opts ...ResourceOption) (*Folder, error)
public static Folder Get(string name, Input<string> id, FolderState? state, CustomResourceOptions? opts = null)
public static Folder get(String name, Output<String> id, FolderState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Title string

The title of the folder.

Uid string

Unique identifier.

Url string

The full URL of the folder.

Title string

The title of the folder.

Uid string

Unique identifier.

Url string

The full URL of the folder.

title String

The title of the folder.

uid String

Unique identifier.

url String

The full URL of the folder.

title string

The title of the folder.

uid string

Unique identifier.

url string

The full URL of the folder.

title str

The title of the folder.

uid str

Unique identifier.

url str

The full URL of the folder.

title String

The title of the folder.

uid String

Unique identifier.

url String

The full URL of the folder.

Import

 $ pulumi import grafana:index/folder:Folder by_integer_id {{folder_id}}
 $ pulumi import grafana:index/folder:Folder by_uid {{folder_uid}}

Package Details

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

This Pulumi package is based on the grafana Terraform Provider.