/
topicAuthorizationRule.go
437 lines (380 loc) · 19.6 KB
/
topicAuthorizationRule.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
// 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 servicebus
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a ServiceBus Topic authorization Rule within a ServiceBus Topic.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/servicebus"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("tfex-servicebus"),
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleNamespace, err := servicebus.NewNamespace(ctx, "example", &servicebus.NamespaceArgs{
// Name: pulumi.String("tfex-servicebus-namespace"),
// Location: example.Location,
// ResourceGroupName: example.Name,
// Sku: pulumi.String("Standard"),
// Tags: pulumi.StringMap{
// "source": pulumi.String("example"),
// },
// })
// if err != nil {
// return err
// }
// exampleTopic, err := servicebus.NewTopic(ctx, "example", &servicebus.TopicArgs{
// Name: pulumi.String("tfex_servicebus_topic"),
// NamespaceId: exampleNamespace.ID(),
// })
// if err != nil {
// return err
// }
// _, err = servicebus.NewTopicAuthorizationRule(ctx, "example", &servicebus.TopicAuthorizationRuleArgs{
// Name: pulumi.String("tfex_servicebus_topic_sasPolicy"),
// TopicId: exampleTopic.ID(),
// Listen: pulumi.Bool(true),
// Send: pulumi.Bool(false),
// Manage: pulumi.Bool(false),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
//
// ## Import
//
// ServiceBus Topic authorization rules can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:servicebus/topicAuthorizationRule:TopicAuthorizationRule rule1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.ServiceBus/namespaces/namespace1/topics/topic1/authorizationRules/rule1
// ```
type TopicAuthorizationRule struct {
pulumi.CustomResourceState
// Grants listen access to this this Authorization Rule. Defaults to `false`.
Listen pulumi.BoolPtrOutput `pulumi:"listen"`
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
Manage pulumi.BoolPtrOutput `pulumi:"manage"`
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The Primary Connection String for the ServiceBus Topic authorization Rule.
PrimaryConnectionString pulumi.StringOutput `pulumi:"primaryConnectionString"`
// The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.
PrimaryConnectionStringAlias pulumi.StringOutput `pulumi:"primaryConnectionStringAlias"`
// The Primary Key for the ServiceBus Topic authorization Rule.
PrimaryKey pulumi.StringOutput `pulumi:"primaryKey"`
// The Secondary Connection String for the ServiceBus Topic authorization Rule.
SecondaryConnectionString pulumi.StringOutput `pulumi:"secondaryConnectionString"`
// The alias Secondary Connection String for the ServiceBus Namespace
SecondaryConnectionStringAlias pulumi.StringOutput `pulumi:"secondaryConnectionStringAlias"`
// The Secondary Key for the ServiceBus Topic authorization Rule.
SecondaryKey pulumi.StringOutput `pulumi:"secondaryKey"`
// Grants send access to this this Authorization Rule. Defaults to `false`.
Send pulumi.BoolPtrOutput `pulumi:"send"`
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
TopicId pulumi.StringOutput `pulumi:"topicId"`
}
// NewTopicAuthorizationRule registers a new resource with the given unique name, arguments, and options.
func NewTopicAuthorizationRule(ctx *pulumi.Context,
name string, args *TopicAuthorizationRuleArgs, opts ...pulumi.ResourceOption) (*TopicAuthorizationRule, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.TopicId == nil {
return nil, errors.New("invalid value for required argument 'TopicId'")
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure:eventhub/topicAuthorizationRule:TopicAuthorizationRule"),
},
})
opts = append(opts, aliases)
secrets := pulumi.AdditionalSecretOutputs([]string{
"primaryConnectionString",
"primaryConnectionStringAlias",
"primaryKey",
"secondaryConnectionString",
"secondaryConnectionStringAlias",
"secondaryKey",
})
opts = append(opts, secrets)
opts = internal.PkgResourceDefaultOpts(opts)
var resource TopicAuthorizationRule
err := ctx.RegisterResource("azure:servicebus/topicAuthorizationRule:TopicAuthorizationRule", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetTopicAuthorizationRule gets an existing TopicAuthorizationRule 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 GetTopicAuthorizationRule(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *TopicAuthorizationRuleState, opts ...pulumi.ResourceOption) (*TopicAuthorizationRule, error) {
var resource TopicAuthorizationRule
err := ctx.ReadResource("azure:servicebus/topicAuthorizationRule:TopicAuthorizationRule", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering TopicAuthorizationRule resources.
type topicAuthorizationRuleState struct {
// Grants listen access to this this Authorization Rule. Defaults to `false`.
Listen *bool `pulumi:"listen"`
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
Manage *bool `pulumi:"manage"`
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The Primary Connection String for the ServiceBus Topic authorization Rule.
PrimaryConnectionString *string `pulumi:"primaryConnectionString"`
// The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.
PrimaryConnectionStringAlias *string `pulumi:"primaryConnectionStringAlias"`
// The Primary Key for the ServiceBus Topic authorization Rule.
PrimaryKey *string `pulumi:"primaryKey"`
// The Secondary Connection String for the ServiceBus Topic authorization Rule.
SecondaryConnectionString *string `pulumi:"secondaryConnectionString"`
// The alias Secondary Connection String for the ServiceBus Namespace
SecondaryConnectionStringAlias *string `pulumi:"secondaryConnectionStringAlias"`
// The Secondary Key for the ServiceBus Topic authorization Rule.
SecondaryKey *string `pulumi:"secondaryKey"`
// Grants send access to this this Authorization Rule. Defaults to `false`.
Send *bool `pulumi:"send"`
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
TopicId *string `pulumi:"topicId"`
}
type TopicAuthorizationRuleState struct {
// Grants listen access to this this Authorization Rule. Defaults to `false`.
Listen pulumi.BoolPtrInput
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
Manage pulumi.BoolPtrInput
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The Primary Connection String for the ServiceBus Topic authorization Rule.
PrimaryConnectionString pulumi.StringPtrInput
// The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.
PrimaryConnectionStringAlias pulumi.StringPtrInput
// The Primary Key for the ServiceBus Topic authorization Rule.
PrimaryKey pulumi.StringPtrInput
// The Secondary Connection String for the ServiceBus Topic authorization Rule.
SecondaryConnectionString pulumi.StringPtrInput
// The alias Secondary Connection String for the ServiceBus Namespace
SecondaryConnectionStringAlias pulumi.StringPtrInput
// The Secondary Key for the ServiceBus Topic authorization Rule.
SecondaryKey pulumi.StringPtrInput
// Grants send access to this this Authorization Rule. Defaults to `false`.
Send pulumi.BoolPtrInput
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
TopicId pulumi.StringPtrInput
}
func (TopicAuthorizationRuleState) ElementType() reflect.Type {
return reflect.TypeOf((*topicAuthorizationRuleState)(nil)).Elem()
}
type topicAuthorizationRuleArgs struct {
// Grants listen access to this this Authorization Rule. Defaults to `false`.
Listen *bool `pulumi:"listen"`
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
Manage *bool `pulumi:"manage"`
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// Grants send access to this this Authorization Rule. Defaults to `false`.
Send *bool `pulumi:"send"`
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
TopicId string `pulumi:"topicId"`
}
// The set of arguments for constructing a TopicAuthorizationRule resource.
type TopicAuthorizationRuleArgs struct {
// Grants listen access to this this Authorization Rule. Defaults to `false`.
Listen pulumi.BoolPtrInput
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
Manage pulumi.BoolPtrInput
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// Grants send access to this this Authorization Rule. Defaults to `false`.
Send pulumi.BoolPtrInput
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
TopicId pulumi.StringInput
}
func (TopicAuthorizationRuleArgs) ElementType() reflect.Type {
return reflect.TypeOf((*topicAuthorizationRuleArgs)(nil)).Elem()
}
type TopicAuthorizationRuleInput interface {
pulumi.Input
ToTopicAuthorizationRuleOutput() TopicAuthorizationRuleOutput
ToTopicAuthorizationRuleOutputWithContext(ctx context.Context) TopicAuthorizationRuleOutput
}
func (*TopicAuthorizationRule) ElementType() reflect.Type {
return reflect.TypeOf((**TopicAuthorizationRule)(nil)).Elem()
}
func (i *TopicAuthorizationRule) ToTopicAuthorizationRuleOutput() TopicAuthorizationRuleOutput {
return i.ToTopicAuthorizationRuleOutputWithContext(context.Background())
}
func (i *TopicAuthorizationRule) ToTopicAuthorizationRuleOutputWithContext(ctx context.Context) TopicAuthorizationRuleOutput {
return pulumi.ToOutputWithContext(ctx, i).(TopicAuthorizationRuleOutput)
}
// TopicAuthorizationRuleArrayInput is an input type that accepts TopicAuthorizationRuleArray and TopicAuthorizationRuleArrayOutput values.
// You can construct a concrete instance of `TopicAuthorizationRuleArrayInput` via:
//
// TopicAuthorizationRuleArray{ TopicAuthorizationRuleArgs{...} }
type TopicAuthorizationRuleArrayInput interface {
pulumi.Input
ToTopicAuthorizationRuleArrayOutput() TopicAuthorizationRuleArrayOutput
ToTopicAuthorizationRuleArrayOutputWithContext(context.Context) TopicAuthorizationRuleArrayOutput
}
type TopicAuthorizationRuleArray []TopicAuthorizationRuleInput
func (TopicAuthorizationRuleArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TopicAuthorizationRule)(nil)).Elem()
}
func (i TopicAuthorizationRuleArray) ToTopicAuthorizationRuleArrayOutput() TopicAuthorizationRuleArrayOutput {
return i.ToTopicAuthorizationRuleArrayOutputWithContext(context.Background())
}
func (i TopicAuthorizationRuleArray) ToTopicAuthorizationRuleArrayOutputWithContext(ctx context.Context) TopicAuthorizationRuleArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(TopicAuthorizationRuleArrayOutput)
}
// TopicAuthorizationRuleMapInput is an input type that accepts TopicAuthorizationRuleMap and TopicAuthorizationRuleMapOutput values.
// You can construct a concrete instance of `TopicAuthorizationRuleMapInput` via:
//
// TopicAuthorizationRuleMap{ "key": TopicAuthorizationRuleArgs{...} }
type TopicAuthorizationRuleMapInput interface {
pulumi.Input
ToTopicAuthorizationRuleMapOutput() TopicAuthorizationRuleMapOutput
ToTopicAuthorizationRuleMapOutputWithContext(context.Context) TopicAuthorizationRuleMapOutput
}
type TopicAuthorizationRuleMap map[string]TopicAuthorizationRuleInput
func (TopicAuthorizationRuleMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TopicAuthorizationRule)(nil)).Elem()
}
func (i TopicAuthorizationRuleMap) ToTopicAuthorizationRuleMapOutput() TopicAuthorizationRuleMapOutput {
return i.ToTopicAuthorizationRuleMapOutputWithContext(context.Background())
}
func (i TopicAuthorizationRuleMap) ToTopicAuthorizationRuleMapOutputWithContext(ctx context.Context) TopicAuthorizationRuleMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(TopicAuthorizationRuleMapOutput)
}
type TopicAuthorizationRuleOutput struct{ *pulumi.OutputState }
func (TopicAuthorizationRuleOutput) ElementType() reflect.Type {
return reflect.TypeOf((**TopicAuthorizationRule)(nil)).Elem()
}
func (o TopicAuthorizationRuleOutput) ToTopicAuthorizationRuleOutput() TopicAuthorizationRuleOutput {
return o
}
func (o TopicAuthorizationRuleOutput) ToTopicAuthorizationRuleOutputWithContext(ctx context.Context) TopicAuthorizationRuleOutput {
return o
}
// Grants listen access to this this Authorization Rule. Defaults to `false`.
func (o TopicAuthorizationRuleOutput) Listen() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.BoolPtrOutput { return v.Listen }).(pulumi.BoolPtrOutput)
}
// Grants manage access to this this Authorization Rule. When this property is `true` - both `listen` and `send` must be too. Defaults to `false`.
func (o TopicAuthorizationRuleOutput) Manage() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.BoolPtrOutput { return v.Manage }).(pulumi.BoolPtrOutput)
}
// Specifies the name of the ServiceBus Topic Authorization Rule resource. Changing this forces a new resource to be created.
func (o TopicAuthorizationRuleOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The Primary Connection String for the ServiceBus Topic authorization Rule.
func (o TopicAuthorizationRuleOutput) PrimaryConnectionString() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.PrimaryConnectionString }).(pulumi.StringOutput)
}
// The alias Primary Connection String for the ServiceBus Namespace, if the namespace is Geo DR paired.
func (o TopicAuthorizationRuleOutput) PrimaryConnectionStringAlias() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.PrimaryConnectionStringAlias }).(pulumi.StringOutput)
}
// The Primary Key for the ServiceBus Topic authorization Rule.
func (o TopicAuthorizationRuleOutput) PrimaryKey() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.PrimaryKey }).(pulumi.StringOutput)
}
// The Secondary Connection String for the ServiceBus Topic authorization Rule.
func (o TopicAuthorizationRuleOutput) SecondaryConnectionString() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.SecondaryConnectionString }).(pulumi.StringOutput)
}
// The alias Secondary Connection String for the ServiceBus Namespace
func (o TopicAuthorizationRuleOutput) SecondaryConnectionStringAlias() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.SecondaryConnectionStringAlias }).(pulumi.StringOutput)
}
// The Secondary Key for the ServiceBus Topic authorization Rule.
func (o TopicAuthorizationRuleOutput) SecondaryKey() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.SecondaryKey }).(pulumi.StringOutput)
}
// Grants send access to this this Authorization Rule. Defaults to `false`.
func (o TopicAuthorizationRuleOutput) Send() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.BoolPtrOutput { return v.Send }).(pulumi.BoolPtrOutput)
}
// Specifies the ID of the ServiceBus Topic. Changing this forces a new resource to be created.
//
// > **NOTE** At least one of the 3 permissions below needs to be set.
func (o TopicAuthorizationRuleOutput) TopicId() pulumi.StringOutput {
return o.ApplyT(func(v *TopicAuthorizationRule) pulumi.StringOutput { return v.TopicId }).(pulumi.StringOutput)
}
type TopicAuthorizationRuleArrayOutput struct{ *pulumi.OutputState }
func (TopicAuthorizationRuleArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*TopicAuthorizationRule)(nil)).Elem()
}
func (o TopicAuthorizationRuleArrayOutput) ToTopicAuthorizationRuleArrayOutput() TopicAuthorizationRuleArrayOutput {
return o
}
func (o TopicAuthorizationRuleArrayOutput) ToTopicAuthorizationRuleArrayOutputWithContext(ctx context.Context) TopicAuthorizationRuleArrayOutput {
return o
}
func (o TopicAuthorizationRuleArrayOutput) Index(i pulumi.IntInput) TopicAuthorizationRuleOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TopicAuthorizationRule {
return vs[0].([]*TopicAuthorizationRule)[vs[1].(int)]
}).(TopicAuthorizationRuleOutput)
}
type TopicAuthorizationRuleMapOutput struct{ *pulumi.OutputState }
func (TopicAuthorizationRuleMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*TopicAuthorizationRule)(nil)).Elem()
}
func (o TopicAuthorizationRuleMapOutput) ToTopicAuthorizationRuleMapOutput() TopicAuthorizationRuleMapOutput {
return o
}
func (o TopicAuthorizationRuleMapOutput) ToTopicAuthorizationRuleMapOutputWithContext(ctx context.Context) TopicAuthorizationRuleMapOutput {
return o
}
func (o TopicAuthorizationRuleMapOutput) MapIndex(k pulumi.StringInput) TopicAuthorizationRuleOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TopicAuthorizationRule {
return vs[0].(map[string]*TopicAuthorizationRule)[vs[1].(string)]
}).(TopicAuthorizationRuleOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*TopicAuthorizationRuleInput)(nil)).Elem(), &TopicAuthorizationRule{})
pulumi.RegisterInputType(reflect.TypeOf((*TopicAuthorizationRuleArrayInput)(nil)).Elem(), TopicAuthorizationRuleArray{})
pulumi.RegisterInputType(reflect.TypeOf((*TopicAuthorizationRuleMapInput)(nil)).Elem(), TopicAuthorizationRuleMap{})
pulumi.RegisterOutputType(TopicAuthorizationRuleOutput{})
pulumi.RegisterOutputType(TopicAuthorizationRuleArrayOutput{})
pulumi.RegisterOutputType(TopicAuthorizationRuleMapOutput{})
}