-
Notifications
You must be signed in to change notification settings - Fork 74
/
model.go
1270 lines (1119 loc) · 42.5 KB
/
model.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
/*
* Copyright 2020 Baidu, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package ddcrds
const (
STANDARD string = "Standard"
SINGLETON string = "Singleton"
)
type Integer *int
type TagModel struct {
TagKey string `json:"tagKey"`
TagValue string `json:"tagValue"`
}
type CreateInstanceArgs struct {
ClientToken string `json:"-"`
InstanceType string `json:"instanceType,omitempty"`
Number int `json:"number,omitempty"`
Instance CreateInstance `json:"instance,omitempty"`
}
type CreateRdsArgs struct {
ClientToken string `json:"-"`
Billing Billing `json:"billing,omitempty"`
PurchaseCount int `json:"purchaseCount,omitempty"`
InstanceName string `json:"instanceName,omitempty"`
Engine string `json:"engine,omitempty"`
EngineVersion string `json:"engineVersion,omitempty"`
Category string `json:"category,omitempty"`
CpuCount int `json:"cpuCount,omitempty"`
MemoryCapacity float64 `json:"memoryCapacity,omitempty"`
VolumeCapacity int `json:"volumeCapacity,omitempty"`
ZoneNames []string `json:"zoneNames,omitempty"`
VpcId string `json:"vpcId,omitempty"`
IsDirectPay bool `json:"isDirectPay,omitempty"`
Subnets []SubnetMap `json:"subnets,omitempty"`
Tags []TagModel `json:"tags,omitempty"`
AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"`
AutoRenewTime int `json:"autoRenewTime,omitempty"`
DeployId string `json:"deployId,omitempty"`
PoolId string `json:"poolId"`
SyncMode string `json:"syncMode"`
}
type CreateReadReplicaArgs struct {
ClientToken string `json:"-"`
Billing Billing `json:"billing,omitempty"`
PurchaseCount int `json:"purchaseCount,omitempty"`
SourceInstanceId string `json:"sourceInstanceId"`
InstanceName string `json:"instanceName,omitempty"`
CpuCount int `json:"cpuCount,omitempty"`
MemoryCapacity float64 `json:"memoryCapacity,omitempty"`
VolumeCapacity int `json:"volumeCapacity,omitempty"`
ZoneNames []string `json:"zoneNames,omitempty"`
VpcId string `json:"vpcId,omitempty"`
IsDirectPay bool `json:"isDirectPay,omitempty"`
Subnets []SubnetMap `json:"subnets,omitempty"`
Tags []TagModel `json:"tags,omitempty"`
DeployId string `json:"deployId,omitempty"`
PoolId string `json:"poolId,omitempty"`
RoGroupId string `json:"roGroupId,omitempty"`
EnableDelayOff string `json:"enableDelayOff,omitempty"`
DelayThreshold string `json:"delayThreshold,omitempty"`
LeastInstanceAmount string `json:"leastInstanceAmount,omitempty"`
RoGroupWeight string `json:"roGroupWeight,omitempty"`
AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"`
AutoRenewTime int `json:"autoRenewTime,omitempty"`
}
type CreateHotBackupArgs struct {
ClientToken string `json:"-"`
Billing Billing `json:"billing,omitempty"`
PurchaseCount int `json:"purchaseCount,omitempty"`
SourceInstanceId string `json:"sourceInstanceId"`
InstanceName string `json:"instanceName,omitempty"`
CpuCount int `json:"cpuCount,omitempty"`
MemoryCapacity float64 `json:"memoryCapacity,omitempty"`
VolumeCapacity int `json:"volumeCapacity,omitempty"`
ZoneNames []string `json:"zoneNames,omitempty"`
VpcId string `json:"vpcId,omitempty"`
IsDirectPay bool `json:"isDirectPay,omitempty"`
Subnets []SubnetMap `json:"subnets,omitempty"`
Tags []TagModel `json:"tags,omitempty"`
DeployId string `json:"deployId,omitempty"`
PoolId string `json:"poolId,omitempty"`
AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"`
AutoRenewTime int `json:"autoRenewTime,omitempty"`
}
type Instance struct {
InstanceId string `json:"instanceId"`
InstanceName string `json:"instanceName"`
Engine string `json:"engine"`
EngineVersion string `json:"engineVersion"`
Category string `json:"category"`
InstanceStatus string `json:"instanceStatus"`
CpuCount int `json:"cpuCount"`
MemoryCapacity float64 `json:"allocatedMemoryInGB"`
VolumeCapacity int `json:"allocatedStorageInGB"`
NodeAmount int `json:"nodeAmount"`
UsedStorage float64 `json:"usedStorageInGB"`
PublicAccessStatus string `json:"publicAccessStatus"`
InstanceCreateTime string `json:"instanceCreateTime"`
InstanceExpireTime string `json:"instanceExpireTime"`
Endpoint Endpoint `json:"endpoint"`
SyncMode string `json:"syncMode"`
BackupPolicy BackupPolicy `json:"backupPolicy"`
Region string `json:"region"`
InstanceType string `json:"type"`
SourceInstanceId string `json:"sourceInstanceId"`
SourceRegion string `json:"sourceRegion"`
ZoneNames []string `json:"zoneNames"`
VpcId string `json:"vpcId"`
Subnets []Subnet `json:"subnets"`
Topology Topology `json:"topology"`
PaymentTiming string `json:"paymentTiming"`
PubliclyAccessible bool `json:"publiclyAccessible"`
RoGroupList []RoGroup `json:"roGroupList"`
NodeMaster NodeInfo `json:"nodeMaster"`
NodeSlave NodeInfo `json:"nodeSlave"`
NodeReadReplica NodeInfo `json:"nodeReadReplica"`
DeployId string `json:"deployId"`
LongBBCId string `json:"longBBCId"`
HostName string `json:"hostname,omitempty"`
InstanceTopoForReadonly InstanceTopoForReadonly `json:"instanceTopoForReadonly,omitempty"`
AutoRenewRule *AutoRenewRule `json:"autoRenewRule,omitempty"`
IsHotBackup bool `json:"isHotBackup"`
HotBackupList []HotBackup `json:"hotBackupList"`
}
type AutoRenewRule struct {
RenewTime int `json:"renewTime"`
RenewTimeUnit string `json:"renewTimeUnit"`
}
func (instance *Instance) ProductType() string {
if isDDCId(instance.InstanceId) {
return "ddc"
}
return "rds"
}
type SubnetMap struct {
ZoneName string `json:"zoneName"`
SubnetId string `json:"subnetId"`
}
type Billing struct {
PaymentTiming string `json:"paymentTiming"`
Reservation Reservation `json:"reservation,omitempty"`
}
type Reservation struct {
ReservationLength int `json:"reservationLength,omitempty"`
ReservationTimeUnit string `json:"reservationTimeUnit,omitempty"`
}
type CreateResult struct {
OrderId string `json:"orderId"`
InstanceIds []string `json:"instanceIds"`
}
type InstanceModelResult struct {
Instance InstanceModel `json:"instance"`
}
type CreateInstance struct {
InstanceId string `json:"instanceId,omitempty"`
InstanceName string `json:"instanceName,omitempty"`
SourceInstanceId string `json:"sourceInstanceId,omitempty"`
Engine string `json:"engine,omitempty"`
EngineVersion string `json:"engineVersion,omitempty"`
CpuCount int `json:"cpuCount,omitempty"`
AllocatedMemoryInGB int `json:"allocatedMemoryInGB,omitempty"`
AllocatedStorageInGB int `json:"allocatedStorageInGB,omitempty"`
AZone string `json:"azone,omitempty"`
VpcId string `json:"vpcId,omitempty"`
SubnetId string `json:"subnetId,omitempty"`
DiskIoType string `json:"diskIoType,omitempty"`
DeployId string `json:"deployId,omitempty"`
PoolId string `json:"poolId,omitempty"`
RoGroupId string `json:"roGroupId,omitempty"`
IsBalanceRoLoad Integer `json:"isBalanceRoLoad,omitempty"`
EnableDelayOff Integer `json:"enableDelayOff,omitempty"`
DelayThreshold Integer `json:"delayThreshold,omitempty"`
LeastInstanceAmount Integer `json:"leastInstanceAmount,omitempty"`
RoGroupWeight Integer `json:"roGroupWeight,omitempty"`
IsDirectPay bool `json:"IsDirectPay,omitempty"`
Billing Billing `json:"billing,omitempty"`
AutoRenewTimeUnit string `json:"autoRenewTimeUnit,omitempty"`
AutoRenewTime int `json:"autoRenewTime,omitempty"`
Category string `json:"category,omitempty"`
Tags []TagModel `json:"tags,omitempty"`
SyncMode string `json:"syncMode,omitempty"`
Remark string `json:"remark,omitempty"`
}
type Pool struct {
CPUQuotaTotal int `json:"cpuQuotaTotal"`
CPUQuotaUsed int `json:"cpuQuotaUsed"`
CreateTime string `json:"createTime"`
DeployMethod string `json:"deployMethod"`
DiskQuotaTotal int `json:"diskQuotaTotal"`
DiskQuotaUsed int `json:"diskQuotaUsed"`
Engine string `json:"engine"`
Hosts []Host `json:"hosts"`
MaxMemoryUsedRatio string `json:"maxMemoryUsedRatio"`
MemoryQuotaTotal int `json:"memoryQuotaTotal"`
MemoryQuotaUsed int `json:"memoryQuotaUsed"`
PoolID string `json:"poolId"`
PoolName string `json:"poolName"`
VpcID string `json:"vpcId"`
}
type Host struct {
Containers []Container `json:"containers"`
Flavor Flavor `json:"flavor"`
CPUQuotaTotal int `json:"cpuQuotaTotal"`
CPUQuotaUsed int `json:"cpuQuotaUsed"`
DeploymentStatus string `json:"deploymentStatus"`
DiskQuotaTotal int `json:"diskQuotaTotal"`
DiskQuotaUsed int `json:"diskQuotaUsed"`
HostID string `json:"hostId"`
HostName string `json:"hostName"`
ImageType string `json:"imageType"`
MemoryQuotaTotal int64 `json:"memoryQuotaTotal"`
MemoryQuotaUsed int64 `json:"memoryQuotaUsed"`
PnetIP string `json:"pnetIp"`
Role string `json:"role"`
Status string `json:"status"`
SubnetID string `json:"subnetId"`
VnetIP string `json:"vnetIp"`
VpcID string `json:"vpcId"`
Zone string `json:"zone"`
}
type OperateHostRequest struct {
Action string `json:"action"`
}
type Flavor struct {
CPUCount int `json:"cpuCount"`
CPUType string `json:"cpuType"`
Disk int `json:"disk"`
FlavorID string `json:"flavorId"`
MemoryCapacityInGB int `json:"memoryCapacityInGB"`
}
type Container struct {
ContainerID string `json:"containerId"`
DeployID string `json:"deployId"`
DeployName string `json:"deployName"`
Engine string `json:"engine"`
HostID string `json:"hostId"`
HostName string `json:"hostName"`
PoolName string `json:"poolName"`
Role string `json:"role"`
Zone string `json:"zone"`
}
type DeploySet struct {
CreateTime string `json:"createTime"`
DeployID string `json:"deployId"`
DeployName string `json:"deployName"`
Instances []string `json:"instances"`
PoolID string `json:"poolId"`
Strategy string `json:"strategy"`
CentralizeThreshold int `json:"centralizeThreshold"`
}
type CreateDeployRequest struct {
ClientToken string `json:"-"`
DeployName string `json:"deployName"`
Strategy string `json:"strategy"`
CentralizeThreshold int `json:"centralizeThreshold"`
}
type CreateDeployResult struct {
DeployID string `json:"deployId"`
}
type UpdateDeployRequest struct {
ClientToken string `json:"-"`
Strategy string `json:"strategy"`
CentralizeThreshold int `json:"centralizeThreshold"`
}
type Marker struct {
Marker string `json:"marker,omitempty"`
MaxKeys int `json:"maxKeys,omitempty"`
}
type ListResultWithMarker struct {
IsTruncated bool `json:"isTruncated"`
Marker string `json:"marker"`
MaxKeys int `json:"maxKeys"`
NextMarker string `json:"nextMarker"`
}
type ListPoolResult struct {
ListResultWithMarker
Result []Pool `json:"result"`
}
type ListHostResult struct {
ListResultWithMarker
Result []Host `json:"result"`
}
type ListDeploySetResult struct {
ListResultWithMarker
Result []DeploySet `json:"result"`
}
type InstanceModel struct {
InstanceId string `json:"instanceId"`
InstanceName string `json:"instanceName"`
Engine string `json:"engine"`
EngineVersion string `json:"engineVersion"`
InstanceStatus string `json:"instanceStatus"`
CpuCount int `json:"cpuCount"`
AllocatedMemoryInGB float64 `json:"allocatedMemoryInGB"`
AllocatedStorageInGB int `json:"allocatedStorageInGB"`
NodeAmount int `json:"nodeAmount"`
UsedStorageInGB float64 `json:"usedStorageInGB"`
PublicAccessStatus bool `json:"publicAccessStatus"`
InstanceCreateTime string `json:"instanceCreateTime"`
InstanceExpireTime string `json:"instanceExpireTime"`
Endpoint Endpoint `json:"endpoint"`
SyncMode string `json:"syncMode"`
BackupPolicy BackupPolicy `json:"backupPolicy"`
Region string `json:"region"`
InstanceType string `json:"instanceType"`
SourceInstanceId string `json:"sourceInstanceId"`
SourceRegion string `json:"sourceRegion"`
ZoneNames []string `json:"zoneNames"`
VpcId string `json:"vpcId"`
Subnets []Subnet `json:"subnets"`
NodeMaster NodeInfo `json:"nodeMaster"`
NodeSlave NodeInfo `json:"nodeSlave"`
NodeReadReplica NodeInfo `json:"nodeReadReplica"`
DeployId string `json:"deployId"`
Topology Topology `json:"topology"`
DiskType string `json:"diskType"`
Type string `json:"type"`
ApplicationType string `json:"applicationType"`
RoGroupList []RoGroup `json:"roGroupList"`
PaymentTiming string `json:"paymentTiming"`
Category string `json:"category"`
LongBBCId string `json:"longBBCId"`
InstanceTopoForReadonly InstanceTopoForReadonly `json:"instanceTopoForReadonly,omitempty"`
AutoRenewRule *AutoRenewRule `json:"autoRenewRule,omitempty"`
IsHotBackup bool `json:"isHotBackup"`
HotBackupList []HotBackup `json:"hotBackupList"`
}
type TopoInstance struct {
InstanceID string `json:"instanceId,omitempty"`
SyncMode string `json:"syncMode,omitempty"`
MasterSlaveDelay int `json:"masterSlaveDelay,omitempty"`
Type string `json:"type,omitempty"`
Region string `json:"region,omitempty"`
RoGroupID string `json:"roGroupId,omitempty"`
ZoneName string `json:"zoneName,omitempty"`
InstanceStatus string `json:"instanceStatus,omitempty"`
}
type InstanceTopoForReadonly struct {
ReadReplica []TopoInstance `json:"readReplica,omitempty"`
Master []TopoInstance `json:"master,omitempty"`
}
type SubnetVo struct {
Name string `json:"name"`
SubnetId string `json:"subnetId"`
Az string `json:"az"`
Cidr string `json:"cidr"`
ShortId string `json:"shortId"`
}
type RoGroup struct {
RoGroupID string `json:"roGroupId"`
RoGroupName string `json:"roGroupName"`
VnetIP string `json:"vnetIp"`
IsBalanceRoLoad int `json:"isBalanceRoLoad"`
EnableDelayOff int `json:"enableDelayOff"`
DelayThreshold int `json:"delayThreshold"`
LeastInstanceAmount int `json:"leastInstanceAmount"`
ReplicaList []Replica `json:"replicaList"`
}
type HotBackup struct {
InstanceId string `json:"instanceId"`
Status string `json:"status"`
InstanceName string `json:"instanceName"`
}
type UpdateRoGroupArgs struct {
RoGroupName string `json:"roGroupName,omitempty"`
IsBalanceRoLoad string `json:"isBalanceRoLoad,omitempty"`
EnableDelayOff string `json:"enableDelayOff,omitempty"`
DelayThreshold string `json:"delayThreshold,omitempty"`
LeastInstanceAmount string `json:"leastInstanceAmount,omitempty"`
MasterDelay string `json:"masterDelay,omitempty"`
}
type UpdateRoGroupRealArgs struct {
RoGroupName string `json:"roGroupName,omitempty"`
IsBalanceRoLoad Integer `json:"isBalanceRoLoad,omitempty"`
EnableDelayOff Integer `json:"enableDelayOff,omitempty"`
DelayThreshold Integer `json:"delayThreshold,omitempty"`
LeastInstanceAmount Integer `json:"leastInstanceAmount,omitempty"`
MasterDelay Integer `json:"masterDelay,omitempty"`
}
type UpdateRoGroupWeightArgs struct {
RoGroupName string `json:"roGroupName,omitempty"`
EnableDelayOff string `json:"enableDelayOff,omitempty"`
DelayThreshold string `json:"delayThreshold,omitempty"`
LeastInstanceAmount string `json:"leastInstanceAmount,omitempty"`
IsBalanceRoLoad string `json:"isBalanceRoLoad,omitempty"`
MasterDelay string `json:"masterDelay,omitempty"`
ReplicaList []ReplicaWeight `json:"replicaList,omitempty"`
}
type UpdateRoGroupWeightRealArgs struct {
RoGroupName string `json:"roGroupName,omitempty"`
EnableDelayOff Integer `json:"enableDelayOff,omitempty"`
DelayThreshold Integer `json:"delayThreshold,omitempty"`
LeastInstanceAmount Integer `json:"leastInstanceAmount,omitempty"`
IsBalanceRoLoad Integer `json:"isBalanceRoLoad,omitempty"`
MasterDelay Integer `json:"masterDelay,omitempty"`
ReplicaList []ReplicaWeight `json:"replicaList,omitempty"`
}
type ReplicaWeight struct {
InstanceId string `json:"instanceId"`
Weight int `json:"weight"`
}
type Replica struct {
InstanceId string `json:"instanceId"`
InstanceName string `json:"instanceName"`
Status string `json:"status"`
RoGroupWeight int `json:"roGroupWeight"`
}
type NodeInfo struct {
Id string `json:"id"`
Azone string `json:"azone"`
SubnetId string `json:"subnetId"`
Cidr string `json:"cidr"`
Name string `json:"name"`
HostName string `json:"hostname"`
}
type Subnet struct {
Name string `json:"name"`
LongId string `json:"subnetId"`
ZoneName string `json:"zoneName"`
Cidr string `json:"cidr"`
ShortId string `json:"shortId"`
VpcId string `json:"vpcId"`
VpcShortId string `json:"vpcShortId"`
Az string `json:"az"`
CreatedTime string `json:"createdTime"`
UpdatedTime string `json:"updatedTime"`
}
type Endpoint struct {
Address string `json:"address"`
Port int `json:"port"`
VnetIp string `json:"vnetIp"`
VnetIpBackup string `json:"vnetIpBackup"`
InetIp string `json:"inetIp"`
}
type BackupPolicy struct {
BackupDays string `json:"backupDays"`
BackupTime string `json:"backupTime"`
Persistent bool `json:"persistent"`
ExpireInDaysStr string `json:"expireInDaysStr"`
FreeSpaceInGB int `json:"freeSpaceInGb"`
ExpireInDaysInt int `json:"expireInDays"`
}
type Topology struct {
Rdsproxy []string `json:"rdsproxy"`
Master []string `json:"master"`
ReadReplica []string `json:"readReplica"`
}
type DeleteDdcArgs struct {
InstanceIds []string `json:"instanceIds"`
}
type UpdateInstanceNameArgs struct {
InstanceName string `json:"instanceName"`
}
type ListRdsResult struct {
Marker string `json:"marker"`
MaxKeys int `json:"maxKeys"`
IsTruncated bool `json:"isTruncated"`
NextMarker string `json:"nextMarker"`
Instances []Instance `json:"result"`
}
type ListRdsArgs struct {
Marker string
MaxKeys int
}
type ListPageArgs struct {
PageNo int `json:"pageNo"`
PageSize int `json:"pageSize"`
Filters []Filter `json:"filters"`
}
type Filter struct {
KeywordType string `json:"keywordType"`
Keyword string `json:"keyword"`
}
type ListPageResult struct {
Page Page `json:"page"`
}
type Page struct {
Result []Instance `json:"result"`
PageNo int `json:"pageNo"`
PageSize int `json:"pageSize"`
TotalCount int `json:"totalCount"`
}
type GetBackupListResult struct {
Marker string `json:"marker"`
MaxKeys int `json:"maxKeys"`
IsTruncated bool `json:"isTruncated"`
NextMarker string `json:"nextMarker"`
Backups []Snapshot `json:"snapshots"`
FreeSpaceInMB int64 `json:"freeSpaceInMB"`
UsedSpaceInMB int64 `json:"usedSpaceInMB"`
}
type GetZoneListResult struct {
Zones []ZoneName `json:"zones"`
}
type ZoneName struct {
ZoneNames []string `json:"apiZoneNames"`
ApiZoneNames []string `json:"zoneNames"`
Available bool `json:"bool"`
DefaultSubnetId string `json:"defaultSubnetId"`
}
type ListSubnetsArgs struct {
VpcId string `json:"vpcId"`
ZoneName string `json:"zoneName"`
}
type ListSubnetsResult struct {
Subnets []Subnet `json:"subnets"`
}
type SecurityIpsRawResult struct {
SecurityIps []string `json:"ip"`
}
type UpdateSecurityIpsArgs struct {
SecurityIps []string `json:"securityIps"`
}
type ListParametersResult struct {
Etag string `json:"etag"`
Parameters []Parameter `json:"items"`
}
type Parameter struct {
Name string `json:"name"`
DefaultValue string `json:"defaultValue"`
Value string `json:"value"`
PendingValue string `json:"pendingValue"`
Type string `json:"type"`
IsDynamic bool `json:"dynamic"`
ISModifiable bool `json:"modifiable"`
AllowedValues string `json:"allowedValues"`
Desc string `json:"desc"`
// 多加字段,兼容RDS
Dynamic string `json:"dynamicStr"`
Modifiable string `json:"modifiableStr"`
}
type UpdateParameterArgs struct {
Parameters []KVParameter `json:"parameters"`
WaitSwitch int `json:"waitSwitch"`
}
type KVParameter struct {
Name string `json:"name"`
Value string `json:"value"`
}
type Snapshot struct {
SnapshotId string `json:"snapshotId"`
SnapshotSizeInBytes string `json:"snapshotSizeInBytes"`
SnapshotType string `json:"snapshotType"`
SnapshotStatus string `json:"snapshotStatus"`
SnapshotStartTime string `json:"snapshotStartTime"`
SnapshotEndTime string `json:"snapshotEndTime"`
}
type SnapshotModel struct {
SnapshotId string `json:"snapshotId"`
SnapshotSizeInBytes string `json:"snapshotSizeInBytes"`
SnapshotType string `json:"snapshotType"`
SnapshotStatus string `json:"snapshotStatus"`
SnapshotStartTime string `json:"snapshotStartTime"`
SnapshotEndTime string `json:"snapshotEndTime"`
DownloadUrl string `json:"downloadUrl"`
DownloadExpires string `json:"downloadExpires"`
}
type BackupDetailResult struct {
Snapshot SnapshotModel `json:"snapshot"`
}
type Binlog struct {
BinlogId string `json:"binlogId"`
BinlogSizeInBytes int64 `json:"binlogSizeInBytes"`
BinlogStatus string `json:"binlogStatus"`
BinlogStartTime string `json:"binlogStartTime"`
BinlogEndTime string `json:"binlogEndTime"`
}
type BinlogModel struct {
BinlogId string `json:"binlogId"`
BinlogSizeInBytes int64 `json:"binlogSizeInBytes"`
BinlogStatus string `json:"binlogStatus"`
BinlogStartTime string `json:"binlogStartTime"`
BinlogEndTime string `json:"binlogEndTime"`
DownloadUrl string `json:"downloadUrl"`
DownloadExpires string `json:"downloadExpires"`
}
type BinlogListResult struct {
Binlogs []Binlog `json:"binlogs"`
}
type BinlogDetailResult struct {
Binlog BinlogModel `json:"binlog"`
}
type AuthType string
const (
AuthType_ReadOnly AuthType = "readOnly"
AuthType_ReadWrite AuthType = "readWrite"
)
type AccountPrivilege struct {
AccountName string `json:"accountName"`
AuthType AuthType `json:"authType"`
}
type CreateDatabaseArgs struct {
ClientToken string `json:"-"`
DbName string `json:"dbName"`
CharacterSetName string `json:"characterSetName"`
Remark string `json:"remark"`
}
type UpdateDatabaseRemarkArgs struct {
Remark string `json:"remark"`
}
type Database struct {
DbName string `json:"dbName"`
CharacterSetName string `json:"characterSetName"`
DbStatus string `json:"dbStatus"`
Remark string `json:"remark"`
AccountPrivileges []AccountPrivilege `json:"accountPrivileges"`
}
type DatabaseResult struct {
Database Database `json:"database"`
}
type ListDatabaseResult struct {
Databases []Database `json:"databases"`
}
// Account
type AccountType string
const (
AccountType_Super AccountType = "rdssuper"
AccountType_Common AccountType = "common"
)
type CreateAccountArgs struct {
ClientToken string `json:"-"`
AccountName string `json:"accountName"`
Password string `json:"password"`
// 为了兼容 RDS 参数结构
AccountType AccountType `json:"type"`
Desc string `json:"remark"`
DatabasePrivileges []DatabasePrivilege `json:"databasePrivileges,omitempty"`
}
type DatabasePrivilege struct {
DbName string `json:"dbName"`
AuthType string `json:"authType"`
}
type Account struct {
AccountName string `json:"accountName"`
Desc string `json:"remark"`
Status string `json:"accountStatus"`
AccountType string `json:"accountType"`
DatabasePrivileges []DatabasePrivilege `json:"databasePrivileges"`
}
type AccountResult struct {
Account Account `json:"account"`
}
type ListAccountResult struct {
Accounts []Account `json:"accounts"`
}
type UpdateAccountPasswordArgs struct {
Password string `json:"password"`
}
type UpdateAccountDescArgs struct {
Desc string `json:"remark"`
}
type UpdateAccountPrivilegesArgs struct {
DatabasePrivileges []DatabasePrivilege `json:"databasePrivileges"`
}
type ListRoGroupResult struct {
RoGroups []RoGroup `json:"roGroups"`
}
type VpcVo struct {
VpcId string `json:"vpcId"`
ShortId string `json:"shortId"`
Name string `json:"name"`
Cidr string `json:"cidr"`
Status int `json:"status"`
CreateTime string `json:"createTime"`
Description string `json:"description"`
DefaultVpc bool `json:"defaultVpc"`
Ipv6Cidr string `json:"ipv6Cidr"`
AuxiliaryCidr []string `json:"auxiliaryCidr"`
Relay bool `json:"relay"`
}
type GetBackupListArgs struct {
Marker string
MaxKeys int
}
type GetSecurityIpsResult struct {
Etag string `json:"etag"`
SecurityIps []string `json:"securityIps"`
}
// struct for rds
type CreateRdsProxyArgs struct {
ClientToken string `json:"-"`
Billing Billing `json:"billing"`
SourceInstanceId string `json:"sourceInstanceId"`
InstanceName string `json:"instanceName,omitempty"`
NodeAmount int `json:"nodeAmount"`
ZoneNames []string `json:"zoneNames,omitempty"`
VpcId string `json:"vpcId,omitempty"`
IsDirectPay bool `json:"isDirectPay,omitempty"`
Subnets []SubnetMap `json:"subnets,omitempty"`
Tags []TagModel `json:"tags,omitempty"`
}
type ResizeRdsArgs struct {
ClientToken string `json:"-"`
CpuCount int `json:"cpuCount"`
MemoryCapacity float64 `json:"memoryCapacity"`
VolumeCapacity int `json:"volumeCapacity"`
NodeAmount int `json:"nodeAmount,omitempty"`
IsDirectPay bool `json:"isDirectPay,omitempty"`
IsResizeNow bool `json:"isResizeNow,omitempty"`
WaitSwitch int `json:"waitSwitch,omitempty"`
}
type OrderIdResponse struct {
OrderId string `json:"orderId"`
}
type ModifySyncModeArgs struct {
SyncMode string `json:"syncMode"`
}
type ModifyEndpointArgs struct {
Address string `json:"address"`
}
type ModifyPublicAccessArgs struct {
PublicAccess bool `json:"publicAccess"`
}
type AutoRenewArgs struct {
InstanceIds []string `json:"instanceIds"`
AutoRenewTimeUnit string `json:"autoRenewTimeUnit"`
AutoRenewTime int `json:"autoRenewTime"`
}
type RebootArgs struct {
IsRebootNow bool `json:"isRebootNow"`
}
type SwitchArgs struct {
IsSwitchNow bool `json:"isSwitchNow"`
WaitSwitch int `json:"waitSwitch,omitempty"`
}
type MaintainWindow struct {
MaintainTime MaintainTime `json:"maintentime"`
}
type MaintainTime struct {
Period string `json:"period"`
StartTime string `json:"startTime"`
Duration int `json:"duration"`
}
type RecycleInstance struct {
EngineVersion string `json:"engineVersion"`
VolumeCapacity int `json:"volumeCapacity"`
ApplicationType string `json:"applicationType"`
InstanceName string `json:"instanceName"`
PublicAccessStatus string `json:"publicAccessStatus"`
InstanceCreateTime string `json:"instanceCreateTime"`
InstanceType string `json:"instanceType"`
Type string `json:"type"`
InstanceStatus string `json:"instanceStatus"`
MemoryCapacity float64 `json:"memoryCapacity"`
InstanceId string `json:"instanceId"`
Engine string `json:"engine"`
VpcId string `json:"vpcId"`
PubliclyAccessible bool `json:"publiclyAccessible"`
InstanceExpireTime string `json:"instanceExpireTime"`
DiskType string `json:"diskType"`
Region string `json:"region"`
CpuCount int `json:"cpuCount"`
UsedStorage float64 `json:"usedStorage"`
LongBBCId string `json:"longBBCId"`
}
type RecyclerInstanceList struct {
ListResultWithMarker
Result []RecycleInstance `json:"result"`
}
type BatchInstanceIds struct {
InstanceIds string `json:"instanceIds"`
}
type SecurityGroup struct {
Name string `json:"name"`
SecurityGroupID string `json:"securityGroupId"`
Description string `json:"description"`
TenantID string `json:"tenantId"`
AssociateNum int `json:"associateNum"`
VpcID string `json:"vpcId"`
VpcShortID string `json:"vpcShortId"`
VpcName string `json:"vpcName"`
CreatedTime string `json:"createdTime"`
Version int `json:"version"`
DefaultSecurityGroup int `json:"defaultSecurityGroup"`
}
type SecurityGroupArgs struct {
InstanceIds []string `json:"instanceIds"`
SecurityGroupIds []string `json:"securityGroupIds"`
}
type ListSecurityGroupResult struct {
Groups []SecurityGroupDetail `json:"groups"`
}
type SecurityGroupRule struct {
PortRange string `json:"portRange"`
Protocol string `json:"protocol"`
RemoteGroupID string `json:"remoteGroupId"`
RemoteIP string `json:"remoteIP"`
Ethertype string `json:"ethertype"`
TenantID string `json:"tenantId"`
Name string `json:"name"`
ID string `json:"id"`
SecurityGroupRuleID string `json:"securityGroupRuleId"`
Direction string `json:"direction"`
}
type SecurityGroupDetail struct {
SecurityGroupName string `json:"securityGroupName"`
SecurityGroupID string `json:"securityGroupId"`
SecurityGroupRemark string `json:"securityGroupRemark"`
Inbound []SecurityGroupRule `json:"inbound"`
Outbound []SecurityGroupRule `json:"outbound"`
VpcName string `json:"vpcName"`
VpcID string `json:"vpcId"`
ProjectID string `json:"projectId"`
}
type ListLogArgs struct {
LogType string `json:"logType"`
Datetime string `json:"datetime"`
}
type Log struct {
LogStartTime string `json:"logStartTime"`
LogEndTime string `json:"logEndTime"`
LogID string `json:"logId"`
LogSizeInBytes int `json:"logSizeInBytes"`
}
type LogDetail struct {
Log
DownloadURL string `json:"downloadUrl"`
DownloadExpires string `json:"downloadExpires"`
}
type GetLogArgs struct {
ValidSeconds int `json:"downloadValidTimeInSec"`
}
type CreateTableHardLinkArgs struct {
TableName string `json:"tableName"`
}
type Disk struct {
Response struct {
Items []struct {
DiskPartition string `json:"DiskPartition"`
InstanceID string `json:"InstanceId"`
InstanceRole string `json:"InstanceRole"`
PhysicalIP string `json:"PhysicalIp"`
ReportTime string `json:"ReportTime"`
TotalSize int `json:"TotalSize"`
UsedSize int `json:"UsedSize"`
} `json:"Items"`
} `json:"Response"`
}
type MachineInfo struct {
Response struct {
Items []struct {
InstanceID string `json:"instanceId"`
Role string `json:"role"`
CPUInCore int `json:"cpuInCore"`
FreeCPUInCore int `json:"freeCpuInCore"`
MemSizeInMB int `json:"memSizeInMB"`
FreeMemSizeInMB int `json:"freeMemSizeInMB"`
SizeInGB []struct {
FreeSizeInGB int `json:"freeSizeInGB"`
Label map[string]string `json:"label"`
Path string `json:"path"`
SizeInGB int `json:"sizeInGB"`
} `json:"sizeInGB"`
} `json:"Items"`
} `json:"Response"`
}
type GetResidualResult struct {
Residual map[string]ResidualOfZone `json:"residual"`
}
type Slave struct {
DiskInGb float64 `json:"diskInGb"`
MemoryInGb float64 `json:"memoryInGb"`
CPUInCore int `json:"cpuInCore"`
}
type Single struct {
DiskInGb float64 `json:"diskInGb"`
MemoryInGb float64 `json:"memoryInGb"`
CPUInCore int `json:"cpuInCore"`
}
type HA struct {