/
groupShareGroup.go
309 lines (259 loc) · 11.3 KB
/
groupShareGroup.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package gitlab
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// The `GroupShareGroup` resource allows to manage the lifecycle of group shared with another group.
//
// **Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/groups.html#share-groups-with-groups)
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gitlab/sdk/v4/go/gitlab"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := gitlab.NewGroupShareGroup(ctx, "test", &gitlab.GroupShareGroupArgs{
// GroupId: pulumi.Any(gitlab_group.Foo.Id),
// ShareGroupId: pulumi.Any(gitlab_group.Bar.Id),
// GroupAccess: pulumi.String("guest"),
// ExpiresAt: pulumi.String("2099-01-01"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// GitLab group shares can be imported using an id made up of `mainGroupId:shareGroupId`, e.g.
//
// ```sh
//
// $ pulumi import gitlab:index/groupShareGroup:GroupShareGroup test 12345:1337
//
// ```
type GroupShareGroup struct {
pulumi.CustomResourceState
// Share expiration date. Format: `YYYY-MM-DD`
ExpiresAt pulumi.StringPtrOutput `pulumi:"expiresAt"`
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
GroupAccess pulumi.StringOutput `pulumi:"groupAccess"`
// The id of the main group to be shared.
GroupId pulumi.StringOutput `pulumi:"groupId"`
// The id of the additional group with which the main group will be shared.
ShareGroupId pulumi.IntOutput `pulumi:"shareGroupId"`
}
// NewGroupShareGroup registers a new resource with the given unique name, arguments, and options.
func NewGroupShareGroup(ctx *pulumi.Context,
name string, args *GroupShareGroupArgs, opts ...pulumi.ResourceOption) (*GroupShareGroup, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.GroupAccess == nil {
return nil, errors.New("invalid value for required argument 'GroupAccess'")
}
if args.GroupId == nil {
return nil, errors.New("invalid value for required argument 'GroupId'")
}
if args.ShareGroupId == nil {
return nil, errors.New("invalid value for required argument 'ShareGroupId'")
}
var resource GroupShareGroup
err := ctx.RegisterResource("gitlab:index/groupShareGroup:GroupShareGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetGroupShareGroup gets an existing GroupShareGroup 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 GetGroupShareGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *GroupShareGroupState, opts ...pulumi.ResourceOption) (*GroupShareGroup, error) {
var resource GroupShareGroup
err := ctx.ReadResource("gitlab:index/groupShareGroup:GroupShareGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering GroupShareGroup resources.
type groupShareGroupState struct {
// Share expiration date. Format: `YYYY-MM-DD`
ExpiresAt *string `pulumi:"expiresAt"`
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
GroupAccess *string `pulumi:"groupAccess"`
// The id of the main group to be shared.
GroupId *string `pulumi:"groupId"`
// The id of the additional group with which the main group will be shared.
ShareGroupId *int `pulumi:"shareGroupId"`
}
type GroupShareGroupState struct {
// Share expiration date. Format: `YYYY-MM-DD`
ExpiresAt pulumi.StringPtrInput
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
GroupAccess pulumi.StringPtrInput
// The id of the main group to be shared.
GroupId pulumi.StringPtrInput
// The id of the additional group with which the main group will be shared.
ShareGroupId pulumi.IntPtrInput
}
func (GroupShareGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*groupShareGroupState)(nil)).Elem()
}
type groupShareGroupArgs struct {
// Share expiration date. Format: `YYYY-MM-DD`
ExpiresAt *string `pulumi:"expiresAt"`
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
GroupAccess string `pulumi:"groupAccess"`
// The id of the main group to be shared.
GroupId string `pulumi:"groupId"`
// The id of the additional group with which the main group will be shared.
ShareGroupId int `pulumi:"shareGroupId"`
}
// The set of arguments for constructing a GroupShareGroup resource.
type GroupShareGroupArgs struct {
// Share expiration date. Format: `YYYY-MM-DD`
ExpiresAt pulumi.StringPtrInput
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
GroupAccess pulumi.StringInput
// The id of the main group to be shared.
GroupId pulumi.StringInput
// The id of the additional group with which the main group will be shared.
ShareGroupId pulumi.IntInput
}
func (GroupShareGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*groupShareGroupArgs)(nil)).Elem()
}
type GroupShareGroupInput interface {
pulumi.Input
ToGroupShareGroupOutput() GroupShareGroupOutput
ToGroupShareGroupOutputWithContext(ctx context.Context) GroupShareGroupOutput
}
func (*GroupShareGroup) ElementType() reflect.Type {
return reflect.TypeOf((**GroupShareGroup)(nil)).Elem()
}
func (i *GroupShareGroup) ToGroupShareGroupOutput() GroupShareGroupOutput {
return i.ToGroupShareGroupOutputWithContext(context.Background())
}
func (i *GroupShareGroup) ToGroupShareGroupOutputWithContext(ctx context.Context) GroupShareGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(GroupShareGroupOutput)
}
// GroupShareGroupArrayInput is an input type that accepts GroupShareGroupArray and GroupShareGroupArrayOutput values.
// You can construct a concrete instance of `GroupShareGroupArrayInput` via:
//
// GroupShareGroupArray{ GroupShareGroupArgs{...} }
type GroupShareGroupArrayInput interface {
pulumi.Input
ToGroupShareGroupArrayOutput() GroupShareGroupArrayOutput
ToGroupShareGroupArrayOutputWithContext(context.Context) GroupShareGroupArrayOutput
}
type GroupShareGroupArray []GroupShareGroupInput
func (GroupShareGroupArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GroupShareGroup)(nil)).Elem()
}
func (i GroupShareGroupArray) ToGroupShareGroupArrayOutput() GroupShareGroupArrayOutput {
return i.ToGroupShareGroupArrayOutputWithContext(context.Background())
}
func (i GroupShareGroupArray) ToGroupShareGroupArrayOutputWithContext(ctx context.Context) GroupShareGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(GroupShareGroupArrayOutput)
}
// GroupShareGroupMapInput is an input type that accepts GroupShareGroupMap and GroupShareGroupMapOutput values.
// You can construct a concrete instance of `GroupShareGroupMapInput` via:
//
// GroupShareGroupMap{ "key": GroupShareGroupArgs{...} }
type GroupShareGroupMapInput interface {
pulumi.Input
ToGroupShareGroupMapOutput() GroupShareGroupMapOutput
ToGroupShareGroupMapOutputWithContext(context.Context) GroupShareGroupMapOutput
}
type GroupShareGroupMap map[string]GroupShareGroupInput
func (GroupShareGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GroupShareGroup)(nil)).Elem()
}
func (i GroupShareGroupMap) ToGroupShareGroupMapOutput() GroupShareGroupMapOutput {
return i.ToGroupShareGroupMapOutputWithContext(context.Background())
}
func (i GroupShareGroupMap) ToGroupShareGroupMapOutputWithContext(ctx context.Context) GroupShareGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(GroupShareGroupMapOutput)
}
type GroupShareGroupOutput struct{ *pulumi.OutputState }
func (GroupShareGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((**GroupShareGroup)(nil)).Elem()
}
func (o GroupShareGroupOutput) ToGroupShareGroupOutput() GroupShareGroupOutput {
return o
}
func (o GroupShareGroupOutput) ToGroupShareGroupOutputWithContext(ctx context.Context) GroupShareGroupOutput {
return o
}
// Share expiration date. Format: `YYYY-MM-DD`
func (o GroupShareGroupOutput) ExpiresAt() pulumi.StringPtrOutput {
return o.ApplyT(func(v *GroupShareGroup) pulumi.StringPtrOutput { return v.ExpiresAt }).(pulumi.StringPtrOutput)
}
// The access level to grant the group. Valid values are: `no one`, `minimal`, `guest`, `reporter`, `developer`, `maintainer`, `owner`, `master`
func (o GroupShareGroupOutput) GroupAccess() pulumi.StringOutput {
return o.ApplyT(func(v *GroupShareGroup) pulumi.StringOutput { return v.GroupAccess }).(pulumi.StringOutput)
}
// The id of the main group to be shared.
func (o GroupShareGroupOutput) GroupId() pulumi.StringOutput {
return o.ApplyT(func(v *GroupShareGroup) pulumi.StringOutput { return v.GroupId }).(pulumi.StringOutput)
}
// The id of the additional group with which the main group will be shared.
func (o GroupShareGroupOutput) ShareGroupId() pulumi.IntOutput {
return o.ApplyT(func(v *GroupShareGroup) pulumi.IntOutput { return v.ShareGroupId }).(pulumi.IntOutput)
}
type GroupShareGroupArrayOutput struct{ *pulumi.OutputState }
func (GroupShareGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*GroupShareGroup)(nil)).Elem()
}
func (o GroupShareGroupArrayOutput) ToGroupShareGroupArrayOutput() GroupShareGroupArrayOutput {
return o
}
func (o GroupShareGroupArrayOutput) ToGroupShareGroupArrayOutputWithContext(ctx context.Context) GroupShareGroupArrayOutput {
return o
}
func (o GroupShareGroupArrayOutput) Index(i pulumi.IntInput) GroupShareGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *GroupShareGroup {
return vs[0].([]*GroupShareGroup)[vs[1].(int)]
}).(GroupShareGroupOutput)
}
type GroupShareGroupMapOutput struct{ *pulumi.OutputState }
func (GroupShareGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*GroupShareGroup)(nil)).Elem()
}
func (o GroupShareGroupMapOutput) ToGroupShareGroupMapOutput() GroupShareGroupMapOutput {
return o
}
func (o GroupShareGroupMapOutput) ToGroupShareGroupMapOutputWithContext(ctx context.Context) GroupShareGroupMapOutput {
return o
}
func (o GroupShareGroupMapOutput) MapIndex(k pulumi.StringInput) GroupShareGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *GroupShareGroup {
return vs[0].(map[string]*GroupShareGroup)[vs[1].(string)]
}).(GroupShareGroupOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*GroupShareGroupInput)(nil)).Elem(), &GroupShareGroup{})
pulumi.RegisterInputType(reflect.TypeOf((*GroupShareGroupArrayInput)(nil)).Elem(), GroupShareGroupArray{})
pulumi.RegisterInputType(reflect.TypeOf((*GroupShareGroupMapInput)(nil)).Elem(), GroupShareGroupMap{})
pulumi.RegisterOutputType(GroupShareGroupOutput{})
pulumi.RegisterOutputType(GroupShareGroupArrayOutput{})
pulumi.RegisterOutputType(GroupShareGroupMapOutput{})
}