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

github.UserInvitationAccepter

Explore with Pulumi AI

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

    Provides a resource to manage GitHub repository collaborator invitations.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    const exampleRepository = new github.Repository("exampleRepository", {});
    const exampleRepositoryCollaborator = new github.RepositoryCollaborator("exampleRepositoryCollaborator", {
        repository: exampleRepository.name,
        username: "example-username",
        permission: "push",
    });
    const invitee = new github.Provider("invitee", {token: _var.invitee_token});
    const exampleUserInvitationAccepter = new github.UserInvitationAccepter("exampleUserInvitationAccepter", {invitationId: exampleRepositoryCollaborator.invitationId}, {
        provider: "github.invitee",
    });
    
    import pulumi
    import pulumi_github as github
    
    example_repository = github.Repository("exampleRepository")
    example_repository_collaborator = github.RepositoryCollaborator("exampleRepositoryCollaborator",
        repository=example_repository.name,
        username="example-username",
        permission="push")
    invitee = github.Provider("invitee", token=var["invitee_token"])
    example_user_invitation_accepter = github.UserInvitationAccepter("exampleUserInvitationAccepter", invitation_id=example_repository_collaborator.invitation_id,
    opts=pulumi.ResourceOptions(provider="github.invitee"))
    
    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 {
    		exampleRepository, err := github.NewRepository(ctx, "exampleRepository", nil)
    		if err != nil {
    			return err
    		}
    		exampleRepositoryCollaborator, err := github.NewRepositoryCollaborator(ctx, "exampleRepositoryCollaborator", &github.RepositoryCollaboratorArgs{
    			Repository: exampleRepository.Name,
    			Username:   pulumi.String("example-username"),
    			Permission: pulumi.String("push"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewProvider(ctx, "invitee", &github.ProviderArgs{
    			Token: pulumi.Any(_var.Invitee_token),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewUserInvitationAccepter(ctx, "exampleUserInvitationAccepter", &github.UserInvitationAccepterArgs{
    			InvitationId: exampleRepositoryCollaborator.InvitationId,
    		}, pulumi.Provider("github.invitee"))
    		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 exampleRepository = new Github.Repository("exampleRepository");
    
        var exampleRepositoryCollaborator = new Github.RepositoryCollaborator("exampleRepositoryCollaborator", new()
        {
            Repository = exampleRepository.Name,
            Username = "example-username",
            Permission = "push",
        });
    
        var invitee = new Github.Provider("invitee", new()
        {
            Token = @var.Invitee_token,
        });
    
        var exampleUserInvitationAccepter = new Github.UserInvitationAccepter("exampleUserInvitationAccepter", new()
        {
            InvitationId = exampleRepositoryCollaborator.InvitationId,
        }, new CustomResourceOptions
        {
            Provider = "github.invitee",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.Repository;
    import com.pulumi.github.RepositoryCollaborator;
    import com.pulumi.github.RepositoryCollaboratorArgs;
    import com.pulumi.github.Provider;
    import com.pulumi.github.ProviderArgs;
    import com.pulumi.github.UserInvitationAccepter;
    import com.pulumi.github.UserInvitationAccepterArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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) {
            var exampleRepository = new Repository("exampleRepository");
    
            var exampleRepositoryCollaborator = new RepositoryCollaborator("exampleRepositoryCollaborator", RepositoryCollaboratorArgs.builder()        
                .repository(exampleRepository.name())
                .username("example-username")
                .permission("push")
                .build());
    
            var invitee = new Provider("invitee", ProviderArgs.builder()        
                .token(var_.invitee_token())
                .build());
    
            var exampleUserInvitationAccepter = new UserInvitationAccepter("exampleUserInvitationAccepter", UserInvitationAccepterArgs.builder()        
                .invitationId(exampleRepositoryCollaborator.invitationId())
                .build(), CustomResourceOptions.builder()
                    .provider("github.invitee")
                    .build());
    
        }
    }
    
    resources:
      exampleRepository:
        type: github:Repository
      exampleRepositoryCollaborator:
        type: github:RepositoryCollaborator
        properties:
          repository: ${exampleRepository.name}
          username: example-username
          permission: push
      invitee:
        type: pulumi:providers:github
        properties:
          token: ${var.invitee_token}
      exampleUserInvitationAccepter:
        type: github:UserInvitationAccepter
        properties:
          invitationId: ${exampleRepositoryCollaborator.invitationId}
        options:
          provider: github.invitee
    

    Allowing empty invitation IDs

    Set allow_empty_id when using for_each over a list of github_repository_collaborator.invitation_id’s.

    This allows applying a module again when a new github.RepositoryCollaborator resource is added to the for_each loop. This is needed as the github_repository_collaborator.invitation_id will be empty after a state refresh when the invitation has been accepted.

    Note that when an invitation is accepted manually or by another tool between a state refresh and a pulumi up using that refreshed state, the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted.

    This is tracked in #1157.

    Create UserInvitationAccepter Resource

    new UserInvitationAccepter(name: string, args?: UserInvitationAccepterArgs, opts?: CustomResourceOptions);
    @overload
    def UserInvitationAccepter(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               allow_empty_id: Optional[bool] = None,
                               invitation_id: Optional[str] = None)
    @overload
    def UserInvitationAccepter(resource_name: str,
                               args: Optional[UserInvitationAccepterArgs] = None,
                               opts: Optional[ResourceOptions] = None)
    func NewUserInvitationAccepter(ctx *Context, name string, args *UserInvitationAccepterArgs, opts ...ResourceOption) (*UserInvitationAccepter, error)
    public UserInvitationAccepter(string name, UserInvitationAccepterArgs? args = null, CustomResourceOptions? opts = null)
    public UserInvitationAccepter(String name, UserInvitationAccepterArgs args)
    public UserInvitationAccepter(String name, UserInvitationAccepterArgs args, CustomResourceOptions options)
    
    type: github:UserInvitationAccepter
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args UserInvitationAccepterArgs
    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 UserInvitationAccepterArgs
    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 UserInvitationAccepterArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserInvitationAccepterArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserInvitationAccepterArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    UserInvitationAccepter 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 UserInvitationAccepter resource accepts the following input properties:

    AllowEmptyId bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    InvitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    AllowEmptyId bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    InvitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId Boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId String
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allow_empty_id bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitation_id str
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId Boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId String
    ID of the invitation to accept. Must be set when allow_empty_id is false.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the UserInvitationAccepter 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 UserInvitationAccepter Resource

    Get an existing UserInvitationAccepter 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?: UserInvitationAccepterState, opts?: CustomResourceOptions): UserInvitationAccepter
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allow_empty_id: Optional[bool] = None,
            invitation_id: Optional[str] = None) -> UserInvitationAccepter
    func GetUserInvitationAccepter(ctx *Context, name string, id IDInput, state *UserInvitationAccepterState, opts ...ResourceOption) (*UserInvitationAccepter, error)
    public static UserInvitationAccepter Get(string name, Input<string> id, UserInvitationAccepterState? state, CustomResourceOptions? opts = null)
    public static UserInvitationAccepter get(String name, Output<String> id, UserInvitationAccepterState 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:
    AllowEmptyId bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    InvitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    AllowEmptyId bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    InvitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId Boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId String
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId string
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allow_empty_id bool
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitation_id str
    ID of the invitation to accept. Must be set when allow_empty_id is false.
    allowEmptyId Boolean
    Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error.
    invitationId String
    ID of the invitation to accept. Must be set when allow_empty_id is false.

    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