-
Notifications
You must be signed in to change notification settings - Fork 0
/
membership.go
103 lines (91 loc) · 3.4 KB
/
membership.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
// *** 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 membership resource.
//
// This resource allows you to add/remove users from your organization. When applied,
// an invitation will be sent to the user to become part of the organization. When
// destroyed, either the invitation will be cancelled or the user will be removed.
//
// > This content is derived from https://github.com/terraform-providers/terraform-provider-github/blob/master/website/docs/r/membership.html.markdown.
type Membership struct {
s *pulumi.ResourceState
}
// NewMembership registers a new resource with the given unique name, arguments, and options.
func NewMembership(ctx *pulumi.Context,
name string, args *MembershipArgs, opts ...pulumi.ResourceOpt) (*Membership, error) {
if args == nil || args.Username == nil {
return nil, errors.New("missing required argument 'Username'")
}
inputs := make(map[string]interface{})
if args == nil {
inputs["role"] = nil
inputs["username"] = nil
} else {
inputs["role"] = args.Role
inputs["username"] = args.Username
}
inputs["etag"] = nil
s, err := ctx.RegisterResource("github:index/membership:Membership", name, true, inputs, opts...)
if err != nil {
return nil, err
}
return &Membership{s: s}, nil
}
// GetMembership gets an existing Membership 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 GetMembership(ctx *pulumi.Context,
name string, id pulumi.ID, state *MembershipState, opts ...pulumi.ResourceOpt) (*Membership, error) {
inputs := make(map[string]interface{})
if state != nil {
inputs["etag"] = state.Etag
inputs["role"] = state.Role
inputs["username"] = state.Username
}
s, err := ctx.ReadResource("github:index/membership:Membership", name, id, inputs, opts...)
if err != nil {
return nil, err
}
return &Membership{s: s}, nil
}
// URN is this resource's unique name assigned by Pulumi.
func (r *Membership) URN() *pulumi.URNOutput {
return r.s.URN()
}
// ID is this resource's unique identifier assigned by its provider.
func (r *Membership) ID() *pulumi.IDOutput {
return r.s.ID()
}
func (r *Membership) Etag() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["etag"])
}
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
func (r *Membership) Role() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["role"])
}
// The user to add to the organization.
func (r *Membership) Username() *pulumi.StringOutput {
return (*pulumi.StringOutput)(r.s.State["username"])
}
// Input properties used for looking up and filtering Membership resources.
type MembershipState struct {
Etag interface{}
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role interface{}
// The user to add to the organization.
Username interface{}
}
// The set of arguments for constructing a Membership resource.
type MembershipArgs struct {
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role interface{}
// The user to add to the organization.
Username interface{}
}