1. Packages
  2. Github Provider
  3. API Docs
  4. UserInvitationAccepter
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.UserInvitationAccepter

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 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 example = new github.Repository("example", {name: "example-repo"});
    const exampleRepositoryCollaborator = new github.RepositoryCollaborator("example", {
        repository: example.name,
        username: "example-username",
        permission: "push",
    });
    const exampleUserInvitationAccepter = new github.UserInvitationAccepter("example", {invitationId: exampleRepositoryCollaborator.invitationId});
    
    import pulumi
    import pulumi_github as github
    
    example = github.Repository("example", name="example-repo")
    example_repository_collaborator = github.RepositoryCollaborator("example",
        repository=example.name,
        username="example-username",
        permission="push")
    example_user_invitation_accepter = github.UserInvitationAccepter("example", invitation_id=example_repository_collaborator.invitation_id)
    
    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 {
    		example, err := github.NewRepository(ctx, "example", &github.RepositoryArgs{
    			Name: pulumi.String("example-repo"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleRepositoryCollaborator, err := github.NewRepositoryCollaborator(ctx, "example", &github.RepositoryCollaboratorArgs{
    			Repository: example.Name,
    			Username:   pulumi.String("example-username"),
    			Permission: pulumi.String("push"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewUserInvitationAccepter(ctx, "example", &github.UserInvitationAccepterArgs{
    			InvitationId: exampleRepositoryCollaborator.InvitationId,
    		})
    		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 example = new Github.Repository("example", new()
        {
            Name = "example-repo",
        });
    
        var exampleRepositoryCollaborator = new Github.RepositoryCollaborator("example", new()
        {
            Repository = example.Name,
            Username = "example-username",
            Permission = "push",
        });
    
        var exampleUserInvitationAccepter = new Github.UserInvitationAccepter("example", new()
        {
            InvitationId = exampleRepositoryCollaborator.InvitationId,
        });
    
    });
    
    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.RepositoryArgs;
    import com.pulumi.github.RepositoryCollaborator;
    import com.pulumi.github.RepositoryCollaboratorArgs;
    import com.pulumi.github.UserInvitationAccepter;
    import com.pulumi.github.UserInvitationAccepterArgs;
    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 example = new Repository("example", RepositoryArgs.builder()
                .name("example-repo")
                .build());
    
            var exampleRepositoryCollaborator = new RepositoryCollaborator("exampleRepositoryCollaborator", RepositoryCollaboratorArgs.builder()
                .repository(example.name())
                .username("example-username")
                .permission("push")
                .build());
    
            var exampleUserInvitationAccepter = new UserInvitationAccepter("exampleUserInvitationAccepter", UserInvitationAccepterArgs.builder()
                .invitationId(exampleRepositoryCollaborator.invitationId())
                .build());
    
        }
    }
    
    resources:
      example:
        type: github:Repository
        properties:
          name: example-repo
      exampleRepositoryCollaborator:
        type: github:RepositoryCollaborator
        name: example
        properties:
          repository: ${example.name}
          username: example-username
          permission: push
      exampleUserInvitationAccepter:
        type: github:UserInvitationAccepter
        name: example
        properties:
          invitationId: ${exampleRepositoryCollaborator.invitationId}
    

    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

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

    Constructor syntax

    new UserInvitationAccepter(name: string, args?: UserInvitationAccepterArgs, opts?: CustomResourceOptions);
    @overload
    def UserInvitationAccepter(resource_name: str,
                               args: Optional[UserInvitationAccepterArgs] = None,
                               opts: Optional[ResourceOptions] = None)
    
    @overload
    def UserInvitationAccepter(resource_name: str,
                               opts: Optional[ResourceOptions] = None,
                               allow_empty_id: Optional[bool] = None,
                               invitation_id: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

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

    var userInvitationAccepterResource = new Github.UserInvitationAccepter("userInvitationAccepterResource", new()
    {
        AllowEmptyId = false,
        InvitationId = "string",
    });
    
    example, err := github.NewUserInvitationAccepter(ctx, "userInvitationAccepterResource", &github.UserInvitationAccepterArgs{
    	AllowEmptyId: pulumi.Bool(false),
    	InvitationId: pulumi.String("string"),
    })
    
    var userInvitationAccepterResource = new UserInvitationAccepter("userInvitationAccepterResource", UserInvitationAccepterArgs.builder()
        .allowEmptyId(false)
        .invitationId("string")
        .build());
    
    user_invitation_accepter_resource = github.UserInvitationAccepter("userInvitationAccepterResource",
        allow_empty_id=False,
        invitation_id="string")
    
    const userInvitationAccepterResource = new github.UserInvitationAccepter("userInvitationAccepterResource", {
        allowEmptyId: false,
        invitationId: "string",
    });
    
    type: github:UserInvitationAccepter
    properties:
        allowEmptyId: false
        invitationId: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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.3.2 published on Friday, Oct 11, 2024 by Pulumi