This repository has been archived by the owner on Mar 11, 2021. It is now read-only.
/
snapshot.go
259 lines (235 loc) · 10 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
// *** 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 v20180601
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"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD 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 settings for disk or snapshot
EncryptionSettings EncryptionSettingsResponsePtrOutput `pulumi:"encryptionSettings"`
// Resource location
Location pulumi.StringOutput `pulumi:"location"`
// Unused. Always Null.
ManagedBy pulumi.StringOutput `pulumi:"managedBy"`
// Resource name
Name pulumi.StringOutput `pulumi:"name"`
// 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 disk was created.
TimeCreated pulumi.StringOutput `pulumi:"timeCreated"`
// Resource type
Type pulumi.StringOutput `pulumi:"type"`
}
// 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/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/v20200501: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/v20180601: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/v20180601: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"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD 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 settings for disk or snapshot
EncryptionSettings *EncryptionSettingsResponse `pulumi:"encryptionSettings"`
// Resource location
Location *string `pulumi:"location"`
// Unused. Always Null.
ManagedBy *string `pulumi:"managedBy"`
// Resource name
Name *string `pulumi:"name"`
// 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 disk was created.
TimeCreated *string `pulumi:"timeCreated"`
// Resource type
Type *string `pulumi:"type"`
}
type SnapshotState struct {
// Disk source information. CreationData information cannot be changed after the disk has been created.
CreationData CreationDataResponsePtrInput
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD 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 settings for disk or snapshot
EncryptionSettings EncryptionSettingsResponsePtrInput
// Resource location
Location pulumi.StringPtrInput
// Unused. Always Null.
ManagedBy pulumi.StringPtrInput
// Resource name
Name 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 disk was created.
TimeCreated pulumi.StringPtrInput
// Resource type
Type 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"`
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD 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 settings for disk or snapshot
EncryptionSettings *EncryptionSettings `pulumi:"encryptionSettings"`
// Resource location
Location *string `pulumi:"location"`
// 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
// If creationData.createOption is Empty, this field is mandatory and it indicates the size of the VHD 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 settings for disk or snapshot
EncryptionSettings EncryptionSettingsPtrInput
// Resource location
Location 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{})
}