/
getDisk.go
369 lines (319 loc) · 15.5 KB
/
getDisk.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
// Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
// *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
package compute
import (
"context"
"reflect"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Get information about a Google Compute Persistent disks.
//
// [the official documentation](https://cloud.google.com/compute/docs/disks) and its [API](https://cloud.google.com/compute/docs/reference/latest/disks).
//
// ## Example Usage
//
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// persistent_boot_disk, err := compute.LookupDisk(ctx, &compute.LookupDiskArgs{
// Name: "persistent-boot-disk",
// Project: pulumi.StringRef("example"),
// }, nil)
// if err != nil {
// return err
// }
// _, err = compute.NewInstance(ctx, "default", &compute.InstanceArgs{
// BootDisk: &compute.InstanceBootDiskArgs{
// Source: pulumi.String(persistent_boot_disk.SelfLink),
// AutoDelete: pulumi.Bool(false),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
func LookupDisk(ctx *pulumi.Context, args *LookupDiskArgs, opts ...pulumi.InvokeOption) (*LookupDiskResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupDiskResult
err := ctx.Invoke("gcp:compute/getDisk:getDisk", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getDisk.
type LookupDiskArgs struct {
// The name of a specific disk.
//
// ***
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"`
// A reference to the zone where the disk resides.
Zone *string `pulumi:"zone"`
}
// A collection of values returned by getDisk.
type LookupDiskResult struct {
AsyncPrimaryDisks []GetDiskAsyncPrimaryDisk `pulumi:"asyncPrimaryDisks"`
// Creation timestamp in RFC3339 text format.
CreationTimestamp string `pulumi:"creationTimestamp"`
// The optional description of this resource.
Description string `pulumi:"description"`
DiskEncryptionKeys []GetDiskDiskEncryptionKey `pulumi:"diskEncryptionKeys"`
DiskId string `pulumi:"diskId"`
EffectiveLabels map[string]string `pulumi:"effectiveLabels"`
EnableConfidentialCompute bool `pulumi:"enableConfidentialCompute"`
GuestOsFeatures []GetDiskGuestOsFeature `pulumi:"guestOsFeatures"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
// The image from which to initialize this disk.
Image string `pulumi:"image"`
Interface string `pulumi:"interface"`
// The fingerprint used for optimistic locking of this resource. Used
// internally during updates.
LabelFingerprint string `pulumi:"labelFingerprint"`
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
Labels map[string]string `pulumi:"labels"`
// Last attach timestamp in RFC3339 text format.
LastAttachTimestamp string `pulumi:"lastAttachTimestamp"`
// Last detach timestamp in RFC3339 text format.
LastDetachTimestamp string `pulumi:"lastDetachTimestamp"`
Licenses []string `pulumi:"licenses"`
MultiWriter bool `pulumi:"multiWriter"`
Name string `pulumi:"name"`
// Physical block size of the persistent disk, in bytes.
PhysicalBlockSizeBytes int `pulumi:"physicalBlockSizeBytes"`
Project *string `pulumi:"project"`
ProvisionedIops int `pulumi:"provisionedIops"`
ProvisionedThroughput int `pulumi:"provisionedThroughput"`
PulumiLabels map[string]string `pulumi:"pulumiLabels"`
ResourcePolicies []string `pulumi:"resourcePolicies"`
// The URI of the created resource.
SelfLink string `pulumi:"selfLink"`
// Size of the persistent disk, specified in GB.
Size int `pulumi:"size"`
// The source snapshot used to create this disk.
Snapshot string `pulumi:"snapshot"`
SourceDisk string `pulumi:"sourceDisk"`
SourceDiskId string `pulumi:"sourceDiskId"`
// The customer-supplied encryption key of the source image.
SourceImageEncryptionKeys []GetDiskSourceImageEncryptionKey `pulumi:"sourceImageEncryptionKeys"`
// The ID value of the image used to create this disk. This value
// identifies the exact image that was used to create this persistent
// disk. For example, if you created the persistent disk from an image
// that was later deleted and recreated under the same name, the source
// image ID would identify the exact version of the image that was used.
SourceImageId string `pulumi:"sourceImageId"`
// The customer-supplied encryption key of the source snapshot.
SourceSnapshotEncryptionKeys []GetDiskSourceSnapshotEncryptionKey `pulumi:"sourceSnapshotEncryptionKeys"`
// The unique ID of the snapshot used to create this disk. This value
// identifies the exact snapshot that was used to create this persistent
// disk. For example, if you created the persistent disk from a snapshot
// that was later deleted and recreated under the same name, the source
// snapshot ID would identify the exact version of the snapshot that was
// used.
SourceSnapshotId string `pulumi:"sourceSnapshotId"`
// URL of the disk type resource describing which disk type to use to
// create the disk.
Type string `pulumi:"type"`
// Links to the users of the disk (attached instances) in form:
// project/zones/zone/instances/instance
Users []string `pulumi:"users"`
// A reference to the zone where the disk resides.
Zone *string `pulumi:"zone"`
}
func LookupDiskOutput(ctx *pulumi.Context, args LookupDiskOutputArgs, opts ...pulumi.InvokeOption) LookupDiskResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupDiskResult, error) {
args := v.(LookupDiskArgs)
r, err := LookupDisk(ctx, &args, opts...)
var s LookupDiskResult
if r != nil {
s = *r
}
return s, err
}).(LookupDiskResultOutput)
}
// A collection of arguments for invoking getDisk.
type LookupDiskOutputArgs struct {
// The name of a specific disk.
//
// ***
Name pulumi.StringInput `pulumi:"name"`
// The ID of the project in which the resource belongs.
// If it is not provided, the provider project is used.
Project pulumi.StringPtrInput `pulumi:"project"`
// A reference to the zone where the disk resides.
Zone pulumi.StringPtrInput `pulumi:"zone"`
}
func (LookupDiskOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDiskArgs)(nil)).Elem()
}
// A collection of values returned by getDisk.
type LookupDiskResultOutput struct{ *pulumi.OutputState }
func (LookupDiskResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupDiskResult)(nil)).Elem()
}
func (o LookupDiskResultOutput) ToLookupDiskResultOutput() LookupDiskResultOutput {
return o
}
func (o LookupDiskResultOutput) ToLookupDiskResultOutputWithContext(ctx context.Context) LookupDiskResultOutput {
return o
}
func (o LookupDiskResultOutput) AsyncPrimaryDisks() GetDiskAsyncPrimaryDiskArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []GetDiskAsyncPrimaryDisk { return v.AsyncPrimaryDisks }).(GetDiskAsyncPrimaryDiskArrayOutput)
}
// Creation timestamp in RFC3339 text format.
func (o LookupDiskResultOutput) CreationTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.CreationTimestamp }).(pulumi.StringOutput)
}
// The optional description of this resource.
func (o LookupDiskResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Description }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) DiskEncryptionKeys() GetDiskDiskEncryptionKeyArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []GetDiskDiskEncryptionKey { return v.DiskEncryptionKeys }).(GetDiskDiskEncryptionKeyArrayOutput)
}
func (o LookupDiskResultOutput) DiskId() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.DiskId }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) EffectiveLabels() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupDiskResult) map[string]string { return v.EffectiveLabels }).(pulumi.StringMapOutput)
}
func (o LookupDiskResultOutput) EnableConfidentialCompute() pulumi.BoolOutput {
return o.ApplyT(func(v LookupDiskResult) bool { return v.EnableConfidentialCompute }).(pulumi.BoolOutput)
}
func (o LookupDiskResultOutput) GuestOsFeatures() GetDiskGuestOsFeatureArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []GetDiskGuestOsFeature { return v.GuestOsFeatures }).(GetDiskGuestOsFeatureArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupDiskResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Id }).(pulumi.StringOutput)
}
// The image from which to initialize this disk.
func (o LookupDiskResultOutput) Image() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Image }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) Interface() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Interface }).(pulumi.StringOutput)
}
// The fingerprint used for optimistic locking of this resource. Used
// internally during updates.
func (o LookupDiskResultOutput) LabelFingerprint() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.LabelFingerprint }).(pulumi.StringOutput)
}
// All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
func (o LookupDiskResultOutput) Labels() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupDiskResult) map[string]string { return v.Labels }).(pulumi.StringMapOutput)
}
// Last attach timestamp in RFC3339 text format.
func (o LookupDiskResultOutput) LastAttachTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.LastAttachTimestamp }).(pulumi.StringOutput)
}
// Last detach timestamp in RFC3339 text format.
func (o LookupDiskResultOutput) LastDetachTimestamp() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.LastDetachTimestamp }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) Licenses() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []string { return v.Licenses }).(pulumi.StringArrayOutput)
}
func (o LookupDiskResultOutput) MultiWriter() pulumi.BoolOutput {
return o.ApplyT(func(v LookupDiskResult) bool { return v.MultiWriter }).(pulumi.BoolOutput)
}
func (o LookupDiskResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Name }).(pulumi.StringOutput)
}
// Physical block size of the persistent disk, in bytes.
func (o LookupDiskResultOutput) PhysicalBlockSizeBytes() pulumi.IntOutput {
return o.ApplyT(func(v LookupDiskResult) int { return v.PhysicalBlockSizeBytes }).(pulumi.IntOutput)
}
func (o LookupDiskResultOutput) Project() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDiskResult) *string { return v.Project }).(pulumi.StringPtrOutput)
}
func (o LookupDiskResultOutput) ProvisionedIops() pulumi.IntOutput {
return o.ApplyT(func(v LookupDiskResult) int { return v.ProvisionedIops }).(pulumi.IntOutput)
}
func (o LookupDiskResultOutput) ProvisionedThroughput() pulumi.IntOutput {
return o.ApplyT(func(v LookupDiskResult) int { return v.ProvisionedThroughput }).(pulumi.IntOutput)
}
func (o LookupDiskResultOutput) PulumiLabels() pulumi.StringMapOutput {
return o.ApplyT(func(v LookupDiskResult) map[string]string { return v.PulumiLabels }).(pulumi.StringMapOutput)
}
func (o LookupDiskResultOutput) ResourcePolicies() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []string { return v.ResourcePolicies }).(pulumi.StringArrayOutput)
}
// The URI of the created resource.
func (o LookupDiskResultOutput) SelfLink() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.SelfLink }).(pulumi.StringOutput)
}
// Size of the persistent disk, specified in GB.
func (o LookupDiskResultOutput) Size() pulumi.IntOutput {
return o.ApplyT(func(v LookupDiskResult) int { return v.Size }).(pulumi.IntOutput)
}
// The source snapshot used to create this disk.
func (o LookupDiskResultOutput) Snapshot() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Snapshot }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) SourceDisk() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.SourceDisk }).(pulumi.StringOutput)
}
func (o LookupDiskResultOutput) SourceDiskId() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.SourceDiskId }).(pulumi.StringOutput)
}
// The customer-supplied encryption key of the source image.
func (o LookupDiskResultOutput) SourceImageEncryptionKeys() GetDiskSourceImageEncryptionKeyArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []GetDiskSourceImageEncryptionKey { return v.SourceImageEncryptionKeys }).(GetDiskSourceImageEncryptionKeyArrayOutput)
}
// The ID value of the image used to create this disk. This value
// identifies the exact image that was used to create this persistent
// disk. For example, if you created the persistent disk from an image
// that was later deleted and recreated under the same name, the source
// image ID would identify the exact version of the image that was used.
func (o LookupDiskResultOutput) SourceImageId() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.SourceImageId }).(pulumi.StringOutput)
}
// The customer-supplied encryption key of the source snapshot.
func (o LookupDiskResultOutput) SourceSnapshotEncryptionKeys() GetDiskSourceSnapshotEncryptionKeyArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []GetDiskSourceSnapshotEncryptionKey { return v.SourceSnapshotEncryptionKeys }).(GetDiskSourceSnapshotEncryptionKeyArrayOutput)
}
// The unique ID of the snapshot used to create this disk. This value
// identifies the exact snapshot that was used to create this persistent
// disk. For example, if you created the persistent disk from a snapshot
// that was later deleted and recreated under the same name, the source
// snapshot ID would identify the exact version of the snapshot that was
// used.
func (o LookupDiskResultOutput) SourceSnapshotId() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.SourceSnapshotId }).(pulumi.StringOutput)
}
// URL of the disk type resource describing which disk type to use to
// create the disk.
func (o LookupDiskResultOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v LookupDiskResult) string { return v.Type }).(pulumi.StringOutput)
}
// Links to the users of the disk (attached instances) in form:
// project/zones/zone/instances/instance
func (o LookupDiskResultOutput) Users() pulumi.StringArrayOutput {
return o.ApplyT(func(v LookupDiskResult) []string { return v.Users }).(pulumi.StringArrayOutput)
}
// A reference to the zone where the disk resides.
func (o LookupDiskResultOutput) Zone() pulumi.StringPtrOutput {
return o.ApplyT(func(v LookupDiskResult) *string { return v.Zone }).(pulumi.StringPtrOutput)
}
func init() {
pulumi.RegisterOutputType(LookupDiskResultOutput{})
}