-
Notifications
You must be signed in to change notification settings - Fork 50
/
resourceGroupPolicyExemption.go
423 lines (368 loc) · 20.4 KB
/
resourceGroupPolicyExemption.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
// 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 core
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a Resource Group Policy Exemption.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "encoding/json"
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/policy"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
// Name: pulumi.String("resourceGroup1"),
// Location: pulumi.String("westus"),
// })
// if err != nil {
// return err
// }
// example, err := policy.GetPolicyDefintion(ctx, &policy.GetPolicyDefintionArgs{
// DisplayName: pulumi.StringRef("Allowed locations"),
// }, nil)
// if err != nil {
// return err
// }
// exampleResourceGroupPolicyAssignment, err := core.NewResourceGroupPolicyAssignment(ctx, "example", &core.ResourceGroupPolicyAssignmentArgs{
// Name: pulumi.String("exampleAssignment"),
// ResourceGroupId: exampleResourceGroup.ID(),
// PolicyDefinitionId: *pulumi.String(example.Id),
// Parameters: exampleResourceGroup.Location.ApplyT(func(location string) (pulumi.String, error) {
// var _zero pulumi.String
// tmpJSON0, err := json.Marshal(map[string]interface{}{
// "listOfAllowedLocations": map[string]interface{}{
// "value": []string{
// location,
// },
// },
// })
// if err != nil {
// return _zero, err
// }
// json0 := string(tmpJSON0)
// return pulumi.String(json0), nil
// }).(pulumi.StringOutput),
// })
// if err != nil {
// return err
// }
// _, err = core.NewResourceGroupPolicyExemption(ctx, "example", &core.ResourceGroupPolicyExemptionArgs{
// Name: pulumi.String("exampleExemption"),
// ResourceGroupId: exampleResourceGroup.ID(),
// PolicyAssignmentId: exampleResourceGroupPolicyAssignment.ID(),
// ExemptionCategory: pulumi.String("Mitigated"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Policy Exemptions can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:core/resourceGroupPolicyExemption:ResourceGroupPolicyExemption exemption1 /subscriptions/00000000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Authorization/policyExemptions/exemption1
// ```
type ResourceGroupPolicyExemption struct {
pulumi.CustomResourceState
// A description to use for this Policy Exemption.
Description pulumi.StringPtrOutput `pulumi:"description"`
// A friendly display name to use for this Policy Exemption.
DisplayName pulumi.StringPtrOutput `pulumi:"displayName"`
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
ExemptionCategory pulumi.StringOutput `pulumi:"exemptionCategory"`
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
ExpiresOn pulumi.StringPtrOutput `pulumi:"expiresOn"`
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
Metadata pulumi.StringOutput `pulumi:"metadata"`
// The name of the Policy Exemption. Changing this forces a new resource to be created.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
PolicyAssignmentId pulumi.StringOutput `pulumi:"policyAssignmentId"`
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
PolicyDefinitionReferenceIds pulumi.StringArrayOutput `pulumi:"policyDefinitionReferenceIds"`
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
ResourceGroupId pulumi.StringOutput `pulumi:"resourceGroupId"`
}
// NewResourceGroupPolicyExemption registers a new resource with the given unique name, arguments, and options.
func NewResourceGroupPolicyExemption(ctx *pulumi.Context,
name string, args *ResourceGroupPolicyExemptionArgs, opts ...pulumi.ResourceOption) (*ResourceGroupPolicyExemption, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ExemptionCategory == nil {
return nil, errors.New("invalid value for required argument 'ExemptionCategory'")
}
if args.PolicyAssignmentId == nil {
return nil, errors.New("invalid value for required argument 'PolicyAssignmentId'")
}
if args.ResourceGroupId == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource ResourceGroupPolicyExemption
err := ctx.RegisterResource("azure:core/resourceGroupPolicyExemption:ResourceGroupPolicyExemption", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetResourceGroupPolicyExemption gets an existing ResourceGroupPolicyExemption 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 GetResourceGroupPolicyExemption(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ResourceGroupPolicyExemptionState, opts ...pulumi.ResourceOption) (*ResourceGroupPolicyExemption, error) {
var resource ResourceGroupPolicyExemption
err := ctx.ReadResource("azure:core/resourceGroupPolicyExemption:ResourceGroupPolicyExemption", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering ResourceGroupPolicyExemption resources.
type resourceGroupPolicyExemptionState struct {
// A description to use for this Policy Exemption.
Description *string `pulumi:"description"`
// A friendly display name to use for this Policy Exemption.
DisplayName *string `pulumi:"displayName"`
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
ExemptionCategory *string `pulumi:"exemptionCategory"`
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
ExpiresOn *string `pulumi:"expiresOn"`
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
Metadata *string `pulumi:"metadata"`
// The name of the Policy Exemption. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
PolicyAssignmentId *string `pulumi:"policyAssignmentId"`
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
PolicyDefinitionReferenceIds []string `pulumi:"policyDefinitionReferenceIds"`
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
ResourceGroupId *string `pulumi:"resourceGroupId"`
}
type ResourceGroupPolicyExemptionState struct {
// A description to use for this Policy Exemption.
Description pulumi.StringPtrInput
// A friendly display name to use for this Policy Exemption.
DisplayName pulumi.StringPtrInput
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
ExemptionCategory pulumi.StringPtrInput
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
ExpiresOn pulumi.StringPtrInput
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
Metadata pulumi.StringPtrInput
// The name of the Policy Exemption. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
PolicyAssignmentId pulumi.StringPtrInput
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
PolicyDefinitionReferenceIds pulumi.StringArrayInput
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
ResourceGroupId pulumi.StringPtrInput
}
func (ResourceGroupPolicyExemptionState) ElementType() reflect.Type {
return reflect.TypeOf((*resourceGroupPolicyExemptionState)(nil)).Elem()
}
type resourceGroupPolicyExemptionArgs struct {
// A description to use for this Policy Exemption.
Description *string `pulumi:"description"`
// A friendly display name to use for this Policy Exemption.
DisplayName *string `pulumi:"displayName"`
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
ExemptionCategory string `pulumi:"exemptionCategory"`
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
ExpiresOn *string `pulumi:"expiresOn"`
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
Metadata *string `pulumi:"metadata"`
// The name of the Policy Exemption. Changing this forces a new resource to be created.
Name *string `pulumi:"name"`
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
PolicyAssignmentId string `pulumi:"policyAssignmentId"`
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
PolicyDefinitionReferenceIds []string `pulumi:"policyDefinitionReferenceIds"`
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
ResourceGroupId string `pulumi:"resourceGroupId"`
}
// The set of arguments for constructing a ResourceGroupPolicyExemption resource.
type ResourceGroupPolicyExemptionArgs struct {
// A description to use for this Policy Exemption.
Description pulumi.StringPtrInput
// A friendly display name to use for this Policy Exemption.
DisplayName pulumi.StringPtrInput
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
ExemptionCategory pulumi.StringInput
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
ExpiresOn pulumi.StringPtrInput
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
Metadata pulumi.StringPtrInput
// The name of the Policy Exemption. Changing this forces a new resource to be created.
Name pulumi.StringPtrInput
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
PolicyAssignmentId pulumi.StringInput
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
PolicyDefinitionReferenceIds pulumi.StringArrayInput
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
ResourceGroupId pulumi.StringInput
}
func (ResourceGroupPolicyExemptionArgs) ElementType() reflect.Type {
return reflect.TypeOf((*resourceGroupPolicyExemptionArgs)(nil)).Elem()
}
type ResourceGroupPolicyExemptionInput interface {
pulumi.Input
ToResourceGroupPolicyExemptionOutput() ResourceGroupPolicyExemptionOutput
ToResourceGroupPolicyExemptionOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionOutput
}
func (*ResourceGroupPolicyExemption) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceGroupPolicyExemption)(nil)).Elem()
}
func (i *ResourceGroupPolicyExemption) ToResourceGroupPolicyExemptionOutput() ResourceGroupPolicyExemptionOutput {
return i.ToResourceGroupPolicyExemptionOutputWithContext(context.Background())
}
func (i *ResourceGroupPolicyExemption) ToResourceGroupPolicyExemptionOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceGroupPolicyExemptionOutput)
}
// ResourceGroupPolicyExemptionArrayInput is an input type that accepts ResourceGroupPolicyExemptionArray and ResourceGroupPolicyExemptionArrayOutput values.
// You can construct a concrete instance of `ResourceGroupPolicyExemptionArrayInput` via:
//
// ResourceGroupPolicyExemptionArray{ ResourceGroupPolicyExemptionArgs{...} }
type ResourceGroupPolicyExemptionArrayInput interface {
pulumi.Input
ToResourceGroupPolicyExemptionArrayOutput() ResourceGroupPolicyExemptionArrayOutput
ToResourceGroupPolicyExemptionArrayOutputWithContext(context.Context) ResourceGroupPolicyExemptionArrayOutput
}
type ResourceGroupPolicyExemptionArray []ResourceGroupPolicyExemptionInput
func (ResourceGroupPolicyExemptionArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ResourceGroupPolicyExemption)(nil)).Elem()
}
func (i ResourceGroupPolicyExemptionArray) ToResourceGroupPolicyExemptionArrayOutput() ResourceGroupPolicyExemptionArrayOutput {
return i.ToResourceGroupPolicyExemptionArrayOutputWithContext(context.Background())
}
func (i ResourceGroupPolicyExemptionArray) ToResourceGroupPolicyExemptionArrayOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceGroupPolicyExemptionArrayOutput)
}
// ResourceGroupPolicyExemptionMapInput is an input type that accepts ResourceGroupPolicyExemptionMap and ResourceGroupPolicyExemptionMapOutput values.
// You can construct a concrete instance of `ResourceGroupPolicyExemptionMapInput` via:
//
// ResourceGroupPolicyExemptionMap{ "key": ResourceGroupPolicyExemptionArgs{...} }
type ResourceGroupPolicyExemptionMapInput interface {
pulumi.Input
ToResourceGroupPolicyExemptionMapOutput() ResourceGroupPolicyExemptionMapOutput
ToResourceGroupPolicyExemptionMapOutputWithContext(context.Context) ResourceGroupPolicyExemptionMapOutput
}
type ResourceGroupPolicyExemptionMap map[string]ResourceGroupPolicyExemptionInput
func (ResourceGroupPolicyExemptionMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ResourceGroupPolicyExemption)(nil)).Elem()
}
func (i ResourceGroupPolicyExemptionMap) ToResourceGroupPolicyExemptionMapOutput() ResourceGroupPolicyExemptionMapOutput {
return i.ToResourceGroupPolicyExemptionMapOutputWithContext(context.Background())
}
func (i ResourceGroupPolicyExemptionMap) ToResourceGroupPolicyExemptionMapOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(ResourceGroupPolicyExemptionMapOutput)
}
type ResourceGroupPolicyExemptionOutput struct{ *pulumi.OutputState }
func (ResourceGroupPolicyExemptionOutput) ElementType() reflect.Type {
return reflect.TypeOf((**ResourceGroupPolicyExemption)(nil)).Elem()
}
func (o ResourceGroupPolicyExemptionOutput) ToResourceGroupPolicyExemptionOutput() ResourceGroupPolicyExemptionOutput {
return o
}
func (o ResourceGroupPolicyExemptionOutput) ToResourceGroupPolicyExemptionOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionOutput {
return o
}
// A description to use for this Policy Exemption.
func (o ResourceGroupPolicyExemptionOutput) Description() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringPtrOutput { return v.Description }).(pulumi.StringPtrOutput)
}
// A friendly display name to use for this Policy Exemption.
func (o ResourceGroupPolicyExemptionOutput) DisplayName() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringPtrOutput { return v.DisplayName }).(pulumi.StringPtrOutput)
}
// The category of this policy exemption. Possible values are `Waiver` and `Mitigated`.
func (o ResourceGroupPolicyExemptionOutput) ExemptionCategory() pulumi.StringOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringOutput { return v.ExemptionCategory }).(pulumi.StringOutput)
}
// The expiration date and time in UTC ISO 8601 format of this policy exemption.
func (o ResourceGroupPolicyExemptionOutput) ExpiresOn() pulumi.StringPtrOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringPtrOutput { return v.ExpiresOn }).(pulumi.StringPtrOutput)
}
// The metadata for this policy exemption. This is a JSON string representing additional metadata that should be stored with the policy exemption.
func (o ResourceGroupPolicyExemptionOutput) Metadata() pulumi.StringOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringOutput { return v.Metadata }).(pulumi.StringOutput)
}
// The name of the Policy Exemption. Changing this forces a new resource to be created.
func (o ResourceGroupPolicyExemptionOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
// The ID of the Policy Assignment to be exempted at the specified Scope. Changing this forces a new resource to be created.
func (o ResourceGroupPolicyExemptionOutput) PolicyAssignmentId() pulumi.StringOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringOutput { return v.PolicyAssignmentId }).(pulumi.StringOutput)
}
// The policy definition reference ID list when the associated policy assignment is an assignment of a policy set definition.
func (o ResourceGroupPolicyExemptionOutput) PolicyDefinitionReferenceIds() pulumi.StringArrayOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringArrayOutput { return v.PolicyDefinitionReferenceIds }).(pulumi.StringArrayOutput)
}
// The Resource Group ID where the Policy Exemption should be applied. Changing this forces a new resource to be created.
func (o ResourceGroupPolicyExemptionOutput) ResourceGroupId() pulumi.StringOutput {
return o.ApplyT(func(v *ResourceGroupPolicyExemption) pulumi.StringOutput { return v.ResourceGroupId }).(pulumi.StringOutput)
}
type ResourceGroupPolicyExemptionArrayOutput struct{ *pulumi.OutputState }
func (ResourceGroupPolicyExemptionArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*ResourceGroupPolicyExemption)(nil)).Elem()
}
func (o ResourceGroupPolicyExemptionArrayOutput) ToResourceGroupPolicyExemptionArrayOutput() ResourceGroupPolicyExemptionArrayOutput {
return o
}
func (o ResourceGroupPolicyExemptionArrayOutput) ToResourceGroupPolicyExemptionArrayOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionArrayOutput {
return o
}
func (o ResourceGroupPolicyExemptionArrayOutput) Index(i pulumi.IntInput) ResourceGroupPolicyExemptionOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *ResourceGroupPolicyExemption {
return vs[0].([]*ResourceGroupPolicyExemption)[vs[1].(int)]
}).(ResourceGroupPolicyExemptionOutput)
}
type ResourceGroupPolicyExemptionMapOutput struct{ *pulumi.OutputState }
func (ResourceGroupPolicyExemptionMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*ResourceGroupPolicyExemption)(nil)).Elem()
}
func (o ResourceGroupPolicyExemptionMapOutput) ToResourceGroupPolicyExemptionMapOutput() ResourceGroupPolicyExemptionMapOutput {
return o
}
func (o ResourceGroupPolicyExemptionMapOutput) ToResourceGroupPolicyExemptionMapOutputWithContext(ctx context.Context) ResourceGroupPolicyExemptionMapOutput {
return o
}
func (o ResourceGroupPolicyExemptionMapOutput) MapIndex(k pulumi.StringInput) ResourceGroupPolicyExemptionOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *ResourceGroupPolicyExemption {
return vs[0].(map[string]*ResourceGroupPolicyExemption)[vs[1].(string)]
}).(ResourceGroupPolicyExemptionOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ResourceGroupPolicyExemptionInput)(nil)).Elem(), &ResourceGroupPolicyExemption{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceGroupPolicyExemptionArrayInput)(nil)).Elem(), ResourceGroupPolicyExemptionArray{})
pulumi.RegisterInputType(reflect.TypeOf((*ResourceGroupPolicyExemptionMapInput)(nil)).Elem(), ResourceGroupPolicyExemptionMap{})
pulumi.RegisterOutputType(ResourceGroupPolicyExemptionOutput{})
pulumi.RegisterOutputType(ResourceGroupPolicyExemptionArrayOutput{})
pulumi.RegisterOutputType(ResourceGroupPolicyExemptionMapOutput{})
}