/
reservation.go
293 lines (249 loc) · 18.8 KB
/
reservation.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
// 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 alpha
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Creates a new reservation. For more information, read Reserving zonal resources.
type Reservation struct {
pulumi.CustomResourceState
// Reservation for aggregated resources, providing shape flexibility.
AggregateReservation AllocationAggregateReservationResponseOutput `pulumi:"aggregateReservation"`
// Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment.
Commitment pulumi.StringOutput `pulumi:"commitment"`
// Creation timestamp in RFC3339 text format.
CreationTimestamp pulumi.StringOutput `pulumi:"creationTimestamp"`
// Duration time relative to reservation creation when GCE will automatically delete this resource.
DeleteAfterDuration DurationResponseOutput `pulumi:"deleteAfterDuration"`
// Absolute time in future when the reservation will be auto-deleted by GCE. Timestamp is represented in RFC3339 text format.
DeleteAtTime pulumi.StringOutput `pulumi:"deleteAtTime"`
// An optional description of this resource. Provide this property when you create the resource.
Description pulumi.StringOutput `pulumi:"description"`
// Type of the resource. Always compute#reservations for reservations.
Kind pulumi.StringOutput `pulumi:"kind"`
// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
Name pulumi.StringOutput `pulumi:"name"`
Project pulumi.StringOutput `pulumi:"project"`
// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
RequestId pulumi.StringPtrOutput `pulumi:"requestId"`
// Resource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation.
ResourcePolicies pulumi.StringMapOutput `pulumi:"resourcePolicies"`
// Status information for Reservation resource.
ResourceStatus AllocationResourceStatusResponseOutput `pulumi:"resourceStatus"`
// Reserved for future use.
SatisfiesPzs pulumi.BoolOutput `pulumi:"satisfiesPzs"`
// Server-defined fully-qualified URL for this resource.
SelfLink pulumi.StringOutput `pulumi:"selfLink"`
// Server-defined URL for this resource with the resource id.
SelfLinkWithId pulumi.StringOutput `pulumi:"selfLinkWithId"`
// Specify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation.
ShareSettings ShareSettingsResponseOutput `pulumi:"shareSettings"`
// Reservation for instances with specific machine shapes.
SpecificReservation AllocationSpecificSKUReservationResponseOutput `pulumi:"specificReservation"`
// Indicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation.
SpecificReservationRequired pulumi.BoolOutput `pulumi:"specificReservationRequired"`
// The status of the reservation.
Status pulumi.StringOutput `pulumi:"status"`
Zone pulumi.StringOutput `pulumi:"zone"`
}
// NewReservation registers a new resource with the given unique name, arguments, and options.
func NewReservation(ctx *pulumi.Context,
name string, args *ReservationArgs, opts ...pulumi.ResourceOption) (*Reservation, error) {
if args == nil {
args = &ReservationArgs{}
}
replaceOnChanges := pulumi.ReplaceOnChanges([]string{
"project",
"zone",
})
opts = append(opts, replaceOnChanges)
opts = internal.PkgResourceDefaultOpts(opts)
var resource Reservation
err := ctx.RegisterResource("google-native:compute/alpha:Reservation", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetReservation gets an existing Reservation 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 GetReservation(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *ReservationState, opts ...pulumi.ResourceOption) (*Reservation, error) {
var resource Reservation
err := ctx.ReadResource("google-native:compute/alpha:Reservation", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Reservation resources.
type reservationState struct {
}
type ReservationState struct {
}
func (ReservationState) ElementType() reflect.Type {
return reflect.TypeOf((*reservationState)(nil)).Elem()
}
type reservationArgs struct {
// Reservation for aggregated resources, providing shape flexibility.
AggregateReservation *AllocationAggregateReservation `pulumi:"aggregateReservation"`
// Duration time relative to reservation creation when GCE will automatically delete this resource.
DeleteAfterDuration *Duration `pulumi:"deleteAfterDuration"`
// Absolute time in future when the reservation will be auto-deleted by GCE. Timestamp is represented in RFC3339 text format.
DeleteAtTime *string `pulumi:"deleteAtTime"`
// An optional description of this resource. Provide this property when you create the resource.
Description *string `pulumi:"description"`
// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
Name *string `pulumi:"name"`
Project *string `pulumi:"project"`
// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
RequestId *string `pulumi:"requestId"`
// Resource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation.
ResourcePolicies map[string]string `pulumi:"resourcePolicies"`
// Specify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation.
ShareSettings *ShareSettings `pulumi:"shareSettings"`
// Reservation for instances with specific machine shapes.
SpecificReservation *AllocationSpecificSKUReservation `pulumi:"specificReservation"`
// Indicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation.
SpecificReservationRequired *bool `pulumi:"specificReservationRequired"`
// Zone in which the reservation resides. A zone must be provided if the reservation is created within a commitment.
Zone *string `pulumi:"zone"`
}
// The set of arguments for constructing a Reservation resource.
type ReservationArgs struct {
// Reservation for aggregated resources, providing shape flexibility.
AggregateReservation AllocationAggregateReservationPtrInput
// Duration time relative to reservation creation when GCE will automatically delete this resource.
DeleteAfterDuration DurationPtrInput
// Absolute time in future when the reservation will be auto-deleted by GCE. Timestamp is represented in RFC3339 text format.
DeleteAtTime pulumi.StringPtrInput
// An optional description of this resource. Provide this property when you create the resource.
Description pulumi.StringPtrInput
// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
Name pulumi.StringPtrInput
Project pulumi.StringPtrInput
// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
RequestId pulumi.StringPtrInput
// Resource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation.
ResourcePolicies pulumi.StringMapInput
// Specify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation.
ShareSettings ShareSettingsPtrInput
// Reservation for instances with specific machine shapes.
SpecificReservation AllocationSpecificSKUReservationPtrInput
// Indicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation.
SpecificReservationRequired pulumi.BoolPtrInput
// Zone in which the reservation resides. A zone must be provided if the reservation is created within a commitment.
Zone pulumi.StringPtrInput
}
func (ReservationArgs) ElementType() reflect.Type {
return reflect.TypeOf((*reservationArgs)(nil)).Elem()
}
type ReservationInput interface {
pulumi.Input
ToReservationOutput() ReservationOutput
ToReservationOutputWithContext(ctx context.Context) ReservationOutput
}
func (*Reservation) ElementType() reflect.Type {
return reflect.TypeOf((**Reservation)(nil)).Elem()
}
func (i *Reservation) ToReservationOutput() ReservationOutput {
return i.ToReservationOutputWithContext(context.Background())
}
func (i *Reservation) ToReservationOutputWithContext(ctx context.Context) ReservationOutput {
return pulumi.ToOutputWithContext(ctx, i).(ReservationOutput)
}
type ReservationOutput struct{ *pulumi.OutputState }
func (ReservationOutput) ElementType() reflect.Type {
return reflect.TypeOf((**Reservation)(nil)).Elem()
}
func (o ReservationOutput) ToReservationOutput() ReservationOutput {
return o
}
func (o ReservationOutput) ToReservationOutputWithContext(ctx context.Context) ReservationOutput {
return o
}
// Reservation for aggregated resources, providing shape flexibility.
func (o ReservationOutput) AggregateReservation() AllocationAggregateReservationResponseOutput {
return o.ApplyT(func(v *Reservation) AllocationAggregateReservationResponseOutput { return v.AggregateReservation }).(AllocationAggregateReservationResponseOutput)
}
// Full or partial URL to a parent commitment. This field displays for reservations that are tied to a commitment.
func (o ReservationOutput) Commitment() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Commitment }).(pulumi.StringOutput)
}
// Creation timestamp in RFC3339 text format.
func (o ReservationOutput) CreationTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.CreationTimestamp }).(pulumi.StringOutput)
}
// Duration time relative to reservation creation when GCE will automatically delete this resource.
func (o ReservationOutput) DeleteAfterDuration() DurationResponseOutput {
return o.ApplyT(func(v *Reservation) DurationResponseOutput { return v.DeleteAfterDuration }).(DurationResponseOutput)
}
// Absolute time in future when the reservation will be auto-deleted by GCE. Timestamp is represented in RFC3339 text format.
func (o ReservationOutput) DeleteAtTime() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.DeleteAtTime }).(pulumi.StringOutput)
}
// An optional description of this resource. Provide this property when you create the resource.
func (o ReservationOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
}
// Type of the resource. Always compute#reservations for reservations.
func (o ReservationOutput) Kind() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Kind }).(pulumi.StringOutput)
}
// The name of the resource, provided by the client when initially creating the resource. The resource name must be 1-63 characters long, and comply with RFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
func (o ReservationOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
}
func (o ReservationOutput) Project() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Project }).(pulumi.StringOutput)
}
// An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed. For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments. The request ID must be a valid UUID with the exception that zero UUID is not supported ( 00000000-0000-0000-0000-000000000000).
func (o ReservationOutput) RequestId() pulumi.StringPtrOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringPtrOutput { return v.RequestId }).(pulumi.StringPtrOutput)
}
// Resource policies to be added to this reservation. The key is defined by user, and the value is resource policy url. This is to define placement policy with reservation.
func (o ReservationOutput) ResourcePolicies() pulumi.StringMapOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringMapOutput { return v.ResourcePolicies }).(pulumi.StringMapOutput)
}
// Status information for Reservation resource.
func (o ReservationOutput) ResourceStatus() AllocationResourceStatusResponseOutput {
return o.ApplyT(func(v *Reservation) AllocationResourceStatusResponseOutput { return v.ResourceStatus }).(AllocationResourceStatusResponseOutput)
}
// Reserved for future use.
func (o ReservationOutput) SatisfiesPzs() pulumi.BoolOutput {
return o.ApplyT(func(v *Reservation) pulumi.BoolOutput { return v.SatisfiesPzs }).(pulumi.BoolOutput)
}
// Server-defined fully-qualified URL for this resource.
func (o ReservationOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.SelfLink }).(pulumi.StringOutput)
}
// Server-defined URL for this resource with the resource id.
func (o ReservationOutput) SelfLinkWithId() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.SelfLinkWithId }).(pulumi.StringOutput)
}
// Specify share-settings to create a shared reservation. This property is optional. For more information about the syntax and options for this field and its subfields, see the guide for creating a shared reservation.
func (o ReservationOutput) ShareSettings() ShareSettingsResponseOutput {
return o.ApplyT(func(v *Reservation) ShareSettingsResponseOutput { return v.ShareSettings }).(ShareSettingsResponseOutput)
}
// Reservation for instances with specific machine shapes.
func (o ReservationOutput) SpecificReservation() AllocationSpecificSKUReservationResponseOutput {
return o.ApplyT(func(v *Reservation) AllocationSpecificSKUReservationResponseOutput { return v.SpecificReservation }).(AllocationSpecificSKUReservationResponseOutput)
}
// Indicates whether the reservation can be consumed by VMs with affinity for "any" reservation. If the field is set, then only VMs that target the reservation by name can consume from this reservation.
func (o ReservationOutput) SpecificReservationRequired() pulumi.BoolOutput {
return o.ApplyT(func(v *Reservation) pulumi.BoolOutput { return v.SpecificReservationRequired }).(pulumi.BoolOutput)
}
// The status of the reservation.
func (o ReservationOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
func (o ReservationOutput) Zone() pulumi.StringOutput {
return o.ApplyT(func(v *Reservation) pulumi.StringOutput { return v.Zone }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*ReservationInput)(nil)).Elem(), &Reservation{})
pulumi.RegisterOutputType(ReservationOutput{})
}