Grafana v0.7.0 published on Tuesday, Nov 5, 2024 by pulumiverse
grafana.getUser
Explore with Pulumi AI
Deprecated: grafana.index/getuser.getUser has been deprecated in favor of grafana.oss/getuser.getUser
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.oss.User("test", {
email: "test.datasource@example.com",
name: "Testing Datasource",
login: "test-datasource",
password: "my-password",
isAdmin: true,
});
const fromId = grafana.oss.getUserOutput({
userId: test.userId,
});
const fromEmail = grafana.oss.getUserOutput({
email: test.email,
});
const fromLogin = test.login.apply(login => grafana.oss.getUserOutput({
login: login,
}));
import pulumi
import pulumi_grafana as grafana
import pulumiverse_grafana as grafana
test = grafana.oss.User("test",
email="test.datasource@example.com",
name="Testing Datasource",
login="test-datasource",
password="my-password",
is_admin=True)
from_id = grafana.oss.get_user_output(user_id=test.user_id)
from_email = grafana.oss.get_user_output(email=test.email)
from_login = test.login.apply(lambda login: grafana.oss.get_user_output(login=login))
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-grafana/sdk/go/grafana/oss"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := oss.NewUser(ctx, "test", &oss.UserArgs{
Email: pulumi.String("test.datasource@example.com"),
Name: pulumi.String("Testing Datasource"),
Login: pulumi.String("test-datasource"),
Password: pulumi.String("my-password"),
IsAdmin: pulumi.Bool(true),
})
if err != nil {
return err
}
_ = oss.LookupUserOutput(ctx, oss.GetUserOutputArgs{
UserId: test.UserId,
}, nil)
_ = oss.LookupUserOutput(ctx, oss.GetUserOutputArgs{
Email: test.Email,
}, nil)
_ = test.Login.ApplyT(func(login *string) (oss.GetUserResult, error) {
return oss.GetUserResult(interface{}(oss.LookupUserOutput(ctx, oss.GetUserOutputArgs{
Login: login,
}, nil))), nil
}).(oss.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.Oss.User("test", new()
{
Email = "test.datasource@example.com",
Name = "Testing Datasource",
Login = "test-datasource",
Password = "my-password",
IsAdmin = true,
});
var fromId = Grafana.Oss.GetUser.Invoke(new()
{
UserId = test.UserId,
});
var fromEmail = Grafana.Oss.GetUser.Invoke(new()
{
Email = test.Email,
});
var fromLogin = Grafana.Oss.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.oss.User;
import com.pulumi.grafana.oss.UserArgs;
import com.pulumi.grafana.oss.OssFunctions;
import com.pulumi.grafana.oss.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")
.name("Testing Datasource")
.login("test-datasource")
.password("my-password")
.isAdmin(true)
.build());
final var fromId = OssFunctions.getUser(GetUserArgs.builder()
.userId(test.userId())
.build());
final var fromEmail = OssFunctions.getUser(GetUserArgs.builder()
.email(test.email())
.build());
final var fromLogin = OssFunctions.getUser(GetUserArgs.builder()
.login(test.login())
.build());
}
}
resources:
test:
type: grafana:oss:User
properties:
email: test.datasource@example.com
name: Testing Datasource
login: test-datasource
password: my-password
isAdmin: true
variables:
fromId:
fn::invoke:
Function: grafana:oss:getUser
Arguments:
userId: ${test.userId}
fromEmail:
fn::invoke:
Function: grafana:oss:getUser
Arguments:
email: ${test.email}
fromLogin:
fn::invoke:
Function: grafana:oss: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.