GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi
github.getMembership
Explore with Pulumi AI
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",
});
import pulumi
import pulumi_github as github
membership_for_some_user = github.get_membership(username="SomeUser")
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
})
}
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",
});
});
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());
}
}
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
ormember
-- the role the user has within the organization.- State string
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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
ormember
-- the role the user has within the organization.- State string
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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
ormember
-- the role the user has within the organization.- state String
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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
ormember
-- the role the user has within the organization.- state string
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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
ormember
-- the role the user has within the organization.- state str
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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
ormember
-- the role the user has within the organization.- state String
active
orpending
-- the state of membership within the organization.active
if the member has accepted the invite, orpending
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.