/
userHierarchyGroup.go
404 lines (349 loc) · 16.8 KB
/
userHierarchyGroup.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
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
// 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 connect
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides an Amazon Connect User Hierarchy Group resource. For more information see
// [Amazon Connect: Getting Started](https://docs.aws.amazon.com/connect/latest/adminguide/amazon-connect-get-started.html)
//
// > **NOTE:** The User Hierarchy Structure must be created before creating a User Hierarchy Group.
//
// ## Example Usage
// ### Basic
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/connect"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := connect.NewUserHierarchyGroup(ctx, "example", &connect.UserHierarchyGroupArgs{
// InstanceId: pulumi.String("aaaaaaaa-bbbb-cccc-dddd-111111111111"),
// Tags: pulumi.StringMap{
// "Name": pulumi.String("Example User Hierarchy Group"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// ### With a parent group
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/connect"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// parent, err := connect.NewUserHierarchyGroup(ctx, "parent", &connect.UserHierarchyGroupArgs{
// InstanceId: pulumi.String("aaaaaaaa-bbbb-cccc-dddd-111111111111"),
// Tags: pulumi.StringMap{
// "Name": pulumi.String("Example User Hierarchy Group Parent"),
// },
// })
// if err != nil {
// return err
// }
// _, err = connect.NewUserHierarchyGroup(ctx, "child", &connect.UserHierarchyGroupArgs{
// InstanceId: pulumi.String("aaaaaaaa-bbbb-cccc-dddd-111111111111"),
// ParentGroupId: parent.HierarchyGroupId,
// Tags: pulumi.StringMap{
// "Name": pulumi.String("Example User Hierarchy Group Child"),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Amazon Connect User Hierarchy Groups can be imported using the `instance_id` and `hierarchy_group_id` separated by a colon (`:`), e.g.,
//
// ```sh
//
// $ pulumi import aws:connect/userHierarchyGroup:UserHierarchyGroup example f1288a1f-6193-445a-b47e-af739b2:c1d4e5f6-1b3c-1b3c-1b3c-c1d4e5f6c1d4e5
//
// ```
type UserHierarchyGroup struct {
pulumi.CustomResourceState
// The Amazon Resource Name (ARN) of the hierarchy group.
Arn pulumi.StringOutput `pulumi:"arn"`
// The identifier for the hierarchy group.
HierarchyGroupId pulumi.StringOutput `pulumi:"hierarchyGroupId"`
// A block that contains information about the levels in the hierarchy group. The `hierarchyPath` block is documented below.
HierarchyPaths UserHierarchyGroupHierarchyPathArrayOutput `pulumi:"hierarchyPaths"`
// Specifies the identifier of the hosting Amazon Connect Instance.
InstanceId pulumi.StringOutput `pulumi:"instanceId"`
// The identifier of the level in the hierarchy group.
LevelId pulumi.StringOutput `pulumi:"levelId"`
// The name of the user hierarchy group. Must not be more than 100 characters.
Name pulumi.StringOutput `pulumi:"name"`
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
ParentGroupId pulumi.StringPtrOutput `pulumi:"parentGroupId"`
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapOutput `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
}
// NewUserHierarchyGroup registers a new resource with the given unique name, arguments, and options.
func NewUserHierarchyGroup(ctx *pulumi.Context,
name string, args *UserHierarchyGroupArgs, opts ...pulumi.ResourceOption) (*UserHierarchyGroup, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.InstanceId == nil {
return nil, errors.New("invalid value for required argument 'InstanceId'")
}
var resource UserHierarchyGroup
err := ctx.RegisterResource("aws:connect/userHierarchyGroup:UserHierarchyGroup", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetUserHierarchyGroup gets an existing UserHierarchyGroup 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 GetUserHierarchyGroup(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *UserHierarchyGroupState, opts ...pulumi.ResourceOption) (*UserHierarchyGroup, error) {
var resource UserHierarchyGroup
err := ctx.ReadResource("aws:connect/userHierarchyGroup:UserHierarchyGroup", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering UserHierarchyGroup resources.
type userHierarchyGroupState struct {
// The Amazon Resource Name (ARN) of the hierarchy group.
Arn *string `pulumi:"arn"`
// The identifier for the hierarchy group.
HierarchyGroupId *string `pulumi:"hierarchyGroupId"`
// A block that contains information about the levels in the hierarchy group. The `hierarchyPath` block is documented below.
HierarchyPaths []UserHierarchyGroupHierarchyPath `pulumi:"hierarchyPaths"`
// Specifies the identifier of the hosting Amazon Connect Instance.
InstanceId *string `pulumi:"instanceId"`
// The identifier of the level in the hierarchy group.
LevelId *string `pulumi:"levelId"`
// The name of the user hierarchy group. Must not be more than 100 characters.
Name *string `pulumi:"name"`
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
ParentGroupId *string `pulumi:"parentGroupId"`
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll map[string]string `pulumi:"tagsAll"`
}
type UserHierarchyGroupState struct {
// The Amazon Resource Name (ARN) of the hierarchy group.
Arn pulumi.StringPtrInput
// The identifier for the hierarchy group.
HierarchyGroupId pulumi.StringPtrInput
// A block that contains information about the levels in the hierarchy group. The `hierarchyPath` block is documented below.
HierarchyPaths UserHierarchyGroupHierarchyPathArrayInput
// Specifies the identifier of the hosting Amazon Connect Instance.
InstanceId pulumi.StringPtrInput
// The identifier of the level in the hierarchy group.
LevelId pulumi.StringPtrInput
// The name of the user hierarchy group. Must not be more than 100 characters.
Name pulumi.StringPtrInput
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
ParentGroupId pulumi.StringPtrInput
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
TagsAll pulumi.StringMapInput
}
func (UserHierarchyGroupState) ElementType() reflect.Type {
return reflect.TypeOf((*userHierarchyGroupState)(nil)).Elem()
}
type userHierarchyGroupArgs struct {
// Specifies the identifier of the hosting Amazon Connect Instance.
InstanceId string `pulumi:"instanceId"`
// The name of the user hierarchy group. Must not be more than 100 characters.
Name *string `pulumi:"name"`
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
ParentGroupId *string `pulumi:"parentGroupId"`
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a UserHierarchyGroup resource.
type UserHierarchyGroupArgs struct {
// Specifies the identifier of the hosting Amazon Connect Instance.
InstanceId pulumi.StringInput
// The name of the user hierarchy group. Must not be more than 100 characters.
Name pulumi.StringPtrInput
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
ParentGroupId pulumi.StringPtrInput
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Tags pulumi.StringMapInput
}
func (UserHierarchyGroupArgs) ElementType() reflect.Type {
return reflect.TypeOf((*userHierarchyGroupArgs)(nil)).Elem()
}
type UserHierarchyGroupInput interface {
pulumi.Input
ToUserHierarchyGroupOutput() UserHierarchyGroupOutput
ToUserHierarchyGroupOutputWithContext(ctx context.Context) UserHierarchyGroupOutput
}
func (*UserHierarchyGroup) ElementType() reflect.Type {
return reflect.TypeOf((**UserHierarchyGroup)(nil)).Elem()
}
func (i *UserHierarchyGroup) ToUserHierarchyGroupOutput() UserHierarchyGroupOutput {
return i.ToUserHierarchyGroupOutputWithContext(context.Background())
}
func (i *UserHierarchyGroup) ToUserHierarchyGroupOutputWithContext(ctx context.Context) UserHierarchyGroupOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserHierarchyGroupOutput)
}
// UserHierarchyGroupArrayInput is an input type that accepts UserHierarchyGroupArray and UserHierarchyGroupArrayOutput values.
// You can construct a concrete instance of `UserHierarchyGroupArrayInput` via:
//
// UserHierarchyGroupArray{ UserHierarchyGroupArgs{...} }
type UserHierarchyGroupArrayInput interface {
pulumi.Input
ToUserHierarchyGroupArrayOutput() UserHierarchyGroupArrayOutput
ToUserHierarchyGroupArrayOutputWithContext(context.Context) UserHierarchyGroupArrayOutput
}
type UserHierarchyGroupArray []UserHierarchyGroupInput
func (UserHierarchyGroupArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserHierarchyGroup)(nil)).Elem()
}
func (i UserHierarchyGroupArray) ToUserHierarchyGroupArrayOutput() UserHierarchyGroupArrayOutput {
return i.ToUserHierarchyGroupArrayOutputWithContext(context.Background())
}
func (i UserHierarchyGroupArray) ToUserHierarchyGroupArrayOutputWithContext(ctx context.Context) UserHierarchyGroupArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserHierarchyGroupArrayOutput)
}
// UserHierarchyGroupMapInput is an input type that accepts UserHierarchyGroupMap and UserHierarchyGroupMapOutput values.
// You can construct a concrete instance of `UserHierarchyGroupMapInput` via:
//
// UserHierarchyGroupMap{ "key": UserHierarchyGroupArgs{...} }
type UserHierarchyGroupMapInput interface {
pulumi.Input
ToUserHierarchyGroupMapOutput() UserHierarchyGroupMapOutput
ToUserHierarchyGroupMapOutputWithContext(context.Context) UserHierarchyGroupMapOutput
}
type UserHierarchyGroupMap map[string]UserHierarchyGroupInput
func (UserHierarchyGroupMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserHierarchyGroup)(nil)).Elem()
}
func (i UserHierarchyGroupMap) ToUserHierarchyGroupMapOutput() UserHierarchyGroupMapOutput {
return i.ToUserHierarchyGroupMapOutputWithContext(context.Background())
}
func (i UserHierarchyGroupMap) ToUserHierarchyGroupMapOutputWithContext(ctx context.Context) UserHierarchyGroupMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(UserHierarchyGroupMapOutput)
}
type UserHierarchyGroupOutput struct{ *pulumi.OutputState }
func (UserHierarchyGroupOutput) ElementType() reflect.Type {
return reflect.TypeOf((**UserHierarchyGroup)(nil)).Elem()
}
func (o UserHierarchyGroupOutput) ToUserHierarchyGroupOutput() UserHierarchyGroupOutput {
return o
}
func (o UserHierarchyGroupOutput) ToUserHierarchyGroupOutputWithContext(ctx context.Context) UserHierarchyGroupOutput {
return o
}
// The Amazon Resource Name (ARN) of the hierarchy group.
func (o UserHierarchyGroupOutput) Arn() pulumi.StringOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
}
// The identifier for the hierarchy group.
func (o UserHierarchyGroupOutput) HierarchyGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringOutput { return v.HierarchyGroupId }).(pulumi.StringOutput)
}
// A block that contains information about the levels in the hierarchy group. The `hierarchyPath` block is documented below.
func (o UserHierarchyGroupOutput) HierarchyPaths() UserHierarchyGroupHierarchyPathArrayOutput {
return o.ApplyT(func(v *UserHierarchyGroup) UserHierarchyGroupHierarchyPathArrayOutput { return v.HierarchyPaths }).(UserHierarchyGroupHierarchyPathArrayOutput)
}
// Specifies the identifier of the hosting Amazon Connect Instance.
func (o UserHierarchyGroupOutput) InstanceId() pulumi.StringOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringOutput { return v.InstanceId }).(pulumi.StringOutput)
}
// The identifier of the level in the hierarchy group.
func (o UserHierarchyGroupOutput) LevelId() pulumi.StringOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringOutput { return v.LevelId }).(pulumi.StringOutput)
}
// The name of the user hierarchy group. Must not be more than 100 characters.
func (o UserHierarchyGroupOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The identifier for the parent hierarchy group. The user hierarchy is created at level one if the parent group ID is null.
func (o UserHierarchyGroupOutput) ParentGroupId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringPtrOutput { return v.ParentGroupId }).(pulumi.StringPtrOutput)
}
// Tags to apply to the hierarchy group. If configured with a provider
// `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
func (o UserHierarchyGroupOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
func (o UserHierarchyGroupOutput) TagsAll() pulumi.StringMapOutput {
return o.ApplyT(func(v *UserHierarchyGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
}
type UserHierarchyGroupArrayOutput struct{ *pulumi.OutputState }
func (UserHierarchyGroupArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*UserHierarchyGroup)(nil)).Elem()
}
func (o UserHierarchyGroupArrayOutput) ToUserHierarchyGroupArrayOutput() UserHierarchyGroupArrayOutput {
return o
}
func (o UserHierarchyGroupArrayOutput) ToUserHierarchyGroupArrayOutputWithContext(ctx context.Context) UserHierarchyGroupArrayOutput {
return o
}
func (o UserHierarchyGroupArrayOutput) Index(i pulumi.IntInput) UserHierarchyGroupOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *UserHierarchyGroup {
return vs[0].([]*UserHierarchyGroup)[vs[1].(int)]
}).(UserHierarchyGroupOutput)
}
type UserHierarchyGroupMapOutput struct{ *pulumi.OutputState }
func (UserHierarchyGroupMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*UserHierarchyGroup)(nil)).Elem()
}
func (o UserHierarchyGroupMapOutput) ToUserHierarchyGroupMapOutput() UserHierarchyGroupMapOutput {
return o
}
func (o UserHierarchyGroupMapOutput) ToUserHierarchyGroupMapOutputWithContext(ctx context.Context) UserHierarchyGroupMapOutput {
return o
}
func (o UserHierarchyGroupMapOutput) MapIndex(k pulumi.StringInput) UserHierarchyGroupOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *UserHierarchyGroup {
return vs[0].(map[string]*UserHierarchyGroup)[vs[1].(string)]
}).(UserHierarchyGroupOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*UserHierarchyGroupInput)(nil)).Elem(), &UserHierarchyGroup{})
pulumi.RegisterInputType(reflect.TypeOf((*UserHierarchyGroupArrayInput)(nil)).Elem(), UserHierarchyGroupArray{})
pulumi.RegisterInputType(reflect.TypeOf((*UserHierarchyGroupMapInput)(nil)).Elem(), UserHierarchyGroupMap{})
pulumi.RegisterOutputType(UserHierarchyGroupOutput{})
pulumi.RegisterOutputType(UserHierarchyGroupArrayOutput{})
pulumi.RegisterOutputType(UserHierarchyGroupMapOutput{})
}