/
auditing.go
348 lines (288 loc) · 12.1 KB
/
auditing.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
// *** 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 mongodbatlas
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// `Auditing` provides an Auditing resource. This allows auditing to be created.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-mongodbatlas/sdk/go/mongodbatlas"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := mongodbatlas.NewAuditing(ctx, "test", &mongodbatlas.AuditingArgs{
// AuditAuthorizationSuccess: pulumi.Bool(false),
// AuditFilter: pulumi.String("{ 'atype': 'authenticate', 'param': { 'user': 'auditAdmin', 'db': 'admin', 'mechanism': 'SCRAM-SHA-1' }}"),
// Enabled: pulumi.Bool(true),
// ProjectId: pulumi.String("<project-id>"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Auditing must be imported using auditing ID, e.g.
//
// ```sh
// $ pulumi import mongodbatlas:index/auditing:Auditing my_auditing 5d09d6a59ccf6445652a444a
// ```
//
// For more information see[MongoDB Atlas API Reference.](https://docs.atlas.mongodb.com/reference/api/auditing/)
type Auditing struct {
pulumi.CustomResourceState
// JSON-formatted audit filter used by the project
AuditAuthorizationSuccess pulumi.BoolOutput `pulumi:"auditAuthorizationSuccess"`
// Indicates whether the auditing system captures successful authentication attempts for audit filters using the "atype" : "authCheck" auditing event. For more information, see auditAuthorizationSuccess
AuditFilter pulumi.StringOutput `pulumi:"auditFilter"`
// Denotes the configuration method for the audit filter. Possible values are:
// * NONE - auditing not configured for the project.
// * FILTER_BUILDER - auditing configured via Atlas UI filter builder.
// * FILTER_JSON - auditing configured via Atlas custom filter or API.
ConfigurationType pulumi.StringOutput `pulumi:"configurationType"`
// Denotes whether or not the project associated with the {project_id} has database auditing enabled.
Enabled pulumi.BoolOutput `pulumi:"enabled"`
// The unique ID for the project to configure auditing.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
}
// NewAuditing registers a new resource with the given unique name, arguments, and options.
func NewAuditing(ctx *pulumi.Context,
name string, args *AuditingArgs, opts ...pulumi.ResourceOption) (*Auditing, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProjectId == nil {
return nil, errors.New("invalid value for required argument 'ProjectId'")
}
var resource Auditing
err := ctx.RegisterResource("mongodbatlas:index/auditing:Auditing", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAuditing gets an existing Auditing 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 GetAuditing(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AuditingState, opts ...pulumi.ResourceOption) (*Auditing, error) {
var resource Auditing
err := ctx.ReadResource("mongodbatlas:index/auditing:Auditing", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Auditing resources.
type auditingState struct {
// JSON-formatted audit filter used by the project
AuditAuthorizationSuccess *bool `pulumi:"auditAuthorizationSuccess"`
// Indicates whether the auditing system captures successful authentication attempts for audit filters using the "atype" : "authCheck" auditing event. For more information, see auditAuthorizationSuccess
AuditFilter *string `pulumi:"auditFilter"`
// Denotes the configuration method for the audit filter. Possible values are:
// * NONE - auditing not configured for the project.
// * FILTER_BUILDER - auditing configured via Atlas UI filter builder.
// * FILTER_JSON - auditing configured via Atlas custom filter or API.
ConfigurationType *string `pulumi:"configurationType"`
// Denotes whether or not the project associated with the {project_id} has database auditing enabled.
Enabled *bool `pulumi:"enabled"`
// The unique ID for the project to configure auditing.
ProjectId *string `pulumi:"projectId"`
}
type AuditingState struct {
// JSON-formatted audit filter used by the project
AuditAuthorizationSuccess pulumi.BoolPtrInput
// Indicates whether the auditing system captures successful authentication attempts for audit filters using the "atype" : "authCheck" auditing event. For more information, see auditAuthorizationSuccess
AuditFilter pulumi.StringPtrInput
// Denotes the configuration method for the audit filter. Possible values are:
// * NONE - auditing not configured for the project.
// * FILTER_BUILDER - auditing configured via Atlas UI filter builder.
// * FILTER_JSON - auditing configured via Atlas custom filter or API.
ConfigurationType pulumi.StringPtrInput
// Denotes whether or not the project associated with the {project_id} has database auditing enabled.
Enabled pulumi.BoolPtrInput
// The unique ID for the project to configure auditing.
ProjectId pulumi.StringPtrInput
}
func (AuditingState) ElementType() reflect.Type {
return reflect.TypeOf((*auditingState)(nil)).Elem()
}
type auditingArgs struct {
// JSON-formatted audit filter used by the project
AuditAuthorizationSuccess *bool `pulumi:"auditAuthorizationSuccess"`
// Indicates whether the auditing system captures successful authentication attempts for audit filters using the "atype" : "authCheck" auditing event. For more information, see auditAuthorizationSuccess
AuditFilter *string `pulumi:"auditFilter"`
// Denotes whether or not the project associated with the {project_id} has database auditing enabled.
Enabled *bool `pulumi:"enabled"`
// The unique ID for the project to configure auditing.
ProjectId string `pulumi:"projectId"`
}
// The set of arguments for constructing a Auditing resource.
type AuditingArgs struct {
// JSON-formatted audit filter used by the project
AuditAuthorizationSuccess pulumi.BoolPtrInput
// Indicates whether the auditing system captures successful authentication attempts for audit filters using the "atype" : "authCheck" auditing event. For more information, see auditAuthorizationSuccess
AuditFilter pulumi.StringPtrInput
// Denotes whether or not the project associated with the {project_id} has database auditing enabled.
Enabled pulumi.BoolPtrInput
// The unique ID for the project to configure auditing.
ProjectId pulumi.StringInput
}
func (AuditingArgs) ElementType() reflect.Type {
return reflect.TypeOf((*auditingArgs)(nil)).Elem()
}
type AuditingInput interface {
pulumi.Input
ToAuditingOutput() AuditingOutput
ToAuditingOutputWithContext(ctx context.Context) AuditingOutput
}
func (*Auditing) ElementType() reflect.Type {
return reflect.TypeOf((*Auditing)(nil))
}
func (i *Auditing) ToAuditingOutput() AuditingOutput {
return i.ToAuditingOutputWithContext(context.Background())
}
func (i *Auditing) ToAuditingOutputWithContext(ctx context.Context) AuditingOutput {
return pulumi.ToOutputWithContext(ctx, i).(AuditingOutput)
}
func (i *Auditing) ToAuditingPtrOutput() AuditingPtrOutput {
return i.ToAuditingPtrOutputWithContext(context.Background())
}
func (i *Auditing) ToAuditingPtrOutputWithContext(ctx context.Context) AuditingPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(AuditingPtrOutput)
}
type AuditingPtrInput interface {
pulumi.Input
ToAuditingPtrOutput() AuditingPtrOutput
ToAuditingPtrOutputWithContext(ctx context.Context) AuditingPtrOutput
}
type auditingPtrType AuditingArgs
func (*auditingPtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Auditing)(nil))
}
func (i *auditingPtrType) ToAuditingPtrOutput() AuditingPtrOutput {
return i.ToAuditingPtrOutputWithContext(context.Background())
}
func (i *auditingPtrType) ToAuditingPtrOutputWithContext(ctx context.Context) AuditingPtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(AuditingPtrOutput)
}
// AuditingArrayInput is an input type that accepts AuditingArray and AuditingArrayOutput values.
// You can construct a concrete instance of `AuditingArrayInput` via:
//
// AuditingArray{ AuditingArgs{...} }
type AuditingArrayInput interface {
pulumi.Input
ToAuditingArrayOutput() AuditingArrayOutput
ToAuditingArrayOutputWithContext(context.Context) AuditingArrayOutput
}
type AuditingArray []AuditingInput
func (AuditingArray) ElementType() reflect.Type {
return reflect.TypeOf(([]*Auditing)(nil))
}
func (i AuditingArray) ToAuditingArrayOutput() AuditingArrayOutput {
return i.ToAuditingArrayOutputWithContext(context.Background())
}
func (i AuditingArray) ToAuditingArrayOutputWithContext(ctx context.Context) AuditingArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(AuditingArrayOutput)
}
// AuditingMapInput is an input type that accepts AuditingMap and AuditingMapOutput values.
// You can construct a concrete instance of `AuditingMapInput` via:
//
// AuditingMap{ "key": AuditingArgs{...} }
type AuditingMapInput interface {
pulumi.Input
ToAuditingMapOutput() AuditingMapOutput
ToAuditingMapOutputWithContext(context.Context) AuditingMapOutput
}
type AuditingMap map[string]AuditingInput
func (AuditingMap) ElementType() reflect.Type {
return reflect.TypeOf((map[string]*Auditing)(nil))
}
func (i AuditingMap) ToAuditingMapOutput() AuditingMapOutput {
return i.ToAuditingMapOutputWithContext(context.Background())
}
func (i AuditingMap) ToAuditingMapOutputWithContext(ctx context.Context) AuditingMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(AuditingMapOutput)
}
type AuditingOutput struct {
*pulumi.OutputState
}
func (AuditingOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Auditing)(nil))
}
func (o AuditingOutput) ToAuditingOutput() AuditingOutput {
return o
}
func (o AuditingOutput) ToAuditingOutputWithContext(ctx context.Context) AuditingOutput {
return o
}
func (o AuditingOutput) ToAuditingPtrOutput() AuditingPtrOutput {
return o.ToAuditingPtrOutputWithContext(context.Background())
}
func (o AuditingOutput) ToAuditingPtrOutputWithContext(ctx context.Context) AuditingPtrOutput {
return o.ApplyT(func(v Auditing) *Auditing {
return &v
}).(AuditingPtrOutput)
}
type AuditingPtrOutput struct {
*pulumi.OutputState
}
func (AuditingPtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Auditing)(nil))
}
func (o AuditingPtrOutput) ToAuditingPtrOutput() AuditingPtrOutput {
return o
}
func (o AuditingPtrOutput) ToAuditingPtrOutputWithContext(ctx context.Context) AuditingPtrOutput {
return o
}
type AuditingArrayOutput struct{ *pulumi.OutputState }
func (AuditingArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Auditing)(nil))
}
func (o AuditingArrayOutput) ToAuditingArrayOutput() AuditingArrayOutput {
return o
}
func (o AuditingArrayOutput) ToAuditingArrayOutputWithContext(ctx context.Context) AuditingArrayOutput {
return o
}
func (o AuditingArrayOutput) Index(i pulumi.IntInput) AuditingOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Auditing {
return vs[0].([]Auditing)[vs[1].(int)]
}).(AuditingOutput)
}
type AuditingMapOutput struct{ *pulumi.OutputState }
func (AuditingMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Auditing)(nil))
}
func (o AuditingMapOutput) ToAuditingMapOutput() AuditingMapOutput {
return o
}
func (o AuditingMapOutput) ToAuditingMapOutputWithContext(ctx context.Context) AuditingMapOutput {
return o
}
func (o AuditingMapOutput) MapIndex(k pulumi.StringInput) AuditingOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Auditing {
return vs[0].(map[string]Auditing)[vs[1].(string)]
}).(AuditingOutput)
}
func init() {
pulumi.RegisterOutputType(AuditingOutput{})
pulumi.RegisterOutputType(AuditingPtrOutput{})
pulumi.RegisterOutputType(AuditingArrayOutput{})
pulumi.RegisterOutputType(AuditingMapOutput{})
}