1. Packages
  2. New Relic
  3. API Docs
  4. getUser
New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi

newrelic.getUser

Explore with Pulumi AI

newrelic logo
New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi

    The newrelic.User data source helps search for a user by their name and/or email ID, and accordingly, fetch the ID of the matching user.

    Example Usage

    The below example illustrates fetching a the ID of a user (and other arguments) using the ID of the authentication domain the user belongs to, as well as a name and/or email ID, which can be used as criteria to search for a user who matches these specified parameters.

    import * as pulumi from "@pulumi/pulumi";
    import * as newrelic from "@pulumi/newrelic";
    
    const foo = newrelic.getAuthenticationDomain({
        name: "Test Authentication Domain",
    });
    const userOne = foo.then(foo => newrelic.getUser({
        authenticationDomainId: foo.id,
        name: "Test User",
    }));
    const userTwo = foo.then(foo => newrelic.getUser({
        authenticationDomainId: foo.id,
        emailId: "test_user@random.com",
    }));
    
    import pulumi
    import pulumi_newrelic as newrelic
    
    foo = newrelic.get_authentication_domain(name="Test Authentication Domain")
    user_one = newrelic.get_user(authentication_domain_id=foo.id,
        name="Test User")
    user_two = newrelic.get_user(authentication_domain_id=foo.id,
        email_id="test_user@random.com")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-newrelic/sdk/v5/go/newrelic"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := newrelic.GetAuthenticationDomain(ctx, &newrelic.GetAuthenticationDomainArgs{
    			Name: "Test Authentication Domain",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.LookupUser(ctx, &newrelic.LookupUserArgs{
    			AuthenticationDomainId: foo.Id,
    			Name:                   pulumi.StringRef("Test User"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = newrelic.LookupUser(ctx, &newrelic.LookupUserArgs{
    			AuthenticationDomainId: foo.Id,
    			EmailId:                pulumi.StringRef("test_user@random.com"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using NewRelic = Pulumi.NewRelic;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = NewRelic.GetAuthenticationDomain.Invoke(new()
        {
            Name = "Test Authentication Domain",
        });
    
        var userOne = NewRelic.GetUser.Invoke(new()
        {
            AuthenticationDomainId = foo.Apply(getAuthenticationDomainResult => getAuthenticationDomainResult.Id),
            Name = "Test User",
        });
    
        var userTwo = NewRelic.GetUser.Invoke(new()
        {
            AuthenticationDomainId = foo.Apply(getAuthenticationDomainResult => getAuthenticationDomainResult.Id),
            EmailId = "test_user@random.com",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.newrelic.NewrelicFunctions;
    import com.pulumi.newrelic.inputs.GetAuthenticationDomainArgs;
    import com.pulumi.newrelic.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) {
            final var foo = NewrelicFunctions.getAuthenticationDomain(GetAuthenticationDomainArgs.builder()
                .name("Test Authentication Domain")
                .build());
    
            final var userOne = NewrelicFunctions.getUser(GetUserArgs.builder()
                .authenticationDomainId(foo.applyValue(getAuthenticationDomainResult -> getAuthenticationDomainResult.id()))
                .name("Test User")
                .build());
    
            final var userTwo = NewrelicFunctions.getUser(GetUserArgs.builder()
                .authenticationDomainId(foo.applyValue(getAuthenticationDomainResult -> getAuthenticationDomainResult.id()))
                .emailId("test_user@random.com")
                .build());
    
        }
    }
    
    variables:
      foo:
        fn::invoke:
          Function: newrelic:getAuthenticationDomain
          Arguments:
            name: Test Authentication Domain
      userOne:
        fn::invoke:
          Function: newrelic:getUser
          Arguments:
            authenticationDomainId: ${foo.id}
            name: Test User
      userTwo:
        fn::invoke:
          Function: newrelic:getUser
          Arguments:
            authenticationDomainId: ${foo.id}
            emailId: test_user@random.com
    

    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(authentication_domain_id: Optional[str] = None,
                 email_id: Optional[str] = None,
                 name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetUserResult
    def get_user_output(authentication_domain_id: Optional[pulumi.Input[str]] = None,
                 email_id: Optional[pulumi.Input[str]] = None,
                 name: Optional[pulumi.Input[str]] = 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: newrelic:index/getUser:getUser
      arguments:
        # arguments dictionary

    The following arguments are supported:

    AuthenticationDomainId string
    The ID of the authentication domain the user to be searched for belongs to.
    EmailId string

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    Name string
    The name of the user to search for.
    AuthenticationDomainId string
    The ID of the authentication domain the user to be searched for belongs to.
    EmailId string

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    Name string
    The name of the user to search for.
    authenticationDomainId String
    The ID of the authentication domain the user to be searched for belongs to.
    emailId String

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    name String
    The name of the user to search for.
    authenticationDomainId string
    The ID of the authentication domain the user to be searched for belongs to.
    emailId string

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    name string
    The name of the user to search for.
    authentication_domain_id str
    The ID of the authentication domain the user to be searched for belongs to.
    email_id str

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    name str
    The name of the user to search for.
    authenticationDomainId String
    The ID of the authentication domain the user to be searched for belongs to.
    emailId String

    The email ID of the user to search for.

    It should be noted that either name or email_id must be specified in order to retrieve a matching user.

    NOTE If the name specified in the configuration matches the names of multiple users in the account, the data source will return the first match from the list of all matching users retrieved from the API. However, when using the email_id argument as the search criterion, only the user with the specified email ID will be returned, as each user has a unique email ID and multiple users cannot have the same email ID.

    NOTE The ID of an authentication domain can be retrieved using its name, via the data source newrelic.getAuthenticationDomain, as shown in the example above. Head over to the documentation of this data source for more details and examples.

    name String
    The name of the user to search for.

    getUser Result

    The following output properties are available:

    AuthenticationDomainId string
    EmailId string
    Id string
    The ID of the matching user fetched.
    Name string
    AuthenticationDomainId string
    EmailId string
    Id string
    The ID of the matching user fetched.
    Name string
    authenticationDomainId String
    emailId String
    id String
    The ID of the matching user fetched.
    name String
    authenticationDomainId string
    emailId string
    id string
    The ID of the matching user fetched.
    name string
    authentication_domain_id str
    email_id str
    id str
    The ID of the matching user fetched.
    name str
    authenticationDomainId String
    emailId String
    id String
    The ID of the matching user fetched.
    name String

    Package Details

    Repository
    New Relic pulumi/pulumi-newrelic
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the newrelic Terraform Provider.
    newrelic logo
    New Relic v5.25.3 published on Tuesday, Jun 25, 2024 by Pulumi