/
hook.go
356 lines (303 loc) · 10.9 KB
/
hook.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
// 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 inline
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates an inline hook.
//
// This resource allows you to create and configure an inline hook.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-okta/sdk/v3/go/okta/inline"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := inline.NewHook(ctx, "example", &inline.HookArgs{
// Auth: pulumi.StringMap{
// "key": pulumi.String("Authorization"),
// "type": pulumi.String("HEADER"),
// "value": pulumi.String("secret"),
// },
// Channel: pulumi.StringMap{
// "method": pulumi.String("POST"),
// "uri": pulumi.String("https://example.com/test"),
// "version": pulumi.String("1.0.0"),
// },
// Type: pulumi.String("com.okta.oauth2.tokens.transform"),
// Version: pulumi.String("1.0.0"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// An inline hook can be imported via the Okta ID.
//
// ```sh
//
// $ pulumi import okta:inline/hook:Hook example <hook id>
//
// ```
type Hook struct {
pulumi.CustomResourceState
// Authentication required for inline hook request.
Auth pulumi.StringMapOutput `pulumi:"auth"`
// Details of the endpoint the inline hook will hit.
Channel pulumi.StringMapOutput `pulumi:"channel"`
// Map of headers to send along in inline hook request.
Headers HookHeaderArrayOutput `pulumi:"headers"`
// The inline hook display name.
Name pulumi.StringOutput `pulumi:"name"`
Status pulumi.StringPtrOutput `pulumi:"status"`
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
Type pulumi.StringOutput `pulumi:"type"`
// Version of the channel. The currently-supported version is `"1.0.0"`.
Version pulumi.StringOutput `pulumi:"version"`
}
// NewHook registers a new resource with the given unique name, arguments, and options.
func NewHook(ctx *pulumi.Context,
name string, args *HookArgs, opts ...pulumi.ResourceOption) (*Hook, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Channel == nil {
return nil, errors.New("invalid value for required argument 'Channel'")
}
if args.Type == nil {
return nil, errors.New("invalid value for required argument 'Type'")
}
if args.Version == nil {
return nil, errors.New("invalid value for required argument 'Version'")
}
var resource Hook
err := ctx.RegisterResource("okta:inline/hook:Hook", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetHook gets an existing Hook 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 GetHook(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *HookState, opts ...pulumi.ResourceOption) (*Hook, error) {
var resource Hook
err := ctx.ReadResource("okta:inline/hook:Hook", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Hook resources.
type hookState struct {
// Authentication required for inline hook request.
Auth map[string]string `pulumi:"auth"`
// Details of the endpoint the inline hook will hit.
Channel map[string]string `pulumi:"channel"`
// Map of headers to send along in inline hook request.
Headers []HookHeader `pulumi:"headers"`
// The inline hook display name.
Name *string `pulumi:"name"`
Status *string `pulumi:"status"`
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
Type *string `pulumi:"type"`
// Version of the channel. The currently-supported version is `"1.0.0"`.
Version *string `pulumi:"version"`
}
type HookState struct {
// Authentication required for inline hook request.
Auth pulumi.StringMapInput
// Details of the endpoint the inline hook will hit.
Channel pulumi.StringMapInput
// Map of headers to send along in inline hook request.
Headers HookHeaderArrayInput
// The inline hook display name.
Name pulumi.StringPtrInput
Status pulumi.StringPtrInput
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
Type pulumi.StringPtrInput
// Version of the channel. The currently-supported version is `"1.0.0"`.
Version pulumi.StringPtrInput
}
func (HookState) ElementType() reflect.Type {
return reflect.TypeOf((*hookState)(nil)).Elem()
}
type hookArgs struct {
// Authentication required for inline hook request.
Auth map[string]string `pulumi:"auth"`
// Details of the endpoint the inline hook will hit.
Channel map[string]string `pulumi:"channel"`
// Map of headers to send along in inline hook request.
Headers []HookHeader `pulumi:"headers"`
// The inline hook display name.
Name *string `pulumi:"name"`
Status *string `pulumi:"status"`
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
Type string `pulumi:"type"`
// Version of the channel. The currently-supported version is `"1.0.0"`.
Version string `pulumi:"version"`
}
// The set of arguments for constructing a Hook resource.
type HookArgs struct {
// Authentication required for inline hook request.
Auth pulumi.StringMapInput
// Details of the endpoint the inline hook will hit.
Channel pulumi.StringMapInput
// Map of headers to send along in inline hook request.
Headers HookHeaderArrayInput
// The inline hook display name.
Name pulumi.StringPtrInput
Status pulumi.StringPtrInput
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
Type pulumi.StringInput
// Version of the channel. The currently-supported version is `"1.0.0"`.
Version pulumi.StringInput
}
func (HookArgs) ElementType() reflect.Type {
return reflect.TypeOf((*hookArgs)(nil)).Elem()
}
type HookInput interface {
pulumi.Input
ToHookOutput() HookOutput
ToHookOutputWithContext(ctx context.Context) HookOutput
}
func (*Hook) ElementType() reflect.Type {
return reflect.TypeOf((**Hook)(nil)).Elem()
}
func (i *Hook) ToHookOutput() HookOutput {
return i.ToHookOutputWithContext(context.Background())
}
func (i *Hook) ToHookOutputWithContext(ctx context.Context) HookOutput {
return pulumi.ToOutputWithContext(ctx, i).(HookOutput)
}
// HookArrayInput is an input type that accepts HookArray and HookArrayOutput values.
// You can construct a concrete instance of `HookArrayInput` via:
//
// HookArray{ HookArgs{...} }
type HookArrayInput interface {
pulumi.Input
ToHookArrayOutput() HookArrayOutput
ToHookArrayOutputWithContext(context.Context) HookArrayOutput
}
type HookArray []HookInput
func (HookArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Hook)(nil)).Elem()
}
func (i HookArray) ToHookArrayOutput() HookArrayOutput {
return i.ToHookArrayOutputWithContext(context.Background())
}
func (i HookArray) ToHookArrayOutputWithContext(ctx context.Context) HookArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(HookArrayOutput)
}
// HookMapInput is an input type that accepts HookMap and HookMapOutput values.
// You can construct a concrete instance of `HookMapInput` via:
//
// HookMap{ "key": HookArgs{...} }
type HookMapInput interface {
pulumi.Input
ToHookMapOutput() HookMapOutput
ToHookMapOutputWithContext(context.Context) HookMapOutput
}
type HookMap map[string]HookInput
func (HookMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Hook)(nil)).Elem()
}
func (i HookMap) ToHookMapOutput() HookMapOutput {
return i.ToHookMapOutputWithContext(context.Background())
}
func (i HookMap) ToHookMapOutputWithContext(ctx context.Context) HookMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(HookMapOutput)
}
type HookOutput struct{ *pulumi.OutputState }
func (HookOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Hook)(nil)).Elem()
}
func (o HookOutput) ToHookOutput() HookOutput {
return o
}
func (o HookOutput) ToHookOutputWithContext(ctx context.Context) HookOutput {
return o
}
// Authentication required for inline hook request.
func (o HookOutput) Auth() pulumi.StringMapOutput {
return o.ApplyT(func(v *Hook) pulumi.StringMapOutput { return v.Auth }).(pulumi.StringMapOutput)
}
// Details of the endpoint the inline hook will hit.
func (o HookOutput) Channel() pulumi.StringMapOutput {
return o.ApplyT(func(v *Hook) pulumi.StringMapOutput { return v.Channel }).(pulumi.StringMapOutput)
}
// Map of headers to send along in inline hook request.
func (o HookOutput) Headers() HookHeaderArrayOutput {
return o.ApplyT(func(v *Hook) HookHeaderArrayOutput { return v.Headers }).(HookHeaderArrayOutput)
}
// The inline hook display name.
func (o HookOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Hook) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o HookOutput) Status() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Hook) pulumi.StringPtrOutput { return v.Status }).(pulumi.StringPtrOutput)
}
// The type of hook to trigger. Currently, the only supported type is `"HTTP"`.
func (o HookOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v *Hook) pulumi.StringOutput { return v.Type }).(pulumi.StringOutput)
}
// Version of the channel. The currently-supported version is `"1.0.0"`.
func (o HookOutput) Version() pulumi.StringOutput {
return o.ApplyT(func(v *Hook) pulumi.StringOutput { return v.Version }).(pulumi.StringOutput)
}
type HookArrayOutput struct{ *pulumi.OutputState }
func (HookArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Hook)(nil)).Elem()
}
func (o HookArrayOutput) ToHookArrayOutput() HookArrayOutput {
return o
}
func (o HookArrayOutput) ToHookArrayOutputWithContext(ctx context.Context) HookArrayOutput {
return o
}
func (o HookArrayOutput) Index(i pulumi.IntInput) HookOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *Hook {
return vs[0].([]*Hook)[vs[1].(int)]
}).(HookOutput)
}
type HookMapOutput struct{ *pulumi.OutputState }
func (HookMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Hook)(nil)).Elem()
}
func (o HookMapOutput) ToHookMapOutput() HookMapOutput {
return o
}
func (o HookMapOutput) ToHookMapOutputWithContext(ctx context.Context) HookMapOutput {
return o
}
func (o HookMapOutput) MapIndex(k pulumi.StringInput) HookOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *Hook {
return vs[0].(map[string]*Hook)[vs[1].(string)]
}).(HookOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*HookInput)(nil)).Elem(), &Hook{})
pulumi.RegisterInputType(reflect.TypeOf((*HookArrayInput)(nil)).Elem(), HookArray{})
pulumi.RegisterInputType(reflect.TypeOf((*HookMapInput)(nil)).Elem(), HookMap{})
pulumi.RegisterOutputType(HookOutput{})
pulumi.RegisterOutputType(HookArrayOutput{})
pulumi.RegisterOutputType(HookMapOutput{})
}