1. Packages
  2. Github Provider
  3. API Docs
  4. getMembership
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

github.getMembership

Explore with Pulumi AI

GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi

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

import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";

const membershipForSomeUser = github.getMembership({
    username: "SomeUser",
});
Copy
import pulumi
import pulumi_github as github

membership_for_some_user = github.get_membership(username="SomeUser")
Copy
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 {
		_, err := github.LookupMembership(ctx, &github.LookupMembershipArgs{
			Username: "SomeUser",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;

return await Deployment.RunAsync(() => 
{
    var membershipForSomeUser = Github.GetMembership.Invoke(new()
    {
        Username = "SomeUser",
    });

});
Copy
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());

    }
}
Copy
variables:
  membershipForSomeUser:
    fn::invoke:
      function: github:getMembership
      arguments:
        username: SomeUser
Copy

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>
Copy
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]
Copy
func LookupMembership(ctx *Context, args *LookupMembershipArgs, opts ...InvokeOption) (*LookupMembershipResult, error)
func LookupMembershipOutput(ctx *Context, args *LookupMembershipOutputArgs, opts ...InvokeOption) LookupMembershipResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetMembershipResult> getMembership(GetMembershipArgs args, InvokeOptions options)
public static Output<GetMembershipResult> getMembership(GetMembershipArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: github:index/getMembership:getMembership
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Username This property is required. string
The username to lookup in the organization.
Organization string
The organization to check for the above username.
Username This property is required. string
The username to lookup in the organization.
Organization string
The organization to check for the above username.
username This property is required. String
The username to lookup in the organization.
organization String
The organization to check for the above username.
username This property is required. string
The username to lookup in the organization.
organization string
The organization to check for the above username.
username This property is required. str
The username to lookup in the organization.
organization str
The organization to check for the above username.
username This property is required. 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.
State string
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
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.
State string
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
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.
state String
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
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.
state string
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
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.
state str
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
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.
state String
active or pending -- the state of membership within the organization. active if the member has accepted the invite, or pending if the invite is still pending.
username String
The username.
organization String

Package Details

Repository
GitHub pulumi/pulumi-github
License
Apache-2.0
Notes
This Pulumi package is based on the github Terraform Provider.
GitHub v6.7.0 published on Friday, Feb 28, 2025 by Pulumi