/
organizationalUnit.go
301 lines (250 loc) · 10.5 KB
/
organizationalUnit.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
// 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 aiven
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates and manages an [organizational unit](https://aiven.io/docs/platform/concepts/projects_accounts_access) in an Aiven organization.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := aiven.NewOrganizationalUnit(ctx, "exampleUnit", &aiven.OrganizationalUnitArgs{
// ParentId: pulumi.Any(aiven_organization.Main.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// ```sh
// $ pulumi import aiven:index/organizationalUnit:OrganizationalUnit example_unit ORGANIZATIONAL_UNIT_ID
// ```
type OrganizationalUnit struct {
pulumi.CustomResourceState
// Time of creation.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// The name of the organizational unit.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the organization that the unit is created in.
ParentId pulumi.StringOutput `pulumi:"parentId"`
// Tenant ID.
TenantId pulumi.StringOutput `pulumi:"tenantId"`
// Time of last update.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
}
// NewOrganizationalUnit registers a new resource with the given unique name, arguments, and options.
func NewOrganizationalUnit(ctx *pulumi.Context,
name string, args *OrganizationalUnitArgs, opts ...pulumi.ResourceOption) (*OrganizationalUnit, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ParentId == nil {
return nil, errors.New("invalid value for required argument 'ParentId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource OrganizationalUnit
err := ctx.RegisterResource("aiven:index/organizationalUnit:OrganizationalUnit", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetOrganizationalUnit gets an existing OrganizationalUnit 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 GetOrganizationalUnit(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *OrganizationalUnitState, opts ...pulumi.ResourceOption) (*OrganizationalUnit, error) {
var resource OrganizationalUnit
err := ctx.ReadResource("aiven:index/organizationalUnit:OrganizationalUnit", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering OrganizationalUnit resources.
type organizationalUnitState struct {
// Time of creation.
CreateTime *string `pulumi:"createTime"`
// The name of the organizational unit.
Name *string `pulumi:"name"`
// The ID of the organization that the unit is created in.
ParentId *string `pulumi:"parentId"`
// Tenant ID.
TenantId *string `pulumi:"tenantId"`
// Time of last update.
UpdateTime *string `pulumi:"updateTime"`
}
type OrganizationalUnitState struct {
// Time of creation.
CreateTime pulumi.StringPtrInput
// The name of the organizational unit.
Name pulumi.StringPtrInput
// The ID of the organization that the unit is created in.
ParentId pulumi.StringPtrInput
// Tenant ID.
TenantId pulumi.StringPtrInput
// Time of last update.
UpdateTime pulumi.StringPtrInput
}
func (OrganizationalUnitState) ElementType() reflect.Type {
return reflect.TypeOf((*organizationalUnitState)(nil)).Elem()
}
type organizationalUnitArgs struct {
// The name of the organizational unit.
Name *string `pulumi:"name"`
// The ID of the organization that the unit is created in.
ParentId string `pulumi:"parentId"`
}
// The set of arguments for constructing a OrganizationalUnit resource.
type OrganizationalUnitArgs struct {
// The name of the organizational unit.
Name pulumi.StringPtrInput
// The ID of the organization that the unit is created in.
ParentId pulumi.StringInput
}
func (OrganizationalUnitArgs) ElementType() reflect.Type {
return reflect.TypeOf((*organizationalUnitArgs)(nil)).Elem()
}
type OrganizationalUnitInput interface {
pulumi.Input
ToOrganizationalUnitOutput() OrganizationalUnitOutput
ToOrganizationalUnitOutputWithContext(ctx context.Context) OrganizationalUnitOutput
}
func (*OrganizationalUnit) ElementType() reflect.Type {
return reflect.TypeOf((**OrganizationalUnit)(nil)).Elem()
}
func (i *OrganizationalUnit) ToOrganizationalUnitOutput() OrganizationalUnitOutput {
return i.ToOrganizationalUnitOutputWithContext(context.Background())
}
func (i *OrganizationalUnit) ToOrganizationalUnitOutputWithContext(ctx context.Context) OrganizationalUnitOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationalUnitOutput)
}
// OrganizationalUnitArrayInput is an input type that accepts OrganizationalUnitArray and OrganizationalUnitArrayOutput values.
// You can construct a concrete instance of `OrganizationalUnitArrayInput` via:
//
// OrganizationalUnitArray{ OrganizationalUnitArgs{...} }
type OrganizationalUnitArrayInput interface {
pulumi.Input
ToOrganizationalUnitArrayOutput() OrganizationalUnitArrayOutput
ToOrganizationalUnitArrayOutputWithContext(context.Context) OrganizationalUnitArrayOutput
}
type OrganizationalUnitArray []OrganizationalUnitInput
func (OrganizationalUnitArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*OrganizationalUnit)(nil)).Elem()
}
func (i OrganizationalUnitArray) ToOrganizationalUnitArrayOutput() OrganizationalUnitArrayOutput {
return i.ToOrganizationalUnitArrayOutputWithContext(context.Background())
}
func (i OrganizationalUnitArray) ToOrganizationalUnitArrayOutputWithContext(ctx context.Context) OrganizationalUnitArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationalUnitArrayOutput)
}
// OrganizationalUnitMapInput is an input type that accepts OrganizationalUnitMap and OrganizationalUnitMapOutput values.
// You can construct a concrete instance of `OrganizationalUnitMapInput` via:
//
// OrganizationalUnitMap{ "key": OrganizationalUnitArgs{...} }
type OrganizationalUnitMapInput interface {
pulumi.Input
ToOrganizationalUnitMapOutput() OrganizationalUnitMapOutput
ToOrganizationalUnitMapOutputWithContext(context.Context) OrganizationalUnitMapOutput
}
type OrganizationalUnitMap map[string]OrganizationalUnitInput
func (OrganizationalUnitMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*OrganizationalUnit)(nil)).Elem()
}
func (i OrganizationalUnitMap) ToOrganizationalUnitMapOutput() OrganizationalUnitMapOutput {
return i.ToOrganizationalUnitMapOutputWithContext(context.Background())
}
func (i OrganizationalUnitMap) ToOrganizationalUnitMapOutputWithContext(ctx context.Context) OrganizationalUnitMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(OrganizationalUnitMapOutput)
}
type OrganizationalUnitOutput struct{ *pulumi.OutputState }
func (OrganizationalUnitOutput) ElementType() reflect.Type {
return reflect.TypeOf((**OrganizationalUnit)(nil)).Elem()
}
func (o OrganizationalUnitOutput) ToOrganizationalUnitOutput() OrganizationalUnitOutput {
return o
}
func (o OrganizationalUnitOutput) ToOrganizationalUnitOutputWithContext(ctx context.Context) OrganizationalUnitOutput {
return o
}
// Time of creation.
func (o OrganizationalUnitOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationalUnit) pulumi.StringOutput { return v.CreateTime }).(pulumi.StringOutput)
}
// The name of the organizational unit.
func (o OrganizationalUnitOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationalUnit) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the organization that the unit is created in.
func (o OrganizationalUnitOutput) ParentId() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationalUnit) pulumi.StringOutput { return v.ParentId }).(pulumi.StringOutput)
}
// Tenant ID.
func (o OrganizationalUnitOutput) TenantId() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationalUnit) pulumi.StringOutput { return v.TenantId }).(pulumi.StringOutput)
}
// Time of last update.
func (o OrganizationalUnitOutput) UpdateTime() pulumi.StringOutput {
return o.ApplyT(func(v *OrganizationalUnit) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)
}
type OrganizationalUnitArrayOutput struct{ *pulumi.OutputState }
func (OrganizationalUnitArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*OrganizationalUnit)(nil)).Elem()
}
func (o OrganizationalUnitArrayOutput) ToOrganizationalUnitArrayOutput() OrganizationalUnitArrayOutput {
return o
}
func (o OrganizationalUnitArrayOutput) ToOrganizationalUnitArrayOutputWithContext(ctx context.Context) OrganizationalUnitArrayOutput {
return o
}
func (o OrganizationalUnitArrayOutput) Index(i pulumi.IntInput) OrganizationalUnitOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *OrganizationalUnit {
return vs[0].([]*OrganizationalUnit)[vs[1].(int)]
}).(OrganizationalUnitOutput)
}
type OrganizationalUnitMapOutput struct{ *pulumi.OutputState }
func (OrganizationalUnitMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*OrganizationalUnit)(nil)).Elem()
}
func (o OrganizationalUnitMapOutput) ToOrganizationalUnitMapOutput() OrganizationalUnitMapOutput {
return o
}
func (o OrganizationalUnitMapOutput) ToOrganizationalUnitMapOutputWithContext(ctx context.Context) OrganizationalUnitMapOutput {
return o
}
func (o OrganizationalUnitMapOutput) MapIndex(k pulumi.StringInput) OrganizationalUnitOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *OrganizationalUnit {
return vs[0].(map[string]*OrganizationalUnit)[vs[1].(string)]
}).(OrganizationalUnitOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationalUnitInput)(nil)).Elem(), &OrganizationalUnit{})
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationalUnitArrayInput)(nil)).Elem(), OrganizationalUnitArray{})
pulumi.RegisterInputType(reflect.TypeOf((*OrganizationalUnitMapInput)(nil)).Elem(), OrganizationalUnitMap{})
pulumi.RegisterOutputType(OrganizationalUnitOutput{})
pulumi.RegisterOutputType(OrganizationalUnitArrayOutput{})
pulumi.RegisterOutputType(OrganizationalUnitMapOutput{})
}