-
Notifications
You must be signed in to change notification settings - Fork 9
/
membership.go
124 lines (111 loc) · 3.84 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// *** 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 (
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/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.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-github/sdk/go/github"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := github.NewMembership(ctx, "membershipForSomeUser", &github.MembershipArgs{
// Role: pulumi.String("member"),
// Username: pulumi.String("SomeUser"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
type Membership struct {
pulumi.CustomResourceState
Etag pulumi.StringOutput `pulumi:"etag"`
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role pulumi.StringPtrOutput `pulumi:"role"`
// The user to add to the organization.
Username pulumi.StringOutput `pulumi:"username"`
}
// NewMembership registers a new resource with the given unique name, arguments, and options.
func NewMembership(ctx *pulumi.Context,
name string, args *MembershipArgs, opts ...pulumi.ResourceOption) (*Membership, error) {
if args == nil || args.Username == nil {
return nil, errors.New("missing required argument 'Username'")
}
if args == nil {
args = &MembershipArgs{}
}
var resource Membership
err := ctx.RegisterResource("github:index/membership:Membership", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, 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.IDInput, state *MembershipState, opts ...pulumi.ResourceOption) (*Membership, error) {
var resource Membership
err := ctx.ReadResource("github:index/membership:Membership", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Membership resources.
type membershipState struct {
Etag *string `pulumi:"etag"`
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role *string `pulumi:"role"`
// The user to add to the organization.
Username *string `pulumi:"username"`
}
type MembershipState struct {
Etag pulumi.StringPtrInput
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role pulumi.StringPtrInput
// The user to add to the organization.
Username pulumi.StringPtrInput
}
func (MembershipState) ElementType() reflect.Type {
return reflect.TypeOf((*membershipState)(nil)).Elem()
}
type membershipArgs struct {
// The role of the user within the organization.
// Must be one of `member` or `admin`. Defaults to `member`.
Role *string `pulumi:"role"`
// The user to add to the organization.
Username string `pulumi:"username"`
}
// 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 pulumi.StringPtrInput
// The user to add to the organization.
Username pulumi.StringInput
}
func (MembershipArgs) ElementType() reflect.Type {
return reflect.TypeOf((*membershipArgs)(nil)).Elem()
}