GitHub

Pulumi Official
Package maintained by Pulumi
v4.15.0 published on Thursday, Aug 4, 2022 by Pulumi

getMembership

Use this data source to find out if a user is a member of your organization, as well as what role they have within it. If the user’s membership in the organization is pending their acceptance of an invite, the role they would have once they accept will be returned.

Example Usage

using Pulumi;
using Github = Pulumi.Github;

class MyStack : Stack
{
    public MyStack()
    {
        var membershipForSomeUser = Output.Create(Github.GetMembership.InvokeAsync(new Github.GetMembershipArgs
        {
            Username = "SomeUser",
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-github/sdk/v4/go/github"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := github.LookupMembership(ctx, &GetMembershipArgs{
			Username: "SomeUser",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
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.GetMembershipArgs;
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 membershipForSomeUser = GithubFunctions.getMembership(GetMembershipArgs.builder()
            .username("SomeUser")
            .build());

    }
}
import pulumi
import pulumi_github as github

membership_for_some_user = github.get_membership(username="SomeUser")
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const membershipForSomeUser = pulumi.output(github.getMembership({
    username: "SomeUser",
}));
variables:
  membershipForSomeUser:
    Fn::Invoke:
      Function: github:getMembership
      Arguments:
        username: SomeUser

Using getMembership

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 getMembership(args: GetMembershipArgs, opts?: InvokeOptions): Promise<GetMembershipResult>
function getMembershipOutput(args: GetMembershipOutputArgs, opts?: InvokeOptions): Output<GetMembershipResult>
def get_membership(organization: Optional[str] = None,
                   username: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetMembershipResult
def get_membership_output(organization: Optional[pulumi.Input[str]] = None,
                   username: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetMembershipResult]
func LookupMembership(ctx *Context, args *LookupMembershipArgs, opts ...InvokeOption) (*LookupMembershipResult, error)
func LookupMembershipOutput(ctx *Context, args *LookupMembershipOutputArgs, opts ...InvokeOption) LookupMembershipResultOutput

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

public static class GetMembership 
{
    public static Task<GetMembershipResult> InvokeAsync(GetMembershipArgs args, InvokeOptions? opts = null)
    public static Output<GetMembershipResult> Invoke(GetMembershipInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetMembershipResult> getMembership(GetMembershipArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: github:index/getMembership:getMembership
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Username string

The username to lookup in the organization.

Organization string

The organization to check for the above username.

Username string

The username to lookup in the organization.

Organization string

The organization to check for the above username.

username String

The username to lookup in the organization.

organization String

The organization to check for the above username.

username string

The username to lookup in the organization.

organization string

The organization to check for the above username.

username str

The username to lookup in the organization.

organization str

The organization to check for the above username.

username String

The username to lookup in the organization.

organization String

The organization to check for the above username.

getMembership Result

The following output properties are available:

Etag string

An etag representing the membership object.

Id string

The provider-assigned unique ID for this managed resource.

Role string

admin or member -- the role the user has within the organization.

Username string

The username.

Organization string
Etag string

An etag representing the membership object.

Id string

The provider-assigned unique ID for this managed resource.

Role string

admin or member -- the role the user has within the organization.

Username string

The username.

Organization string
etag String

An etag representing the membership object.

id String

The provider-assigned unique ID for this managed resource.

role String

admin or member -- the role the user has within the organization.

username String

The username.

organization String
etag string

An etag representing the membership object.

id string

The provider-assigned unique ID for this managed resource.

role string

admin or member -- the role the user has within the organization.

username string

The username.

organization string
etag str

An etag representing the membership object.

id str

The provider-assigned unique ID for this managed resource.

role str

admin or member -- the role the user has within the organization.

username str

The username.

organization str
etag String

An etag representing the membership object.

id String

The provider-assigned unique ID for this managed resource.

role String

admin or member -- the role the user has within the organization.

username String

The username.

organization String

Package Details

Repository
https://github.com/pulumi/pulumi-github
License
Apache-2.0
Notes

This Pulumi package is based on the github Terraform Provider.