-
Notifications
You must be signed in to change notification settings - Fork 44
/
instance_sdk.go
4282 lines (3361 loc) · 105 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
import (
"bytes"
"encoding/json"
"fmt"
"net"
"net/http"
"net/url"
"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
_ 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 ComputeClusterPolicyMode string
const (
// ComputeClusterPolicyModeOptional is [insert doc].
ComputeClusterPolicyModeOptional = ComputeClusterPolicyMode("optional")
// ComputeClusterPolicyModeEnforced is [insert doc].
ComputeClusterPolicyModeEnforced = ComputeClusterPolicyMode("enforced")
)
func (enum ComputeClusterPolicyMode) String() string {
if enum == "" {
// return default value if empty
return "optional"
}
return string(enum)
}
func (enum ComputeClusterPolicyMode) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ComputeClusterPolicyMode) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ComputeClusterPolicyMode(ComputeClusterPolicyMode(tmp).String())
return nil
}
type ComputeClusterPolicyType string
const (
// ComputeClusterPolicyTypeMaxAvailability is [insert doc].
ComputeClusterPolicyTypeMaxAvailability = ComputeClusterPolicyType("max_availability")
// ComputeClusterPolicyTypeLowLatency is [insert doc].
ComputeClusterPolicyTypeLowLatency = ComputeClusterPolicyType("low_latency")
)
func (enum ComputeClusterPolicyType) String() string {
if enum == "" {
// return default value if empty
return "max_availability"
}
return string(enum)
}
func (enum ComputeClusterPolicyType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ComputeClusterPolicyType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ComputeClusterPolicyType(ComputeClusterPolicyType(tmp).String())
return nil
}
type GetServerTypesAvailabilityResponseAvailability string
const (
// GetServerTypesAvailabilityResponseAvailabilityAvailable is [insert doc].
GetServerTypesAvailabilityResponseAvailabilityAvailable = GetServerTypesAvailabilityResponseAvailability("available")
// GetServerTypesAvailabilityResponseAvailabilityScarce is [insert doc].
GetServerTypesAvailabilityResponseAvailabilityScarce = GetServerTypesAvailabilityResponseAvailability("scarce")
// GetServerTypesAvailabilityResponseAvailabilityShortage is [insert doc].
GetServerTypesAvailabilityResponseAvailabilityShortage = GetServerTypesAvailabilityResponseAvailability("shortage")
)
func (enum GetServerTypesAvailabilityResponseAvailability) String() string {
if enum == "" {
// return default value if empty
return "available"
}
return string(enum)
}
func (enum GetServerTypesAvailabilityResponseAvailability) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *GetServerTypesAvailabilityResponseAvailability) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = GetServerTypesAvailabilityResponseAvailability(GetServerTypesAvailabilityResponseAvailability(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 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")
)
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 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 ServerBootType string
const (
// ServerBootTypeLocal is [insert doc].
ServerBootTypeLocal = ServerBootType("local")
)
func (enum ServerBootType) String() string {
if enum == "" {
// return default value if empty
return "local"
}
return string(enum)
}
func (enum ServerBootType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *ServerBootType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = ServerBootType(ServerBootType(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 SnapshotState string
const (
// SnapshotStateAvailable is [insert doc].
SnapshotStateAvailable = SnapshotState("available")
// SnapshotStateSnapshotting is [insert doc].
SnapshotStateSnapshotting = SnapshotState("snapshotting")
// SnapshotStateError is [insert doc].
SnapshotStateError = SnapshotState("error")
)
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 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 VolumeState string
const (
// VolumeStateAvailable is [insert doc].
VolumeStateAvailable = VolumeState("available")
// VolumeStateSnapshotting is [insert doc].
VolumeStateSnapshotting = VolumeState("snapshotting")
// VolumeStateError is [insert doc].
VolumeStateError = VolumeState("error")
)
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 VolumeType string
const (
// VolumeTypeLSSD is [insert doc].
VolumeTypeLSSD = VolumeType("l_ssd")
// VolumeTypeBSSD is [insert doc].
VolumeTypeBSSD = VolumeType("b_ssd")
)
func (enum VolumeType) String() string {
if enum == "" {
// return default value if empty
return "l_ssd"
}
return string(enum)
}
func (enum VolumeType) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}
func (enum *VolumeType) UnmarshalJSON(data []byte) error {
tmp := ""
if err := json.Unmarshal(data, &tmp); err != nil {
return err
}
*enum = VolumeType(VolumeType(tmp).String())
return nil
}
type Bootscript struct {
// Bootcmdargs display the bootscript parameters
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 display the bootscripts ID
ID string `json:"id"`
// Initrd display the initrd (initial ramdisk) configuration
Initrd string `json:"initrd"`
// Kernel display the server kernel version
Kernel string `json:"kernel"`
// Organization display the bootscripts organization
Organization string `json:"organization"`
// Public provide information if the bootscript is public
Public bool `json:"public"`
// Title display the bootscripts title
Title string `json:"title"`
// Arch display the bootscripts arch
//
// Default value: x86_64
Arch Arch `json:"arch"`
}
type ComputeCluster struct {
// ID display compute-cluster unique ID
ID string `json:"id"`
// Name display compute-cluster name
Name string `json:"name"`
// Organization display compute-cluster organization
Organization string `json:"organization"`
// PolicyMode select the failling mode when the placement cannot be respected, either optional or enforced
//
// Default value: optional
PolicyMode ComputeClusterPolicyMode `json:"policy_mode"`
// PolicyType select the behavior of the compute-cluster, either low_latency (group) or max_availability (spread)
//
// Default value: max_availability
PolicyType ComputeClusterPolicyType `json:"policy_type"`
// PolicyRespected returns true if the policy is respected, false otherwise
PolicyRespected bool `json:"policy_respected"`
}
type ComputeClusterServer struct {
ID string `json:"id"`
Name string `json:"name"`
PolicyRespected bool `json:"policy_respected"`
}
type CreateComputeClusterResponse struct {
ComputeCluster *ComputeCluster `json:"compute_cluster"`
}
type CreateIPResponse struct {
IP *IP `json:"ip"`
Location string `json:"Location"`
}
type CreateImageResponse struct {
Image *Image `json:"image"`
Location string `json:"Location"`
}
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"`
}
type CreateVolumeResponse struct {
Volume *Volume `json:"volume"`
Location string `json:"Location"`
}
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"`
}
type GetBootscriptResponse struct {
Bootscript *Bootscript `json:"bootscript"`
}
type GetComputeClusterResponse struct {
ComputeCluster *ComputeCluster `json:"compute_cluster"`
}
type GetComputeClusterServersResponse struct {
Servers []*ComputeClusterServer `json:"servers"`
}
type GetDashboardResponse struct {
Dashboard *Dashboard `json:"dashboard"`
}
type GetIPResponse struct {
IP *IP `json:"ip"`
}
type GetImageResponse struct {
Image *Image `json:"image"`
}
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 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"`
Server *ServerSummary `json:"server"`
Organization string `json:"organization"`
}
type Image struct {
ID string `json:"id"`
Name string `json:"name"`
// Arch
//
// Default value: x86_64
Arch Arch `json:"arch"`
CreationDate time.Time `json:"creation_date"`
ModificationDate time.Time `json:"modification_date"`
DefaultBootscript *Bootscript `json:"default_bootscript"`
ExtraVolumes map[string]*Volume `json:"extra_volumes"`
FromServer *ServerSummary `json:"from_server"`
Organization string `json:"organization"`
Public bool `json:"public"`
RootVolume *VolumeSummary `json:"root_volume"`
// State
//
// Default value: available
State ImageState `json:"state"`
}
type ListBootscriptsResponse struct {
Bootscripts []*Bootscript `json:"bootscripts"`
TotalCount uint32 `json:"total_count"`
}
type ListComputeClustersResponse struct {
ComputeClusters []*ComputeCluster `json:"compute_clusters"`
TotalCount uint32 `json:"total_count"`
}
type ListIPsResponse struct {
IPs []*IP `json:"ips"`
TotalCount uint32 `json:"total_count"`
}
type ListImagesResponse struct {
Images []*Image `json:"images"`
TotalCount uint32 `json:"total_count"`
}
type ListSecurityGroupRulesResponse struct {
Rules []*SecurityGroupRule `json:"rules"`
TotalCount uint32 `json:"total_count"`
}
type ListSecurityGroupsResponse struct {
SecurityGroups []*SecurityGroup `json:"security_groups"`
TotalCount uint32 `json:"total_count"`
}
type ListServerActionsResponse struct {
Actions []ServerAction `json:"actions"`
}
type ListServerUserDataResponse struct {
UserData []string `json:"user_data"`
}
type ListServersResponse struct {
Servers []*Server `json:"servers"`
TotalCount uint32 `json:"total_count"`
}
type ListServersTypesResponse struct {
Servers map[string]*ServerType `json:"servers"`
TotalCount uint32 `json:"total_count"`
}
type ListSnapshotsResponse struct {
Snapshots []*Snapshot `json:"snapshots"`
TotalCount uint32 `json:"total_count"`
}
type ListVolumesResponse struct {
Volumes []*Volume `json:"volumes"`
TotalCount uint32 `json:"total_count"`
}
type NullableStringValue struct {
Null bool `json:"null,omitempty"`
Value string `json:"value,omitempty"`
}
type SecurityGroup struct {
// ID display the security groups' unique ID
ID string `json:"id"`
// Name display the security groups name
Name string `json:"name"`
// Description display the security groups description
Description string `json:"description"`
// EnableDefaultSecurity display if the security group is set as default
EnableDefaultSecurity bool `json:"enable_default_security"`
// InboundDefaultPolicy display the default inbound policy
//
// Default value: accept
InboundDefaultPolicy SecurityGroupPolicy `json:"inbound_default_policy"`
// OutboundDefaultPolicy display the default outbound policy
//
// Default value: accept
OutboundDefaultPolicy SecurityGroupPolicy `json:"outbound_default_policy"`
// Organization display the security groups organization ID
Organization string `json:"organization"`
// OrganizationDefault display if the security group is set as organization default
OrganizationDefault bool `json:"organization_default"`
// CreationDate display the security group creation date
CreationDate time.Time `json:"creation_date"`
// ModificationDate display the security group modification date
ModificationDate time.Time `json:"modification_date"`
// Servers list of servers attached to this security group
Servers []*ServerSummary `json:"servers"`
// Stateful true if the security group is stateful
Stateful bool `json:"stateful"`
}
type SecurityGroupRule struct {
ID string `json:"id"`
// Protocol
//
// Default value: TCP
Protocol SecurityGroupRuleProtocol `json:"protocol"`
// Direction
//
// Default value: inbound
Direction SecurityGroupRuleDirection `json:"direction"`
// Action
//
// Default value: accept
Action SecurityGroupRuleAction `json:"action"`
IPRange string `json:"ip_range"`
DestPortFrom *uint32 `json:"dest_port_from"`
DestPortTo *uint32 `json:"dest_port_to"`
Position uint32 `json:"position"`
Editable bool `json:"editable"`
}
type SecurityGroupSummary struct {
ID string `json:"id"`
Name string `json:"name"`
}
type SecurityGroupTemplate struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
}
type Server struct {
// ID display the server unique ID
ID string `json:"id"`
// Name display the server name
Name string `json:"name"`
// Organization display the server organization
Organization string `json:"organization"`
// AllowedActions provide as list of allowed actions on the server
AllowedActions []ServerAction `json:"allowed_actions"`
// Tags display the server associated tags
Tags []string `json:"tags"`
// CommercialType display the server commercial type (eg. GP1-M)
CommercialType string `json:"commercial_type"`
// CreationDate display the server creation date
CreationDate time.Time `json:"creation_date"`
// DynamicIPRequired display if a dynamic IP is required
DynamicIPRequired bool `json:"dynamic_ip_required"`
// EnableIPv6 display if IPv6 is enabled
EnableIPv6 bool `json:"enable_ipv6"`
// Hostname display the server host name
Hostname string `json:"hostname"`
// Image provide information on the server image
Image *Image `json:"image"`
// Protected display the server protection option is activated
Protected bool `json:"protected"`
// PrivateIP display the server private IP address
PrivateIP *string `json:"private_ip"`
// PublicIP display the server public IP address
PublicIP *ServerIP `json:"public_ip"`
// ModificationDate display the server modification date
ModificationDate time.Time `json:"modification_date"`
// State display the server state
//
// Default value: running
State ServerState `json:"state"`
// Location display the server location
Location *ServerLocation `json:"location"`
// IPv6 display the server IPv6 address
IPv6 *ServerIPv6 `json:"ipv6"`
// Bootscript display the server bootscript
Bootscript *Bootscript `json:"bootscript"`
// BootType display the server boot type
//
// Default value: local
BootType ServerBootType `json:"boot_type"`
// Volumes display the server volumes
Volumes map[string]*Volume `json:"volumes"`
// SecurityGroup display the server security group
SecurityGroup *SecurityGroupSummary `json:"security_group"`
// Maintenances display the server planned maintenances
Maintenances []*ServerMaintenance `json:"maintenances"`
// StateDetail display the server state_detail
StateDetail string `json:"state_detail"`
// Arch display the server arch
//
// Default value: x86_64
Arch Arch `json:"arch"`
// ComputeCluster display the server ComputeCluster
ComputeCluster *ComputeCluster `json:"compute_cluster"`
}
type ServerActionResponse struct {
Task *Task `json:"task"`
}