@pulumiverse/grafana
Version:
A Pulumi package for creating and managing grafana.
150 lines (149 loc) • 5.71 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* Manages the entire set of permissions for a datasource. Permissions that aren't specified when applying this resource will be removed.
* * [HTTP API](https://grafana.com/docs/grafana/latest/developer-resources/api-reference/http-api/api-legacy/datasource_permissions/)
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as grafana from "@pulumiverse/grafana";
*
* const team = new grafana.oss.Team("team", {name: "Team Name"});
* const foo = new grafana.oss.DataSource("foo", {
* type: "cloudwatch",
* name: "cw-example",
* jsonDataEncoded: JSON.stringify({
* defaultRegion: "us-east-1",
* authType: "keys",
* }),
* secureJsonDataEncoded: JSON.stringify({
* accessKey: "123",
* secretKey: "456",
* }),
* });
* const user = new grafana.oss.User("user", {
* name: "test-ds-permissions",
* email: "test-ds-permissions@example.com",
* login: "test-ds-permissions",
* password: "hunter2",
* });
* const sa = new grafana.oss.ServiceAccount("sa", {
* name: "test-ds-permissions",
* role: "Viewer",
* });
* const fooPermissions = new grafana.enterprise.DataSourcePermission("fooPermissions", {
* datasourceUid: foo.uid,
* permissions: [
* {
* teamId: team.id,
* permission: "Edit",
* },
* {
* userId: user.id,
* permission: "Edit",
* },
* {
* builtInRole: "Viewer",
* permission: "Query",
* },
* {
* userId: sa.id,
* permission: "Query",
* },
* ],
* });
* ```
*
* ## Import
*
* ```sh
* terraform import grafana_data_source_permission.name "{{ datasourceID }}"
* terraform import grafana_data_source_permission.name "{{ orgID }}:{{ datasourceID }}"
* ```
*/
export declare class DataSourcePermission extends pulumi.CustomResource {
/**
* Get an existing DataSourcePermission resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: DataSourcePermissionState, opts?: pulumi.CustomResourceOptions): DataSourcePermission;
/**
* Returns true if the given object is an instance of DataSourcePermission. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is DataSourcePermission;
/**
* The plugin type of the datasource (e.g. "prometheus"). If set, skips the lookup of the datasource type from the API.
*/
readonly datasourceType: pulumi.Output<string | undefined>;
/**
* UID of the datasource to apply permissions to.
*/
readonly datasourceUid: pulumi.Output<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
readonly orgId: pulumi.Output<string | undefined>;
/**
* The permission items to add/update. Items that are omitted from the list will be removed.
*/
readonly permissions: pulumi.Output<outputs.enterprise.DataSourcePermissionPermission[] | undefined>;
/**
* Create a DataSourcePermission resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: DataSourcePermissionArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering DataSourcePermission resources.
*/
export interface DataSourcePermissionState {
/**
* The plugin type of the datasource (e.g. "prometheus"). If set, skips the lookup of the datasource type from the API.
*/
datasourceType?: pulumi.Input<string>;
/**
* UID of the datasource to apply permissions to.
*/
datasourceUid?: pulumi.Input<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: pulumi.Input<string>;
/**
* The permission items to add/update. Items that are omitted from the list will be removed.
*/
permissions?: pulumi.Input<pulumi.Input<inputs.enterprise.DataSourcePermissionPermission>[]>;
}
/**
* The set of arguments for constructing a DataSourcePermission resource.
*/
export interface DataSourcePermissionArgs {
/**
* The plugin type of the datasource (e.g. "prometheus"). If set, skips the lookup of the datasource type from the API.
*/
datasourceType?: pulumi.Input<string>;
/**
* UID of the datasource to apply permissions to.
*/
datasourceUid: pulumi.Input<string>;
/**
* The Organization ID. If not set, the Org ID defined in the provider block will be used.
*/
orgId?: pulumi.Input<string>;
/**
* The permission items to add/update. Items that are omitted from the list will be removed.
*/
permissions?: pulumi.Input<pulumi.Input<inputs.enterprise.DataSourcePermissionPermission>[]>;
}