Grafana v0.5.1 published on Wednesday, Jun 12, 2024 by pulumiverse
grafana.getUser
Explore with Pulumi AI
This data source uses Grafana’s admin APIs for reading users which does not currently work with API Tokens. You must use basic auth.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as grafana from "@pulumi/grafana";
import * as grafana from "@pulumiverse/grafana";
const test = new grafana.User("test", {
email: "test.datasource@example.com",
login: "test-datasource",
password: "my-password",
isAdmin: true,
});
const fromId = grafana.getUserOutput({
userId: test.userId,
});
const fromEmail = grafana.getUserOutput({
email: test.email,
});
const fromLogin = test.login.apply(login => grafana.getUserOutput({
login: login,
}));
import pulumi
import pulumi_grafana as grafana
import pulumiverse_grafana as grafana
test = grafana.User("test",
email="test.datasource@example.com",
login="test-datasource",
password="my-password",
is_admin=True)
from_id = grafana.get_user_output(user_id=test.user_id)
from_email = grafana.get_user_output(email=test.email)
from_login = test.login.apply(lambda login: grafana.get_user_output(login=login))
package main
import (
"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 {
test, err := grafana.NewUser(ctx, "test", &grafana.UserArgs{
Email: pulumi.String("test.datasource@example.com"),
Login: pulumi.String("test-datasource"),
Password: pulumi.String("my-password"),
IsAdmin: pulumi.Bool(true),
})
if err != nil {
return err
}
_ = grafana.LookupUserOutput(ctx, grafana.GetUserOutputArgs{
UserId: test.UserId,
}, nil)
_ = grafana.LookupUserOutput(ctx, grafana.GetUserOutputArgs{
Email: test.Email,
}, nil)
_ = test.Login.ApplyT(func(login *string) (grafana.GetUserResult, error) {
return grafana.LookupUserOutput(ctx, grafana.GetUserOutputArgs{
Login: login,
}, nil), nil
}).(grafana.GetUserResultOutput)
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Grafana = Pulumi.Grafana;
using Grafana = Pulumiverse.Grafana;
return await Deployment.RunAsync(() =>
{
var test = new Grafana.User("test", new()
{
Email = "test.datasource@example.com",
Login = "test-datasource",
Password = "my-password",
IsAdmin = true,
});
var fromId = Grafana.GetUser.Invoke(new()
{
UserId = test.UserId,
});
var fromEmail = Grafana.GetUser.Invoke(new()
{
Email = test.Email,
});
var fromLogin = Grafana.GetUser.Invoke(new()
{
Login = test.Login,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.grafana.User;
import com.pulumi.grafana.UserArgs;
import com.pulumi.grafana.GrafanaFunctions;
import com.pulumi.grafana.inputs.GetUserArgs;
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 User("test", UserArgs.builder()
.email("test.datasource@example.com")
.login("test-datasource")
.password("my-password")
.isAdmin(true)
.build());
final var fromId = GrafanaFunctions.getUser(GetUserArgs.builder()
.userId(test.userId())
.build());
final var fromEmail = GrafanaFunctions.getUser(GetUserArgs.builder()
.email(test.email())
.build());
final var fromLogin = GrafanaFunctions.getUser(GetUserArgs.builder()
.login(test.login())
.build());
}
}
resources:
test:
type: grafana:User
properties:
email: test.datasource@example.com
login: test-datasource
password: my-password
isAdmin: true
variables:
fromId:
fn::invoke:
Function: grafana:getUser
Arguments:
userId: ${test.userId}
fromEmail:
fn::invoke:
Function: grafana:getUser
Arguments:
email: ${test.email}
fromLogin:
fn::invoke:
Function: grafana:getUser
Arguments:
login: ${test.login}
Using getUser
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 getUser(args: GetUserArgs, opts?: InvokeOptions): Promise<GetUserResult>
function getUserOutput(args: GetUserOutputArgs, opts?: InvokeOptions): Output<GetUserResult>
def get_user(email: Optional[str] = None,
login: Optional[str] = None,
user_id: Optional[int] = None,
opts: Optional[InvokeOptions] = None) -> GetUserResult
def get_user_output(email: Optional[pulumi.Input[str]] = None,
login: Optional[pulumi.Input[str]] = None,
user_id: Optional[pulumi.Input[int]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
func LookupUser(ctx *Context, args *LookupUserArgs, opts ...InvokeOption) (*LookupUserResult, error)
func LookupUserOutput(ctx *Context, args *LookupUserOutputArgs, opts ...InvokeOption) LookupUserResultOutput
> Note: This function is named LookupUser
in the Go SDK.
public static class GetUser
{
public static Task<GetUserResult> InvokeAsync(GetUserArgs args, InvokeOptions? opts = null)
public static Output<GetUserResult> Invoke(GetUserInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetUserResult> getUser(GetUserArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: grafana:index/getUser:getUser
arguments:
# arguments dictionary
The following arguments are supported:
getUser Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Admin bool - Whether the user is an admin.
- Name string
- The display name for the Grafana user.
- Email string
- The email address of the Grafana user. Defaults to ``.
- Login string
- The username for the Grafana user. Defaults to ``.
- User
Id int - The numerical ID of the Grafana user. Defaults to
-1
.
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Admin bool - Whether the user is an admin.
- Name string
- The display name for the Grafana user.
- Email string
- The email address of the Grafana user. Defaults to ``.
- Login string
- The username for the Grafana user. Defaults to ``.
- User
Id int - The numerical ID of the Grafana user. Defaults to
-1
.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Admin Boolean - Whether the user is an admin.
- name String
- The display name for the Grafana user.
- email String
- The email address of the Grafana user. Defaults to ``.
- login String
- The username for the Grafana user. Defaults to ``.
- user
Id Integer - The numerical ID of the Grafana user. Defaults to
-1
.
- id string
- The provider-assigned unique ID for this managed resource.
- is
Admin boolean - Whether the user is an admin.
- name string
- The display name for the Grafana user.
- email string
- The email address of the Grafana user. Defaults to ``.
- login string
- The username for the Grafana user. Defaults to ``.
- user
Id number - The numerical ID of the Grafana user. Defaults to
-1
.
- id str
- The provider-assigned unique ID for this managed resource.
- is_
admin bool - Whether the user is an admin.
- name str
- The display name for the Grafana user.
- email str
- The email address of the Grafana user. Defaults to ``.
- login str
- The username for the Grafana user. Defaults to ``.
- user_
id int - The numerical ID of the Grafana user. Defaults to
-1
.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Admin Boolean - Whether the user is an admin.
- name String
- The display name for the Grafana user.
- email String
- The email address of the Grafana user. Defaults to ``.
- login String
- The username for the Grafana user. Defaults to ``.
- user
Id Number - The numerical ID of the Grafana user. Defaults to
-1
.
Package Details
- Repository
- grafana pulumiverse/pulumi-grafana
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
grafana
Terraform Provider.