/
backend.go
394 lines (334 loc) · 14.6 KB
/
backend.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
// *** 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 apimanagement
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Manages a backend within an API Management Service.
//
// ## Import
//
// API Management backends can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:apimanagement/backend:Backend example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.ApiManagement/service/instance1/backends/backend1
// ```
type Backend struct {
pulumi.CustomResourceState
// The Name of the API Management Service where this backend should be created. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringOutput `pulumi:"apiManagementName"`
// A `credentials` block as documented below.
Credentials BackendCredentialsPtrOutput `pulumi:"credentials"`
// The description of the backend.
Description pulumi.StringPtrOutput `pulumi:"description"`
// The name of the API Management backend. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The protocol used by the backend host. Possible values are `http` or `soap`.
Protocol pulumi.StringOutput `pulumi:"protocol"`
// A `proxy` block as documented below.
Proxy BackendProxyPtrOutput `pulumi:"proxy"`
// The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringOutput `pulumi:"resourceGroupName"`
// The management URI of the backend host in an external system. This URI can be the ARM Resource ID of Logic Apps, Function Apps or API Apps, or the management endpoint of a Service Fabric cluster.
ResourceId pulumi.StringPtrOutput `pulumi:"resourceId"`
// A `serviceFabricCluster` block as documented below.
ServiceFabricCluster BackendServiceFabricClusterPtrOutput `pulumi:"serviceFabricCluster"`
// The title of the backend.
Title pulumi.StringPtrOutput `pulumi:"title"`
// A `tls` block as documented below.
Tls BackendTlsPtrOutput `pulumi:"tls"`
// The URL of the backend host.
Url pulumi.StringOutput `pulumi:"url"`
}
// NewBackend registers a new resource with the given unique name, arguments, and options.
func NewBackend(ctx *pulumi.Context,
name string, args *BackendArgs, opts ...pulumi.ResourceOption) (*Backend, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ApiManagementName == nil {
return nil, errors.New("invalid value for required argument 'ApiManagementName'")
}
if args.Protocol == nil {
return nil, errors.New("invalid value for required argument 'Protocol'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.Url == nil {
return nil, errors.New("invalid value for required argument 'Url'")
}
var resource Backend
err := ctx.RegisterResource("azure:apimanagement/backend:Backend", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBackend gets an existing Backend 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 GetBackend(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BackendState, opts ...pulumi.ResourceOption) (*Backend, error) {
var resource Backend
err := ctx.ReadResource("azure:apimanagement/backend:Backend", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Backend resources.
type backendState struct {
// The Name of the API Management Service where this backend should be created. Changing this forces a new resource to be created.
ApiManagementName *string `pulumi:"apiManagementName"`
// A `credentials` block as documented below.
Credentials *BackendCredentials `pulumi:"credentials"`
// The description of the backend.
Description *string `pulumi:"description"`
// The name of the API Management backend. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The protocol used by the backend host. Possible values are `http` or `soap`.
Protocol *string `pulumi:"protocol"`
// A `proxy` block as documented below.
Proxy *BackendProxy `pulumi:"proxy"`
// The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName *string `pulumi:"resourceGroupName"`
// The management URI of the backend host in an external system. This URI can be the ARM Resource ID of Logic Apps, Function Apps or API Apps, or the management endpoint of a Service Fabric cluster.
ResourceId *string `pulumi:"resourceId"`
// A `serviceFabricCluster` block as documented below.
ServiceFabricCluster *BackendServiceFabricCluster `pulumi:"serviceFabricCluster"`
// The title of the backend.
Title *string `pulumi:"title"`
// A `tls` block as documented below.
Tls *BackendTls `pulumi:"tls"`
// The URL of the backend host.
Url *string `pulumi:"url"`
}
type BackendState struct {
// The Name of the API Management Service where this backend should be created. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringPtrInput
// A `credentials` block as documented below.
Credentials BackendCredentialsPtrInput
// The description of the backend.
Description pulumi.StringPtrInput
// The name of the API Management backend. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The protocol used by the backend host. Possible values are `http` or `soap`.
Protocol pulumi.StringPtrInput
// A `proxy` block as documented below.
Proxy BackendProxyPtrInput
// The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringPtrInput
// The management URI of the backend host in an external system. This URI can be the ARM Resource ID of Logic Apps, Function Apps or API Apps, or the management endpoint of a Service Fabric cluster.
ResourceId pulumi.StringPtrInput
// A `serviceFabricCluster` block as documented below.
ServiceFabricCluster BackendServiceFabricClusterPtrInput
// The title of the backend.
Title pulumi.StringPtrInput
// A `tls` block as documented below.
Tls BackendTlsPtrInput
// The URL of the backend host.
Url pulumi.StringPtrInput
}
func (BackendState) ElementType() reflect.Type {
return reflect.TypeOf((*backendState)(nil)).Elem()
}
type backendArgs struct {
// The Name of the API Management Service where this backend should be created. Changing this forces a new resource to be created.
ApiManagementName string `pulumi:"apiManagementName"`
// A `credentials` block as documented below.
Credentials *BackendCredentials `pulumi:"credentials"`
// The description of the backend.
Description *string `pulumi:"description"`
// The name of the API Management backend. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The protocol used by the backend host. Possible values are `http` or `soap`.
Protocol string `pulumi:"protocol"`
// A `proxy` block as documented below.
Proxy *BackendProxy `pulumi:"proxy"`
// The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The management URI of the backend host in an external system. This URI can be the ARM Resource ID of Logic Apps, Function Apps or API Apps, or the management endpoint of a Service Fabric cluster.
ResourceId *string `pulumi:"resourceId"`
// A `serviceFabricCluster` block as documented below.
ServiceFabricCluster *BackendServiceFabricCluster `pulumi:"serviceFabricCluster"`
// The title of the backend.
Title *string `pulumi:"title"`
// A `tls` block as documented below.
Tls *BackendTls `pulumi:"tls"`
// The URL of the backend host.
Url string `pulumi:"url"`
}
// The set of arguments for constructing a Backend resource.
type BackendArgs struct {
// The Name of the API Management Service where this backend should be created. Changing this forces a new resource to be created.
ApiManagementName pulumi.StringInput
// A `credentials` block as documented below.
Credentials BackendCredentialsPtrInput
// The description of the backend.
Description pulumi.StringPtrInput
// The name of the API Management backend. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The protocol used by the backend host. Possible values are `http` or `soap`.
Protocol pulumi.StringInput
// A `proxy` block as documented below.
Proxy BackendProxyPtrInput
// The Name of the Resource Group where the API Management Service exists. Changing this forces a new resource to be created.
ResourceGroupName pulumi.StringInput
// The management URI of the backend host in an external system. This URI can be the ARM Resource ID of Logic Apps, Function Apps or API Apps, or the management endpoint of a Service Fabric cluster.
ResourceId pulumi.StringPtrInput
// A `serviceFabricCluster` block as documented below.
ServiceFabricCluster BackendServiceFabricClusterPtrInput
// The title of the backend.
Title pulumi.StringPtrInput
// A `tls` block as documented below.
Tls BackendTlsPtrInput
// The URL of the backend host.
Url pulumi.StringInput
}
func (BackendArgs) ElementType() reflect.Type {
return reflect.TypeOf((*backendArgs)(nil)).Elem()
}
type BackendInput interface {
pulumi.Input
ToBackendOutput() BackendOutput
ToBackendOutputWithContext(ctx context.Context) BackendOutput
}
func (*Backend) ElementType() reflect.Type {
return reflect.TypeOf((*Backend)(nil))
}
func (i *Backend) ToBackendOutput() BackendOutput {
return i.ToBackendOutputWithContext(context.Background())
}
func (i *Backend) ToBackendOutputWithContext(ctx context.Context) BackendOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackendOutput)
}
func (i *Backend) ToBackendPtrOutput() BackendPtrOutput {
return i.ToBackendPtrOutputWithContext(context.Background())
}
func (i *Backend) ToBackendPtrOutputWithContext(ctx context.Context) BackendPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackendPtrOutput)
}
type BackendPtrInput interface {
pulumi.Input
ToBackendPtrOutput() BackendPtrOutput
ToBackendPtrOutputWithContext(ctx context.Context) BackendPtrOutput
}
type backendPtrType BackendArgs
func (*backendPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Backend)(nil))
}
func (i *backendPtrType) ToBackendPtrOutput() BackendPtrOutput {
return i.ToBackendPtrOutputWithContext(context.Background())
}
func (i *backendPtrType) ToBackendPtrOutputWithContext(ctx context.Context) BackendPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackendPtrOutput)
}
// BackendArrayInput is an input type that accepts BackendArray and BackendArrayOutput values.
// You can construct a concrete instance of `BackendArrayInput` via:
//
// BackendArray{ BackendArgs{...} }
type BackendArrayInput interface {
pulumi.Input
ToBackendArrayOutput() BackendArrayOutput
ToBackendArrayOutputWithContext(context.Context) BackendArrayOutput
}
type BackendArray []BackendInput
func (BackendArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Backend)(nil))
}
func (i BackendArray) ToBackendArrayOutput() BackendArrayOutput {
return i.ToBackendArrayOutputWithContext(context.Background())
}
func (i BackendArray) ToBackendArrayOutputWithContext(ctx context.Context) BackendArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackendArrayOutput)
}
// BackendMapInput is an input type that accepts BackendMap and BackendMapOutput values.
// You can construct a concrete instance of `BackendMapInput` via:
//
// BackendMap{ "key": BackendArgs{...} }
type BackendMapInput interface {
pulumi.Input
ToBackendMapOutput() BackendMapOutput
ToBackendMapOutputWithContext(context.Context) BackendMapOutput
}
type BackendMap map[string]BackendInput
func (BackendMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Backend)(nil))
}
func (i BackendMap) ToBackendMapOutput() BackendMapOutput {
return i.ToBackendMapOutputWithContext(context.Background())
}
func (i BackendMap) ToBackendMapOutputWithContext(ctx context.Context) BackendMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BackendMapOutput)
}
type BackendOutput struct {
*pulumi.OutputState
}
func (BackendOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Backend)(nil))
}
func (o BackendOutput) ToBackendOutput() BackendOutput {
return o
}
func (o BackendOutput) ToBackendOutputWithContext(ctx context.Context) BackendOutput {
return o
}
func (o BackendOutput) ToBackendPtrOutput() BackendPtrOutput {
return o.ToBackendPtrOutputWithContext(context.Background())
}
func (o BackendOutput) ToBackendPtrOutputWithContext(ctx context.Context) BackendPtrOutput {
return o.ApplyT(func(v Backend) *Backend {
return &v
}).(BackendPtrOutput)
}
type BackendPtrOutput struct {
*pulumi.OutputState
}
func (BackendPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Backend)(nil))
}
func (o BackendPtrOutput) ToBackendPtrOutput() BackendPtrOutput {
return o
}
func (o BackendPtrOutput) ToBackendPtrOutputWithContext(ctx context.Context) BackendPtrOutput {
return o
}
type BackendArrayOutput struct{ *pulumi.OutputState }
func (BackendArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Backend)(nil))
}
func (o BackendArrayOutput) ToBackendArrayOutput() BackendArrayOutput {
return o
}
func (o BackendArrayOutput) ToBackendArrayOutputWithContext(ctx context.Context) BackendArrayOutput {
return o
}
func (o BackendArrayOutput) Index(i pulumi.IntInput) BackendOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Backend {
return vs[0].([]Backend)[vs[1].(int)]
}).(BackendOutput)
}
type BackendMapOutput struct{ *pulumi.OutputState }
func (BackendMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Backend)(nil))
}
func (o BackendMapOutput) ToBackendMapOutput() BackendMapOutput {
return o
}
func (o BackendMapOutput) ToBackendMapOutputWithContext(ctx context.Context) BackendMapOutput {
return o
}
func (o BackendMapOutput) MapIndex(k pulumi.StringInput) BackendOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Backend {
return vs[0].(map[string]Backend)[vs[1].(string)]
}).(BackendOutput)
}
func init() {
pulumi.RegisterOutputType(BackendOutput{})
pulumi.RegisterOutputType(BackendPtrOutput{})
pulumi.RegisterOutputType(BackendArrayOutput{})
pulumi.RegisterOutputType(BackendMapOutput{})
}