generated from pulumi/pulumi-tf-provider-boilerplate
/
blockStorage.go
373 lines (317 loc) · 14.4 KB
/
blockStorage.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
370
371
372
373
// 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 vultr
import (
"context"
"reflect"
"github.com/pkg/errors"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Provides a Vultr Block Storage resource. This can be used to create, read, modify, and delete Block Storage.
//
// ## Example Usage
//
// Create a new Block Storage
//
// ```go
// package main
//
// import (
// "github.com/pulumi/pulumi-vultr/sdk/go/vultr"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// _, err := vultr.NewBlockStorage(ctx, "myBlockstorage", &vultr.BlockStorageArgs{
// Region: pulumi.String("ewr"),
// SizeGb: pulumi.Int(10),
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
// ```
//
// ## Import
//
// Block Storage can be imported using the Block Storage `ID`, e.g.
//
// ```sh
// $ pulumi import vultr:index/blockStorage:BlockStorage my_blockstorage e315835e-d466-4e89-9b4c-dfd8788d7685
// ```
type BlockStorage struct {
pulumi.CustomResourceState
// VPS ID that you want to have this block storage attached to.
AttachedToInstance pulumi.StringPtrOutput `pulumi:"attachedToInstance"`
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
BlockType pulumi.StringOutput `pulumi:"blockType"`
// The monthly cost of this block storage.
Cost pulumi.Float64Output `pulumi:"cost"`
// The date this block storage was created.
DateCreated pulumi.StringOutput `pulumi:"dateCreated"`
// Label that is given to your block storage.
Label pulumi.StringPtrOutput `pulumi:"label"`
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
Live pulumi.BoolPtrOutput `pulumi:"live"`
// An ID associated with the instance, when mounted the ID can be found in /dev/disk/by-id prefixed with virtio.
MountId pulumi.StringOutput `pulumi:"mountId"`
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
Region pulumi.StringOutput `pulumi:"region"`
// The size of the given block storage.
SizeGb pulumi.IntOutput `pulumi:"sizeGb"`
// Current status of your block storage.
Status pulumi.StringOutput `pulumi:"status"`
}
// NewBlockStorage registers a new resource with the given unique name, arguments, and options.
func NewBlockStorage(ctx *pulumi.Context,
name string, args *BlockStorageArgs, opts ...pulumi.ResourceOption) (*BlockStorage, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.Region == nil {
return nil, errors.New("invalid value for required argument 'Region'")
}
if args.SizeGb == nil {
return nil, errors.New("invalid value for required argument 'SizeGb'")
}
var resource BlockStorage
err := ctx.RegisterResource("vultr:index/blockStorage:BlockStorage", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetBlockStorage gets an existing BlockStorage 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 GetBlockStorage(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *BlockStorageState, opts ...pulumi.ResourceOption) (*BlockStorage, error) {
var resource BlockStorage
err := ctx.ReadResource("vultr:index/blockStorage:BlockStorage", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering BlockStorage resources.
type blockStorageState struct {
// VPS ID that you want to have this block storage attached to.
AttachedToInstance *string `pulumi:"attachedToInstance"`
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
BlockType *string `pulumi:"blockType"`
// The monthly cost of this block storage.
Cost *float64 `pulumi:"cost"`
// The date this block storage was created.
DateCreated *string `pulumi:"dateCreated"`
// Label that is given to your block storage.
Label *string `pulumi:"label"`
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
Live *bool `pulumi:"live"`
// An ID associated with the instance, when mounted the ID can be found in /dev/disk/by-id prefixed with virtio.
MountId *string `pulumi:"mountId"`
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
Region *string `pulumi:"region"`
// The size of the given block storage.
SizeGb *int `pulumi:"sizeGb"`
// Current status of your block storage.
Status *string `pulumi:"status"`
}
type BlockStorageState struct {
// VPS ID that you want to have this block storage attached to.
AttachedToInstance pulumi.StringPtrInput
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
BlockType pulumi.StringPtrInput
// The monthly cost of this block storage.
Cost pulumi.Float64PtrInput
// The date this block storage was created.
DateCreated pulumi.StringPtrInput
// Label that is given to your block storage.
Label pulumi.StringPtrInput
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
Live pulumi.BoolPtrInput
// An ID associated with the instance, when mounted the ID can be found in /dev/disk/by-id prefixed with virtio.
MountId pulumi.StringPtrInput
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
Region pulumi.StringPtrInput
// The size of the given block storage.
SizeGb pulumi.IntPtrInput
// Current status of your block storage.
Status pulumi.StringPtrInput
}
func (BlockStorageState) ElementType() reflect.Type {
return reflect.TypeOf((*blockStorageState)(nil)).Elem()
}
type blockStorageArgs struct {
// VPS ID that you want to have this block storage attached to.
AttachedToInstance *string `pulumi:"attachedToInstance"`
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
BlockType *string `pulumi:"blockType"`
// Label that is given to your block storage.
Label *string `pulumi:"label"`
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
Live *bool `pulumi:"live"`
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
Region string `pulumi:"region"`
// The size of the given block storage.
SizeGb int `pulumi:"sizeGb"`
}
// The set of arguments for constructing a BlockStorage resource.
type BlockStorageArgs struct {
// VPS ID that you want to have this block storage attached to.
AttachedToInstance pulumi.StringPtrInput
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
BlockType pulumi.StringPtrInput
// Label that is given to your block storage.
Label pulumi.StringPtrInput
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
Live pulumi.BoolPtrInput
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
Region pulumi.StringInput
// The size of the given block storage.
SizeGb pulumi.IntInput
}
func (BlockStorageArgs) ElementType() reflect.Type {
return reflect.TypeOf((*blockStorageArgs)(nil)).Elem()
}
type BlockStorageInput interface {
pulumi.Input
ToBlockStorageOutput() BlockStorageOutput
ToBlockStorageOutputWithContext(ctx context.Context) BlockStorageOutput
}
func (*BlockStorage) ElementType() reflect.Type {
return reflect.TypeOf((**BlockStorage)(nil)).Elem()
}
func (i *BlockStorage) ToBlockStorageOutput() BlockStorageOutput {
return i.ToBlockStorageOutputWithContext(context.Background())
}
func (i *BlockStorage) ToBlockStorageOutputWithContext(ctx context.Context) BlockStorageOutput {
return pulumi.ToOutputWithContext(ctx, i).(BlockStorageOutput)
}
// BlockStorageArrayInput is an input type that accepts BlockStorageArray and BlockStorageArrayOutput values.
// You can construct a concrete instance of `BlockStorageArrayInput` via:
//
// BlockStorageArray{ BlockStorageArgs{...} }
type BlockStorageArrayInput interface {
pulumi.Input
ToBlockStorageArrayOutput() BlockStorageArrayOutput
ToBlockStorageArrayOutputWithContext(context.Context) BlockStorageArrayOutput
}
type BlockStorageArray []BlockStorageInput
func (BlockStorageArray) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BlockStorage)(nil)).Elem()
}
func (i BlockStorageArray) ToBlockStorageArrayOutput() BlockStorageArrayOutput {
return i.ToBlockStorageArrayOutputWithContext(context.Background())
}
func (i BlockStorageArray) ToBlockStorageArrayOutputWithContext(ctx context.Context) BlockStorageArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(BlockStorageArrayOutput)
}
// BlockStorageMapInput is an input type that accepts BlockStorageMap and BlockStorageMapOutput values.
// You can construct a concrete instance of `BlockStorageMapInput` via:
//
// BlockStorageMap{ "key": BlockStorageArgs{...} }
type BlockStorageMapInput interface {
pulumi.Input
ToBlockStorageMapOutput() BlockStorageMapOutput
ToBlockStorageMapOutputWithContext(context.Context) BlockStorageMapOutput
}
type BlockStorageMap map[string]BlockStorageInput
func (BlockStorageMap) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BlockStorage)(nil)).Elem()
}
func (i BlockStorageMap) ToBlockStorageMapOutput() BlockStorageMapOutput {
return i.ToBlockStorageMapOutputWithContext(context.Background())
}
func (i BlockStorageMap) ToBlockStorageMapOutputWithContext(ctx context.Context) BlockStorageMapOutput {
return pulumi.ToOutputWithContext(ctx, i).(BlockStorageMapOutput)
}
type BlockStorageOutput struct{ *pulumi.OutputState }
func (BlockStorageOutput) ElementType() reflect.Type {
return reflect.TypeOf((**BlockStorage)(nil)).Elem()
}
func (o BlockStorageOutput) ToBlockStorageOutput() BlockStorageOutput {
return o
}
func (o BlockStorageOutput) ToBlockStorageOutputWithContext(ctx context.Context) BlockStorageOutput {
return o
}
// VPS ID that you want to have this block storage attached to.
func (o BlockStorageOutput) AttachedToInstance() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringPtrOutput { return v.AttachedToInstance }).(pulumi.StringPtrOutput)
}
// Determines on the type of block storage volume that will be created. Soon to become a required parameter. Options are `highPerf` or `storageOpt`.
func (o BlockStorageOutput) BlockType() pulumi.StringOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringOutput { return v.BlockType }).(pulumi.StringOutput)
}
// The monthly cost of this block storage.
func (o BlockStorageOutput) Cost() pulumi.Float64Output {
return o.ApplyT(func(v *BlockStorage) pulumi.Float64Output { return v.Cost }).(pulumi.Float64Output)
}
// The date this block storage was created.
func (o BlockStorageOutput) DateCreated() pulumi.StringOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringOutput { return v.DateCreated }).(pulumi.StringOutput)
}
// Label that is given to your block storage.
func (o BlockStorageOutput) Label() pulumi.StringPtrOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringPtrOutput { return v.Label }).(pulumi.StringPtrOutput)
}
// Boolean value that will allow attachment of the volume to an instance without a restart. Default is false.
func (o BlockStorageOutput) Live() pulumi.BoolPtrOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.BoolPtrOutput { return v.Live }).(pulumi.BoolPtrOutput)
}
// An ID associated with the instance, when mounted the ID can be found in /dev/disk/by-id prefixed with virtio.
func (o BlockStorageOutput) MountId() pulumi.StringOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringOutput { return v.MountId }).(pulumi.StringOutput)
}
// Region in which this block storage will reside in. (Currently only NJ/NY supported region "ewr")
func (o BlockStorageOutput) Region() pulumi.StringOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// The size of the given block storage.
func (o BlockStorageOutput) SizeGb() pulumi.IntOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.IntOutput { return v.SizeGb }).(pulumi.IntOutput)
}
// Current status of your block storage.
func (o BlockStorageOutput) Status() pulumi.StringOutput {
return o.ApplyT(func(v *BlockStorage) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
}
type BlockStorageArrayOutput struct{ *pulumi.OutputState }
func (BlockStorageArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*BlockStorage)(nil)).Elem()
}
func (o BlockStorageArrayOutput) ToBlockStorageArrayOutput() BlockStorageArrayOutput {
return o
}
func (o BlockStorageArrayOutput) ToBlockStorageArrayOutputWithContext(ctx context.Context) BlockStorageArrayOutput {
return o
}
func (o BlockStorageArrayOutput) Index(i pulumi.IntInput) BlockStorageOutput {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *BlockStorage {
return vs[0].([]*BlockStorage)[vs[1].(int)]
}).(BlockStorageOutput)
}
type BlockStorageMapOutput struct{ *pulumi.OutputState }
func (BlockStorageMapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*BlockStorage)(nil)).Elem()
}
func (o BlockStorageMapOutput) ToBlockStorageMapOutput() BlockStorageMapOutput {
return o
}
func (o BlockStorageMapOutput) ToBlockStorageMapOutputWithContext(ctx context.Context) BlockStorageMapOutput {
return o
}
func (o BlockStorageMapOutput) MapIndex(k pulumi.StringInput) BlockStorageOutput {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *BlockStorage {
return vs[0].(map[string]*BlockStorage)[vs[1].(string)]
}).(BlockStorageOutput)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*BlockStorageInput)(nil)).Elem(), &BlockStorage{})
pulumi.RegisterInputType(reflect.TypeOf((*BlockStorageArrayInput)(nil)).Elem(), BlockStorageArray{})
pulumi.RegisterInputType(reflect.TypeOf((*BlockStorageMapInput)(nil)).Elem(), BlockStorageMap{})
pulumi.RegisterOutputType(BlockStorageOutput{})
pulumi.RegisterOutputType(BlockStorageArrayOutput{})
pulumi.RegisterOutputType(BlockStorageMapOutput{})
}