Grafana

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

DataSourcePermission

Example Usage

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

return await Deployment.RunAsync(() => 
{
    var team = new Grafana.Team("team");

    var foo = new Grafana.DataSource("foo", new()
    {
        Type = "cloudwatch",
        JsonDatas = new[]
        {
            new Grafana.Inputs.DataSourceJsonDataArgs
            {
                DefaultRegion = "us-east-1",
                AuthType = "keys",
            },
        },
        SecureJsonDatas = new[]
        {
            new Grafana.Inputs.DataSourceSecureJsonDataArgs
            {
                AccessKey = "123",
                SecretKey = "456",
            },
        },
    });

    var fooPermissions = new Grafana.DataSourcePermission("fooPermissions", new()
    {
        DatasourceId = foo.Id,
        Permissions = new[]
        {
            new Grafana.Inputs.DataSourcePermissionPermissionArgs
            {
                TeamId = team.Id,
                Permission = "Query",
            },
            new Grafana.Inputs.DataSourcePermissionPermissionArgs
            {
                UserId = 3,
                Permission = "Query",
            },
        },
    });

});
package main

import (
	"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 {
		team, err := grafana.NewTeam(ctx, "team", nil)
		if err != nil {
			return err
		}
		foo, err := grafana.NewDataSource(ctx, "foo", &grafana.DataSourceArgs{
			Type: pulumi.String("cloudwatch"),
			JsonDatas: DataSourceJsonDataArray{
				&DataSourceJsonDataArgs{
					DefaultRegion: pulumi.String("us-east-1"),
					AuthType:      pulumi.String("keys"),
				},
			},
			SecureJsonDatas: DataSourceSecureJsonDataArray{
				&DataSourceSecureJsonDataArgs{
					AccessKey: pulumi.String("123"),
					SecretKey: pulumi.String("456"),
				},
			},
		})
		if err != nil {
			return err
		}
		_, err = grafana.NewDataSourcePermission(ctx, "fooPermissions", &grafana.DataSourcePermissionArgs{
			DatasourceId: foo.ID(),
			Permissions: DataSourcePermissionPermissionArray{
				&DataSourcePermissionPermissionArgs{
					TeamId:     team.ID(),
					Permission: pulumi.String("Query"),
				},
				&DataSourcePermissionPermissionArgs{
					UserId:     pulumi.Int(3),
					Permission: pulumi.String("Query"),
				},
			},
		})
		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.Team;
import com.pulumi.grafana.DataSource;
import com.pulumi.grafana.DataSourceArgs;
import com.pulumi.grafana.inputs.DataSourceJsonDataArgs;
import com.pulumi.grafana.inputs.DataSourceSecureJsonDataArgs;
import com.pulumi.grafana.DataSourcePermission;
import com.pulumi.grafana.DataSourcePermissionArgs;
import com.pulumi.grafana.inputs.DataSourcePermissionPermissionArgs;
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 team = new Team("team");

        var foo = new DataSource("foo", DataSourceArgs.builder()        
            .type("cloudwatch")
            .jsonDatas(DataSourceJsonDataArgs.builder()
                .defaultRegion("us-east-1")
                .authType("keys")
                .build())
            .secureJsonDatas(DataSourceSecureJsonDataArgs.builder()
                .accessKey("123")
                .secretKey("456")
                .build())
            .build());

        var fooPermissions = new DataSourcePermission("fooPermissions", DataSourcePermissionArgs.builder()        
            .datasourceId(foo.id())
            .permissions(            
                DataSourcePermissionPermissionArgs.builder()
                    .teamId(team.id())
                    .permission("Query")
                    .build(),
                DataSourcePermissionPermissionArgs.builder()
                    .userId(3)
                    .permission("Query")
                    .build())
            .build());

    }
}
import pulumi
import lbrlabs_pulumi_grafana as grafana

team = grafana.Team("team")
foo = grafana.DataSource("foo",
    type="cloudwatch",
    json_datas=[grafana.DataSourceJsonDataArgs(
        default_region="us-east-1",
        auth_type="keys",
    )],
    secure_json_datas=[grafana.DataSourceSecureJsonDataArgs(
        access_key="123",
        secret_key="456",
    )])
foo_permissions = grafana.DataSourcePermission("fooPermissions",
    datasource_id=foo.id,
    permissions=[
        grafana.DataSourcePermissionPermissionArgs(
            team_id=team.id,
            permission="Query",
        ),
        grafana.DataSourcePermissionPermissionArgs(
            user_id=3,
            permission="Query",
        ),
    ])
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@lbrlabs/pulumi-grafana";

const team = new grafana.Team("team", {});
const foo = new grafana.DataSource("foo", {
    type: "cloudwatch",
    jsonDatas: [{
        defaultRegion: "us-east-1",
        authType: "keys",
    }],
    secureJsonDatas: [{
        accessKey: "123",
        secretKey: "456",
    }],
});
const fooPermissions = new grafana.DataSourcePermission("fooPermissions", {
    datasourceId: foo.id,
    permissions: [
        {
            teamId: team.id,
            permission: "Query",
        },
        {
            userId: 3,
            permission: "Query",
        },
    ],
});
resources:
  team:
    type: grafana:Team
  foo:
    type: grafana:DataSource
    properties:
      type: cloudwatch
      jsonDatas:
        - defaultRegion: us-east-1
          authType: keys
      secureJsonDatas:
        - accessKey: 123
          secretKey: 456
  fooPermissions:
    type: grafana:DataSourcePermission
    properties:
      datasourceId: ${foo.id}
      permissions:
        - teamId: ${team.id}
          permission: Query
        - userId: 3
          permission: Query

