-
Notifications
You must be signed in to change notification settings - Fork 51
/
getSnapshot.go
173 lines (147 loc) · 6.21 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
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
// 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/sdk/v3/go/pulumi"
)
// Use this data source to access information about an existing Snapshot.
//
// ## Example Usage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/compute"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := compute.LookupSnapshot(ctx, &compute.LookupSnapshotArgs{
// Name: "my-snapshot",
// ResourceGroupName: "my-resource-group",
// }, nil)
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
func LookupSnapshot(ctx *pulumi.Context, args *LookupSnapshotArgs, opts ...pulumi.InvokeOption) (*LookupSnapshotResult, error) {
var rv LookupSnapshotResult
err := ctx.Invoke("azure:compute/getSnapshot:getSnapshot", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
}
// A collection of arguments for invoking getSnapshot.
type LookupSnapshotArgs struct {
// Specifies the name of the Snapshot.
Name string `pulumi:"name"`
// Specifies the name of the resource group the Snapshot is located in.
ResourceGroupName string `pulumi:"resourceGroupName"`
}
// A collection of values returned by getSnapshot.
type LookupSnapshotResult struct {
CreationOption string `pulumi:"creationOption"`
// The size of the Snapshotted Disk in GB.
DiskSizeGb int `pulumi:"diskSizeGb"`
EncryptionSettings []GetSnapshotEncryptionSetting `pulumi:"encryptionSettings"`
// The provider-assigned unique ID for this managed resource.
Id string `pulumi:"id"`
Name string `pulumi:"name"`
OsType string `pulumi:"osType"`
ResourceGroupName string `pulumi:"resourceGroupName"`
// The reference to an existing snapshot.
SourceResourceId string `pulumi:"sourceResourceId"`
// The URI to a Managed or Unmanaged Disk.
SourceUri string `pulumi:"sourceUri"`
// The ID of an storage account.
StorageAccountId string `pulumi:"storageAccountId"`
TimeCreated string `pulumi:"timeCreated"`
// Whether Trusted Launch is enabled for the Snapshot.
TrustedLaunchEnabled bool `pulumi:"trustedLaunchEnabled"`
}
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)
}
// A collection of arguments for invoking getSnapshot.
type LookupSnapshotOutputArgs struct {
// Specifies the name of the Snapshot.
Name pulumi.StringInput `pulumi:"name"`
// Specifies the name of the resource group the Snapshot is located in.
ResourceGroupName pulumi.StringInput `pulumi:"resourceGroupName"`
}
func (LookupSnapshotOutputArgs) ElementType() reflect.Type {
return reflect.TypeOf((*LookupSnapshotArgs)(nil)).Elem()
}
// A collection of values returned by getSnapshot.
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
}
func (o LookupSnapshotResultOutput) CreationOption() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.CreationOption }).(pulumi.StringOutput)
}
// The size of the Snapshotted Disk in GB.
func (o LookupSnapshotResultOutput) DiskSizeGb() pulumi.IntOutput {
return o.ApplyT(func(v LookupSnapshotResult) int { return v.DiskSizeGb }).(pulumi.IntOutput)
}
func (o LookupSnapshotResultOutput) EncryptionSettings() GetSnapshotEncryptionSettingArrayOutput {
return o.ApplyT(func(v LookupSnapshotResult) []GetSnapshotEncryptionSetting { return v.EncryptionSettings }).(GetSnapshotEncryptionSettingArrayOutput)
}
// The provider-assigned unique ID for this managed resource.
func (o LookupSnapshotResultOutput) Id() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.Id }).(pulumi.StringOutput)
}
func (o LookupSnapshotResultOutput) Name() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.Name }).(pulumi.StringOutput)
}
func (o LookupSnapshotResultOutput) OsType() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.OsType }).(pulumi.StringOutput)
}
func (o LookupSnapshotResultOutput) ResourceGroupName() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.ResourceGroupName }).(pulumi.StringOutput)
}
// The reference to an existing snapshot.
func (o LookupSnapshotResultOutput) SourceResourceId() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.SourceResourceId }).(pulumi.StringOutput)
}
// The URI to a Managed or Unmanaged Disk.
func (o LookupSnapshotResultOutput) SourceUri() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.SourceUri }).(pulumi.StringOutput)
}
// The ID of an storage account.
func (o LookupSnapshotResultOutput) StorageAccountId() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.StorageAccountId }).(pulumi.StringOutput)
}
func (o LookupSnapshotResultOutput) TimeCreated() pulumi.StringOutput {
return o.ApplyT(func(v LookupSnapshotResult) string { return v.TimeCreated }).(pulumi.StringOutput)
}
// Whether Trusted Launch is enabled for the Snapshot.
func (o LookupSnapshotResultOutput) TrustedLaunchEnabled() pulumi.BoolOutput {
return o.ApplyT(func(v LookupSnapshotResult) bool { return v.TrustedLaunchEnabled }).(pulumi.BoolOutput)
}
func init() {
pulumi.RegisterOutputType(LookupSnapshotResultOutput{})
}