-
Notifications
You must be signed in to change notification settings - Fork 0
/
repositoryCollaborator.go
130 lines (117 loc) · 5.17 KB
/
repositoryCollaborator.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package github
import (
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/go/pulumi"
)
// Provides a GitHub repository collaborator resource.
//
// This resource allows you to add/remove collaborators from repositories in your
// organization. Collaborators can have explicit (and differing levels of) read,
// write, or administrator access to specific repositories in your organization,
// without giving the user full organization membership.
//
// When applied, an invitation will be sent to the user to become a collaborator
// on a repository. When destroyed, either the invitation will be cancelled or the
// collaborator will be removed from the repository.
//
// Further documentation on GitHub collaborators:
//
// - [Adding outside collaborators to repositories in your organization](https://help.github.com/articles/adding-outside-collaborators-to-repositories-in-your-organization/)
// - [Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-github/blob/master/website/docs/r/repository_collaborator.html.markdown.
type RepositoryCollaborator struct {
s *pulumi.ResourceState
}
// NewRepositoryCollaborator registers a new resource with the given unique name, arguments, and options.
func NewRepositoryCollaborator(ctx *pulumi.Context,
name string, args *RepositoryCollaboratorArgs, opts ...pulumi.ResourceOpt) (*RepositoryCollaborator, error) {
if args == nil || args.Repository == nil {
return nil, errors.New("missing required argument 'Repository'")
}
if args == nil || args.Username == nil {
return nil, errors.New("missing required argument 'Username'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["permission"] = nil
inputs["repository"] = nil
inputs["username"] = nil
} else {
inputs["permission"] = args.Permission
inputs["repository"] = args.Repository
inputs["username"] = args.Username
}
inputs["invitationId"] = nil
s, err := ctx.RegisterResource("github:index/repositoryCollaborator:RepositoryCollaborator", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &RepositoryCollaborator{s: s}, nil
}
// GetRepositoryCollaborator gets an existing RepositoryCollaborator resource's state with the given name, ID, and optional
// state properties that are used to uniquely qualify the lookup (nil if not required).
func GetRepositoryCollaborator(ctx *pulumi.Context,
name string, id pulumi.ID, state *RepositoryCollaboratorState, opts ...pulumi.ResourceOpt) (*RepositoryCollaborator, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["invitationId"] = state.InvitationId
inputs["permission"] = state.Permission
inputs["repository"] = state.Repository
inputs["username"] = state.Username
}
s, err := ctx.ReadResource("github:index/repositoryCollaborator:RepositoryCollaborator", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &RepositoryCollaborator{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *RepositoryCollaborator) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *RepositoryCollaborator) ID() *pulumi.IDOutput {
return r.s.ID()
}
// ID of the invitation to be used in `.UserInvitationAccepter`
func (r *RepositoryCollaborator) InvitationId() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["invitationId"])
}
// The permission of the outside collaborator for the repository.
// Must be one of `pull`, `push`, or `admin`. Defaults to `push`.
func (r *RepositoryCollaborator) Permission() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["permission"])
}
// The GitHub repository
func (r *RepositoryCollaborator) Repository() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["repository"])
}
// The user to add to the repository as a collaborator.
func (r *RepositoryCollaborator) Username() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["username"])
}
// Input properties used for looking up and filtering RepositoryCollaborator resources.
type RepositoryCollaboratorState struct {
// ID of the invitation to be used in `.UserInvitationAccepter`
InvitationId interface{}
// The permission of the outside collaborator for the repository.
// Must be one of `pull`, `push`, or `admin`. Defaults to `push`.
Permission interface{}
// The GitHub repository
Repository interface{}
// The user to add to the repository as a collaborator.
Username interface{}
}
// The set of arguments for constructing a RepositoryCollaborator resource.
type RepositoryCollaboratorArgs struct {
// The permission of the outside collaborator for the repository.
// Must be one of `pull`, `push`, or `admin`. Defaults to `push`.
Permission interface{}
// The GitHub repository
Repository interface{}
// The user to add to the repository as a collaborator.
Username interface{}
}