Create a DataSourcePermission Resource

new DataSourcePermission(name: string, args: DataSourcePermissionArgs, opts?: CustomResourceOptions);
@overload
def DataSourcePermission(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         datasource_id: Optional[int] = None,
                         permissions: Optional[Sequence[DataSourcePermissionPermissionArgs]] = None)
@overload
def DataSourcePermission(resource_name: str,
                         args: DataSourcePermissionArgs,
                         opts: Optional[ResourceOptions] = None)
func NewDataSourcePermission(ctx *Context, name string, args DataSourcePermissionArgs, opts ...ResourceOption) (*DataSourcePermission, error)
public DataSourcePermission(string name, DataSourcePermissionArgs args, CustomResourceOptions? opts = null)
public DataSourcePermission(String name, DataSourcePermissionArgs args)
public DataSourcePermission(String name, DataSourcePermissionArgs args, CustomResourceOptions options)
type: grafana:DataSourcePermission
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DataSourcePermissionArgs
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 DataSourcePermissionArgs
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 DataSourcePermissionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DataSourcePermissionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DataSourcePermissionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DataSourcePermission 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 DataSourcePermission resource accepts the following input properties:

DatasourceId int

ID of the datasource to apply permissions to.

Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.DataSourcePermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

DatasourceId int

ID of the datasource to apply permissions to.

Permissions []DataSourcePermissionPermissionArgs

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId Integer

ID of the datasource to apply permissions to.

permissions List<DataSourcePermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId number

ID of the datasource to apply permissions to.

permissions DataSourcePermissionPermissionArgs[]

The permission items to add/update. Items that are omitted from the list will be removed.

datasource_id int

ID of the datasource to apply permissions to.

permissions Sequence[DataSourcePermissionPermissionArgs]

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId Number

ID of the datasource to apply permissions to.

permissions List<Property Map>

The permission items to add/update. Items that are omitted from the list will be removed.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing DataSourcePermission Resource

Get an existing DataSourcePermission 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?: DataSourcePermissionState, opts?: CustomResourceOptions): DataSourcePermission
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        datasource_id: Optional[int] = None,
        permissions: Optional[Sequence[DataSourcePermissionPermissionArgs]] = None) -> DataSourcePermission
func GetDataSourcePermission(ctx *Context, name string, id IDInput, state *DataSourcePermissionState, opts ...ResourceOption) (*DataSourcePermission, error)
public static DataSourcePermission Get(string name, Input<string> id, DataSourcePermissionState? state, CustomResourceOptions? opts = null)
public static DataSourcePermission get(String name, Output<String> id, DataSourcePermissionState 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:
DatasourceId int

ID of the datasource to apply permissions to.

Permissions List<Lbrlabs.PulumiPackage.Grafana.Inputs.DataSourcePermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

DatasourceId int

ID of the datasource to apply permissions to.

Permissions []DataSourcePermissionPermissionArgs

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId Integer

ID of the datasource to apply permissions to.

permissions List<DataSourcePermissionPermissionArgs>

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId number

ID of the datasource to apply permissions to.

permissions DataSourcePermissionPermissionArgs[]

The permission items to add/update. Items that are omitted from the list will be removed.

datasource_id int

ID of the datasource to apply permissions to.

permissions Sequence[DataSourcePermissionPermissionArgs]

The permission items to add/update. Items that are omitted from the list will be removed.

datasourceId Number

ID of the datasource to apply permissions to.

permissions List<Property Map>

The permission items to add/update. Items that are omitted from the list will be removed.

Supporting Types

DataSourcePermissionPermission

Permission string

Permission to associate with item. Must be Query.

TeamId int

ID of the team to manage permissions for. Defaults to 0.

UserId int

ID of the user to manage permissions for. Defaults to 0.

Permission string

Permission to associate with item. Must be Query.

TeamId int

ID of the team to manage permissions for. Defaults to 0.

UserId int

ID of the user to manage permissions for. Defaults to 0.

permission String

Permission to associate with item. Must be Query.

teamId Integer

ID of the team to manage permissions for. Defaults to 0.

userId Integer

ID of the user to manage permissions for. Defaults to 0.

permission string

Permission to associate with item. Must be Query.

teamId number

ID of the team to manage permissions for. Defaults to 0.

userId number

ID of the user to manage permissions for. Defaults to 0.

permission str

Permission to associate with item. Must be Query.

team_id int

ID of the team to manage permissions for. Defaults to 0.

user_id int

ID of the user to manage permissions for. Defaults to 0.

permission String

Permission to associate with item. Must be Query.

teamId Number

ID of the team to manage permissions for. Defaults to 0.

userId Number

ID of the user to manage permissions for. Defaults to 0.

Package Details

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

This Pulumi package is based on the grafana Terraform Provider.