/
quoteSetV3.go
489 lines (433 loc) · 17.3 KB
/
quoteSetV3.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
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
// 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 blockstorage
import (
"context"
"reflect"
"errors"
"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/internal"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
// Manages a V3 block storage quotaset resource within OpenStack.
//
// > **Note:** This usually requires admin privileges.
//
// > **Note:** This resource has a no-op deletion so no actual actions will be done against the OpenStack API
//
// in case of delete call.
//
// > **Note:** This resource has all-in creation so all optional quota arguments that were not specified are
//
// created with zero value. This excludes volume type quota.
//
// ## Example Usage
//
// <!--Start PulumiCodeChooser -->
// ```go
// package main
//
// import (
//
// "github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/blockstorage"
// "github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/identity"
// "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
//
// )
//
// func main() {
// pulumi.Run(func(ctx *pulumi.Context) error {
// project1, err := identity.NewProject(ctx, "project1", nil)
// if err != nil {
// return err
// }
// _, err = blockstorage.NewQuoteSetV3(ctx, "quotaset1", &blockstorage.QuoteSetV3Args{
// ProjectId: project1.ID(),
// Volumes: pulumi.Int(10),
// Snapshots: pulumi.Int(4),
// Gigabytes: pulumi.Int(100),
// PerVolumeGigabytes: pulumi.Int(10),
// Backups: pulumi.Int(4),
// BackupGigabytes: pulumi.Int(10),
// Groups: pulumi.Int(100),
// VolumeTypeQuota: pulumi.Map{
// "volumes_ssd": pulumi.Any(30),
// "gigabytes_ssd": pulumi.Any(500),
// "snapshots_ssd": pulumi.Any(10),
// },
// })
// if err != nil {
// return err
// }
// return nil
// })
// }
//
// ```
// <!--End PulumiCodeChooser -->
//
// ## Import
//
// Quotasets can be imported using the `project_id/region`, e.g.
//
// ```sh
// $ pulumi import openstack:blockstorage/quoteSetV3:QuoteSetV3 quotaset_1 2a0f2240-c5e6-41de-896d-e80d97428d6b/region_1
// ```
type QuoteSetV3 struct {
pulumi.CustomResourceState
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
BackupGigabytes pulumi.IntOutput `pulumi:"backupGigabytes"`
// Quota value for backups. Changing this updates the
// existing quotaset.
Backups pulumi.IntOutput `pulumi:"backups"`
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
Gigabytes pulumi.IntOutput `pulumi:"gigabytes"`
// Quota value for groups. Changing this updates the
// existing quotaset.
Groups pulumi.IntOutput `pulumi:"groups"`
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
PerVolumeGigabytes pulumi.IntOutput `pulumi:"perVolumeGigabytes"`
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
ProjectId pulumi.StringOutput `pulumi:"projectId"`
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
Region pulumi.StringOutput `pulumi:"region"`
// Quota value for snapshots. Changing this updates the
// existing quotaset.
Snapshots pulumi.IntOutput `pulumi:"snapshots"`
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
VolumeTypeQuota pulumi.MapOutput `pulumi:"volumeTypeQuota"`
// Quota value for volumes. Changing this updates the
// existing quotaset.
Volumes pulumi.IntOutput `pulumi:"volumes"`
}
// NewQuoteSetV3 registers a new resource with the given unique name, arguments, and options.
func NewQuoteSetV3(ctx *pulumi.Context,
name string, args *QuoteSetV3Args, opts ...pulumi.ResourceOption) (*QuoteSetV3, error) {
if args == nil {
return nil, errors.New("missing one or more required arguments")
}
if args.ProjectId == nil {
return nil, errors.New("invalid value for required argument 'ProjectId'")
}
opts = internal.PkgResourceDefaultOpts(opts)
var resource QuoteSetV3
err := ctx.RegisterResource("openstack:blockstorage/quoteSetV3:QuoteSetV3", name, args, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// GetQuoteSetV3 gets an existing QuoteSetV3 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 GetQuoteSetV3(ctx *pulumi.Context,
name string, id pulumi.IDInput, state *QuoteSetV3State, opts ...pulumi.ResourceOption) (*QuoteSetV3, error) {
var resource QuoteSetV3
err := ctx.ReadResource("openstack:blockstorage/quoteSetV3:QuoteSetV3", name, id, state, &resource, opts...)
if err != nil {
return nil, err
}
return &resource, nil
}
// Input properties used for looking up and filtering QuoteSetV3 resources.
type quoteSetV3State struct {
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
BackupGigabytes *int `pulumi:"backupGigabytes"`
// Quota value for backups. Changing this updates the
// existing quotaset.
Backups *int `pulumi:"backups"`
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
Gigabytes *int `pulumi:"gigabytes"`
// Quota value for groups. Changing this updates the
// existing quotaset.
Groups *int `pulumi:"groups"`
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
PerVolumeGigabytes *int `pulumi:"perVolumeGigabytes"`
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
ProjectId *string `pulumi:"projectId"`
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
Region *string `pulumi:"region"`
// Quota value for snapshots. Changing this updates the
// existing quotaset.
Snapshots *int `pulumi:"snapshots"`
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
VolumeTypeQuota map[string]interface{} `pulumi:"volumeTypeQuota"`
// Quota value for volumes. Changing this updates the
// existing quotaset.
Volumes *int `pulumi:"volumes"`
}
type QuoteSetV3State struct {
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
BackupGigabytes pulumi.IntPtrInput
// Quota value for backups. Changing this updates the
// existing quotaset.
Backups pulumi.IntPtrInput
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
Gigabytes pulumi.IntPtrInput
// Quota value for groups. Changing this updates the
// existing quotaset.
Groups pulumi.IntPtrInput
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
PerVolumeGigabytes pulumi.IntPtrInput
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
ProjectId pulumi.StringPtrInput
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
Region pulumi.StringPtrInput
// Quota value for snapshots. Changing this updates the
// existing quotaset.
Snapshots pulumi.IntPtrInput
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
VolumeTypeQuota pulumi.MapInput
// Quota value for volumes. Changing this updates the
// existing quotaset.
Volumes pulumi.IntPtrInput
}
func (QuoteSetV3State) ElementType() reflect.Type {
return reflect.TypeOf((*quoteSetV3State)(nil)).Elem()
}
type quoteSetV3Args struct {
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
BackupGigabytes *int `pulumi:"backupGigabytes"`
// Quota value for backups. Changing this updates the
// existing quotaset.
Backups *int `pulumi:"backups"`
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
Gigabytes *int `pulumi:"gigabytes"`
// Quota value for groups. Changing this updates the
// existing quotaset.
Groups *int `pulumi:"groups"`
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
PerVolumeGigabytes *int `pulumi:"perVolumeGigabytes"`
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
ProjectId string `pulumi:"projectId"`
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
Region *string `pulumi:"region"`
// Quota value for snapshots. Changing this updates the
// existing quotaset.
Snapshots *int `pulumi:"snapshots"`
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
VolumeTypeQuota map[string]interface{} `pulumi:"volumeTypeQuota"`
// Quota value for volumes. Changing this updates the
// existing quotaset.
Volumes *int `pulumi:"volumes"`
}
// The set of arguments for constructing a QuoteSetV3 resource.
type QuoteSetV3Args struct {
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
BackupGigabytes pulumi.IntPtrInput
// Quota value for backups. Changing this updates the
// existing quotaset.
Backups pulumi.IntPtrInput
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
Gigabytes pulumi.IntPtrInput
// Quota value for groups. Changing this updates the
// existing quotaset.
Groups pulumi.IntPtrInput
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
PerVolumeGigabytes pulumi.IntPtrInput
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
ProjectId pulumi.StringInput
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
Region pulumi.StringPtrInput
// Quota value for snapshots. Changing this updates the
// existing quotaset.
Snapshots pulumi.IntPtrInput
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
VolumeTypeQuota pulumi.MapInput
// Quota value for volumes. Changing this updates the
// existing quotaset.
Volumes pulumi.IntPtrInput
}
func (QuoteSetV3Args) ElementType() reflect.Type {
return reflect.TypeOf((*quoteSetV3Args)(nil)).Elem()
}
type QuoteSetV3Input interface {
pulumi.Input
ToQuoteSetV3Output() QuoteSetV3Output
ToQuoteSetV3OutputWithContext(ctx context.Context) QuoteSetV3Output
}
func (*QuoteSetV3) ElementType() reflect.Type {
return reflect.TypeOf((**QuoteSetV3)(nil)).Elem()
}
func (i *QuoteSetV3) ToQuoteSetV3Output() QuoteSetV3Output {
return i.ToQuoteSetV3OutputWithContext(context.Background())
}
func (i *QuoteSetV3) ToQuoteSetV3OutputWithContext(ctx context.Context) QuoteSetV3Output {
return pulumi.ToOutputWithContext(ctx, i).(QuoteSetV3Output)
}
// QuoteSetV3ArrayInput is an input type that accepts QuoteSetV3Array and QuoteSetV3ArrayOutput values.
// You can construct a concrete instance of `QuoteSetV3ArrayInput` via:
//
// QuoteSetV3Array{ QuoteSetV3Args{...} }
type QuoteSetV3ArrayInput interface {
pulumi.Input
ToQuoteSetV3ArrayOutput() QuoteSetV3ArrayOutput
ToQuoteSetV3ArrayOutputWithContext(context.Context) QuoteSetV3ArrayOutput
}
type QuoteSetV3Array []QuoteSetV3Input
func (QuoteSetV3Array) ElementType() reflect.Type {
return reflect.TypeOf((*[]*QuoteSetV3)(nil)).Elem()
}
func (i QuoteSetV3Array) ToQuoteSetV3ArrayOutput() QuoteSetV3ArrayOutput {
return i.ToQuoteSetV3ArrayOutputWithContext(context.Background())
}
func (i QuoteSetV3Array) ToQuoteSetV3ArrayOutputWithContext(ctx context.Context) QuoteSetV3ArrayOutput {
return pulumi.ToOutputWithContext(ctx, i).(QuoteSetV3ArrayOutput)
}
// QuoteSetV3MapInput is an input type that accepts QuoteSetV3Map and QuoteSetV3MapOutput values.
// You can construct a concrete instance of `QuoteSetV3MapInput` via:
//
// QuoteSetV3Map{ "key": QuoteSetV3Args{...} }
type QuoteSetV3MapInput interface {
pulumi.Input
ToQuoteSetV3MapOutput() QuoteSetV3MapOutput
ToQuoteSetV3MapOutputWithContext(context.Context) QuoteSetV3MapOutput
}
type QuoteSetV3Map map[string]QuoteSetV3Input
func (QuoteSetV3Map) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*QuoteSetV3)(nil)).Elem()
}
func (i QuoteSetV3Map) ToQuoteSetV3MapOutput() QuoteSetV3MapOutput {
return i.ToQuoteSetV3MapOutputWithContext(context.Background())
}
func (i QuoteSetV3Map) ToQuoteSetV3MapOutputWithContext(ctx context.Context) QuoteSetV3MapOutput {
return pulumi.ToOutputWithContext(ctx, i).(QuoteSetV3MapOutput)
}
type QuoteSetV3Output struct{ *pulumi.OutputState }
func (QuoteSetV3Output) ElementType() reflect.Type {
return reflect.TypeOf((**QuoteSetV3)(nil)).Elem()
}
func (o QuoteSetV3Output) ToQuoteSetV3Output() QuoteSetV3Output {
return o
}
func (o QuoteSetV3Output) ToQuoteSetV3OutputWithContext(ctx context.Context) QuoteSetV3Output {
return o
}
// Quota value for backup gigabytes. Changing
// this updates the existing quotaset.
func (o QuoteSetV3Output) BackupGigabytes() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.BackupGigabytes }).(pulumi.IntOutput)
}
// Quota value for backups. Changing this updates the
// existing quotaset.
func (o QuoteSetV3Output) Backups() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.Backups }).(pulumi.IntOutput)
}
// Quota value for gigabytes. Changing this updates the
// existing quotaset.
func (o QuoteSetV3Output) Gigabytes() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.Gigabytes }).(pulumi.IntOutput)
}
// Quota value for groups. Changing this updates the
// existing quotaset.
func (o QuoteSetV3Output) Groups() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.Groups }).(pulumi.IntOutput)
}
// Quota value for gigabytes per volume .
// Changing this updates the existing quotaset.
func (o QuoteSetV3Output) PerVolumeGigabytes() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.PerVolumeGigabytes }).(pulumi.IntOutput)
}
// ID of the project to manage quotas. Changing this
// creates a new quotaset.
func (o QuoteSetV3Output) ProjectId() pulumi.StringOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.StringOutput { return v.ProjectId }).(pulumi.StringOutput)
}
// The region in which to create the volume. If
// omitted, the `region` argument of the provider is used. Changing this
// creates a new quotaset.
func (o QuoteSetV3Output) Region() pulumi.StringOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.StringOutput { return v.Region }).(pulumi.StringOutput)
}
// Quota value for snapshots. Changing this updates the
// existing quotaset.
func (o QuoteSetV3Output) Snapshots() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.Snapshots }).(pulumi.IntOutput)
}
// Key/Value pairs for setting quota for
// volumes types. Possible keys are `snapshots_<volume_type_name>`,
// `volumes_<volume_type_name>` and `gigabytes_<volume_type_name>`.
func (o QuoteSetV3Output) VolumeTypeQuota() pulumi.MapOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.MapOutput { return v.VolumeTypeQuota }).(pulumi.MapOutput)
}
// Quota value for volumes. Changing this updates the
// existing quotaset.
func (o QuoteSetV3Output) Volumes() pulumi.IntOutput {
return o.ApplyT(func(v *QuoteSetV3) pulumi.IntOutput { return v.Volumes }).(pulumi.IntOutput)
}
type QuoteSetV3ArrayOutput struct{ *pulumi.OutputState }
func (QuoteSetV3ArrayOutput) ElementType() reflect.Type {
return reflect.TypeOf((*[]*QuoteSetV3)(nil)).Elem()
}
func (o QuoteSetV3ArrayOutput) ToQuoteSetV3ArrayOutput() QuoteSetV3ArrayOutput {
return o
}
func (o QuoteSetV3ArrayOutput) ToQuoteSetV3ArrayOutputWithContext(ctx context.Context) QuoteSetV3ArrayOutput {
return o
}
func (o QuoteSetV3ArrayOutput) Index(i pulumi.IntInput) QuoteSetV3Output {
return pulumi.All(o, i).ApplyT(func(vs []interface{}) *QuoteSetV3 {
return vs[0].([]*QuoteSetV3)[vs[1].(int)]
}).(QuoteSetV3Output)
}
type QuoteSetV3MapOutput struct{ *pulumi.OutputState }
func (QuoteSetV3MapOutput) ElementType() reflect.Type {
return reflect.TypeOf((*map[string]*QuoteSetV3)(nil)).Elem()
}
func (o QuoteSetV3MapOutput) ToQuoteSetV3MapOutput() QuoteSetV3MapOutput {
return o
}
func (o QuoteSetV3MapOutput) ToQuoteSetV3MapOutputWithContext(ctx context.Context) QuoteSetV3MapOutput {
return o
}
func (o QuoteSetV3MapOutput) MapIndex(k pulumi.StringInput) QuoteSetV3Output {
return pulumi.All(o, k).ApplyT(func(vs []interface{}) *QuoteSetV3 {
return vs[0].(map[string]*QuoteSetV3)[vs[1].(string)]
}).(QuoteSetV3Output)
}
func init() {
pulumi.RegisterInputType(reflect.TypeOf((*QuoteSetV3Input)(nil)).Elem(), &QuoteSetV3{})
pulumi.RegisterInputType(reflect.TypeOf((*QuoteSetV3ArrayInput)(nil)).Elem(), QuoteSetV3Array{})
pulumi.RegisterInputType(reflect.TypeOf((*QuoteSetV3MapInput)(nil)).Elem(), QuoteSetV3Map{})
pulumi.RegisterOutputType(QuoteSetV3Output{})
pulumi.RegisterOutputType(QuoteSetV3ArrayOutput{})
pulumi.RegisterOutputType(QuoteSetV3MapOutput{})
}