-
Notifications
You must be signed in to change notification settings - Fork 50
/
workspaceVulnerabilityAssessment.go
366 lines (320 loc) · 18.8 KB
/
workspaceVulnerabilityAssessment.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
// *** 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 synapse
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages the Vulnerability Assessment for a Synapse Workspace.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "fmt"
//
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/storage"
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/synapse"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
// Location: pulumi.String("West Europe"),
// })
// if err != nil {
// return err
// }
// exampleAccount, err := storage.NewAccount(ctx, "exampleAccount", &storage.AccountArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// AccountTier: pulumi.String("Standard"),
// AccountReplicationType: pulumi.String("LRS"),
// AccountKind: pulumi.String("StorageV2"),
// IsHnsEnabled: pulumi.Bool(true),
// })
// if err != nil {
// return err
// }
// exampleDataLakeGen2Filesystem, err := storage.NewDataLakeGen2Filesystem(ctx, "exampleDataLakeGen2Filesystem", &storage.DataLakeGen2FilesystemArgs{
// StorageAccountId: exampleAccount.ID(),
// })
// if err != nil {
// return err
// }
// exampleWorkspace, err := synapse.NewWorkspace(ctx, "exampleWorkspace", &synapse.WorkspaceArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// StorageDataLakeGen2FilesystemId: exampleDataLakeGen2Filesystem.ID(),
// SqlAdministratorLogin: pulumi.String("sqladminuser"),
// SqlAdministratorLoginPassword: pulumi.String("H@Sh1CoR3!"),
// AadAdmin: &synapse.WorkspaceAadAdminArgs{
// Login: pulumi.String("AzureAD Admin"),
// ObjectId: pulumi.String("00000000-0000-0000-0000-000000000000"),
// TenantId: pulumi.String("00000000-0000-0000-0000-000000000000"),
// },
// Tags: pulumi.StringMap{
// "Env": pulumi.String("production"),
// },
// })
// if err != nil {
// return err
// }
// auditLogs, err := storage.NewAccount(ctx, "auditLogs", &storage.AccountArgs{
// ResourceGroupName: exampleResourceGroup.Name,
// Location: exampleResourceGroup.Location,
// AccountTier: pulumi.String("Standard"),
// AccountReplicationType: pulumi.String("LRS"),
// })
// if err != nil {
// return err
// }
// exampleWorkspaceSecurityAlertPolicy, err := synapse.NewWorkspaceSecurityAlertPolicy(ctx, "exampleWorkspaceSecurityAlertPolicy", &synapse.WorkspaceSecurityAlertPolicyArgs{
// SynapseWorkspaceId: exampleWorkspace.ID(),
// PolicyState: pulumi.String("Enabled"),
// StorageEndpoint: auditLogs.PrimaryBlobEndpoint,
// StorageAccountAccessKey: auditLogs.PrimaryAccessKey,
// DisabledAlerts: pulumi.StringArray{
// pulumi.String("Sql_Injection"),
// pulumi.String("Data_Exfiltration"),
// },
// RetentionDays: pulumi.Int(20),
// })
// if err != nil {
// return err
// }
// _, err = synapse.NewWorkspaceVulnerabilityAssessment(ctx, "exampleWorkspaceVulnerabilityAssessment", &synapse.WorkspaceVulnerabilityAssessmentArgs{
// WorkspaceSecurityAlertPolicyId: exampleWorkspaceSecurityAlertPolicy.ID(),
// StorageContainerPath: exampleAccount.PrimaryBlobEndpoint.ApplyT(func(primaryBlobEndpoint string) (string, error) {
// return fmt.Sprintf("%v%v%v", primaryBlobEndpoint, azurerm_storage_container.Example.Name, "/"), nil
// }).(pulumi.StringOutput),
// StorageAccountAccessKey: exampleAccount.PrimaryAccessKey,
// RecurringScans: &synapse.WorkspaceVulnerabilityAssessmentRecurringScansArgs{
// Enabled: pulumi.Bool(true),
// EmailSubscriptionAdminsEnabled: pulumi.Bool(true),
// Emails: pulumi.StringArray{
// pulumi.String("email@example1.com"),
// pulumi.String("email@example2.com"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Synapse Workspace Vulnerability Assessment can be imported using the `resource id`, e.g.
//
// ```sh
// $ pulumi import azure:synapse/workspaceVulnerabilityAssessment:WorkspaceVulnerabilityAssessment example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Synapse/workspaces/workspace1/vulnerabilityAssessments/default
// ```
type WorkspaceVulnerabilityAssessment struct {
pulumi.CustomResourceState
// The recurring scans settings. The `recurringScans` block supports fields documented below.
RecurringScans WorkspaceVulnerabilityAssessmentRecurringScansOutput `pulumi:"recurringScans"`
// Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storageContainerSasKey` isn't specified, `storageAccountAccessKey` is required.
StorageAccountAccessKey pulumi.StringPtrOutput `pulumi:"storageAccountAccessKey"`
// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
StorageContainerPath pulumi.StringOutput `pulumi:"storageContainerPath"`
// A shared access signature (SAS Key) that has write access to the blob container specified in `storageContainerPath` parameter. If `storageAccountAccessKey` isn't specified, `storageContainerSasKey` is required.
StorageContainerSasKey pulumi.StringPtrOutput `pulumi:"storageContainerSasKey"`
// The ID of the security alert policy of the Synapse Workspace. Changing this forces a new resource to be created.
WorkspaceSecurityAlertPolicyId pulumi.StringOutput `pulumi:"workspaceSecurityAlertPolicyId"`
}
// NewWorkspaceVulnerabilityAssessment registers a new resource with the given unique name, arguments, and options.
func NewWorkspaceVulnerabilityAssessment(ctx *pulumi.Context,
name string, args *WorkspaceVulnerabilityAssessmentArgs, opts ...pulumi.ResourceOption) (*WorkspaceVulnerabilityAssessment, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.StorageContainerPath == nil {
return nil, errors.New("invalid value for required argument 'StorageContainerPath'")
}
if args.WorkspaceSecurityAlertPolicyId == nil {
return nil, errors.New("invalid value for required argument 'WorkspaceSecurityAlertPolicyId'")
}
var resource WorkspaceVulnerabilityAssessment
err := ctx.RegisterResource("azure:synapse/workspaceVulnerabilityAssessment:WorkspaceVulnerabilityAssessment", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetWorkspaceVulnerabilityAssessment gets an existing WorkspaceVulnerabilityAssessment 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 GetWorkspaceVulnerabilityAssessment(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *WorkspaceVulnerabilityAssessmentState, opts ...pulumi.ResourceOption) (*WorkspaceVulnerabilityAssessment, error) {
var resource WorkspaceVulnerabilityAssessment
err := ctx.ReadResource("azure:synapse/workspaceVulnerabilityAssessment:WorkspaceVulnerabilityAssessment", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering WorkspaceVulnerabilityAssessment resources.
type workspaceVulnerabilityAssessmentState struct {
// The recurring scans settings. The `recurringScans` block supports fields documented below.
RecurringScans *WorkspaceVulnerabilityAssessmentRecurringScans `pulumi:"recurringScans"`
// Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storageContainerSasKey` isn't specified, `storageAccountAccessKey` is required.
StorageAccountAccessKey *string `pulumi:"storageAccountAccessKey"`
// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
StorageContainerPath *string `pulumi:"storageContainerPath"`
// A shared access signature (SAS Key) that has write access to the blob container specified in `storageContainerPath` parameter. If `storageAccountAccessKey` isn't specified, `storageContainerSasKey` is required.
StorageContainerSasKey *string `pulumi:"storageContainerSasKey"`
// The ID of the security alert policy of the Synapse Workspace. Changing this forces a new resource to be created.
WorkspaceSecurityAlertPolicyId *string `pulumi:"workspaceSecurityAlertPolicyId"`
}
type WorkspaceVulnerabilityAssessmentState struct {
// The recurring scans settings. The `recurringScans` block supports fields documented below.
RecurringScans WorkspaceVulnerabilityAssessmentRecurringScansPtrInput
// Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storageContainerSasKey` isn't specified, `storageAccountAccessKey` is required.
StorageAccountAccessKey pulumi.StringPtrInput
// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
StorageContainerPath pulumi.StringPtrInput
// A shared access signature (SAS Key) that has write access to the blob container specified in `storageContainerPath` parameter. If `storageAccountAccessKey` isn't specified, `storageContainerSasKey` is required.
StorageContainerSasKey pulumi.StringPtrInput
// The ID of the security alert policy of the Synapse Workspace. Changing this forces a new resource to be created.
WorkspaceSecurityAlertPolicyId pulumi.StringPtrInput
}
func (WorkspaceVulnerabilityAssessmentState) ElementType() reflect.Type {
return reflect.TypeOf((*workspaceVulnerabilityAssessmentState)(nil)).Elem()
}
type workspaceVulnerabilityAssessmentArgs struct {
// The recurring scans settings. The `recurringScans` block supports fields documented below.
RecurringScans *WorkspaceVulnerabilityAssessmentRecurringScans `pulumi:"recurringScans"`
// Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storageContainerSasKey` isn't specified, `storageAccountAccessKey` is required.
StorageAccountAccessKey *string `pulumi:"storageAccountAccessKey"`
// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
StorageContainerPath string `pulumi:"storageContainerPath"`
// A shared access signature (SAS Key) that has write access to the blob container specified in `storageContainerPath` parameter. If `storageAccountAccessKey` isn't specified, `storageContainerSasKey` is required.
StorageContainerSasKey *string `pulumi:"storageContainerSasKey"`
// The ID of the security alert policy of the Synapse Workspace. Changing this forces a new resource to be created.
WorkspaceSecurityAlertPolicyId string `pulumi:"workspaceSecurityAlertPolicyId"`
}
// The set of arguments for constructing a WorkspaceVulnerabilityAssessment resource.
type WorkspaceVulnerabilityAssessmentArgs struct {
// The recurring scans settings. The `recurringScans` block supports fields documented below.
RecurringScans WorkspaceVulnerabilityAssessmentRecurringScansPtrInput
// Specifies the identifier key of the storage account for vulnerability assessment scan results. If `storageContainerSasKey` isn't specified, `storageAccountAccessKey` is required.
StorageAccountAccessKey pulumi.StringPtrInput
// A blob storage container path to hold the scan results (e.g. https://myStorage.blob.core.windows.net/VaScans/).
StorageContainerPath pulumi.StringInput
// A shared access signature (SAS Key) that has write access to the blob container specified in `storageContainerPath` parameter. If `storageAccountAccessKey` isn't specified, `storageContainerSasKey` is required.
StorageContainerSasKey pulumi.StringPtrInput
// The ID of the security alert policy of the Synapse Workspace. Changing this forces a new resource to be created.
WorkspaceSecurityAlertPolicyId pulumi.StringInput
}
func (WorkspaceVulnerabilityAssessmentArgs) ElementType() reflect.Type {
return reflect.TypeOf((*workspaceVulnerabilityAssessmentArgs)(nil)).Elem()
}
type WorkspaceVulnerabilityAssessmentInput interface {
pulumi.Input
ToWorkspaceVulnerabilityAssessmentOutput() WorkspaceVulnerabilityAssessmentOutput
ToWorkspaceVulnerabilityAssessmentOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentOutput
}
func (*WorkspaceVulnerabilityAssessment) ElementType() reflect.Type {
return reflect.TypeOf((**WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (i *WorkspaceVulnerabilityAssessment) ToWorkspaceVulnerabilityAssessmentOutput() WorkspaceVulnerabilityAssessmentOutput {
return i.ToWorkspaceVulnerabilityAssessmentOutputWithContext(context.Background())
}
func (i *WorkspaceVulnerabilityAssessment) ToWorkspaceVulnerabilityAssessmentOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkspaceVulnerabilityAssessmentOutput)
}
// WorkspaceVulnerabilityAssessmentArrayInput is an input type that accepts WorkspaceVulnerabilityAssessmentArray and WorkspaceVulnerabilityAssessmentArrayOutput values.
// You can construct a concrete instance of `WorkspaceVulnerabilityAssessmentArrayInput` via:
//
// WorkspaceVulnerabilityAssessmentArray{ WorkspaceVulnerabilityAssessmentArgs{...} }
type WorkspaceVulnerabilityAssessmentArrayInput interface {
pulumi.Input
ToWorkspaceVulnerabilityAssessmentArrayOutput() WorkspaceVulnerabilityAssessmentArrayOutput
ToWorkspaceVulnerabilityAssessmentArrayOutputWithContext(context.Context) WorkspaceVulnerabilityAssessmentArrayOutput
}
type WorkspaceVulnerabilityAssessmentArray []WorkspaceVulnerabilityAssessmentInput
func (WorkspaceVulnerabilityAssessmentArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (i WorkspaceVulnerabilityAssessmentArray) ToWorkspaceVulnerabilityAssessmentArrayOutput() WorkspaceVulnerabilityAssessmentArrayOutput {
return i.ToWorkspaceVulnerabilityAssessmentArrayOutputWithContext(context.Background())
}
func (i WorkspaceVulnerabilityAssessmentArray) ToWorkspaceVulnerabilityAssessmentArrayOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkspaceVulnerabilityAssessmentArrayOutput)
}
// WorkspaceVulnerabilityAssessmentMapInput is an input type that accepts WorkspaceVulnerabilityAssessmentMap and WorkspaceVulnerabilityAssessmentMapOutput values.
// You can construct a concrete instance of `WorkspaceVulnerabilityAssessmentMapInput` via:
//
// WorkspaceVulnerabilityAssessmentMap{ "key": WorkspaceVulnerabilityAssessmentArgs{...} }
type WorkspaceVulnerabilityAssessmentMapInput interface {
pulumi.Input
ToWorkspaceVulnerabilityAssessmentMapOutput() WorkspaceVulnerabilityAssessmentMapOutput
ToWorkspaceVulnerabilityAssessmentMapOutputWithContext(context.Context) WorkspaceVulnerabilityAssessmentMapOutput
}
type WorkspaceVulnerabilityAssessmentMap map[string]WorkspaceVulnerabilityAssessmentInput
func (WorkspaceVulnerabilityAssessmentMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (i WorkspaceVulnerabilityAssessmentMap) ToWorkspaceVulnerabilityAssessmentMapOutput() WorkspaceVulnerabilityAssessmentMapOutput {
return i.ToWorkspaceVulnerabilityAssessmentMapOutputWithContext(context.Background())
}
func (i WorkspaceVulnerabilityAssessmentMap) ToWorkspaceVulnerabilityAssessmentMapOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(WorkspaceVulnerabilityAssessmentMapOutput)
}
type WorkspaceVulnerabilityAssessmentOutput struct{ *pulumi.OutputState }
func (WorkspaceVulnerabilityAssessmentOutput) ElementType() reflect.Type {
return reflect.TypeOf((**WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (o WorkspaceVulnerabilityAssessmentOutput) ToWorkspaceVulnerabilityAssessmentOutput() WorkspaceVulnerabilityAssessmentOutput {
return o
}
func (o WorkspaceVulnerabilityAssessmentOutput) ToWorkspaceVulnerabilityAssessmentOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentOutput {
return o
}
type WorkspaceVulnerabilityAssessmentArrayOutput struct{ *pulumi.OutputState }
func (WorkspaceVulnerabilityAssessmentArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (o WorkspaceVulnerabilityAssessmentArrayOutput) ToWorkspaceVulnerabilityAssessmentArrayOutput() WorkspaceVulnerabilityAssessmentArrayOutput {
return o
}
func (o WorkspaceVulnerabilityAssessmentArrayOutput) ToWorkspaceVulnerabilityAssessmentArrayOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentArrayOutput {
return o
}
func (o WorkspaceVulnerabilityAssessmentArrayOutput) Index(i pulumi.IntInput) WorkspaceVulnerabilityAssessmentOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *WorkspaceVulnerabilityAssessment {
return vs[0].([]*WorkspaceVulnerabilityAssessment)[vs[1].(int)]
}).(WorkspaceVulnerabilityAssessmentOutput)
}
type WorkspaceVulnerabilityAssessmentMapOutput struct{ *pulumi.OutputState }
func (WorkspaceVulnerabilityAssessmentMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*WorkspaceVulnerabilityAssessment)(nil)).Elem()
}
func (o WorkspaceVulnerabilityAssessmentMapOutput) ToWorkspaceVulnerabilityAssessmentMapOutput() WorkspaceVulnerabilityAssessmentMapOutput {
return o
}
func (o WorkspaceVulnerabilityAssessmentMapOutput) ToWorkspaceVulnerabilityAssessmentMapOutputWithContext(ctx context.Context) WorkspaceVulnerabilityAssessmentMapOutput {
return o
}
func (o WorkspaceVulnerabilityAssessmentMapOutput) MapIndex(k pulumi.StringInput) WorkspaceVulnerabilityAssessmentOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *WorkspaceVulnerabilityAssessment {
return vs[0].(map[string]*WorkspaceVulnerabilityAssessment)[vs[1].(string)]
}).(WorkspaceVulnerabilityAssessmentOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceVulnerabilityAssessmentInput)(nil)).Elem(), &WorkspaceVulnerabilityAssessment{})
pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceVulnerabilityAssessmentArrayInput)(nil)).Elem(), WorkspaceVulnerabilityAssessmentArray{})
pulumi.RegisterInputType(reflect.TypeOf((*WorkspaceVulnerabilityAssessmentMapInput)(nil)).Elem(), WorkspaceVulnerabilityAssessmentMap{})
pulumi.RegisterOutputType(WorkspaceVulnerabilityAssessmentOutput{})
pulumi.RegisterOutputType(WorkspaceVulnerabilityAssessmentArrayOutput{})
pulumi.RegisterOutputType(WorkspaceVulnerabilityAssessmentMapOutput{})
}