1. Packages
  2. GitHub
  3. API Docs
  4. getUsers
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

github.getUsers

Explore with Pulumi AI

github logo
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

    Use this data source to retrieve information about multiple GitHub users at once.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const example = github.getUsers({
        usernames: [
            "example1",
            "example2",
            "example3",
        ],
    });
    export const validUsers = example.then(example => example.logins);
    export const invalidUsers = example.then(example => example.unknownLogins);
    
    import pulumi
    import pulumi_github as github
    
    example = github.get_users(usernames=[
        "example1",
        "example2",
        "example3",
    ])
    pulumi.export("validUsers", example.logins)
    pulumi.export("invalidUsers", example.unknown_logins)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-github/sdk/v6/go/github"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := github.GetUsers(ctx, &github.GetUsersArgs{
    			Usernames: []string{
    				"example1",
    				"example2",
    				"example3",
    			},
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("validUsers", example.Logins)
    		ctx.Export("invalidUsers", example.UnknownLogins)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Github.GetUsers.Invoke(new()
        {
            Usernames = new[]
            {
                "example1",
                "example2",
                "example3",
            },
        });
    
        return new Dictionary<string, object?>
        {
            ["validUsers"] = example.Apply(getUsersResult => getUsersResult.Logins),
            ["invalidUsers"] = example.Apply(getUsersResult => getUsersResult.UnknownLogins),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.GithubFunctions;
    import com.pulumi.github.inputs.GetUsersArgs;
    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 example = GithubFunctions.getUsers(GetUsersArgs.builder()
                .usernames(            
                    "example1",
                    "example2",
                    "example3")
                .build());
    
            ctx.export("validUsers", example.applyValue(getUsersResult -> getUsersResult.logins()));
            ctx.export("invalidUsers", example.applyValue(getUsersResult -> getUsersResult.unknownLogins()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: github:getUsers
          Arguments:
            usernames:
              - example1
              - example2
              - example3
    outputs:
      validUsers: ${example.logins}
      invalidUsers: ${example.unknownLogins}
    

    Using getUsers

    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 getUsers(args: GetUsersArgs, opts?: InvokeOptions): Promise<GetUsersResult>
    function getUsersOutput(args: GetUsersOutputArgs, opts?: InvokeOptions): Output<GetUsersResult>
    def get_users(usernames: Optional[Sequence[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> GetUsersResult
    def get_users_output(usernames: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetUsersResult]
    func GetUsers(ctx *Context, args *GetUsersArgs, opts ...InvokeOption) (*GetUsersResult, error)
    func GetUsersOutput(ctx *Context, args *GetUsersOutputArgs, opts ...InvokeOption) GetUsersResultOutput

    > Note: This function is named GetUsers in the Go SDK.

    public static class GetUsers 
    {
        public static Task<GetUsersResult> InvokeAsync(GetUsersArgs args, InvokeOptions? opts = null)
        public static Output<GetUsersResult> Invoke(GetUsersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetUsersResult> getUsers(GetUsersArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: github:index/getUsers:getUsers
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Usernames List<string>
    List of usernames.
    Usernames []string
    List of usernames.
    usernames List<String>
    List of usernames.
    usernames string[]
    List of usernames.
    usernames Sequence[str]
    List of usernames.
    usernames List<String>
    List of usernames.

    getUsers Result

    The following output properties are available:

    Emails List<string>
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    Id string
    The provider-assigned unique ID for this managed resource.
    Logins List<string>
    list of logins of users that could be found.
    NodeIds List<string>
    list of Node IDs of users that could be found.
    UnknownLogins List<string>
    list of logins without matching user.
    Usernames List<string>
    Emails []string
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    Id string
    The provider-assigned unique ID for this managed resource.
    Logins []string
    list of logins of users that could be found.
    NodeIds []string
    list of Node IDs of users that could be found.
    UnknownLogins []string
    list of logins without matching user.
    Usernames []string
    emails List<String>
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    id String
    The provider-assigned unique ID for this managed resource.
    logins List<String>
    list of logins of users that could be found.
    nodeIds List<String>
    list of Node IDs of users that could be found.
    unknownLogins List<String>
    list of logins without matching user.
    usernames List<String>
    emails string[]
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    id string
    The provider-assigned unique ID for this managed resource.
    logins string[]
    list of logins of users that could be found.
    nodeIds string[]
    list of Node IDs of users that could be found.
    unknownLogins string[]
    list of logins without matching user.
    usernames string[]
    emails Sequence[str]
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    id str
    The provider-assigned unique ID for this managed resource.
    logins Sequence[str]
    list of logins of users that could be found.
    node_ids Sequence[str]
    list of Node IDs of users that could be found.
    unknown_logins Sequence[str]
    list of logins without matching user.
    usernames Sequence[str]
    emails List<String>
    list of the user's publicly visible profile email (will be empty string in case if user decided not to show it).
    id String
    The provider-assigned unique ID for this managed resource.
    logins List<String>
    list of logins of users that could be found.
    nodeIds List<String>
    list of Node IDs of users that could be found.
    unknownLogins List<String>
    list of logins without matching user.
    usernames List<String>

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi