This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
/
snapshot.go
321 lines (297 loc) · 14.5 KB
/
snapshot.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
// *** WARNING: this file was generated by the Pulumi SDK Generator. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package v20200501
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
// Snapshot resource.
type Snapshot struct {
pulumi.CustomResourceState
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData CreationDataResponseOutput `pulumi:"creationData"`
// ARM id of the DiskAccess resource for using private endpoints on disks.
DiskAccessId pulumi.StringPtrOutput `pulumi:"diskAccessId"`
// The size of the disk in bytes. This field is read only.
DiskSizeBytes pulumi.Float64Output `pulumi:"diskSizeBytes"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
DiskSizeGB pulumi.IntPtrOutput `pulumi:"diskSizeGB"`
// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
Encryption EncryptionResponsePtrOutput `pulumi:"encryption"`
// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
EncryptionSettingsCollection EncryptionSettingsCollectionResponsePtrOutput `pulumi:"encryptionSettingsCollection"`
// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
HyperVGeneration pulumi.StringPtrOutput `pulumi:"hyperVGeneration"`
// Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
Incremental pulumi.BoolPtrOutput `pulumi:"incremental"`
// Resource location
Location pulumi.StringOutput `pulumi:"location"`
// Unused. Always Null.
ManagedBy pulumi.StringOutput `pulumi:"managedBy"`
// Resource name
Name pulumi.StringOutput `pulumi:"name"`
// Policy for accessing the disk via network.
NetworkAccessPolicy pulumi.StringPtrOutput `pulumi:"networkAccessPolicy"`
// The Operating System type.
OsType pulumi.StringPtrOutput `pulumi:"osType"`
// The disk provisioning state.
ProvisioningState pulumi.StringOutput `pulumi:"provisioningState"`
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS.
Sku SnapshotSkuResponsePtrOutput `pulumi:"sku"`
// Resource tags
Tags pulumi.StringMapOutput `pulumi:"tags"`
// The time when the snapshot was created.
TimeCreated pulumi.StringOutput `pulumi:"timeCreated"`
// Resource type
Type pulumi.StringOutput `pulumi:"type"`
// Unique Guid identifying the resource.
UniqueId pulumi.StringOutput `pulumi:"uniqueId"`
}
// NewSnapshot registers a new resource with the given unique name, arguments, and options.
func NewSnapshot(ctx *pulumi.Context,
name string, args *SnapshotArgs, opts ...pulumi.ResourceOption) (*Snapshot, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.CreationData == nil {
return nil, errors.New("invalid value for required argument 'CreationData'")
}
if args.ResourceGroupName == nil {
return nil, errors.New("invalid value for required argument 'ResourceGroupName'")
}
if args.SnapshotName == nil {
return nil, errors.New("invalid value for required argument 'SnapshotName'")
}
aliases := pulumi.Aliases([]pulumi.Alias{
{
Type: pulumi.String("azure-nextgen:compute/latest:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20160430preview:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20170330:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20180401:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20180601:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20180930:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20190301:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20190701:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20191101:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20200630:Snapshot"),
},
{
Type: pulumi.String("azure-nextgen:compute/v20200930:Snapshot"),
},
})
opts = append(opts, aliases)
var resource Snapshot
err := ctx.RegisterResource("azure-nextgen:compute/v20200501:Snapshot", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetSnapshot gets an existing Snapshot 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 GetSnapshot(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *SnapshotState, opts ...pulumi.ResourceOption) (*Snapshot, error) {
var resource Snapshot
err := ctx.ReadResource("azure-nextgen:compute/v20200501:Snapshot", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering Snapshot resources.
type snapshotState struct {
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData *CreationDataResponse `pulumi:"creationData"`
// ARM id of the DiskAccess resource for using private endpoints on disks.
DiskAccessId *string `pulumi:"diskAccessId"`
// The size of the disk in bytes. This field is read only.
DiskSizeBytes *float64 `pulumi:"diskSizeBytes"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
DiskSizeGB *int `pulumi:"diskSizeGB"`
// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
Encryption *EncryptionResponse `pulumi:"encryption"`
// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
EncryptionSettingsCollection *EncryptionSettingsCollectionResponse `pulumi:"encryptionSettingsCollection"`
// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
HyperVGeneration *string `pulumi:"hyperVGeneration"`
// Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
Incremental *bool `pulumi:"incremental"`
// Resource location
Location *string `pulumi:"location"`
// Unused. Always Null.
ManagedBy *string `pulumi:"managedBy"`
// Resource name
Name *string `pulumi:"name"`
// Policy for accessing the disk via network.
NetworkAccessPolicy *string `pulumi:"networkAccessPolicy"`
// The Operating System type.
OsType *string `pulumi:"osType"`
// The disk provisioning state.
ProvisioningState *string `pulumi:"provisioningState"`
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS.
Sku *SnapshotSkuResponse `pulumi:"sku"`
// Resource tags
Tags map[string]string `pulumi:"tags"`
// The time when the snapshot was created.
TimeCreated *string `pulumi:"timeCreated"`
// Resource type
Type *string `pulumi:"type"`
// Unique Guid identifying the resource.
UniqueId *string `pulumi:"uniqueId"`
}
type SnapshotState struct {
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData CreationDataResponsePtrInput
// ARM id of the DiskAccess resource for using private endpoints on disks.
DiskAccessId pulumi.StringPtrInput
// The size of the disk in bytes. This field is read only.
DiskSizeBytes pulumi.Float64PtrInput
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
DiskSizeGB pulumi.IntPtrInput
// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
Encryption EncryptionResponsePtrInput
// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
EncryptionSettingsCollection EncryptionSettingsCollectionResponsePtrInput
// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
HyperVGeneration pulumi.StringPtrInput
// Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
Incremental pulumi.BoolPtrInput
// Resource location
Location pulumi.StringPtrInput
// Unused. Always Null.
ManagedBy pulumi.StringPtrInput
// Resource name
Name pulumi.StringPtrInput
// Policy for accessing the disk via network.
NetworkAccessPolicy pulumi.StringPtrInput
// The Operating System type.
OsType pulumi.StringPtrInput
// The disk provisioning state.
ProvisioningState pulumi.StringPtrInput
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS.
Sku SnapshotSkuResponsePtrInput
// Resource tags
Tags pulumi.StringMapInput
// The time when the snapshot was created.
TimeCreated pulumi.StringPtrInput
// Resource type
Type pulumi.StringPtrInput
// Unique Guid identifying the resource.
UniqueId pulumi.StringPtrInput
}
func (SnapshotState) ElementType() reflect.Type {
return reflect.TypeOf((*snapshotState)(nil)).Elem()
}
type snapshotArgs struct {
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData CreationData `pulumi:"creationData"`
// ARM id of the DiskAccess resource for using private endpoints on disks.
DiskAccessId *string `pulumi:"diskAccessId"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
DiskSizeGB *int `pulumi:"diskSizeGB"`
// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
Encryption *Encryption `pulumi:"encryption"`
// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
EncryptionSettingsCollection *EncryptionSettingsCollection `pulumi:"encryptionSettingsCollection"`
// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
HyperVGeneration *string `pulumi:"hyperVGeneration"`
// Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
Incremental *bool `pulumi:"incremental"`
// Resource location
Location *string `pulumi:"location"`
// Policy for accessing the disk via network.
NetworkAccessPolicy *string `pulumi:"networkAccessPolicy"`
// The Operating System type.
OsType *string `pulumi:"osType"`
// The name of the resource group.
ResourceGroupName string `pulumi:"resourceGroupName"`
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS.
Sku *SnapshotSku `pulumi:"sku"`
// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
SnapshotName string `pulumi:"snapshotName"`
// Resource tags
Tags map[string]string `pulumi:"tags"`
}
// The set of arguments for constructing a Snapshot resource.
type SnapshotArgs struct {
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData CreationDataInput
// ARM id of the DiskAccess resource for using private endpoints on disks.
DiskAccessId pulumi.StringPtrInput
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the disk to create. If this field is present for updates or creation with other options, it indicates a resize. Resizes are only allowed if the disk is not attached to a running VM, and can only increase the disk's size.
DiskSizeGB pulumi.IntPtrInput
// Encryption property can be used to encrypt data at rest with customer managed keys or platform managed keys.
Encryption EncryptionPtrInput
// Encryption settings collection used be Azure Disk Encryption, can contain multiple encryption settings per disk or snapshot.
EncryptionSettingsCollection EncryptionSettingsCollectionPtrInput
// The hypervisor generation of the Virtual Machine. Applicable to OS disks only.
HyperVGeneration pulumi.StringPtrInput
// Whether a snapshot is incremental. Incremental snapshots on the same disk occupy less space than full snapshots and can be diffed.
Incremental pulumi.BoolPtrInput
// Resource location
Location pulumi.StringPtrInput
// Policy for accessing the disk via network.
NetworkAccessPolicy pulumi.StringPtrInput
// The Operating System type.
OsType *OperatingSystemTypes
// The name of the resource group.
ResourceGroupName pulumi.StringInput
// The snapshots sku name. Can be Standard_LRS, Premium_LRS, or Standard_ZRS.
Sku SnapshotSkuPtrInput
// The name of the snapshot that is being created. The name can't be changed after the snapshot is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The max name length is 80 characters.
SnapshotName pulumi.StringInput
// Resource tags
Tags pulumi.StringMapInput
}
func (SnapshotArgs) ElementType() reflect.Type {
return reflect.TypeOf((*snapshotArgs)(nil)).Elem()
}
type SnapshotInput interface {
pulumi.Input
ToSnapshotOutput() SnapshotOutput
ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput
}
func (*Snapshot) ElementType() reflect.Type {
return reflect.TypeOf((*Snapshot)(nil))
}
func (i *Snapshot) ToSnapshotOutput() SnapshotOutput {
return i.ToSnapshotOutputWithContext(context.Background())
}
func (i *Snapshot) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput {
return pulumi.ToOutputWithContext(ctx, i).(SnapshotOutput)
}
type SnapshotOutput struct {
*pulumi.OutputState
}
func (SnapshotOutput) ElementType() reflect.Type {
return reflect.TypeOf((*Snapshot)(nil))
}
func (o SnapshotOutput) ToSnapshotOutput() SnapshotOutput {
return o
}
func (o SnapshotOutput) ToSnapshotOutputWithContext(ctx context.Context) SnapshotOutput {
return o
}
func init() {
pulumi.RegisterOutputType(SnapshotOutput{})
}