1. Packages
  2. Confluent Cloud
  3. API Docs
  4. getUser
Confluent v2.3.0 published on Friday, Sep 27, 2024 by Pulumi

confluentcloud.getUser

Explore with Pulumi AI

confluentcloud logo
Confluent v2.3.0 published on Friday, Sep 27, 2024 by Pulumi

    General Availability

    confluentcloud.getUser describes a User data source.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as confluentcloud from "@pulumi/confluentcloud";
    
    export = async () => {
        const exampleUsingId = await confluentcloud.getUser({
            id: "u-abc123",
        });
        const exampleUsingEmail = await confluentcloud.getUser({
            email: "test123@gmail.com",
        });
        const test_env = new confluentcloud.Environment("test-env", {displayName: `env_for_${exampleUsingId.fullName}`});
        const standard_cluster_on_aws = new confluentcloud.KafkaCluster("standard-cluster-on-aws", {
            displayName: "standard_kafka_cluster_on_aws",
            availability: "SINGLE_ZONE",
            cloud: "AWS",
            region: "us-west-2",
            standard: {},
            environment: {
                id: test_env.id,
            },
        });
        const test_role_binding = new confluentcloud.RoleBinding("test-role-binding", {
            principal: `User:${exampleUsingEmail.id}`,
            roleName: "CloudClusterAdmin",
            crnPattern: standard_cluster_on_aws.rbacCrn,
        });
        const exampleUsingFullName = await confluentcloud.getUser({
            fullName: "John Doe",
        });
        return {
            exampleUsingId: exampleUsingId,
        };
    }
    
    import pulumi
    import pulumi_confluentcloud as confluentcloud
    
    example_using_id = confluentcloud.get_user(id="u-abc123")
    pulumi.export("exampleUsingId", example_using_id)
    example_using_email = confluentcloud.get_user(email="test123@gmail.com")
    test_env = confluentcloud.Environment("test-env", display_name=f"env_for_{example_using_id.full_name}")
    standard_cluster_on_aws = confluentcloud.KafkaCluster("standard-cluster-on-aws",
        display_name="standard_kafka_cluster_on_aws",
        availability="SINGLE_ZONE",
        cloud="AWS",
        region="us-west-2",
        standard={},
        environment={
            "id": test_env.id,
        })
    test_role_binding = confluentcloud.RoleBinding("test-role-binding",
        principal=f"User:{example_using_email.id}",
        role_name="CloudClusterAdmin",
        crn_pattern=standard_cluster_on_aws.rbac_crn)
    example_using_full_name = confluentcloud.get_user(full_name="John Doe")
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-confluentcloud/sdk/v2/go/confluentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleUsingId, err := confluentcloud.GetUser(ctx, &confluentcloud.GetUserArgs{
    			Id: pulumi.StringRef("u-abc123"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("exampleUsingId", exampleUsingId)
    		exampleUsingEmail, err := confluentcloud.GetUser(ctx, &confluentcloud.GetUserArgs{
    			Email: pulumi.StringRef("test123@gmail.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.NewEnvironment(ctx, "test-env", &confluentcloud.EnvironmentArgs{
    			DisplayName: pulumi.Sprintf("env_for_%v", exampleUsingId.FullName),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.NewKafkaCluster(ctx, "standard-cluster-on-aws", &confluentcloud.KafkaClusterArgs{
    			DisplayName:  pulumi.String("standard_kafka_cluster_on_aws"),
    			Availability: pulumi.String("SINGLE_ZONE"),
    			Cloud:        pulumi.String("AWS"),
    			Region:       pulumi.String("us-west-2"),
    			Standard:     nil,
    			Environment: &confluentcloud.KafkaClusterEnvironmentArgs{
    				Id: test_env.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.NewRoleBinding(ctx, "test-role-binding", &confluentcloud.RoleBindingArgs{
    			Principal:  pulumi.Sprintf("User:%v", exampleUsingEmail.Id),
    			RoleName:   pulumi.String("CloudClusterAdmin"),
    			CrnPattern: standard_cluster_on_aws.RbacCrn,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = confluentcloud.GetUser(ctx, &confluentcloud.GetUserArgs{
    			FullName: pulumi.StringRef("John Doe"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using ConfluentCloud = Pulumi.ConfluentCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleUsingId = ConfluentCloud.GetUser.Invoke(new()
        {
            Id = "u-abc123",
        });
    
        var exampleUsingEmail = ConfluentCloud.GetUser.Invoke(new()
        {
            Email = "test123@gmail.com",
        });
    
        var test_env = new ConfluentCloud.Environment("test-env", new()
        {
            DisplayName = $"env_for_{exampleUsingId.Apply(getUserResult => getUserResult.FullName)}",
        });
    
        var standard_cluster_on_aws = new ConfluentCloud.KafkaCluster("standard-cluster-on-aws", new()
        {
            DisplayName = "standard_kafka_cluster_on_aws",
            Availability = "SINGLE_ZONE",
            Cloud = "AWS",
            Region = "us-west-2",
            Standard = null,
            Environment = new ConfluentCloud.Inputs.KafkaClusterEnvironmentArgs
            {
                Id = test_env.Id,
            },
        });
    
        var test_role_binding = new ConfluentCloud.RoleBinding("test-role-binding", new()
        {
            Principal = $"User:{exampleUsingEmail.Apply(getUserResult => getUserResult.Id)}",
            RoleName = "CloudClusterAdmin",
            CrnPattern = standard_cluster_on_aws.RbacCrn,
        });
    
        var exampleUsingFullName = ConfluentCloud.GetUser.Invoke(new()
        {
            FullName = "John Doe",
        });
    
        return new Dictionary<string, object?>
        {
            ["exampleUsingId"] = exampleUsingId,
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.confluentcloud.ConfluentcloudFunctions;
    import com.pulumi.confluentcloud.inputs.GetUserArgs;
    import com.pulumi.confluentcloud.Environment;
    import com.pulumi.confluentcloud.EnvironmentArgs;
    import com.pulumi.confluentcloud.KafkaCluster;
    import com.pulumi.confluentcloud.KafkaClusterArgs;
    import com.pulumi.confluentcloud.inputs.KafkaClusterStandardArgs;
    import com.pulumi.confluentcloud.inputs.KafkaClusterEnvironmentArgs;
    import com.pulumi.confluentcloud.RoleBinding;
    import com.pulumi.confluentcloud.RoleBindingArgs;
    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) {
            final var exampleUsingId = ConfluentcloudFunctions.getUser(GetUserArgs.builder()
                .id("u-abc123")
                .build());
    
            ctx.export("exampleUsingId", exampleUsingId.applyValue(getUserResult -> getUserResult));
            final var exampleUsingEmail = ConfluentcloudFunctions.getUser(GetUserArgs.builder()
                .email("test123@gmail.com")
                .build());
    
            var test_env = new Environment("test-env", EnvironmentArgs.builder()
                .displayName(String.format("env_for_%s", exampleUsingId.applyValue(getUserResult -> getUserResult.fullName())))
                .build());
    
            var standard_cluster_on_aws = new KafkaCluster("standard-cluster-on-aws", KafkaClusterArgs.builder()
                .displayName("standard_kafka_cluster_on_aws")
                .availability("SINGLE_ZONE")
                .cloud("AWS")
                .region("us-west-2")
                .standard()
                .environment(KafkaClusterEnvironmentArgs.builder()
                    .id(test_env.id())
                    .build())
                .build());
    
            var test_role_binding = new RoleBinding("test-role-binding", RoleBindingArgs.builder()
                .principal(String.format("User:%s", exampleUsingEmail.applyValue(getUserResult -> getUserResult.id())))
                .roleName("CloudClusterAdmin")
                .crnPattern(standard_cluster_on_aws.rbacCrn())
                .build());
    
            final var exampleUsingFullName = ConfluentcloudFunctions.getUser(GetUserArgs.builder()
                .fullName("John Doe")
                .build());
    
        }
    }
    
    resources:
      test-env:
        type: confluentcloud:Environment
        properties:
          displayName: env_for_${exampleUsingId.fullName}
      standard-cluster-on-aws:
        type: confluentcloud:KafkaCluster
        properties:
          displayName: standard_kafka_cluster_on_aws
          availability: SINGLE_ZONE
          cloud: AWS
          region: us-west-2
          standard: {}
          environment:
            id: ${["test-env"].id}
      test-role-binding:
        type: confluentcloud:RoleBinding
        properties:
          principal: User:${exampleUsingEmail.id}
          roleName: CloudClusterAdmin
          crnPattern: ${["standard-cluster-on-aws"].rbacCrn}
    variables:
      exampleUsingId:
        fn::invoke:
          Function: confluentcloud:getUser
          Arguments:
            id: u-abc123
      exampleUsingEmail:
        fn::invoke:
          Function: confluentcloud:getUser
          Arguments:
            email: test123@gmail.com
      exampleUsingFullName:
        fn::invoke:
          Function: confluentcloud:getUser
          Arguments:
            fullName: John Doe
    outputs:
      exampleUsingId: ${exampleUsingId}
    

    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,
                 full_name: Optional[str] = None,
                 id: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetUserResult
    def get_user_output(email: Optional[pulumi.Input[str]] = None,
                 full_name: Optional[pulumi.Input[str]] = None,
                 id: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetUserResult]
    func GetUser(ctx *Context, args *GetUserArgs, opts ...InvokeOption) (*GetUserResult, error)
    func GetUserOutput(ctx *Context, args *GetUserOutputArgs, opts ...InvokeOption) GetUserResultOutput

    > Note: This function is named GetUser 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: confluentcloud:index/getUser:getUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Email string

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    FullName string
    The full name of the User.
    Id string
    The ID of the User (e.g., u-abc123).
    Email string

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    FullName string
    The full name of the User.
    Id string
    The ID of the User (e.g., u-abc123).
    email String

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    fullName String
    The full name of the User.
    id String
    The ID of the User (e.g., u-abc123).
    email string

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    fullName string
    The full name of the User.
    id string
    The ID of the User (e.g., u-abc123).
    email str

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    full_name str
    The full name of the User.
    id str
    The ID of the User (e.g., u-abc123).
    email String

    The email address of the User.

    Note: Exactly one from the id, full_name and email attributes must be specified.

    fullName String
    The full name of the User.
    id String
    The ID of the User (e.g., u-abc123).

    getUser Result

    The following output properties are available:

    ApiVersion string
    (Required String) An API Version of the schema version of the User.
    Email string
    (Required String) The email address of the User.
    FullName string
    (Required String) The full name of the User.
    Id string
    (Required String) The ID of the User, for example, u-abc123.
    Kind string
    (Required String) A kind of the User.
    ApiVersion string
    (Required String) An API Version of the schema version of the User.
    Email string
    (Required String) The email address of the User.
    FullName string
    (Required String) The full name of the User.
    Id string
    (Required String) The ID of the User, for example, u-abc123.
    Kind string
    (Required String) A kind of the User.
    apiVersion String
    (Required String) An API Version of the schema version of the User.
    email String
    (Required String) The email address of the User.
    fullName String
    (Required String) The full name of the User.
    id String
    (Required String) The ID of the User, for example, u-abc123.
    kind String
    (Required String) A kind of the User.
    apiVersion string
    (Required String) An API Version of the schema version of the User.
    email string
    (Required String) The email address of the User.
    fullName string
    (Required String) The full name of the User.
    id string
    (Required String) The ID of the User, for example, u-abc123.
    kind string
    (Required String) A kind of the User.
    api_version str
    (Required String) An API Version of the schema version of the User.
    email str
    (Required String) The email address of the User.
    full_name str
    (Required String) The full name of the User.
    id str
    (Required String) The ID of the User, for example, u-abc123.
    kind str
    (Required String) A kind of the User.
    apiVersion String
    (Required String) An API Version of the schema version of the User.
    email String
    (Required String) The email address of the User.
    fullName String
    (Required String) The full name of the User.
    id String
    (Required String) The ID of the User, for example, u-abc123.
    kind String
    (Required String) A kind of the User.

    Package Details

    Repository
    Confluent Cloud pulumi/pulumi-confluentcloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the confluent Terraform Provider.
    confluentcloud logo
    Confluent v2.3.0 published on Friday, Sep 27, 2024 by Pulumi