/
getSnapshot.go
110 lines (91 loc) · 3.8 KB
/
getSnapshot.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
// 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 v2
import (
"context"
"reflect"
"github.com/pulumi/pulumi-google-native/sdk/go/google/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Returns the specified snapshot resource. Returns INVALID_ARGUMENT if called for a non-boot volume.
func LookupSnapshot(ctx *pulumi.Context, args *LookupSnapshotArgs, opts ...pulumi.InvokeOption) (*LookupSnapshotResult, error) {
opts = internal.PkgInvokeDefaultOpts(opts)
var rv LookupSnapshotResult
err := ctx.Invoke("google-native:baremetalsolution/v2:getSnapshot", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
type LookupSnapshotArgs struct {
Location string `pulumi:"location"`
Project *string `pulumi:"project"`
SnapshotId string `pulumi:"snapshotId"`
VolumeId string `pulumi:"volumeId"`
}
type LookupSnapshotResult struct {
// The creation time of the snapshot.
CreateTime string `pulumi:"createTime"`
// The description of the snapshot.
Description string `pulumi:"description"`
// The name of the snapshot.
Name string `pulumi:"name"`
// The name of the volume which this snapshot belongs to.
StorageVolume string `pulumi:"storageVolume"`
// The type of the snapshot which indicates whether it was scheduled or manual/ad-hoc.
Type string `pulumi:"type"`
}
func LookupSnapshotOutput(ctx *pulumi.Context, args LookupSnapshotOutputArgs, opts ...pulumi.InvokeOption) LookupSnapshotResultOutput {
return pulumi.ToOutputWithContext(context.Background(), args).
ApplyT(func(v interface{}) (LookupSnapshotResult, error) {
args := v.(LookupSnapshotArgs)
r, err := LookupSnapshot(ctx, &args, opts...)
var s LookupSnapshotResult
if r != nil {
s = *r
}
return s, err
}).(LookupSnapshotResultOutput)
}
type LookupSnapshotOutputArgs struct {
Location pulumi.StringInput `pulumi:"location"`
Project pulumi.StringPtrInput `pulumi:"project"`
SnapshotId pulumi.StringInput `pulumi:"snapshotId"`
VolumeId pulumi.StringInput `pulumi:"volumeId"`
}
func (LookupSnapshotOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupSnapshotArgs)(nil)).Elem()
}
type LookupSnapshotResultOutput struct{ *pulumi.OutputState }
func (LookupSnapshotResultOutput) ElementType() reflect.Type {
return reflect.TypeOf((*LookupSnapshotResult)(nil)).Elem()
}
func (o LookupSnapshotResultOutput) ToLookupSnapshotResultOutput() LookupSnapshotResultOutput {
return o
}
func (o LookupSnapshotResultOutput) ToLookupSnapshotResultOutputWithContext(ctx context.Context) LookupSnapshotResultOutput {
return o
}
// The creation time of the snapshot.
func (o LookupSnapshotResultOutput) CreateTime() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.CreateTime }).(pulumi.StringOutput)
}
// The description of the snapshot.
func (o LookupSnapshotResultOutput) Description() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.Description }).(pulumi.StringOutput)
}
// The name of the snapshot.
func (o LookupSnapshotResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.Name }).(pulumi.StringOutput)
}
// The name of the volume which this snapshot belongs to.
func (o LookupSnapshotResultOutput) StorageVolume() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.StorageVolume }).(pulumi.StringOutput)
}
// The type of the snapshot which indicates whether it was scheduled or manual/ad-hoc.
func (o LookupSnapshotResultOutput) Type() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.Type }).(pulumi.StringOutput)
}
func init() {
pulumi.RegisterOutputType(LookupSnapshotResultOutput{})
}