/
source.go
374 lines (313 loc) · 12 KB
/
source.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
// *** 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 securitycenter
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// A Cloud Security Command Center's (Cloud SCC) finding source. A finding
// source is an entity or a mechanism that can produce a finding. A source is
// like a container of findings that come from the same scanner, logger,
// monitor, etc.
//
// To get more information about Source, see:
//
// * [API documentation](https://cloud.google.com/security-command-center/docs/reference/rest/v1beta1/organizations.sources)
// * How-to Guides
// * [Official Documentation](https://cloud.google.com/security-command-center/docs)
//
// ## Example Usage
// ### Scc Source Basic
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/securitycenter"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := securitycenter.NewSource(ctx, "customSource", &securitycenter.SourceArgs{
// Description: pulumi.String("My custom Cloud Security Command Center Finding Source"),
// DisplayName: pulumi.String("My Source"),
// Organization: pulumi.String("123456789"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Source can be imported using any of these accepted formats
//
// ```sh
// $ pulumi import gcp:securitycenter/source:Source default organizations/{{organization}}/sources/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:securitycenter/source:Source default {{organization}}/{{name}}
// ```
type Source struct {
pulumi.CustomResourceState
// The description of the source (max of 1024 characters).
Description pulumi.StringPtrOutput `pulumi:"description"`
// The source’s display name. A source’s display name must be unique
// amongst its siblings, for example, two sources with the same parent
// can't share the same display name. The display name must start and end
// with a letter or digit, may contain letters, digits, spaces, hyphens,
// and underscores, and can be no longer than 32 characters.
DisplayName pulumi.StringOutput `pulumi:"displayName"`
// The resource name of this source, in the format 'organizations/{{organization}}/sources/{{source}}'.
Name pulumi.StringOutput `pulumi:"name"`
// The organization whose Cloud Security Command Center the Source
// lives in.
Organization pulumi.StringOutput `pulumi:"organization"`
}
// NewSource registers a new resource with the given unique name, arguments, and options.
func NewSource(ctx *pulumi.Context,
name string, args *SourceArgs, opts ...pulumi.ResourceOption) (*Source, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.DisplayName == nil {
return nil, errors.New("invalid value for required argument 'DisplayName'")
}
if args.Organization == nil {
return nil, errors.New("invalid value for required argument 'Organization'")
}
var resource Source
err := ctx.RegisterResource("gcp:securitycenter/source:Source", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSource gets an existing Source 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 GetSource(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SourceState, opts ...pulumi.ResourceOption) (*Source, error) {
var resource Source
err := ctx.ReadResource("gcp:securitycenter/source:Source", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Source resources.
type sourceState struct {
// The description of the source (max of 1024 characters).
Description *string `pulumi:"description"`
// The source’s display name. A source’s display name must be unique
// amongst its siblings, for example, two sources with the same parent
// can't share the same display name. The display name must start and end
// with a letter or digit, may contain letters, digits, spaces, hyphens,
// and underscores, and can be no longer than 32 characters.
DisplayName *string `pulumi:"displayName"`
// The resource name of this source, in the format 'organizations/{{organization}}/sources/{{source}}'.
Name *string `pulumi:"name"`
// The organization whose Cloud Security Command Center the Source
// lives in.
Organization *string `pulumi:"organization"`
}
type SourceState struct {
// The description of the source (max of 1024 characters).
Description pulumi.StringPtrInput
// The source’s display name. A source’s display name must be unique
// amongst its siblings, for example, two sources with the same parent
// can't share the same display name. The display name must start and end
// with a letter or digit, may contain letters, digits, spaces, hyphens,
// and underscores, and can be no longer than 32 characters.
DisplayName pulumi.StringPtrInput
// The resource name of this source, in the format 'organizations/{{organization}}/sources/{{source}}'.
Name pulumi.StringPtrInput
// The organization whose Cloud Security Command Center the Source
// lives in.
Organization pulumi.StringPtrInput
}
func (SourceState) ElementType() reflect.Type {
return reflect.TypeOf((*sourceState)(nil)).Elem()
}
type sourceArgs struct {
// The description of the source (max of 1024 characters).
Description *string `pulumi:"description"`
// The source’s display name. A source’s display name must be unique
// amongst its siblings, for example, two sources with the same parent
// can't share the same display name. The display name must start and end
// with a letter or digit, may contain letters, digits, spaces, hyphens,
// and underscores, and can be no longer than 32 characters.
DisplayName string `pulumi:"displayName"`
// The organization whose Cloud Security Command Center the Source
// lives in.
Organization string `pulumi:"organization"`
}
// The set of arguments for constructing a Source resource.
type SourceArgs struct {
// The description of the source (max of 1024 characters).
Description pulumi.StringPtrInput
// The source’s display name. A source’s display name must be unique
// amongst its siblings, for example, two sources with the same parent
// can't share the same display name. The display name must start and end
// with a letter or digit, may contain letters, digits, spaces, hyphens,
// and underscores, and can be no longer than 32 characters.
DisplayName pulumi.StringInput
// The organization whose Cloud Security Command Center the Source
// lives in.
Organization pulumi.StringInput
}
func (SourceArgs) ElementType() reflect.Type {
return reflect.TypeOf((*sourceArgs)(nil)).Elem()
}
type SourceInput interface {
pulumi.Input
ToSourceOutput() SourceOutput
ToSourceOutputWithContext(ctx context.Context) SourceOutput
}
func (*Source) ElementType() reflect.Type {
return reflect.TypeOf((*Source)(nil))
}
func (i *Source) ToSourceOutput() SourceOutput {
return i.ToSourceOutputWithContext(context.Background())
}
func (i *Source) ToSourceOutputWithContext(ctx context.Context) SourceOutput {
return pulumi.ToOutputWithContext(ctx, i).(SourceOutput)
}
func (i *Source) ToSourcePtrOutput() SourcePtrOutput {
return i.ToSourcePtrOutputWithContext(context.Background())
}
func (i *Source) ToSourcePtrOutputWithContext(ctx context.Context) SourcePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SourcePtrOutput)
}
type SourcePtrInput interface {
pulumi.Input
ToSourcePtrOutput() SourcePtrOutput
ToSourcePtrOutputWithContext(ctx context.Context) SourcePtrOutput
}
type sourcePtrType SourceArgs
func (*sourcePtrType) ElementType() reflect.Type {
return reflect.TypeOf((**Source)(nil))
}
func (i *sourcePtrType) ToSourcePtrOutput() SourcePtrOutput {
return i.ToSourcePtrOutputWithContext(context.Background())
}
func (i *sourcePtrType) ToSourcePtrOutputWithContext(ctx context.Context) SourcePtrOutput {
return pulumi.ToOutputWithContext(ctx, i).(SourcePtrOutput)
}
// SourceArrayInput is an input type that accepts SourceArray and SourceArrayOutput values.
// You can construct a concrete instance of `SourceArrayInput` via:
//
// SourceArray{ SourceArgs{...} }
type SourceArrayInput interface {
pulumi.Input
ToSourceArrayOutput() SourceArrayOutput
ToSourceArrayOutputWithContext(context.Context) SourceArrayOutput
}
type SourceArray []SourceInput
func (SourceArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*Source)(nil)).Elem()
}
func (i SourceArray) ToSourceArrayOutput() SourceArrayOutput {
return i.ToSourceArrayOutputWithContext(context.Background())
}
func (i SourceArray) ToSourceArrayOutputWithContext(ctx context.Context) SourceArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(SourceArrayOutput)
}
// SourceMapInput is an input type that accepts SourceMap and SourceMapOutput values.
// You can construct a concrete instance of `SourceMapInput` via:
//
// SourceMap{ "key": SourceArgs{...} }
type SourceMapInput interface {
pulumi.Input
ToSourceMapOutput() SourceMapOutput
ToSourceMapOutputWithContext(context.Context) SourceMapOutput
}
type SourceMap map[string]SourceInput
func (SourceMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*Source)(nil)).Elem()
}
func (i SourceMap) ToSourceMapOutput() SourceMapOutput {
return i.ToSourceMapOutputWithContext(context.Background())
}
func (i SourceMap) ToSourceMapOutputWithContext(ctx context.Context) SourceMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(SourceMapOutput)
}
type SourceOutput struct{ *pulumi.OutputState }
func (SourceOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Source)(nil))
}
func (o SourceOutput) ToSourceOutput() SourceOutput {
return o
}
func (o SourceOutput) ToSourceOutputWithContext(ctx context.Context) SourceOutput {
return o
}
func (o SourceOutput) ToSourcePtrOutput() SourcePtrOutput {
return o.ToSourcePtrOutputWithContext(context.Background())
}
func (o SourceOutput) ToSourcePtrOutputWithContext(ctx context.Context) SourcePtrOutput {
return o.ApplyTWithContext(ctx, func(_ context.Context, v Source) *Source {
return &v
}).(SourcePtrOutput)
}
type SourcePtrOutput struct{ *pulumi.OutputState }
func (SourcePtrOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Source)(nil))
}
func (o SourcePtrOutput) ToSourcePtrOutput() SourcePtrOutput {
return o
}
func (o SourcePtrOutput) ToSourcePtrOutputWithContext(ctx context.Context) SourcePtrOutput {
return o
}
func (o SourcePtrOutput) Elem() SourceOutput {
return o.ApplyT(func(v *Source) Source {
if v != nil {
return *v
}
var ret Source
return ret
}).(SourceOutput)
}
type SourceArrayOutput struct{ *pulumi.OutputState }
func (SourceArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]Source)(nil))
}
func (o SourceArrayOutput) ToSourceArrayOutput() SourceArrayOutput {
return o
}
func (o SourceArrayOutput) ToSourceArrayOutputWithContext(ctx context.Context) SourceArrayOutput {
return o
}
func (o SourceArrayOutput) Index(i pulumi.IntInput) SourceOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) Source {
return vs[0].([]Source)[vs[1].(int)]
}).(SourceOutput)
}
type SourceMapOutput struct{ *pulumi.OutputState }
func (SourceMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]Source)(nil))
}
func (o SourceMapOutput) ToSourceMapOutput() SourceMapOutput {
return o
}
func (o SourceMapOutput) ToSourceMapOutputWithContext(ctx context.Context) SourceMapOutput {
return o
}
func (o SourceMapOutput) MapIndex(k pulumi.StringInput) SourceOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) Source {
return vs[0].(map[string]Source)[vs[1].(string)]
}).(SourceOutput)
}
func init() {
pulumi.RegisterOutputType(SourceOutput{})
pulumi.RegisterOutputType(SourcePtrOutput{})
pulumi.RegisterOutputType(SourceArrayOutput{})
pulumi.RegisterOutputType(SourceMapOutput{})
}