/
webApp.go
466 lines (407 loc) · 19 KB
/
webApp.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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
// 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 bot
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Bot Web App.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/bot"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// current, err := core.GetClientConfig(ctx, nil, nil)
// if err != nil {
// return err
// }
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("example-resources"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// _, err = bot.NewWebApp(ctx, "example", &bot.WebAppArgs{
// Name: pulumi.String("example"),
// Location: pulumi.String("global"),
// ResourceGroupName: example.Name,
// Sku: pulumi.String("F0"),
// MicrosoftAppId: pulumi.String(current.ClientId),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// Bot Web App's can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:bot/webApp:WebApp example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example/providers/Microsoft.BotService/botServices/example
// ```
type WebApp struct {
pulumi.CustomResourceState
// The Application Insights API Key to associate with the Web App Bot.
DeveloperAppInsightsApiKey pulumi.StringOutput `pulumi:"developerAppInsightsApiKey"`
// The Application Insights Application ID to associate with the Web App Bot.
DeveloperAppInsightsApplicationId pulumi.StringOutput `pulumi:"developerAppInsightsApplicationId"`
// The Application Insights Key to associate with the Web App Bot.
DeveloperAppInsightsKey pulumi.StringOutput `pulumi:"developerAppInsightsKey"`
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// The Web App Bot endpoint.
Endpoint pulumi.StringPtrOutput `pulumi:"endpoint"`
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location pulumi.StringOutput `pulumi:"location"`
// A list of LUIS App IDs to associate with the Web App Bot.
LuisAppIds pulumi.StringArrayOutput `pulumi:"luisAppIds"`
// The LUIS key to associate with the Web App Bot.
LuisKey pulumi.StringPtrOutput `pulumi:"luisKey"`
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
MicrosoftAppId pulumi.StringOutput `pulumi:"microsoftAppId"`
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
Name pulumi.StringOutput `pulumi:"name"`
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
Sku pulumi.StringOutput `pulumi:"sku"`
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapOutput `pulumi:"tags"`
}
// NewWebApp registers a new resource with the given unique name, arguments, and options.
func NewWebApp(ctx *pulumi.Context,
name string, args *WebAppArgs, opts ...pulumi.ResourceOption) (*WebApp, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.MicrosoftAppId == nil {
return nil, errors.New("invalid value for required argument 'MicrosoftAppId'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.Sku == nil {
return nil, errors.New("invalid value for required argument 'Sku'")
}
if args.DeveloperAppInsightsApiKey != nil {
args.DeveloperAppInsightsApiKey = pulumi.ToSecret(args.DeveloperAppInsightsApiKey).(pulumi.StringPtrInput)
}
if args.LuisKey != nil {
args.LuisKey = pulumi.ToSecret(args.LuisKey).(pulumi.StringPtrInput)
}
secrets := pulumi.AdditionalSecretOutputs([]string{
"developerAppInsightsApiKey",
"luisKey",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource WebApp
err := ctx.RegisterResource("azure:bot/webApp:WebApp", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWebApp gets an existing WebApp 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 GetWebApp(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WebAppState, opts ...pulumi.ResourceOption) (*WebApp, error) {
var resource WebApp
err := ctx.ReadResource("azure:bot/webApp:WebApp", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering WebApp resources.
type webAppState struct {
// The Application Insights API Key to associate with the Web App Bot.
DeveloperAppInsightsApiKey *string `pulumi:"developerAppInsightsApiKey"`
// The Application Insights Application ID to associate with the Web App Bot.
DeveloperAppInsightsApplicationId *string `pulumi:"developerAppInsightsApplicationId"`
// The Application Insights Key to associate with the Web App Bot.
DeveloperAppInsightsKey *string `pulumi:"developerAppInsightsKey"`
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
DisplayName *string `pulumi:"displayName"`
// The Web App Bot endpoint.
Endpoint *string `pulumi:"endpoint"`
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// A list of LUIS App IDs to associate with the Web App Bot.
LuisAppIds []string `pulumi:"luisAppIds"`
// The LUIS key to associate with the Web App Bot.
LuisKey *string `pulumi:"luisKey"`
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
MicrosoftAppId *string `pulumi:"microsoftAppId"`
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
Name *string `pulumi:"name"`
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
Sku *string `pulumi:"sku"`
// A mapping of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
}
type WebAppState struct {
// The Application Insights API Key to associate with the Web App Bot.
DeveloperAppInsightsApiKey pulumi.StringPtrInput
// The Application Insights Application ID to associate with the Web App Bot.
DeveloperAppInsightsApplicationId pulumi.StringPtrInput
// The Application Insights Key to associate with the Web App Bot.
DeveloperAppInsightsKey pulumi.StringPtrInput
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
DisplayName pulumi.StringPtrInput
// The Web App Bot endpoint.
Endpoint pulumi.StringPtrInput
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// A list of LUIS App IDs to associate with the Web App Bot.
LuisAppIds pulumi.StringArrayInput
// The LUIS key to associate with the Web App Bot.
LuisKey pulumi.StringPtrInput
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
MicrosoftAppId pulumi.StringPtrInput
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
Name pulumi.StringPtrInput
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
Sku pulumi.StringPtrInput
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapInput
}
func (WebAppState) ElementType() reflect.Type {
return reflect.TypeOf((*webAppState)(nil)).Elem()
}
type webAppArgs struct {
// The Application Insights API Key to associate with the Web App Bot.
DeveloperAppInsightsApiKey *string `pulumi:"developerAppInsightsApiKey"`
// The Application Insights Application ID to associate with the Web App Bot.
DeveloperAppInsightsApplicationId *string `pulumi:"developerAppInsightsApplicationId"`
// The Application Insights Key to associate with the Web App Bot.
DeveloperAppInsightsKey *string `pulumi:"developerAppInsightsKey"`
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
DisplayName *string `pulumi:"displayName"`
// The Web App Bot endpoint.
Endpoint *string `pulumi:"endpoint"`
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location *string `pulumi:"location"`
// A list of LUIS App IDs to associate with the Web App Bot.
LuisAppIds []string `pulumi:"luisAppIds"`
// The LUIS key to associate with the Web App Bot.
LuisKey *string `pulumi:"luisKey"`
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
MicrosoftAppId string `pulumi:"microsoftAppId"`
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
Name *string `pulumi:"name"`
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
Sku string `pulumi:"sku"`
// A mapping of tags to assign to the resource.
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a WebApp resource.
type WebAppArgs struct {
// The Application Insights API Key to associate with the Web App Bot.
DeveloperAppInsightsApiKey pulumi.StringPtrInput
// The Application Insights Application ID to associate with the Web App Bot.
DeveloperAppInsightsApplicationId pulumi.StringPtrInput
// The Application Insights Key to associate with the Web App Bot.
DeveloperAppInsightsKey pulumi.StringPtrInput
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
DisplayName pulumi.StringPtrInput
// The Web App Bot endpoint.
Endpoint pulumi.StringPtrInput
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
Location pulumi.StringPtrInput
// A list of LUIS App IDs to associate with the Web App Bot.
LuisAppIds pulumi.StringArrayInput
// The LUIS key to associate with the Web App Bot.
LuisKey pulumi.StringPtrInput
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
MicrosoftAppId pulumi.StringInput
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
Name pulumi.StringPtrInput
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
Sku pulumi.StringInput
// A mapping of tags to assign to the resource.
Tags pulumi.StringMapInput
}
func (WebAppArgs) ElementType() reflect.Type {
return reflect.TypeOf((*webAppArgs)(nil)).Elem()
}
type WebAppInput interface {
pulumi.Input
ToWebAppOutput() WebAppOutput
ToWebAppOutputWithContext(ctx context.Context) WebAppOutput
}
func (*WebApp) ElementType() reflect.Type {
return reflect.TypeOf((**WebApp)(nil)).Elem()
}
func (i *WebApp) ToWebAppOutput() WebAppOutput {
return i.ToWebAppOutputWithContext(context.Background())
}
func (i *WebApp) ToWebAppOutputWithContext(ctx context.Context) WebAppOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebAppOutput)
}
// WebAppArrayInput is an input type that accepts WebAppArray and WebAppArrayOutput values.
// You can construct a concrete instance of `WebAppArrayInput` via:
//
// WebAppArray{ WebAppArgs{...} }
type WebAppArrayInput interface {
pulumi.Input
ToWebAppArrayOutput() WebAppArrayOutput
ToWebAppArrayOutputWithContext(context.Context) WebAppArrayOutput
}
type WebAppArray []WebAppInput
func (WebAppArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*WebApp)(nil)).Elem()
}
func (i WebAppArray) ToWebAppArrayOutput() WebAppArrayOutput {
return i.ToWebAppArrayOutputWithContext(context.Background())
}
func (i WebAppArray) ToWebAppArrayOutputWithContext(ctx context.Context) WebAppArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebAppArrayOutput)
}
// WebAppMapInput is an input type that accepts WebAppMap and WebAppMapOutput values.
// You can construct a concrete instance of `WebAppMapInput` via:
//
// WebAppMap{ "key": WebAppArgs{...} }
type WebAppMapInput interface {
pulumi.Input
ToWebAppMapOutput() WebAppMapOutput
ToWebAppMapOutputWithContext(context.Context) WebAppMapOutput
}
type WebAppMap map[string]WebAppInput
func (WebAppMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*WebApp)(nil)).Elem()
}
func (i WebAppMap) ToWebAppMapOutput() WebAppMapOutput {
return i.ToWebAppMapOutputWithContext(context.Background())
}
func (i WebAppMap) ToWebAppMapOutputWithContext(ctx context.Context) WebAppMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(WebAppMapOutput)
}
type WebAppOutput struct{ *pulumi.OutputState }
func (WebAppOutput) ElementType() reflect.Type {
return reflect.TypeOf((**WebApp)(nil)).Elem()
}
func (o WebAppOutput) ToWebAppOutput() WebAppOutput {
return o
}
func (o WebAppOutput) ToWebAppOutputWithContext(ctx context.Context) WebAppOutput {
return o
}
// The Application Insights API Key to associate with the Web App Bot.
func (o WebAppOutput) DeveloperAppInsightsApiKey() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.DeveloperAppInsightsApiKey }).(pulumi.StringOutput)
}
// The Application Insights Application ID to associate with the Web App Bot.
func (o WebAppOutput) DeveloperAppInsightsApplicationId() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.DeveloperAppInsightsApplicationId }).(pulumi.StringOutput)
}
// The Application Insights Key to associate with the Web App Bot.
func (o WebAppOutput) DeveloperAppInsightsKey() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.DeveloperAppInsightsKey }).(pulumi.StringOutput)
}
// The name of the Web App Bot will be displayed as. This defaults to `name` if not specified.
func (o WebAppOutput) DisplayName() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.DisplayName }).(pulumi.StringOutput)
}
// The Web App Bot endpoint.
func (o WebAppOutput) Endpoint() pulumi.StringPtrOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringPtrOutput { return v.Endpoint }).(pulumi.StringPtrOutput)
}
// The supported Azure location where the resource exists. Changing this forces a new resource to be created.
func (o WebAppOutput) Location() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.Location }).(pulumi.StringOutput)
}
// A list of LUIS App IDs to associate with the Web App Bot.
func (o WebAppOutput) LuisAppIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringArrayOutput { return v.LuisAppIds }).(pulumi.StringArrayOutput)
}
// The LUIS key to associate with the Web App Bot.
func (o WebAppOutput) LuisKey() pulumi.StringPtrOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringPtrOutput { return v.LuisKey }).(pulumi.StringPtrOutput)
}
// The Microsoft Application ID for the Web App Bot. Changing this forces a new resource to be created.
func (o WebAppOutput) MicrosoftAppId() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.MicrosoftAppId }).(pulumi.StringOutput)
}
// Specifies the name of the Web App Bot. Changing this forces a new resource to be created. Must be globally unique.
func (o WebAppOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The name of the resource group in which to create the Web App Bot. Changing this forces a new resource to be created.
func (o WebAppOutput) ResourceGroupName() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)
}
// The SKU of the Web App Bot. Valid values include `F0` or `S1`. Changing this forces a new resource to be created.
func (o WebAppOutput) Sku() pulumi.StringOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringOutput { return v.Sku }).(pulumi.StringOutput)
}
// A mapping of tags to assign to the resource.
func (o WebAppOutput) Tags() pulumi.StringMapOutput {
return o.ApplyT(func(v *WebApp) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
}
type WebAppArrayOutput struct{ *pulumi.OutputState }
func (WebAppArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*WebApp)(nil)).Elem()
}
func (o WebAppArrayOutput) ToWebAppArrayOutput() WebAppArrayOutput {
return o
}
func (o WebAppArrayOutput) ToWebAppArrayOutputWithContext(ctx context.Context) WebAppArrayOutput {
return o
}
func (o WebAppArrayOutput) Index(i pulumi.IntInput) WebAppOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *WebApp {
return vs[0].([]*WebApp)[vs[1].(int)]
}).(WebAppOutput)
}
type WebAppMapOutput struct{ *pulumi.OutputState }
func (WebAppMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*WebApp)(nil)).Elem()
}
func (o WebAppMapOutput) ToWebAppMapOutput() WebAppMapOutput {
return o
}
func (o WebAppMapOutput) ToWebAppMapOutputWithContext(ctx context.Context) WebAppMapOutput {
return o
}
func (o WebAppMapOutput) MapIndex(k pulumi.StringInput) WebAppOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *WebApp {
return vs[0].(map[string]*WebApp)[vs[1].(string)]
}).(WebAppOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*WebAppInput)(nil)).Elem(), &WebApp{})
pulumi.RegisterInputType(reflect.TypeOf((*WebAppArrayInput)(nil)).Elem(), WebAppArray{})
pulumi.RegisterInputType(reflect.TypeOf((*WebAppMapInput)(nil)).Elem(), WebAppMap{})
pulumi.RegisterOutputType(WebAppOutput{})
pulumi.RegisterOutputType(WebAppArrayOutput{})
pulumi.RegisterOutputType(WebAppMapOutput{})
}