-
Notifications
You must be signed in to change notification settings - Fork 44
/
instance_sdk.go
5543 lines (4564 loc) · 149 KB
/
instance_sdk.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
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// This file was automatically generated. DO NOT EDIT.
// If you have any remark or suggestion do not hesitate to open an issue.
// Package instance provides methods and message types of the instance v1 API.
package instance
import (
"bytes"
"encoding/json"
"fmt"
"net"
"net/http"
"net/url"
"strings"
"time"
"github.com/scaleway/scaleway-sdk-go/internal/errors"
"github.com/scaleway/scaleway-sdk-go/internal/marshaler"
"github.com/scaleway/scaleway-sdk-go/internal/parameter"
"github.com/scaleway/scaleway-sdk-go/namegenerator"
"github.com/scaleway/scaleway-sdk-go/scw"
)
// always import dependencies
var (
_ fmt.Stringer
_ json.Unmarshaler
_ url.URL
_ net.IP
_ http.Header
_ bytes.Reader
_ time.Time
_ = strings.Join
_ scw.ScalewayRequest
_ marshaler.Duration
_ scw.File
_ = parameter.AddToQuery
_ = namegenerator.GetRandomName
)
// API: instance API
type API struct {
client *scw.Client
}
// NewAPI returns a API object from a Scaleway client.
func NewAPI(client *scw.Client) *API {
return &API{
client: client,
}
}
type Arch string
const (
// ArchX86_64 is [insert doc].
ArchX86_64 = Arch("x86_64")
// ArchArm is [insert doc].
ArchArm = Arch("arm")
)
func (enum Arch) String() string {
if enum == "" {
// return default value if empty
return "x86_64"
}
return string(enum)
}
func (enum Arch) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *Arch) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = Arch(Arch(tmp).String())
return nil
}
type BootType string
const (
// BootTypeLocal is [insert doc].
BootTypeLocal = BootType("local")
// BootTypeBootscript is [insert doc].
BootTypeBootscript = BootType("bootscript")
// BootTypeRescue is [insert doc].
BootTypeRescue = BootType("rescue")
)
func (enum BootType) String() string {
if enum == "" {
// return default value if empty
return "local"
}
return string(enum)
}
func (enum BootType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *BootType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = BootType(BootType(tmp).String())
return nil
}
type ImageState string
const (
// ImageStateAvailable is [insert doc].
ImageStateAvailable = ImageState("available")
// ImageStateCreating is [insert doc].
ImageStateCreating = ImageState("creating")
// ImageStateError is [insert doc].
ImageStateError = ImageState("error")
)
func (enum ImageState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum ImageState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ImageState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ImageState(ImageState(tmp).String())
return nil
}
type ListServersRequestOrder string
const (
// ListServersRequestOrderCreationDateDesc is [insert doc].
ListServersRequestOrderCreationDateDesc = ListServersRequestOrder("creation_date_desc")
// ListServersRequestOrderCreationDateAsc is [insert doc].
ListServersRequestOrderCreationDateAsc = ListServersRequestOrder("creation_date_asc")
// ListServersRequestOrderModificationDateDesc is [insert doc].
ListServersRequestOrderModificationDateDesc = ListServersRequestOrder("modification_date_desc")
// ListServersRequestOrderModificationDateAsc is [insert doc].
ListServersRequestOrderModificationDateAsc = ListServersRequestOrder("modification_date_asc")
)
func (enum ListServersRequestOrder) String() string {
if enum == "" {
// return default value if empty
return "creation_date_desc"
}
return string(enum)
}
func (enum ListServersRequestOrder) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ListServersRequestOrder) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ListServersRequestOrder(ListServersRequestOrder(tmp).String())
return nil
}
type PlacementGroupPolicyMode string
const (
// PlacementGroupPolicyModeOptional is [insert doc].
PlacementGroupPolicyModeOptional = PlacementGroupPolicyMode("optional")
// PlacementGroupPolicyModeEnforced is [insert doc].
PlacementGroupPolicyModeEnforced = PlacementGroupPolicyMode("enforced")
)
func (enum PlacementGroupPolicyMode) String() string {
if enum == "" {
// return default value if empty
return "optional"
}
return string(enum)
}
func (enum PlacementGroupPolicyMode) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *PlacementGroupPolicyMode) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = PlacementGroupPolicyMode(PlacementGroupPolicyMode(tmp).String())
return nil
}
type PlacementGroupPolicyType string
const (
// PlacementGroupPolicyTypeMaxAvailability is [insert doc].
PlacementGroupPolicyTypeMaxAvailability = PlacementGroupPolicyType("max_availability")
// PlacementGroupPolicyTypeLowLatency is [insert doc].
PlacementGroupPolicyTypeLowLatency = PlacementGroupPolicyType("low_latency")
)
func (enum PlacementGroupPolicyType) String() string {
if enum == "" {
// return default value if empty
return "max_availability"
}
return string(enum)
}
func (enum PlacementGroupPolicyType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *PlacementGroupPolicyType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = PlacementGroupPolicyType(PlacementGroupPolicyType(tmp).String())
return nil
}
type PrivateNICState string
const (
// PrivateNICStateAvailable is [insert doc].
PrivateNICStateAvailable = PrivateNICState("available")
// PrivateNICStateSyncing is [insert doc].
PrivateNICStateSyncing = PrivateNICState("syncing")
// PrivateNICStateSyncingError is [insert doc].
PrivateNICStateSyncingError = PrivateNICState("syncing_error")
)
func (enum PrivateNICState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum PrivateNICState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *PrivateNICState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = PrivateNICState(PrivateNICState(tmp).String())
return nil
}
type SecurityGroupPolicy string
const (
// SecurityGroupPolicyAccept is [insert doc].
SecurityGroupPolicyAccept = SecurityGroupPolicy("accept")
// SecurityGroupPolicyDrop is [insert doc].
SecurityGroupPolicyDrop = SecurityGroupPolicy("drop")
)
func (enum SecurityGroupPolicy) String() string {
if enum == "" {
// return default value if empty
return "accept"
}
return string(enum)
}
func (enum SecurityGroupPolicy) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SecurityGroupPolicy) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SecurityGroupPolicy(SecurityGroupPolicy(tmp).String())
return nil
}
type SecurityGroupRuleAction string
const (
// SecurityGroupRuleActionAccept is [insert doc].
SecurityGroupRuleActionAccept = SecurityGroupRuleAction("accept")
// SecurityGroupRuleActionDrop is [insert doc].
SecurityGroupRuleActionDrop = SecurityGroupRuleAction("drop")
)
func (enum SecurityGroupRuleAction) String() string {
if enum == "" {
// return default value if empty
return "accept"
}
return string(enum)
}
func (enum SecurityGroupRuleAction) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SecurityGroupRuleAction) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SecurityGroupRuleAction(SecurityGroupRuleAction(tmp).String())
return nil
}
type SecurityGroupRuleDirection string
const (
// SecurityGroupRuleDirectionInbound is [insert doc].
SecurityGroupRuleDirectionInbound = SecurityGroupRuleDirection("inbound")
// SecurityGroupRuleDirectionOutbound is [insert doc].
SecurityGroupRuleDirectionOutbound = SecurityGroupRuleDirection("outbound")
)
func (enum SecurityGroupRuleDirection) String() string {
if enum == "" {
// return default value if empty
return "inbound"
}
return string(enum)
}
func (enum SecurityGroupRuleDirection) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SecurityGroupRuleDirection) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SecurityGroupRuleDirection(SecurityGroupRuleDirection(tmp).String())
return nil
}
type SecurityGroupRuleProtocol string
const (
// SecurityGroupRuleProtocolTCP is [insert doc].
SecurityGroupRuleProtocolTCP = SecurityGroupRuleProtocol("TCP")
// SecurityGroupRuleProtocolUDP is [insert doc].
SecurityGroupRuleProtocolUDP = SecurityGroupRuleProtocol("UDP")
// SecurityGroupRuleProtocolICMP is [insert doc].
SecurityGroupRuleProtocolICMP = SecurityGroupRuleProtocol("ICMP")
// SecurityGroupRuleProtocolANY is [insert doc].
SecurityGroupRuleProtocolANY = SecurityGroupRuleProtocol("ANY")
)
func (enum SecurityGroupRuleProtocol) String() string {
if enum == "" {
// return default value if empty
return "TCP"
}
return string(enum)
}
func (enum SecurityGroupRuleProtocol) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SecurityGroupRuleProtocol) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SecurityGroupRuleProtocol(SecurityGroupRuleProtocol(tmp).String())
return nil
}
type SecurityGroupState string
const (
// SecurityGroupStateAvailable is [insert doc].
SecurityGroupStateAvailable = SecurityGroupState("available")
// SecurityGroupStateSyncing is [insert doc].
SecurityGroupStateSyncing = SecurityGroupState("syncing")
// SecurityGroupStateSyncingError is [insert doc].
SecurityGroupStateSyncingError = SecurityGroupState("syncing_error")
)
func (enum SecurityGroupState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum SecurityGroupState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SecurityGroupState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SecurityGroupState(SecurityGroupState(tmp).String())
return nil
}
type ServerAction string
const (
// ServerActionPoweron is [insert doc].
ServerActionPoweron = ServerAction("poweron")
// ServerActionBackup is [insert doc].
ServerActionBackup = ServerAction("backup")
// ServerActionStopInPlace is [insert doc].
ServerActionStopInPlace = ServerAction("stop_in_place")
// ServerActionPoweroff is [insert doc].
ServerActionPoweroff = ServerAction("poweroff")
// ServerActionTerminate is [insert doc].
ServerActionTerminate = ServerAction("terminate")
// ServerActionReboot is [insert doc].
ServerActionReboot = ServerAction("reboot")
)
func (enum ServerAction) String() string {
if enum == "" {
// return default value if empty
return "poweron"
}
return string(enum)
}
func (enum ServerAction) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ServerAction) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ServerAction(ServerAction(tmp).String())
return nil
}
type ServerState string
const (
// ServerStateRunning is [insert doc].
ServerStateRunning = ServerState("running")
// ServerStateStopped is [insert doc].
ServerStateStopped = ServerState("stopped")
// ServerStateStoppedInPlace is [insert doc].
ServerStateStoppedInPlace = ServerState("stopped in place")
// ServerStateStarting is [insert doc].
ServerStateStarting = ServerState("starting")
// ServerStateStopping is [insert doc].
ServerStateStopping = ServerState("stopping")
// ServerStateLocked is [insert doc].
ServerStateLocked = ServerState("locked")
)
func (enum ServerState) String() string {
if enum == "" {
// return default value if empty
return "running"
}
return string(enum)
}
func (enum ServerState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ServerState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ServerState(ServerState(tmp).String())
return nil
}
type ServerTypesAvailability string
const (
// ServerTypesAvailabilityAvailable is [insert doc].
ServerTypesAvailabilityAvailable = ServerTypesAvailability("available")
// ServerTypesAvailabilityScarce is [insert doc].
ServerTypesAvailabilityScarce = ServerTypesAvailability("scarce")
// ServerTypesAvailabilityShortage is [insert doc].
ServerTypesAvailabilityShortage = ServerTypesAvailability("shortage")
)
func (enum ServerTypesAvailability) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum ServerTypesAvailability) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ServerTypesAvailability) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ServerTypesAvailability(ServerTypesAvailability(tmp).String())
return nil
}
type SnapshotState string
const (
// SnapshotStateAvailable is [insert doc].
SnapshotStateAvailable = SnapshotState("available")
// SnapshotStateSnapshotting is [insert doc].
SnapshotStateSnapshotting = SnapshotState("snapshotting")
// SnapshotStateError is [insert doc].
SnapshotStateError = SnapshotState("error")
// SnapshotStateInvalidData is [insert doc].
SnapshotStateInvalidData = SnapshotState("invalid_data")
// SnapshotStateImporting is [insert doc].
SnapshotStateImporting = SnapshotState("importing")
// SnapshotStateExporting is [insert doc].
SnapshotStateExporting = SnapshotState("exporting")
)
func (enum SnapshotState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum SnapshotState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SnapshotState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SnapshotState(SnapshotState(tmp).String())
return nil
}
type SnapshotVolumeType string
const (
// SnapshotVolumeTypeUnknownVolumeType is [insert doc].
SnapshotVolumeTypeUnknownVolumeType = SnapshotVolumeType("unknown_volume_type")
// SnapshotVolumeTypeLSSD is [insert doc].
SnapshotVolumeTypeLSSD = SnapshotVolumeType("l_ssd")
// SnapshotVolumeTypeBSSD is [insert doc].
SnapshotVolumeTypeBSSD = SnapshotVolumeType("b_ssd")
// SnapshotVolumeTypeUnified is [insert doc].
SnapshotVolumeTypeUnified = SnapshotVolumeType("unified")
)
func (enum SnapshotVolumeType) String() string {
if enum == "" {
// return default value if empty
return "unknown_volume_type"
}
return string(enum)
}
func (enum SnapshotVolumeType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *SnapshotVolumeType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = SnapshotVolumeType(SnapshotVolumeType(tmp).String())
return nil
}
type TaskStatus string
const (
// TaskStatusPending is [insert doc].
TaskStatusPending = TaskStatus("pending")
// TaskStatusStarted is [insert doc].
TaskStatusStarted = TaskStatus("started")
// TaskStatusSuccess is [insert doc].
TaskStatusSuccess = TaskStatus("success")
// TaskStatusFailure is [insert doc].
TaskStatusFailure = TaskStatus("failure")
// TaskStatusRetry is [insert doc].
TaskStatusRetry = TaskStatus("retry")
)
func (enum TaskStatus) String() string {
if enum == "" {
// return default value if empty
return "pending"
}
return string(enum)
}
func (enum TaskStatus) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *TaskStatus) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = TaskStatus(TaskStatus(tmp).String())
return nil
}
type VolumeServerState string
const (
// VolumeServerStateAvailable is [insert doc].
VolumeServerStateAvailable = VolumeServerState("available")
// VolumeServerStateSnapshotting is [insert doc].
VolumeServerStateSnapshotting = VolumeServerState("snapshotting")
// VolumeServerStateError is [insert doc].
VolumeServerStateError = VolumeServerState("error")
// VolumeServerStateFetching is [insert doc].
VolumeServerStateFetching = VolumeServerState("fetching")
// VolumeServerStateResizing is [insert doc].
VolumeServerStateResizing = VolumeServerState("resizing")
// VolumeServerStateSaving is [insert doc].
VolumeServerStateSaving = VolumeServerState("saving")
// VolumeServerStateHotsyncing is [insert doc].
VolumeServerStateHotsyncing = VolumeServerState("hotsyncing")
)
func (enum VolumeServerState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum VolumeServerState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *VolumeServerState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = VolumeServerState(VolumeServerState(tmp).String())
return nil
}
type VolumeServerVolumeType string
const (
// VolumeServerVolumeTypeLSSD is [insert doc].
VolumeServerVolumeTypeLSSD = VolumeServerVolumeType("l_ssd")
// VolumeServerVolumeTypeBSSD is [insert doc].
VolumeServerVolumeTypeBSSD = VolumeServerVolumeType("b_ssd")
)
func (enum VolumeServerVolumeType) String() string {
if enum == "" {
// return default value if empty
return "l_ssd"
}
return string(enum)
}
func (enum VolumeServerVolumeType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *VolumeServerVolumeType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = VolumeServerVolumeType(VolumeServerVolumeType(tmp).String())
return nil
}
type VolumeState string
const (
// VolumeStateAvailable is [insert doc].
VolumeStateAvailable = VolumeState("available")
// VolumeStateSnapshotting is [insert doc].
VolumeStateSnapshotting = VolumeState("snapshotting")
// VolumeStateError is [insert doc].
VolumeStateError = VolumeState("error")
// VolumeStateFetching is [insert doc].
VolumeStateFetching = VolumeState("fetching")
// VolumeStateResizing is [insert doc].
VolumeStateResizing = VolumeState("resizing")
// VolumeStateSaving is [insert doc].
VolumeStateSaving = VolumeState("saving")
// VolumeStateHotsyncing is [insert doc].
VolumeStateHotsyncing = VolumeState("hotsyncing")
)
func (enum VolumeState) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum VolumeState) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *VolumeState) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = VolumeState(VolumeState(tmp).String())
return nil
}
type VolumeVolumeType string
const (
// VolumeVolumeTypeLSSD is [insert doc].
VolumeVolumeTypeLSSD = VolumeVolumeType("l_ssd")
// VolumeVolumeTypeBSSD is [insert doc].
VolumeVolumeTypeBSSD = VolumeVolumeType("b_ssd")
// VolumeVolumeTypeUnified is [insert doc].
VolumeVolumeTypeUnified = VolumeVolumeType("unified")
)
func (enum VolumeVolumeType) String() string {
if enum == "" {
// return default value if empty
return "l_ssd"
}
return string(enum)
}
func (enum VolumeVolumeType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *VolumeVolumeType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = VolumeVolumeType(VolumeVolumeType(tmp).String())
return nil
}
// Bootscript: bootscript
type Bootscript struct {
// Bootcmdargs: the bootscript arguments
Bootcmdargs string `json:"bootcmdargs"`
// Default: dispmay if the bootscript is the default bootscript if no other boot option is configured
Default bool `json:"default"`
// Dtb: provide information regarding a Device Tree Binary (dtb) for use with C1 servers
Dtb string `json:"dtb"`
// ID: the bootscript ID
ID string `json:"id"`
// Initrd: the initrd (initial ramdisk) configuration
Initrd string `json:"initrd"`
// Kernel: the server kernel version
Kernel string `json:"kernel"`
// Organization: the bootscript organization ID
Organization string `json:"organization"`
// Project: the bootscript project ID
Project string `json:"project"`
// Public: provide information if the bootscript is public
Public bool `json:"public"`
// Title: the bootscript title
Title string `json:"title"`
// Arch: the bootscript arch
//
// Default value: x86_64
Arch Arch `json:"arch"`
// Zone: the zone in which is the bootscript
Zone scw.Zone `json:"zone"`
}
type CreateIPResponse struct {
IP *IP `json:"ip"`
}
type CreateImageResponse struct {
Image *Image `json:"image"`
}
type CreatePlacementGroupResponse struct {
PlacementGroup *PlacementGroup `json:"placement_group"`
}
type CreatePrivateNICResponse struct {
PrivateNic *PrivateNIC `json:"private_nic"`
}
type CreateSecurityGroupResponse struct {
SecurityGroup *SecurityGroup `json:"security_group"`
}
type CreateSecurityGroupRuleResponse struct {
Rule *SecurityGroupRule `json:"rule"`
}
type CreateServerResponse struct {
Server *Server `json:"server"`
}
type CreateSnapshotResponse struct {
Snapshot *Snapshot `json:"snapshot"`
Task *Task `json:"task"`
}
type CreateVolumeResponse struct {
Volume *Volume `json:"volume"`
}
type Dashboard struct {
VolumesCount uint32 `json:"volumes_count"`
RunningServersCount uint32 `json:"running_servers_count"`
ServersByTypes map[string]uint32 `json:"servers_by_types"`
ImagesCount uint32 `json:"images_count"`
SnapshotsCount uint32 `json:"snapshots_count"`
ServersCount uint32 `json:"servers_count"`
IPsCount uint32 `json:"ips_count"`
SecurityGroupsCount uint32 `json:"security_groups_count"`
IPsUnused uint32 `json:"ips_unused"`
VolumesLSSDCount uint32 `json:"volumes_l_ssd_count"`
VolumesBSSDCount uint32 `json:"volumes_b_ssd_count"`
VolumesLSSDTotalSize scw.Size `json:"volumes_l_ssd_total_size"`
VolumesBSSDTotalSize scw.Size `json:"volumes_b_ssd_total_size"`
PrivateNicsCount uint32 `json:"private_nics_count"`
PlacementGroupsCount uint32 `json:"placement_groups_count"`
}
type ExportSnapshotResponse struct {
Task *Task `json:"task"`
}
type GetBootscriptResponse struct {
Bootscript *Bootscript `json:"bootscript"`
}
type GetDashboardResponse struct {
Dashboard *Dashboard `json:"dashboard"`
}
type GetIPResponse struct {
IP *IP `json:"ip"`
}
type GetImageResponse struct {
Image *Image `json:"image"`
}
type GetPlacementGroupResponse struct {
PlacementGroup *PlacementGroup `json:"placement_group"`
}
type GetPlacementGroupServersResponse struct {
Servers []*PlacementGroupServer `json:"servers"`
}
type GetPrivateNICResponse struct {
PrivateNic *PrivateNIC `json:"private_nic"`
}
type GetSecurityGroupResponse struct {
SecurityGroup *SecurityGroup `json:"security_group"`
}
type GetSecurityGroupRuleResponse struct {
Rule *SecurityGroupRule `json:"rule"`
}
type GetServerResponse struct {
Server *Server `json:"server"`
}
type GetServerTypesAvailabilityResponse struct {
Servers map[string]*GetServerTypesAvailabilityResponseAvailability `json:"servers"`
}
type GetServerTypesAvailabilityResponseAvailability struct {
// Availability:
//
// Default value: available
Availability ServerTypesAvailability `json:"availability"`
}
type GetSnapshotResponse struct {
Snapshot *Snapshot `json:"snapshot"`
}
type GetVolumeResponse struct {
Volume *Volume `json:"volume"`
}
type IP struct {
ID string `json:"id"`
Address net.IP `json:"address"`
Reverse *string `json:"reverse"`