-
Notifications
You must be signed in to change notification settings - Fork 2
/
mapping.go
378 lines (318 loc) · 11.3 KB
/
mapping.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
// *** 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 profile
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a profile mapping.
//
// This resource allows you to manage a profile mapping by source id.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-okta/sdk/v2/go/okta/profile"
// "github.com/pulumi/pulumi-okta/sdk/v2/go/okta/user"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// user, err := user.GetUserProfileMappingSource(ctx, nil, nil)
// if err != nil {
// return err
// }
// _, err = profile.NewMapping(ctx, "example", &profile.MappingArgs{
// DeleteWhenAbsent: pulumi.Bool(true),
// Mappings: profile.MappingMappingArray{
// &profile.MappingMappingArgs{
// Expression: pulumi.String("appuser.firstName"),
// Id: pulumi.String("firstName"),
// },
// &profile.MappingMappingArgs{
// Expression: pulumi.String("appuser.lastName"),
// Id: pulumi.String("lastName"),
// },
// &profile.MappingMappingArgs{
// Expression: pulumi.String("appuser.email"),
// Id: pulumi.String("email"),
// },
// &profile.MappingMappingArgs{
// Expression: pulumi.String("appuser.email"),
// Id: pulumi.String("login"),
// },
// },
// SourceId: pulumi.String("<source id>"),
// TargetId: pulumi.String(user.Id),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// There is no reason to import this resource. You can simply create the resource config and point it to a source ID. Mind here, once the source is deleted this resources will no longer exist.
type Mapping struct {
pulumi.CustomResourceState
// Tells the provider whether to attempt to delete missing mappings under profile mapping.
DeleteWhenAbsent pulumi.BoolPtrOutput `pulumi:"deleteWhenAbsent"`
// Priority of the policy.
Mappings MappingMappingArrayOutput `pulumi:"mappings"`
// Source id of the profile mapping.
SourceId pulumi.StringOutput `pulumi:"sourceId"`
// Name of the mapping source.
SourceName pulumi.StringOutput `pulumi:"sourceName"`
// ID of the mapping source.
SourceType pulumi.StringOutput `pulumi:"sourceType"`
// ID of the mapping target.
TargetId pulumi.StringOutput `pulumi:"targetId"`
// Name of the mapping target.
TargetName pulumi.StringOutput `pulumi:"targetName"`
// ID of the mapping target.
TargetType pulumi.StringOutput `pulumi:"targetType"`
}
// NewMapping registers a new resource with the given unique name, arguments, and options.
func NewMapping(ctx *pulumi.Context,
name string, args *MappingArgs, opts ...pulumi.ResourceOption) (*Mapping, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.SourceId == nil {
return nil, errors.New("invalid value for required argument 'SourceId'")
}
if args.TargetId == nil {
return nil, errors.New("invalid value for required argument 'TargetId'")
}
var resource Mapping
err := ctx.RegisterResource("okta:profile/mapping:Mapping", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetMapping gets an existing Mapping 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 GetMapping(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *MappingState, opts ...pulumi.ResourceOption) (*Mapping, error) {
var resource Mapping
err := ctx.ReadResource("okta:profile/mapping:Mapping", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Mapping resources.
type mappingState struct {
// Tells the provider whether to attempt to delete missing mappings under profile mapping.
DeleteWhenAbsent *bool `pulumi:"deleteWhenAbsent"`
// Priority of the policy.
Mappings []MappingMapping `pulumi:"mappings"`
// Source id of the profile mapping.
SourceId *string `pulumi:"sourceId"`
// Name of the mapping source.
SourceName *string `pulumi:"sourceName"`
// ID of the mapping source.
SourceType *string `pulumi:"sourceType"`
// ID of the mapping target.
TargetId *string `pulumi:"targetId"`
// Name of the mapping target.
TargetName *string `pulumi:"targetName"`
// ID of the mapping target.
TargetType *string `pulumi:"targetType"`
}
type MappingState struct {
// Tells the provider whether to attempt to delete missing mappings under profile mapping.
DeleteWhenAbsent pulumi.BoolPtrInput
// Priority of the policy.
Mappings MappingMappingArrayInput
// Source id of the profile mapping.
SourceId pulumi.StringPtrInput
// Name of the mapping source.
SourceName pulumi.StringPtrInput
// ID of the mapping source.
SourceType pulumi.StringPtrInput
// ID of the mapping target.
TargetId pulumi.StringPtrInput
// Name of the mapping target.
TargetName pulumi.StringPtrInput
// ID of the mapping target.
TargetType pulumi.StringPtrInput
}
func (MappingState) ElementType() reflect.Type {
return reflect.TypeOf((*mappingState)(nil)).Elem()
}
type mappingArgs struct {
// Tells the provider whether to attempt to delete missing mappings under profile mapping.
DeleteWhenAbsent *bool `pulumi:"deleteWhenAbsent"`
// Priority of the policy.
Mappings []MappingMapping `pulumi:"mappings"`
// Source id of the profile mapping.
SourceId string `pulumi:"sourceId"`
// ID of the mapping target.
TargetId string `pulumi:"targetId"`
}
// The set of arguments for constructing a Mapping resource.
type MappingArgs struct {
// Tells the provider whether to attempt to delete missing mappings under profile mapping.
DeleteWhenAbsent pulumi.BoolPtrInput
// Priority of the policy.
Mappings MappingMappingArrayInput
// Source id of the profile mapping.
SourceId pulumi.StringInput
// ID of the mapping target.
TargetId pulumi.StringInput
}
func (MappingArgs) ElementType() reflect.Type {
return reflect.TypeOf((*mappingArgs)(nil)).Elem()
}
type MappingInput interface {
pulumi.Input
ToMappingOutput() MappingOutput
ToMappingOutputWithContext(ctx context.Context) MappingOutput
}
func (*Mapping) ElementType() reflect.Type {
return reflect.TypeOf((*Mapping)(nil))
}
func (i *Mapping) ToMappingOutput() MappingOutput {
return i.ToMappingOutputWithContext(context.Background())
}
func (i *Mapping) ToMappingOutputWithContext(ctx context.Context) MappingOutput {
return pulumi.ToOutputWithContext(ctx, i).(MappingOutput)
}
func (i *Mapping) ToMappingPtrOutput() MappingPtrOutput {
return i.ToMappingPtrOutputWithContext(context.Background())
}
func (i *Mapping) ToMappingPtrOutputWithContext(ctx context.Context) MappingPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MappingPtrOutput)
}
type MappingPtrInput interface {
pulumi.Input
ToMappingPtrOutput() MappingPtrOutput
ToMappingPtrOutputWithContext(ctx context.Context) MappingPtrOutput
}
type mappingPtrType MappingArgs
func (*mappingPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Mapping)(nil))
}
func (i *mappingPtrType) ToMappingPtrOutput() MappingPtrOutput {
return i.ToMappingPtrOutputWithContext(context.Background())
}
func (i *mappingPtrType) ToMappingPtrOutputWithContext(ctx context.Context) MappingPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(MappingPtrOutput)
}
// MappingArrayInput is an input type that accepts MappingArray and MappingArrayOutput values.
// You can construct a concrete instance of `MappingArrayInput` via:
//
// MappingArray{ MappingArgs{...} }
type MappingArrayInput interface {
pulumi.Input
ToMappingArrayOutput() MappingArrayOutput
ToMappingArrayOutputWithContext(context.Context) MappingArrayOutput
}
type MappingArray []MappingInput
func (MappingArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Mapping)(nil))
}
func (i MappingArray) ToMappingArrayOutput() MappingArrayOutput {
return i.ToMappingArrayOutputWithContext(context.Background())
}
func (i MappingArray) ToMappingArrayOutputWithContext(ctx context.Context) MappingArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(MappingArrayOutput)
}
// MappingMapInput is an input type that accepts MappingMap and MappingMapOutput values.
// You can construct a concrete instance of `MappingMapInput` via:
//
// MappingMap{ "key": MappingArgs{...} }
type MappingMapInput interface {
pulumi.Input
ToMappingMapOutput() MappingMapOutput
ToMappingMapOutputWithContext(context.Context) MappingMapOutput
}
type MappingMap map[string]MappingInput
func (MappingMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Mapping)(nil))
}
func (i MappingMap) ToMappingMapOutput() MappingMapOutput {
return i.ToMappingMapOutputWithContext(context.Background())
}
func (i MappingMap) ToMappingMapOutputWithContext(ctx context.Context) MappingMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(MappingMapOutput)
}
type MappingOutput struct {
*pulumi.OutputState
}
func (MappingOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Mapping)(nil))
}
func (o MappingOutput) ToMappingOutput() MappingOutput {
return o
}
func (o MappingOutput) ToMappingOutputWithContext(ctx context.Context) MappingOutput {
return o
}
func (o MappingOutput) ToMappingPtrOutput() MappingPtrOutput {
return o.ToMappingPtrOutputWithContext(context.Background())
}
func (o MappingOutput) ToMappingPtrOutputWithContext(ctx context.Context) MappingPtrOutput {
return o.ApplyT(func(v Mapping) *Mapping {
return &v
}).(MappingPtrOutput)
}
type MappingPtrOutput struct {
*pulumi.OutputState
}
func (MappingPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Mapping)(nil))
}
func (o MappingPtrOutput) ToMappingPtrOutput() MappingPtrOutput {
return o
}
func (o MappingPtrOutput) ToMappingPtrOutputWithContext(ctx context.Context) MappingPtrOutput {
return o
}
type MappingArrayOutput struct{ *pulumi.OutputState }
func (MappingArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Mapping)(nil))
}
func (o MappingArrayOutput) ToMappingArrayOutput() MappingArrayOutput {
return o
}
func (o MappingArrayOutput) ToMappingArrayOutputWithContext(ctx context.Context) MappingArrayOutput {
return o
}
func (o MappingArrayOutput) Index(i pulumi.IntInput) MappingOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Mapping {
return vs[0].([]Mapping)[vs[1].(int)]
}).(MappingOutput)
}
type MappingMapOutput struct{ *pulumi.OutputState }
func (MappingMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Mapping)(nil))
}
func (o MappingMapOutput) ToMappingMapOutput() MappingMapOutput {
return o
}
func (o MappingMapOutput) ToMappingMapOutputWithContext(ctx context.Context) MappingMapOutput {
return o
}
func (o MappingMapOutput) MapIndex(k pulumi.StringInput) MappingOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Mapping {
return vs[0].(map[string]Mapping)[vs[1].(string)]
}).(MappingOutput)
}
func init() {
pulumi.RegisterOutputType(MappingOutput{})
pulumi.RegisterOutputType(MappingPtrOutput{})
pulumi.RegisterOutputType(MappingArrayOutput{})
pulumi.RegisterOutputType(MappingMapOutput{})
}