-
Notifications
You must be signed in to change notification settings - Fork 50
/
note.go
352 lines (328 loc) · 13.1 KB
/
note.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
// *** 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 containeranalysis
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// A Container Analysis note is a high-level piece of metadata that
// describes a type of analysis that can be done for a resource.
//
// To get more information about Note, see:
//
// * [API documentation](https://cloud.google.com/container-analysis/api/reference/rest/)
// * How-to Guides
// * [Official Documentation](https://cloud.google.com/container-analysis/)
// * [Creating Attestations (Occurrences)](https://cloud.google.com/binary-authorization/docs/making-attestations)
//
// ## Example Usage
// ### Container Analysis Note Basic
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v4/go/gcp/containeranalysis"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := containeranalysis.NewNote(ctx, "note", &containeranalysis.NoteArgs{
// AttestationAuthority: &containeranalysis.NoteAttestationAuthorityArgs{
// Hint: &containeranalysis.NoteAttestationAuthorityHintArgs{
// HumanReadableName: pulumi.String("Attestor Note"),
// },
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
// ### Container Analysis Note Attestation Full
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-gcp/sdk/v4/go/gcp/containeranalysis"
// "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := containeranalysis.NewNote(ctx, "note", &containeranalysis.NoteArgs{
// AttestationAuthority: &containeranalysis.NoteAttestationAuthorityArgs{
// Hint: &containeranalysis.NoteAttestationAuthorityHintArgs{
// HumanReadableName: pulumi.String("Attestor Note"),
// },
// },
// ExpirationTime: pulumi.String("2120-10-02T15:01:23.045123456Z"),
// LongDescription: pulumi.String("a longer description of test note"),
// RelatedUrls: containeranalysis.NoteRelatedUrlArray{
// &containeranalysis.NoteRelatedUrlArgs{
// Label: pulumi.String("foo"),
// Url: pulumi.String("some.url"),
// },
// &containeranalysis.NoteRelatedUrlArgs{
// Url: pulumi.String("google.com"),
// },
// },
// ShortDescription: pulumi.String("test note"),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Note can be imported using any of these accepted formats
//
// ```sh
// $ pulumi import gcp:containeranalysis/note:Note default projects/{{project}}/notes/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:containeranalysis/note:Note default {{project}}/{{name}}
// ```
//
// ```sh
// $ pulumi import gcp:containeranalysis/note:Note default {{name}}
// ```
type Note struct {
pulumi.CustomResourceState
// Note kind that represents a logical attestation "role" or "authority".
// For example, an organization might have one AttestationAuthority for
// "QA" and one for "build". This Note is intended to act strictly as a
// grouping mechanism for the attached Occurrences (Attestations). This
// grouping mechanism also provides a security boundary, since IAM ACLs
// gate the ability for a principle to attach an Occurrence to a given
// Note. It also provides a single point of lookup to find all attached
// Attestation Occurrences, even if they don't all live in the same
// project.
// Structure is documented below.
AttestationAuthority NoteAttestationAuthorityOutput `pulumi:"attestationAuthority"`
// The time this note was created.
CreateTime pulumi.StringOutput `pulumi:"createTime"`
// Time of expiration for this note. Leave empty if note does not expire.
ExpirationTime pulumi.StringPtrOutput `pulumi:"expirationTime"`
// The type of analysis this note describes
Kind pulumi.StringOutput `pulumi:"kind"`
// A detailed description of the note
LongDescription pulumi.StringPtrOutput `pulumi:"longDescription"`
// The name of the note.
Name pulumi.StringOutput `pulumi:"name"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringOutput `pulumi:"project"`
// Names of other notes related to this note.
RelatedNoteNames pulumi.StringArrayOutput `pulumi:"relatedNoteNames"`
// URLs associated with this note and related metadata.
// Structure is documented below.
RelatedUrls NoteRelatedUrlArrayOutput `pulumi:"relatedUrls"`
// A one sentence description of the note.
ShortDescription pulumi.StringPtrOutput `pulumi:"shortDescription"`
// The time this note was last updated.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
}
// NewNote registers a new resource with the given unique name, arguments, and options.
func NewNote(ctx *pulumi.Context,
name string, args *NoteArgs, opts ...pulumi.ResourceOption) (*Note, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AttestationAuthority == nil {
return nil, errors.New("invalid value for required argument 'AttestationAuthority'")
}
var resource Note
err := ctx.RegisterResource("gcp:containeranalysis/note:Note", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetNote gets an existing Note 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 GetNote(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *NoteState, opts ...pulumi.ResourceOption) (*Note, error) {
var resource Note
err := ctx.ReadResource("gcp:containeranalysis/note:Note", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Note resources.
type noteState struct {
// Note kind that represents a logical attestation "role" or "authority".
// For example, an organization might have one AttestationAuthority for
// "QA" and one for "build". This Note is intended to act strictly as a
// grouping mechanism for the attached Occurrences (Attestations). This
// grouping mechanism also provides a security boundary, since IAM ACLs
// gate the ability for a principle to attach an Occurrence to a given
// Note. It also provides a single point of lookup to find all attached
// Attestation Occurrences, even if they don't all live in the same
// project.
// Structure is documented below.
AttestationAuthority *NoteAttestationAuthority `pulumi:"attestationAuthority"`
// The time this note was created.
CreateTime *string `pulumi:"createTime"`
// Time of expiration for this note. Leave empty if note does not expire.
ExpirationTime *string `pulumi:"expirationTime"`
// The type of analysis this note describes
Kind *string `pulumi:"kind"`
// A detailed description of the note
LongDescription *string `pulumi:"longDescription"`
// The name of the note.
Name *string `pulumi:"name"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project *string `pulumi:"project"`
// Names of other notes related to this note.
RelatedNoteNames []string `pulumi:"relatedNoteNames"`
// URLs associated with this note and related metadata.
// Structure is documented below.
RelatedUrls []NoteRelatedUrl `pulumi:"relatedUrls"`
// A one sentence description of the note.
ShortDescription *string `pulumi:"shortDescription"`
// The time this note was last updated.
UpdateTime *string `pulumi:"updateTime"`
}
type NoteState struct {
// Note kind that represents a logical attestation "role" or "authority".
// For example, an organization might have one AttestationAuthority for
// "QA" and one for "build". This Note is intended to act strictly as a
// grouping mechanism for the attached Occurrences (Attestations). This
// grouping mechanism also provides a security boundary, since IAM ACLs
// gate the ability for a principle to attach an Occurrence to a given
// Note. It also provides a single point of lookup to find all attached
// Attestation Occurrences, even if they don't all live in the same
// project.
// Structure is documented below.
AttestationAuthority NoteAttestationAuthorityPtrInput
// The time this note was created.
CreateTime pulumi.StringPtrInput
// Time of expiration for this note. Leave empty if note does not expire.
ExpirationTime pulumi.StringPtrInput
// The type of analysis this note describes
Kind pulumi.StringPtrInput
// A detailed description of the note
LongDescription pulumi.StringPtrInput
// The name of the note.
Name pulumi.StringPtrInput
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringPtrInput
// Names of other notes related to this note.
RelatedNoteNames pulumi.StringArrayInput
// URLs associated with this note and related metadata.
// Structure is documented below.
RelatedUrls NoteRelatedUrlArrayInput
// A one sentence description of the note.
ShortDescription pulumi.StringPtrInput
// The time this note was last updated.
UpdateTime pulumi.StringPtrInput
}
func (NoteState) ElementType() reflect.Type {
return reflect.TypeOf((*noteState)(nil)).Elem()
}
type noteArgs struct {
// Note kind that represents a logical attestation "role" or "authority".
// For example, an organization might have one AttestationAuthority for
// "QA" and one for "build". This Note is intended to act strictly as a
// grouping mechanism for the attached Occurrences (Attestations). This
// grouping mechanism also provides a security boundary, since IAM ACLs
// gate the ability for a principle to attach an Occurrence to a given
// Note. It also provides a single point of lookup to find all attached
// Attestation Occurrences, even if they don't all live in the same
// project.
// Structure is documented below.
AttestationAuthority NoteAttestationAuthority `pulumi:"attestationAuthority"`
// Time of expiration for this note. Leave empty if note does not expire.
ExpirationTime *string `pulumi:"expirationTime"`
// A detailed description of the note
LongDescription *string `pulumi:"longDescription"`
// The name of the note.
Name *string `pulumi:"name"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project *string `pulumi:"project"`
// Names of other notes related to this note.
RelatedNoteNames []string `pulumi:"relatedNoteNames"`
// URLs associated with this note and related metadata.
// Structure is documented below.
RelatedUrls []NoteRelatedUrl `pulumi:"relatedUrls"`
// A one sentence description of the note.
ShortDescription *string `pulumi:"shortDescription"`
}
// The set of arguments for constructing a Note resource.
type NoteArgs struct {
// Note kind that represents a logical attestation "role" or "authority".
// For example, an organization might have one AttestationAuthority for
// "QA" and one for "build". This Note is intended to act strictly as a
// grouping mechanism for the attached Occurrences (Attestations). This
// grouping mechanism also provides a security boundary, since IAM ACLs
// gate the ability for a principle to attach an Occurrence to a given
// Note. It also provides a single point of lookup to find all attached
// Attestation Occurrences, even if they don't all live in the same
// project.
// Structure is documented below.
AttestationAuthority NoteAttestationAuthorityInput
// Time of expiration for this note. Leave empty if note does not expire.
ExpirationTime pulumi.StringPtrInput
// A detailed description of the note
LongDescription pulumi.StringPtrInput
// The name of the note.
Name pulumi.StringPtrInput
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringPtrInput
// Names of other notes related to this note.
RelatedNoteNames pulumi.StringArrayInput
// URLs associated with this note and related metadata.
// Structure is documented below.
RelatedUrls NoteRelatedUrlArrayInput
// A one sentence description of the note.
ShortDescription pulumi.StringPtrInput
}
func (NoteArgs) ElementType() reflect.Type {
return reflect.TypeOf((*noteArgs)(nil)).Elem()
}
type NoteInput interface {
pulumi.Input
ToNoteOutput() NoteOutput
ToNoteOutputWithContext(ctx context.Context) NoteOutput
}
func (Note) ElementType() reflect.Type {
return reflect.TypeOf((*Note)(nil)).Elem()
}
func (i Note) ToNoteOutput() NoteOutput {
return i.ToNoteOutputWithContext(context.Background())
}
func (i Note) ToNoteOutputWithContext(ctx context.Context) NoteOutput {
return pulumi.ToOutputWithContext(ctx, i).(NoteOutput)
}
type NoteOutput struct {
*pulumi.OutputState
}
func (NoteOutput) ElementType() reflect.Type {
return reflect.TypeOf((*NoteOutput)(nil)).Elem()
}
func (o NoteOutput) ToNoteOutput() NoteOutput {
return o
}
func (o NoteOutput) ToNoteOutputWithContext(ctx context.Context) NoteOutput {
return o
}
func init() {
pulumi.RegisterOutputType(NoteOutput{})
}