/
attestor.go
184 lines (153 loc) · 7.45 KB
/
attestor.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
// Code generated by the Pulumi SDK Generator DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package v1
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates an attestor, and returns a copy of the new attestor. Returns `NOT_FOUND` if the project does not exist, `INVALID_ARGUMENT` if the request is malformed, `ALREADY_EXISTS` if the attestor already exists.
type Attestor struct {
pulumi.CustomResourceState
// Required. The attestors ID.
AttestorId pulumi.StringOutput `pulumi:"attestorId"`
// Optional. A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.
Description pulumi.StringOutput `pulumi:"description"`
// Optional. A checksum, returned by the server, that can be sent on update requests to ensure the attestor has an up-to-date value before attempting to update it. See https://google.aip.dev/154.
Etag pulumi.StringOutput `pulumi:"etag"`
// The resource name, in the format: `projects/*/attestors/*`. This field may not be updated.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// Time when the attestor was last updated.
UpdateTime pulumi.StringOutput `pulumi:"updateTime"`
// This specifies how an attestation will be read, and how it will be used during policy enforcement.
UserOwnedGrafeasNote UserOwnedGrafeasNoteResponseOutput `pulumi:"userOwnedGrafeasNote"`
}
// NewAttestor registers a new resource with the given unique name, arguments, and options.
func NewAttestor(ctx *pulumi.Context,
name string, args *AttestorArgs, opts ...pulumi.ResourceOption) (*Attestor, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.AttestorId == nil {
return nil, errors.New("invalid value for required argument 'AttestorId'")
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"attestorId",
"project",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Attestor
err := ctx.RegisterResource("google-native:binaryauthorization/v1:Attestor", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetAttestor gets an existing Attestor 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 GetAttestor(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *AttestorState, opts ...pulumi.ResourceOption) (*Attestor, error) {
var resource Attestor
err := ctx.ReadResource("google-native:binaryauthorization/v1:Attestor", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Attestor resources.
type attestorState struct {
}
type AttestorState struct {
}
func (AttestorState) ElementType() reflect.Type {
return reflect.TypeOf((*attestorState)(nil)).Elem()
}
type attestorArgs struct {
// Required. The attestors ID.
AttestorId string `pulumi:"attestorId"`
// Optional. A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.
Description *string `pulumi:"description"`
// Optional. A checksum, returned by the server, that can be sent on update requests to ensure the attestor has an up-to-date value before attempting to update it. See https://google.aip.dev/154.
Etag *string `pulumi:"etag"`
// The resource name, in the format: `projects/*/attestors/*`. This field may not be updated.
Name *string `pulumi:"name"`
Project *string `pulumi:"project"`
// This specifies how an attestation will be read, and how it will be used during policy enforcement.
UserOwnedGrafeasNote *UserOwnedGrafeasNote `pulumi:"userOwnedGrafeasNote"`
}
// The set of arguments for constructing a Attestor resource.
type AttestorArgs struct {
// Required. The attestors ID.
AttestorId pulumi.StringInput
// Optional. A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.
Description pulumi.StringPtrInput
// Optional. A checksum, returned by the server, that can be sent on update requests to ensure the attestor has an up-to-date value before attempting to update it. See https://google.aip.dev/154.
Etag pulumi.StringPtrInput
// The resource name, in the format: `projects/*/attestors/*`. This field may not be updated.
Name pulumi.StringPtrInput
Project pulumi.StringPtrInput
// This specifies how an attestation will be read, and how it will be used during policy enforcement.
UserOwnedGrafeasNote UserOwnedGrafeasNotePtrInput
}
func (AttestorArgs) ElementType() reflect.Type {
return reflect.TypeOf((*attestorArgs)(nil)).Elem()
}
type AttestorInput interface {
pulumi.Input
ToAttestorOutput() AttestorOutput
ToAttestorOutputWithContext(ctx context.Context) AttestorOutput
}
func (*Attestor) ElementType() reflect.Type {
return reflect.TypeOf((**Attestor)(nil)).Elem()
}
func (i *Attestor) ToAttestorOutput() AttestorOutput {
return i.ToAttestorOutputWithContext(context.Background())
}
func (i *Attestor) ToAttestorOutputWithContext(ctx context.Context) AttestorOutput {
return pulumi.ToOutputWithContext(ctx, i).(AttestorOutput)
}
type AttestorOutput struct{ *pulumi.OutputState }
func (AttestorOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Attestor)(nil)).Elem()
}
func (o AttestorOutput) ToAttestorOutput() AttestorOutput {
return o
}
func (o AttestorOutput) ToAttestorOutputWithContext(ctx context.Context) AttestorOutput {
return o
}
// Required. The attestors ID.
func (o AttestorOutput) AttestorId() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.AttestorId }).(pulumi.StringOutput)
}
// Optional. A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.
func (o AttestorOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// Optional. A checksum, returned by the server, that can be sent on update requests to ensure the attestor has an up-to-date value before attempting to update it. See https://google.aip.dev/154.
func (o AttestorOutput) Etag() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.Etag }).(pulumi.StringOutput)
}
// The resource name, in the format: `projects/*/attestors/*`. This field may not be updated.
func (o AttestorOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o AttestorOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// Time when the attestor was last updated.
func (o AttestorOutput) UpdateTime() pulumi.StringOutput {
return o.ApplyT(func(v *Attestor) pulumi.StringOutput { return v.UpdateTime }).(pulumi.StringOutput)
}
// This specifies how an attestation will be read, and how it will be used during policy enforcement.
func (o AttestorOutput) UserOwnedGrafeasNote() UserOwnedGrafeasNoteResponseOutput {
return o.ApplyT(func(v *Attestor) UserOwnedGrafeasNoteResponseOutput { return v.UserOwnedGrafeasNote }).(UserOwnedGrafeasNoteResponseOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*AttestorInput)(nil)).Elem(), &Attestor{})
pulumi.RegisterOutputType(AttestorOutput{})
}