1. Packages
  2. GitHub
  3. API Docs
  4. TeamMembers
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

github.TeamMembers

Explore with Pulumi AI

github logo
GitHub v6.2.2 published on Tuesday, Jun 18, 2024 by Pulumi

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    // Add a user to the organization
    const membershipForSomeUser = new github.Membership("membership_for_some_user", {
        username: "SomeUser",
        role: "member",
    });
    const membershipForAnotherUser = new github.Membership("membership_for_another_user", {
        username: "AnotherUser",
        role: "member",
    });
    const someTeam = new github.Team("some_team", {
        name: "SomeTeam",
        description: "Some cool team",
    });
    const someTeamMembers = new github.TeamMembers("some_team_members", {
        teamId: someTeam.id,
        members: [
            {
                username: "SomeUser",
                role: "maintainer",
            },
            {
                username: "AnotherUser",
                role: "member",
            },
        ],
    });
    
    import pulumi
    import pulumi_github as github
    
    # Add a user to the organization
    membership_for_some_user = github.Membership("membership_for_some_user",
        username="SomeUser",
        role="member")
    membership_for_another_user = github.Membership("membership_for_another_user",
        username="AnotherUser",
        role="member")
    some_team = github.Team("some_team",
        name="SomeTeam",
        description="Some cool team")
    some_team_members = github.TeamMembers("some_team_members",
        team_id=some_team.id,
        members=[
            github.TeamMembersMemberArgs(
                username="SomeUser",
                role="maintainer",
            ),
            github.TeamMembersMemberArgs(
                username="AnotherUser",
                role="member",
            ),
        ])
    
    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 {
    		// Add a user to the organization
    		_, err := github.NewMembership(ctx, "membership_for_some_user", &github.MembershipArgs{
    			Username: pulumi.String("SomeUser"),
    			Role:     pulumi.String("member"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewMembership(ctx, "membership_for_another_user", &github.MembershipArgs{
    			Username: pulumi.String("AnotherUser"),
    			Role:     pulumi.String("member"),
    		})
    		if err != nil {
    			return err
    		}
    		someTeam, err := github.NewTeam(ctx, "some_team", &github.TeamArgs{
    			Name:        pulumi.String("SomeTeam"),
    			Description: pulumi.String("Some cool team"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewTeamMembers(ctx, "some_team_members", &github.TeamMembersArgs{
    			TeamId: someTeam.ID(),
    			Members: github.TeamMembersMemberArray{
    				&github.TeamMembersMemberArgs{
    					Username: pulumi.String("SomeUser"),
    					Role:     pulumi.String("maintainer"),
    				},
    				&github.TeamMembersMemberArgs{
    					Username: pulumi.String("AnotherUser"),
    					Role:     pulumi.String("member"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Github = Pulumi.Github;
    
    return await Deployment.RunAsync(() => 
    {
        // Add a user to the organization
        var membershipForSomeUser = new Github.Membership("membership_for_some_user", new()
        {
            Username = "SomeUser",
            Role = "member",
        });
    
        var membershipForAnotherUser = new Github.Membership("membership_for_another_user", new()
        {
            Username = "AnotherUser",
            Role = "member",
        });
    
        var someTeam = new Github.Team("some_team", new()
        {
            Name = "SomeTeam",
            Description = "Some cool team",
        });
    
        var someTeamMembers = new Github.TeamMembers("some_team_members", new()
        {
            TeamId = someTeam.Id,
            Members = new[]
            {
                new Github.Inputs.TeamMembersMemberArgs
                {
                    Username = "SomeUser",
                    Role = "maintainer",
                },
                new Github.Inputs.TeamMembersMemberArgs
                {
                    Username = "AnotherUser",
                    Role = "member",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.Membership;
    import com.pulumi.github.MembershipArgs;
    import com.pulumi.github.Team;
    import com.pulumi.github.TeamArgs;
    import com.pulumi.github.TeamMembers;
    import com.pulumi.github.TeamMembersArgs;
    import com.pulumi.github.inputs.TeamMembersMemberArgs;
    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) {
            // Add a user to the organization
            var membershipForSomeUser = new Membership("membershipForSomeUser", MembershipArgs.builder()
                .username("SomeUser")
                .role("member")
                .build());
    
            var membershipForAnotherUser = new Membership("membershipForAnotherUser", MembershipArgs.builder()
                .username("AnotherUser")
                .role("member")
                .build());
    
            var someTeam = new Team("someTeam", TeamArgs.builder()
                .name("SomeTeam")
                .description("Some cool team")
                .build());
    
            var someTeamMembers = new TeamMembers("someTeamMembers", TeamMembersArgs.builder()
                .teamId(someTeam.id())
                .members(            
                    TeamMembersMemberArgs.builder()
                        .username("SomeUser")
                        .role("maintainer")
                        .build(),
                    TeamMembersMemberArgs.builder()
                        .username("AnotherUser")
                        .role("member")
                        .build())
                .build());
    
        }
    }
    
    resources:
      # Add a user to the organization
      membershipForSomeUser:
        type: github:Membership
        name: membership_for_some_user
        properties:
          username: SomeUser
          role: member
      membershipForAnotherUser:
        type: github:Membership
        name: membership_for_another_user
        properties:
          username: AnotherUser
          role: member
      someTeam:
        type: github:Team
        name: some_team
        properties:
          name: SomeTeam
          description: Some cool team
      someTeamMembers:
        type: github:TeamMembers
        name: some_team_members
        properties:
          teamId: ${someTeam.id}
          members:
            - username: SomeUser
              role: maintainer
            - username: AnotherUser
              role: member
    

    Create TeamMembers Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TeamMembers(name: string, args: TeamMembersArgs, opts?: CustomResourceOptions);
    @overload
    def TeamMembers(resource_name: str,
                    args: TeamMembersArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def TeamMembers(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    members: Optional[Sequence[TeamMembersMemberArgs]] = None,
                    team_id: Optional[str] = None)
    func NewTeamMembers(ctx *Context, name string, args TeamMembersArgs, opts ...ResourceOption) (*TeamMembers, error)
    public TeamMembers(string name, TeamMembersArgs args, CustomResourceOptions? opts = null)
    public TeamMembers(String name, TeamMembersArgs args)
    public TeamMembers(String name, TeamMembersArgs args, CustomResourceOptions options)
    
    type: github:TeamMembers
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args TeamMembersArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TeamMembersArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TeamMembersArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TeamMembersArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TeamMembersArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var teamMembersResource = new Github.TeamMembers("teamMembersResource", new()
    {
        Members = new[]
        {
            new Github.Inputs.TeamMembersMemberArgs
            {
                Username = "string",
                Role = "string",
            },
        },
        TeamId = "string",
    });
    
    example, err := github.NewTeamMembers(ctx, "teamMembersResource", &github.TeamMembersArgs{
    	Members: github.TeamMembersMemberArray{
    		&github.TeamMembersMemberArgs{
    			Username: pulumi.String("string"),
    			Role:     pulumi.String("string"),
    		},
    	},
    	TeamId: pulumi.String("string"),
    })
    
    var teamMembersResource = new TeamMembers("teamMembersResource", TeamMembersArgs.builder()
        .members(TeamMembersMemberArgs.builder()
            .username("string")
            .role("string")
            .build())
        .teamId("string")
        .build());
    
    team_members_resource = github.TeamMembers("teamMembersResource",
        members=[github.TeamMembersMemberArgs(
            username="string",
            role="string",
        )],
        team_id="string")
    
    const teamMembersResource = new github.TeamMembers("teamMembersResource", {
        members: [{
            username: "string",
            role: "string",
        }],
        teamId: "string",
    });
    
    type: github:TeamMembers
    properties:
        members:
            - role: string
              username: string
        teamId: string
    

    TeamMembers Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The TeamMembers resource accepts the following input properties:

    Members List<TeamMembersMember>
    List of team members. See Members below for details.
    TeamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    Members []TeamMembersMemberArgs
    List of team members. See Members below for details.
    TeamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members List<TeamMembersMember>
    List of team members. See Members below for details.
    teamId String

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members TeamMembersMember[]
    List of team members. See Members below for details.
    teamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members Sequence[TeamMembersMemberArgs]
    List of team members. See Members below for details.
    team_id str

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members List<Property Map>
    List of team members. See Members below for details.
    teamId String

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TeamMembers resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TeamMembers Resource

    Get an existing TeamMembers resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TeamMembersState, opts?: CustomResourceOptions): TeamMembers
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            members: Optional[Sequence[TeamMembersMemberArgs]] = None,
            team_id: Optional[str] = None) -> TeamMembers
    func GetTeamMembers(ctx *Context, name string, id IDInput, state *TeamMembersState, opts ...ResourceOption) (*TeamMembers, error)
    public static TeamMembers Get(string name, Input<string> id, TeamMembersState? state, CustomResourceOptions? opts = null)
    public static TeamMembers get(String name, Output<String> id, TeamMembersState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Members List<TeamMembersMember>
    List of team members. See Members below for details.
    TeamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    Members []TeamMembersMemberArgs
    List of team members. See Members below for details.
    TeamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members List<TeamMembersMember>
    List of team members. See Members below for details.
    teamId String

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members TeamMembersMember[]
    List of team members. See Members below for details.
    teamId string

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members Sequence[TeamMembersMemberArgs]
    List of team members. See Members below for details.
    team_id str

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    members List<Property Map>
    List of team members. See Members below for details.
    teamId String

    The team id or the team slug

    Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated.

    Supporting Types

    TeamMembersMember, TeamMembersMemberArgs

    Username string
    The user to add to the team.
    Role string
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.
    Username string
    The user to add to the team.
    Role string
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.
    username String
    The user to add to the team.
    role String
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.
    username string
    The user to add to the team.
    role string
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.
    username str
    The user to add to the team.
    role str
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.
    username String
    The user to add to the team.
    role String
    The role of the user within the team. Must be one of member or maintainer. Defaults to member.

    Import

    ~> Note Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will result in terraform doing conversions between the team slug and team id. This will cause team members associations to the team to be destroyed and recreated on import.

    GitHub Team Membership can be imported using the team ID team id or team slug, e.g.

    $ pulumi import github:index/teamMembers:TeamMembers some_team 1234567
    
    $ pulumi import github:index/teamMembers:TeamMembers some_team Administrators
    

    To learn more about importing existing cloud resources, see Importing resources.

    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.2.2 published on Tuesday, Jun 18, 2024 by Pulumi