This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 560
/
converterfromapi.go
1074 lines (987 loc) · 40.1 KB
/
converterfromapi.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
package api
import (
"fmt"
"regexp"
"strings"
"github.com/Masterminds/semver"
"github.com/Azure/acs-engine/pkg/api/v20160330"
"github.com/Azure/acs-engine/pkg/api/v20160930"
"github.com/Azure/acs-engine/pkg/api/v20170131"
"github.com/Azure/acs-engine/pkg/api/v20170701"
"github.com/Azure/acs-engine/pkg/api/v20170930"
"github.com/Azure/acs-engine/pkg/api/vlabs"
)
///////////////////////////////////////////////////////////
// The converter exposes functions to convert the top level
// ContainerService resource
//
// All other functions are internal helper functions used
// for converting.
///////////////////////////////////////////////////////////
// ConvertContainerServiceToV20160930 converts an unversioned ContainerService to a v20160930 ContainerService
func ConvertContainerServiceToV20160930(api *ContainerService) *v20160930.ContainerService {
v20160930CS := &v20160930.ContainerService{}
v20160930CS.ID = api.ID
v20160930CS.Location = api.Location
v20160930CS.Name = api.Name
if api.Plan != nil {
v20160930CS.Plan = &v20160930.ResourcePurchasePlan{}
convertResourcePurchasePlanToV20160930(api.Plan, v20160930CS.Plan)
}
v20160930CS.Tags = map[string]string{}
for k, v := range api.Tags {
v20160930CS.Tags[k] = v
}
v20160930CS.Type = api.Type
v20160930CS.Properties = &v20160930.Properties{}
convertPropertiesToV20160930(api.Properties, v20160930CS.Properties)
return v20160930CS
}
// ConvertContainerServiceToV20160330 converts an unversioned ContainerService to a v20160330 ContainerService
func ConvertContainerServiceToV20160330(api *ContainerService) *v20160330.ContainerService {
v20160330CS := &v20160330.ContainerService{}
v20160330CS.ID = api.ID
v20160330CS.Location = api.Location
v20160330CS.Name = api.Name
if api.Plan != nil {
v20160330CS.Plan = &v20160330.ResourcePurchasePlan{}
convertResourcePurchasePlanToV20160330(api.Plan, v20160330CS.Plan)
}
v20160330CS.Tags = map[string]string{}
for k, v := range api.Tags {
v20160330CS.Tags[k] = v
}
v20160330CS.Type = api.Type
v20160330CS.Properties = &v20160330.Properties{}
convertPropertiesToV20160330(api.Properties, v20160330CS.Properties)
return v20160330CS
}
// ConvertContainerServiceToV20170131 converts an unversioned ContainerService to a v20170131 ContainerService
func ConvertContainerServiceToV20170131(api *ContainerService) *v20170131.ContainerService {
v20170131CS := &v20170131.ContainerService{}
v20170131CS.ID = api.ID
v20170131CS.Location = api.Location
v20170131CS.Name = api.Name
if api.Plan != nil {
v20170131CS.Plan = &v20170131.ResourcePurchasePlan{}
convertResourcePurchasePlanToV20170131(api.Plan, v20170131CS.Plan)
}
v20170131CS.Tags = map[string]string{}
for k, v := range api.Tags {
v20170131CS.Tags[k] = v
}
v20170131CS.Type = api.Type
v20170131CS.Properties = &v20170131.Properties{}
convertPropertiesToV20170131(api.Properties, v20170131CS.Properties)
return v20170131CS
}
// ConvertContainerServiceToV20170701 converts an unversioned ContainerService to a v20170701 ContainerService
func ConvertContainerServiceToV20170701(api *ContainerService) *v20170701.ContainerService {
v20170701CS := &v20170701.ContainerService{}
v20170701CS.ID = api.ID
v20170701CS.Location = api.Location
v20170701CS.Name = api.Name
if api.Plan != nil {
v20170701CS.Plan = &v20170701.ResourcePurchasePlan{}
convertResourcePurchasePlanToV20170701(api.Plan, v20170701CS.Plan)
}
v20170701CS.Tags = map[string]string{}
for k, v := range api.Tags {
v20170701CS.Tags[k] = v
}
v20170701CS.Type = api.Type
v20170701CS.Properties = &v20170701.Properties{}
convertPropertiesToV20170701(api.Properties, v20170701CS.Properties)
return v20170701CS
}
// ConvertContainerServiceToVLabs converts an unversioned ContainerService to a vlabs ContainerService
func ConvertContainerServiceToVLabs(api *ContainerService) *vlabs.ContainerService {
vlabsCS := &vlabs.ContainerService{}
vlabsCS.ID = api.ID
vlabsCS.Location = api.Location
vlabsCS.Name = api.Name
if api.Plan != nil {
vlabsCS.Plan = &vlabs.ResourcePurchasePlan{}
convertResourcePurchasePlanToVLabs(api.Plan, vlabsCS.Plan)
}
vlabsCS.Tags = map[string]string{}
for k, v := range api.Tags {
vlabsCS.Tags[k] = v
}
vlabsCS.Type = api.Type
vlabsCS.Properties = &vlabs.Properties{}
convertPropertiesToVLabs(api.Properties, vlabsCS.Properties)
return vlabsCS
}
// ConvertOrchestratorVersionProfileToV20170930 converts an unversioned OrchestratorVersionProfile to a v20170930 OrchestratorVersionProfile
func ConvertOrchestratorVersionProfileToV20170930(api *OrchestratorVersionProfile) *v20170930.OrchestratorVersionProfile {
vProfile := &v20170930.OrchestratorVersionProfile{}
switch api.OrchestratorType {
case Kubernetes:
vProfile.OrchestratorType = v20170930.Kubernetes
case DCOS:
vProfile.OrchestratorType = v20170930.DCOS
case Swarm:
vProfile.OrchestratorType = v20170930.Swarm
case SwarmMode:
vProfile.OrchestratorType = v20170930.DockerCE
}
vProfile.OrchestratorVersion = api.OrchestratorVersion
vProfile.Default = api.Default
if api.Upgrades != nil {
vProfile.Upgrades = make([]*v20170930.OrchestratorProfile, len(api.Upgrades))
for i, h := range api.Upgrades {
vProfile.Upgrades[i] = &v20170930.OrchestratorProfile{
OrchestratorVersion: h.OrchestratorVersion,
}
}
}
return vProfile
}
// ConvertOrchestratorVersionProfileToVLabs converts an unversioned OrchestratorVersionProfile to a vlabs OrchestratorVersionProfile
func ConvertOrchestratorVersionProfileToVLabs(api *OrchestratorVersionProfile) *vlabs.OrchestratorVersionProfile {
vlabsProfile := &vlabs.OrchestratorVersionProfile{}
switch api.OrchestratorType {
case Kubernetes:
vlabsProfile.OrchestratorType = vlabs.Kubernetes
case DCOS:
vlabsProfile.OrchestratorType = vlabs.DCOS
case Swarm:
vlabsProfile.OrchestratorType = vlabs.Swarm
case SwarmMode:
vlabsProfile.OrchestratorType = vlabs.SwarmMode
}
vlabsProfile.OrchestratorVersion = api.OrchestratorVersion
vlabsProfile.Default = api.Default
if api.Upgrades != nil {
vlabsProfile.Upgrades = make([]*vlabs.OrchestratorProfile, len(api.Upgrades))
for i, h := range api.Upgrades {
vlabsProfile.Upgrades[i] = &vlabs.OrchestratorProfile{
OrchestratorVersion: h.OrchestratorVersion,
}
}
}
return vlabsProfile
}
// convertResourcePurchasePlanToV20160930 converts a v20160930 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertResourcePurchasePlanToV20160930(api *ResourcePurchasePlan, v20160930 *v20160930.ResourcePurchasePlan) {
v20160930.Name = api.Name
v20160930.Product = api.Product
v20160930.PromotionCode = api.PromotionCode
v20160930.Publisher = api.Publisher
}
// convertResourcePurchasePlanToV20160330 converts a v20160330 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertResourcePurchasePlanToV20160330(api *ResourcePurchasePlan, v20160330 *v20160330.ResourcePurchasePlan) {
v20160330.Name = api.Name
v20160330.Product = api.Product
v20160330.PromotionCode = api.PromotionCode
v20160330.Publisher = api.Publisher
}
// convertResourcePurchasePlanToV20170131 converts an unversioned ResourcePurchasePlan to a v20170131 ResourcePurchasePlan
func convertResourcePurchasePlanToV20170131(api *ResourcePurchasePlan, v20170131 *v20170131.ResourcePurchasePlan) {
v20170131.Name = api.Name
v20170131.Product = api.Product
v20170131.PromotionCode = api.PromotionCode
v20170131.Publisher = api.Publisher
}
// convertResourcePurchasePlanToV20170701 converts a v20170701 ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertResourcePurchasePlanToV20170701(api *ResourcePurchasePlan, v20170701 *v20170701.ResourcePurchasePlan) {
v20170701.Name = api.Name
v20170701.Product = api.Product
v20170701.PromotionCode = api.PromotionCode
v20170701.Publisher = api.Publisher
}
// convertResourcePurchasePlanToVLabs converts a vlabs ResourcePurchasePlan to an unversioned ResourcePurchasePlan
func convertResourcePurchasePlanToVLabs(api *ResourcePurchasePlan, vlabs *vlabs.ResourcePurchasePlan) {
vlabs.Name = api.Name
vlabs.Product = api.Product
vlabs.PromotionCode = api.PromotionCode
vlabs.Publisher = api.Publisher
}
func convertPropertiesToV20160930(api *Properties, p *v20160930.Properties) {
p.ProvisioningState = v20160930.ProvisioningState(api.ProvisioningState)
if api.OrchestratorProfile != nil {
p.OrchestratorProfile = &v20160930.OrchestratorProfile{}
convertOrchestratorProfileToV20160930(api.OrchestratorProfile, p.OrchestratorProfile)
}
if api.MasterProfile != nil {
p.MasterProfile = &v20160930.MasterProfile{}
convertMasterProfileToV20160930(api.MasterProfile, p.MasterProfile)
}
p.AgentPoolProfiles = []*v20160930.AgentPoolProfile{}
// DCOS conversion logic
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 2 {
var privIndex, pubIndex int
for i, apiProfile := range api.AgentPoolProfiles {
// We added a pool with a "-public" suffix when converting to API model;
// we don't want to include that when converting back to a version-specific model
matched, err := regexp.MatchString(publicAgentPoolSuffix+"$", apiProfile.Name)
if !matched && err == nil {
v20160930Profile := &v20160930.AgentPoolProfile{}
convertAgentPoolProfileToV20160930(apiProfile, v20160930Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20160930Profile)
privIndex = i
} else {
pubIndex = i
}
}
// Assign DNS Prefix to private agent pool from public agent pool
p.AgentPoolProfiles[privIndex].DNSPrefix = api.AgentPoolProfiles[pubIndex].DNSPrefix
p.AgentPoolProfiles[privIndex].FQDN = api.AgentPoolProfiles[pubIndex].FQDN
} else {
for _, apiProfile := range api.AgentPoolProfiles {
v20160930Profile := &v20160930.AgentPoolProfile{}
convertAgentPoolProfileToV20160930(apiProfile, v20160930Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20160930Profile)
}
}
if api.LinuxProfile != nil {
p.LinuxProfile = &v20160930.LinuxProfile{}
convertLinuxProfileToV20160930(api.LinuxProfile, p.LinuxProfile)
}
if api.WindowsProfile != nil {
p.WindowsProfile = &v20160930.WindowsProfile{}
convertWindowsProfileToV20160930(api.WindowsProfile, p.WindowsProfile)
}
if api.DiagnosticsProfile != nil {
p.DiagnosticsProfile = &v20160930.DiagnosticsProfile{}
convertDiagnosticsProfileToV20160930(api.DiagnosticsProfile, p.DiagnosticsProfile)
}
if api.JumpboxProfile != nil {
p.JumpboxProfile = &v20160930.JumpboxProfile{}
convertJumpboxProfileToV20160930(api.JumpboxProfile, p.JumpboxProfile)
}
if api.ServicePrincipalProfile != nil {
p.ServicePrincipalProfile = &v20160930.ServicePrincipalProfile{}
convertServicePrincipalProfileToV20160930(api.ServicePrincipalProfile, p.ServicePrincipalProfile)
}
if api.CustomProfile != nil {
p.CustomProfile = &v20160930.CustomProfile{}
convertCustomProfileToV20160930(api.CustomProfile, p.CustomProfile)
}
}
func convertPropertiesToV20160330(api *Properties, p *v20160330.Properties) {
p.ProvisioningState = v20160330.ProvisioningState(api.ProvisioningState)
if api.OrchestratorProfile != nil {
p.OrchestratorProfile = &v20160330.OrchestratorProfile{}
convertOrchestratorProfileToV20160330(api.OrchestratorProfile, p.OrchestratorProfile)
}
if api.MasterProfile != nil {
p.MasterProfile = &v20160330.MasterProfile{}
convertMasterProfileToV20160330(api.MasterProfile, p.MasterProfile)
}
p.AgentPoolProfiles = []*v20160330.AgentPoolProfile{}
// DCOS conversion logic
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 2 {
var privIndex, pubIndex int
for i, apiProfile := range api.AgentPoolProfiles {
// We added a pool with a "-public" suffix when converting to API model;
// we don't want to include that when converting back to a version-specific model
matched, err := regexp.MatchString(publicAgentPoolSuffix+"$", apiProfile.Name)
if !matched && err == nil {
v20160330Profile := &v20160330.AgentPoolProfile{}
convertAgentPoolProfileToV20160330(apiProfile, v20160330Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20160330Profile)
privIndex = i
} else {
pubIndex = i
}
}
// Assign DNS Prefix to private agent pool from public agent pool
p.AgentPoolProfiles[privIndex].DNSPrefix = api.AgentPoolProfiles[pubIndex].DNSPrefix
p.AgentPoolProfiles[privIndex].FQDN = api.AgentPoolProfiles[pubIndex].FQDN
} else {
for _, apiProfile := range api.AgentPoolProfiles {
v20160330Profile := &v20160330.AgentPoolProfile{}
convertAgentPoolProfileToV20160330(apiProfile, v20160330Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20160330Profile)
}
}
if api.LinuxProfile != nil {
p.LinuxProfile = &v20160330.LinuxProfile{}
convertLinuxProfileToV20160330(api.LinuxProfile, p.LinuxProfile)
}
if api.WindowsProfile != nil {
p.WindowsProfile = &v20160330.WindowsProfile{}
convertWindowsProfileToV20160330(api.WindowsProfile, p.WindowsProfile)
}
if api.DiagnosticsProfile != nil {
p.DiagnosticsProfile = &v20160330.DiagnosticsProfile{}
convertDiagnosticsProfileToV20160330(api.DiagnosticsProfile, p.DiagnosticsProfile)
}
if api.JumpboxProfile != nil {
p.JumpboxProfile = &v20160330.JumpboxProfile{}
convertJumpboxProfileToV20160330(api.JumpboxProfile, p.JumpboxProfile)
}
}
func convertPropertiesToV20170131(api *Properties, p *v20170131.Properties) {
p.ProvisioningState = v20170131.ProvisioningState(api.ProvisioningState)
if api.OrchestratorProfile != nil {
p.OrchestratorProfile = &v20170131.OrchestratorProfile{}
convertOrchestratorProfileToV20170131(api.OrchestratorProfile, p.OrchestratorProfile)
}
if api.MasterProfile != nil {
p.MasterProfile = &v20170131.MasterProfile{}
convertMasterProfileToV20170131(api.MasterProfile, p.MasterProfile)
}
p.AgentPoolProfiles = []*v20170131.AgentPoolProfile{}
// DCOS conversion logic
if api.OrchestratorProfile.IsDCOS() && len(api.AgentPoolProfiles) == 2 {
var privIndex, pubIndex int
for i, apiProfile := range api.AgentPoolProfiles {
// We added a pool with a "-public" suffix when converting to API model;
// we don't want to include that when converting back to a version-specific model
matched, err := regexp.MatchString(publicAgentPoolSuffix+"$", apiProfile.Name)
if !matched && err == nil {
v20170131Profile := &v20170131.AgentPoolProfile{}
convertAgentPoolProfileToV20170131(apiProfile, v20170131Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20170131Profile)
privIndex = i
} else {
pubIndex = i
}
}
// Assign DNS Prefix to private agent pool from public agent pool
p.AgentPoolProfiles[privIndex].DNSPrefix = api.AgentPoolProfiles[pubIndex].DNSPrefix
p.AgentPoolProfiles[privIndex].FQDN = api.AgentPoolProfiles[pubIndex].FQDN
} else {
for _, apiProfile := range api.AgentPoolProfiles {
v20170131Profile := &v20170131.AgentPoolProfile{}
convertAgentPoolProfileToV20170131(apiProfile, v20170131Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20170131Profile)
}
}
if api.LinuxProfile != nil {
p.LinuxProfile = &v20170131.LinuxProfile{}
convertLinuxProfileToV20170131(api.LinuxProfile, p.LinuxProfile)
}
if api.WindowsProfile != nil {
p.WindowsProfile = &v20170131.WindowsProfile{}
convertWindowsProfileToV20170131(api.WindowsProfile, p.WindowsProfile)
}
if api.DiagnosticsProfile != nil {
p.DiagnosticsProfile = &v20170131.DiagnosticsProfile{}
convertDiagnosticsProfileToV20170131(api.DiagnosticsProfile, p.DiagnosticsProfile)
}
if api.JumpboxProfile != nil {
p.JumpboxProfile = &v20170131.JumpboxProfile{}
convertJumpboxProfileToV20170131(api.JumpboxProfile, p.JumpboxProfile)
}
if api.ServicePrincipalProfile != nil {
p.ServicePrincipalProfile = &v20170131.ServicePrincipalProfile{}
convertServicePrincipalProfileToV20170131(api.ServicePrincipalProfile, p.ServicePrincipalProfile)
}
if api.CustomProfile != nil {
p.CustomProfile = &v20170131.CustomProfile{}
convertCustomProfileToV20170131(api.CustomProfile, p.CustomProfile)
}
}
func convertPropertiesToV20170701(api *Properties, p *v20170701.Properties) {
p.ProvisioningState = v20170701.ProvisioningState(api.ProvisioningState)
if api.OrchestratorProfile != nil {
p.OrchestratorProfile = &v20170701.OrchestratorProfile{}
convertOrchestratorProfileToV20170701(api.OrchestratorProfile, p.OrchestratorProfile)
}
if api.MasterProfile != nil {
p.MasterProfile = &v20170701.MasterProfile{}
convertMasterProfileToV20170701(api.MasterProfile, p.MasterProfile)
}
p.AgentPoolProfiles = []*v20170701.AgentPoolProfile{}
for _, apiProfile := range api.AgentPoolProfiles {
v20170701Profile := &v20170701.AgentPoolProfile{}
convertAgentPoolProfileToV20170701(apiProfile, v20170701Profile)
p.AgentPoolProfiles = append(p.AgentPoolProfiles, v20170701Profile)
}
if api.LinuxProfile != nil {
p.LinuxProfile = &v20170701.LinuxProfile{}
convertLinuxProfileToV20170701(api.LinuxProfile, p.LinuxProfile)
}
if api.WindowsProfile != nil {
p.WindowsProfile = &v20170701.WindowsProfile{}
convertWindowsProfileToV20170701(api.WindowsProfile, p.WindowsProfile)
}
if api.ServicePrincipalProfile != nil {
p.ServicePrincipalProfile = &v20170701.ServicePrincipalProfile{}
convertServicePrincipalProfileToV20170701(api.ServicePrincipalProfile, p.ServicePrincipalProfile)
}
if api.CustomProfile != nil {
p.CustomProfile = &v20170701.CustomProfile{}
convertCustomProfileToV20170701(api.CustomProfile, p.CustomProfile)
}
}
func convertPropertiesToVLabs(api *Properties, vlabsProps *vlabs.Properties) {
vlabsProps.ProvisioningState = vlabs.ProvisioningState(api.ProvisioningState)
if api.OrchestratorProfile != nil {
vlabsProps.OrchestratorProfile = &vlabs.OrchestratorProfile{}
convertOrchestratorProfileToVLabs(api.OrchestratorProfile, vlabsProps.OrchestratorProfile)
}
if api.MasterProfile != nil {
vlabsProps.MasterProfile = &vlabs.MasterProfile{}
convertMasterProfileToVLabs(api.MasterProfile, vlabsProps.MasterProfile)
}
vlabsProps.AgentPoolProfiles = []*vlabs.AgentPoolProfile{}
for _, apiProfile := range api.AgentPoolProfiles {
vlabsProfile := &vlabs.AgentPoolProfile{}
convertAgentPoolProfileToVLabs(apiProfile, vlabsProfile)
vlabsProps.AgentPoolProfiles = append(vlabsProps.AgentPoolProfiles, vlabsProfile)
}
if api.LinuxProfile != nil {
vlabsProps.LinuxProfile = &vlabs.LinuxProfile{}
convertLinuxProfileToVLabs(api.LinuxProfile, vlabsProps.LinuxProfile)
}
vlabsProps.ExtensionProfiles = []*vlabs.ExtensionProfile{}
for _, extensionProfile := range api.ExtensionProfiles {
vlabsExtensionProfile := &vlabs.ExtensionProfile{}
convertExtensionProfileToVLabs(extensionProfile, vlabsExtensionProfile)
vlabsProps.ExtensionProfiles = append(vlabsProps.ExtensionProfiles, vlabsExtensionProfile)
}
if api.WindowsProfile != nil {
vlabsProps.WindowsProfile = &vlabs.WindowsProfile{}
convertWindowsProfileToVLabs(api.WindowsProfile, vlabsProps.WindowsProfile)
}
if api.ServicePrincipalProfile != nil {
vlabsProps.ServicePrincipalProfile = &vlabs.ServicePrincipalProfile{}
convertServicePrincipalProfileToVLabs(api.ServicePrincipalProfile, vlabsProps.ServicePrincipalProfile)
}
if api.CertificateProfile != nil {
vlabsProps.CertificateProfile = &vlabs.CertificateProfile{}
convertCertificateProfileToVLabs(api.CertificateProfile, vlabsProps.CertificateProfile)
}
if api.AADProfile != nil {
vlabsProps.AADProfile = &vlabs.AADProfile{}
convertAADProfileToVLabs(api.AADProfile, vlabsProps.AADProfile)
}
}
func convertLinuxProfileToV20160930(api *LinuxProfile, obj *v20160930.LinuxProfile) {
obj.AdminUsername = api.AdminUsername
obj.SSH.PublicKeys = []v20160930.PublicKey{}
for _, d := range api.SSH.PublicKeys {
obj.SSH.PublicKeys = append(obj.SSH.PublicKeys, v20160930.PublicKey{
KeyData: d.KeyData,
})
}
}
func convertLinuxProfileToV20160330(api *LinuxProfile, obj *v20160330.LinuxProfile) {
obj.AdminUsername = api.AdminUsername
obj.SSH.PublicKeys = []v20160330.PublicKey{}
for _, d := range api.SSH.PublicKeys {
obj.SSH.PublicKeys = append(obj.SSH.PublicKeys, v20160330.PublicKey{
KeyData: d.KeyData,
})
}
}
func convertLinuxProfileToV20170131(api *LinuxProfile, obj *v20170131.LinuxProfile) {
obj.AdminUsername = api.AdminUsername
obj.SSH.PublicKeys = []v20170131.PublicKey{}
for _, d := range api.SSH.PublicKeys {
obj.SSH.PublicKeys = append(obj.SSH.PublicKeys, v20170131.PublicKey{KeyData: d.KeyData})
}
}
func convertExtensionProfileToVLabs(api *ExtensionProfile, obj *vlabs.ExtensionProfile) {
obj.Name = api.Name
obj.Version = api.Version
obj.ExtensionParameters = api.ExtensionParameters
if api.ExtensionParametersKeyVaultRef != nil {
obj.ExtensionParametersKeyVaultRef = &vlabs.KeyvaultSecretRef{
VaultID: api.ExtensionParametersKeyVaultRef.VaultID,
SecretName: api.ExtensionParametersKeyVaultRef.SecretName,
SecretVersion: api.ExtensionParametersKeyVaultRef.SecretVersion,
}
}
obj.RootURL = api.RootURL
obj.Script = api.Script
obj.URLQuery = api.URLQuery
}
func convertExtensionToVLabs(api *Extension, vlabs *vlabs.Extension) {
vlabs.Name = api.Name
vlabs.SingleOrAll = api.SingleOrAll
vlabs.Template = api.Template
}
func convertLinuxProfileToV20170701(api *LinuxProfile, obj *v20170701.LinuxProfile) {
obj.AdminUsername = api.AdminUsername
obj.SSH.PublicKeys = []v20170701.PublicKey{}
for _, d := range api.SSH.PublicKeys {
obj.SSH.PublicKeys = append(obj.SSH.PublicKeys, v20170701.PublicKey{
KeyData: d.KeyData,
})
}
}
func convertLinuxProfileToVLabs(obj *LinuxProfile, vlabsProfile *vlabs.LinuxProfile) {
vlabsProfile.AdminUsername = obj.AdminUsername
vlabsProfile.SSH.PublicKeys = []vlabs.PublicKey{}
for _, d := range obj.SSH.PublicKeys {
vlabsProfile.SSH.PublicKeys = append(vlabsProfile.SSH.PublicKeys,
vlabs.PublicKey{KeyData: d.KeyData})
}
vlabsProfile.Secrets = []vlabs.KeyVaultSecrets{}
for _, s := range obj.Secrets {
secret := &vlabs.KeyVaultSecrets{}
convertKeyVaultSecretsToVlabs(&s, secret)
vlabsProfile.Secrets = append(vlabsProfile.Secrets, *secret)
}
vlabsProfile.ScriptRootURL = obj.ScriptRootURL
}
func convertWindowsProfileToV20160930(api *WindowsProfile, v20160930 *v20160930.WindowsProfile) {
v20160930.AdminUsername = api.AdminUsername
v20160930.AdminPassword = api.AdminPassword
}
func convertWindowsProfileToV20160330(api *WindowsProfile, v20160330 *v20160330.WindowsProfile) {
v20160330.AdminUsername = api.AdminUsername
v20160330.AdminPassword = api.AdminPassword
}
func convertWindowsProfileToV20170131(api *WindowsProfile, v20170131 *v20170131.WindowsProfile) {
v20170131.AdminUsername = api.AdminUsername
v20170131.AdminPassword = api.AdminPassword
}
func convertWindowsProfileToV20170701(api *WindowsProfile, v20170701Profile *v20170701.WindowsProfile) {
v20170701Profile.AdminUsername = api.AdminUsername
v20170701Profile.AdminPassword = api.AdminPassword
}
func convertWindowsProfileToVLabs(api *WindowsProfile, vlabsProfile *vlabs.WindowsProfile) {
vlabsProfile.AdminUsername = api.AdminUsername
vlabsProfile.AdminPassword = api.AdminPassword
vlabsProfile.ImageVersion = api.ImageVersion
vlabsProfile.WindowsImageSourceURL = api.WindowsImageSourceURL
vlabsProfile.Secrets = []vlabs.KeyVaultSecrets{}
for _, s := range api.Secrets {
secret := &vlabs.KeyVaultSecrets{}
convertKeyVaultSecretsToVlabs(&s, secret)
vlabsProfile.Secrets = append(vlabsProfile.Secrets, *secret)
}
}
func convertOrchestratorProfileToV20160930(api *OrchestratorProfile, o *v20160930.OrchestratorProfile) {
if strings.HasPrefix(api.OrchestratorType, v20160930.DCOS) {
o.OrchestratorType = v20160930.DCOS
} else {
o.OrchestratorType = api.OrchestratorType
}
}
func convertOrchestratorProfileToV20160330(api *OrchestratorProfile, o *v20160330.OrchestratorProfile) {
if strings.HasPrefix(api.OrchestratorType, v20160330.DCOS) {
o.OrchestratorType = v20160330.DCOS
} else {
o.OrchestratorType = api.OrchestratorType
}
}
func convertOrchestratorProfileToV20170131(api *OrchestratorProfile, o *v20170131.OrchestratorProfile) {
if strings.HasPrefix(api.OrchestratorType, v20170131.DCOS) {
o.OrchestratorType = v20170131.DCOS
} else {
o.OrchestratorType = api.OrchestratorType
}
}
func convertOrchestratorProfileToV20170701(api *OrchestratorProfile, o *v20170701.OrchestratorProfile) {
if api.OrchestratorType == SwarmMode {
o.OrchestratorType = v20170701.DockerCE
} else {
o.OrchestratorType = api.OrchestratorType
}
if api.OrchestratorVersion != "" {
o.OrchestratorVersion = api.OrchestratorVersion
}
}
func convertOrchestratorProfileToVLabs(api *OrchestratorProfile, o *vlabs.OrchestratorProfile) {
o.OrchestratorType = api.OrchestratorType
if api.OrchestratorVersion != "" {
o.OrchestratorVersion = api.OrchestratorVersion
sv, _ := semver.NewVersion(o.OrchestratorVersion)
o.OrchestratorRelease = fmt.Sprintf("%d.%d", sv.Major(), sv.Minor())
}
if api.KubernetesConfig != nil {
o.KubernetesConfig = &vlabs.KubernetesConfig{}
convertKubernetesConfigToVLabs(api.KubernetesConfig, o.KubernetesConfig)
}
if api.DcosConfig != nil {
o.DcosConfig = &vlabs.DcosConfig{}
convertDcosConfigToVLabs(api.DcosConfig, o.DcosConfig)
}
}
func convertDcosConfigToVLabs(api *DcosConfig, vlabs *vlabs.DcosConfig) {
vlabs.DcosBootstrapURL = api.DcosBootstrapURL
vlabs.DcosWindowsBootstrapURL = api.DcosWindowsBootstrapURL
if api.Registry != "" {
vlabs.Registry = api.Registry
}
if api.RegistryUser != "" {
vlabs.RegistryUser = api.RegistryUser
}
if api.RegistryPass != "" {
vlabs.RegistryPass = api.RegistryPass
}
vlabs.DcosRepositoryURL = api.DcosRepositoryURL
vlabs.DcosClusterPackageListID = api.DcosClusterPackageListID
vlabs.DcosProviderPackageID = api.DcosProviderPackageID
}
func convertKubernetesConfigToVLabs(api *KubernetesConfig, vlabs *vlabs.KubernetesConfig) {
vlabs.KubernetesImageBase = api.KubernetesImageBase
vlabs.ClusterSubnet = api.ClusterSubnet
vlabs.DNSServiceIP = api.DNSServiceIP
vlabs.ServiceCidr = api.ServiceCIDR
vlabs.NetworkPolicy = api.NetworkPolicy
vlabs.MaxPods = api.MaxPods
vlabs.DockerBridgeSubnet = api.DockerBridgeSubnet
vlabs.CloudProviderBackoff = api.CloudProviderBackoff
vlabs.CloudProviderBackoffDuration = api.CloudProviderBackoffDuration
vlabs.CloudProviderBackoffExponent = api.CloudProviderBackoffExponent
vlabs.CloudProviderBackoffJitter = api.CloudProviderBackoffJitter
vlabs.CloudProviderBackoffRetries = api.CloudProviderBackoffRetries
vlabs.CloudProviderRateLimit = api.CloudProviderRateLimit
vlabs.CloudProviderRateLimitBucket = api.CloudProviderRateLimitBucket
vlabs.CloudProviderRateLimitQPS = api.CloudProviderRateLimitQPS
vlabs.UseManagedIdentity = api.UseManagedIdentity
vlabs.CustomHyperkubeImage = api.CustomHyperkubeImage
vlabs.DockerEngineVersion = api.DockerEngineVersion
vlabs.CustomCcmImage = api.CustomCcmImage
vlabs.UseCloudControllerManager = api.UseCloudControllerManager
vlabs.UseInstanceMetadata = api.UseInstanceMetadata
vlabs.EnableRbac = api.EnableRbac
vlabs.EnableSecureKubelet = api.EnableSecureKubelet
vlabs.EnableAggregatedAPIs = api.EnableAggregatedAPIs
vlabs.EnableDataEncryptionAtRest = api.EnableDataEncryptionAtRest
vlabs.EnablePodSecurityPolicy = api.EnablePodSecurityPolicy
vlabs.GCHighThreshold = api.GCHighThreshold
vlabs.GCLowThreshold = api.GCLowThreshold
vlabs.EtcdVersion = api.EtcdVersion
vlabs.EtcdDiskSizeGB = api.EtcdDiskSizeGB
convertAddonsToVlabs(api, vlabs)
convertKubeletConfigToVlabs(api, vlabs)
convertControllerManagerConfigToVlabs(api, vlabs)
convertCloudControllerManagerConfigToVlabs(api, vlabs)
convertAPIServerConfigToVlabs(api, vlabs)
convertSchedulerConfigToVlabs(api, vlabs)
convertPrivateClusterToVlabs(api, vlabs)
}
func convertKubeletConfigToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.KubeletConfig = map[string]string{}
for key, val := range a.KubeletConfig {
v.KubeletConfig[key] = val
}
}
func convertControllerManagerConfigToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.ControllerManagerConfig = map[string]string{}
for key, val := range a.ControllerManagerConfig {
v.ControllerManagerConfig[key] = val
}
}
func convertCloudControllerManagerConfigToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.CloudControllerManagerConfig = map[string]string{}
for key, val := range a.CloudControllerManagerConfig {
v.CloudControllerManagerConfig[key] = val
}
}
func convertAPIServerConfigToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.APIServerConfig = map[string]string{}
for key, val := range a.APIServerConfig {
v.APIServerConfig[key] = val
}
}
func convertSchedulerConfigToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.SchedulerConfig = map[string]string{}
for key, val := range a.SchedulerConfig {
v.SchedulerConfig[key] = val
}
}
func convertPrivateClusterToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
if a.PrivateCluster != nil {
v.PrivateCluster = &vlabs.PrivateCluster{}
v.PrivateCluster.Enabled = a.PrivateCluster.Enabled
if a.PrivateCluster.JumpboxProfile != nil {
v.PrivateCluster.JumpboxProfile = &vlabs.PrivateJumpboxProfile{}
convertPrivateJumpboxProfileToVlabs(a.PrivateCluster.JumpboxProfile, v.PrivateCluster.JumpboxProfile)
}
}
}
func convertPrivateJumpboxProfileToVlabs(api *PrivateJumpboxProfile, vlabsProfile *vlabs.PrivateJumpboxProfile) {
vlabsProfile.Name = api.Name
vlabsProfile.OSDiskSizeGB = api.OSDiskSizeGB
vlabsProfile.VMSize = api.VMSize
vlabsProfile.PublicKey = api.PublicKey
vlabsProfile.Username = api.Username
vlabsProfile.StorageProfile = api.StorageProfile
}
func convertAddonsToVlabs(a *KubernetesConfig, v *vlabs.KubernetesConfig) {
v.Addons = []vlabs.KubernetesAddon{}
for i := range a.Addons {
v.Addons = append(v.Addons, vlabs.KubernetesAddon{
Name: a.Addons[i].Name,
Enabled: a.Addons[i].Enabled,
Config: map[string]string{},
})
for j := range a.Addons[i].Containers {
v.Addons[i].Containers = append(v.Addons[i].Containers, vlabs.KubernetesContainerSpec{
Name: a.Addons[i].Containers[j].Name,
Image: a.Addons[i].Containers[j].Image,
CPURequests: a.Addons[i].Containers[j].CPURequests,
MemoryRequests: a.Addons[i].Containers[j].MemoryRequests,
CPULimits: a.Addons[i].Containers[j].CPULimits,
MemoryLimits: a.Addons[i].Containers[j].MemoryLimits,
})
}
if a.Addons[i].Config != nil {
for key, val := range a.Addons[i].Config {
v.Addons[i].Config[key] = val
}
}
}
}
func convertMasterProfileToV20160930(api *MasterProfile, v20160930 *v20160930.MasterProfile) {
v20160930.Count = api.Count
v20160930.DNSPrefix = api.DNSPrefix
v20160930.FQDN = api.FQDN
v20160930.SetSubnet(api.Subnet)
}
func convertMasterProfileToV20160330(api *MasterProfile, v20160330 *v20160330.MasterProfile) {
v20160330.Count = api.Count
v20160330.DNSPrefix = api.DNSPrefix
v20160330.FQDN = api.FQDN
v20160330.SetSubnet(api.Subnet)
}
func convertMasterProfileToV20170131(api *MasterProfile, v20170131 *v20170131.MasterProfile) {
v20170131.Count = api.Count
v20170131.DNSPrefix = api.DNSPrefix
v20170131.FQDN = api.FQDN
v20170131.SetSubnet(api.Subnet)
}
func convertMasterProfileToV20170701(api *MasterProfile, v20170701Profile *v20170701.MasterProfile) {
v20170701Profile.Count = api.Count
v20170701Profile.DNSPrefix = api.DNSPrefix
v20170701Profile.FQDN = api.FQDN
v20170701Profile.SetSubnet(api.Subnet)
v20170701Profile.VMSize = api.VMSize
v20170701Profile.OSDiskSizeGB = api.OSDiskSizeGB
v20170701Profile.VnetSubnetID = api.VnetSubnetID
v20170701Profile.FirstConsecutiveStaticIP = api.FirstConsecutiveStaticIP
v20170701Profile.StorageProfile = api.StorageProfile
}
func convertMasterProfileToVLabs(api *MasterProfile, vlabsProfile *vlabs.MasterProfile) {
vlabsProfile.Count = api.Count
vlabsProfile.DNSPrefix = api.DNSPrefix
vlabsProfile.VMSize = api.VMSize
vlabsProfile.OSDiskSizeGB = api.OSDiskSizeGB
vlabsProfile.VnetSubnetID = api.VnetSubnetID
vlabsProfile.FirstConsecutiveStaticIP = api.FirstConsecutiveStaticIP
vlabsProfile.VnetCidr = api.VnetCidr
vlabsProfile.SetSubnet(api.Subnet)
vlabsProfile.FQDN = api.FQDN
vlabsProfile.StorageProfile = api.StorageProfile
if api.PreprovisionExtension != nil {
vlabsExtension := &vlabs.Extension{}
convertExtensionToVLabs(api.PreprovisionExtension, vlabsExtension)
vlabsProfile.PreProvisionExtension = vlabsExtension
}
vlabsProfile.Extensions = []vlabs.Extension{}
for _, extension := range api.Extensions {
vlabsExtension := &vlabs.Extension{}
convertExtensionToVLabs(&extension, vlabsExtension)
vlabsProfile.Extensions = append(vlabsProfile.Extensions, *vlabsExtension)
}
vlabsProfile.Distro = vlabs.Distro(api.Distro)
if api.KubernetesConfig != nil {
vlabsProfile.KubernetesConfig = &vlabs.KubernetesConfig{}
convertKubernetesConfigToVLabs(api.KubernetesConfig, vlabsProfile.KubernetesConfig)
}
if api.ImageRef != nil {
vlabsProfile.ImageRef = &vlabs.ImageReference{}
vlabsProfile.ImageRef.Name = api.ImageRef.Name
vlabsProfile.ImageRef.ResourceGroup = api.ImageRef.ResourceGroup
}
}
func convertKeyVaultSecretsToVlabs(api *KeyVaultSecrets, vlabsSecrets *vlabs.KeyVaultSecrets) {
vlabsSecrets.SourceVault = &vlabs.KeyVaultID{ID: api.SourceVault.ID}
vlabsSecrets.VaultCertificates = []vlabs.KeyVaultCertificate{}
for _, c := range api.VaultCertificates {
cert := vlabs.KeyVaultCertificate{}
cert.CertificateStore = c.CertificateStore
cert.CertificateURL = c.CertificateURL
vlabsSecrets.VaultCertificates = append(vlabsSecrets.VaultCertificates, cert)
}
}
func convertAgentPoolProfileToV20160930(api *AgentPoolProfile, p *v20160930.AgentPoolProfile) {
p.Name = api.Name
p.Count = api.Count
p.VMSize = api.VMSize
p.DNSPrefix = api.DNSPrefix
p.FQDN = api.FQDN
p.OSType = v20160930.OSType(api.OSType)
p.SetSubnet(api.Subnet)
}
func convertAgentPoolProfileToV20160330(api *AgentPoolProfile, p *v20160330.AgentPoolProfile) {
p.Name = api.Name
p.Count = api.Count
p.VMSize = api.VMSize
p.DNSPrefix = api.DNSPrefix
p.FQDN = api.FQDN
p.OSType = v20160330.OSType(api.OSType)
p.SetSubnet(api.Subnet)
}
func convertAgentPoolProfileToV20170131(api *AgentPoolProfile, p *v20170131.AgentPoolProfile) {
p.Name = api.Name
p.Count = api.Count
p.VMSize = api.VMSize
p.DNSPrefix = api.DNSPrefix
p.FQDN = api.FQDN
p.OSType = v20170131.OSType(api.OSType)
p.SetSubnet(api.Subnet)
}
func convertAgentPoolProfileToV20170701(api *AgentPoolProfile, p *v20170701.AgentPoolProfile) {
p.Name = api.Name
p.Count = api.Count
p.VMSize = api.VMSize
p.DNSPrefix = api.DNSPrefix
p.FQDN = api.FQDN
p.OSType = v20170701.OSType(api.OSType)
p.SetSubnet(api.Subnet)
p.OSDiskSizeGB = api.OSDiskSizeGB
p.Ports = []int{}
p.Ports = append(p.Ports, api.Ports...)
p.StorageProfile = api.StorageProfile
p.VnetSubnetID = api.VnetSubnetID
}
func convertAgentPoolProfileToVLabs(api *AgentPoolProfile, p *vlabs.AgentPoolProfile) {
p.Name = api.Name
p.Count = api.Count
p.VMSize = api.VMSize
p.OSDiskSizeGB = api.OSDiskSizeGB
p.DNSPrefix = api.DNSPrefix
p.OSType = vlabs.OSType(api.OSType)
p.Ports = []int{}
p.Ports = append(p.Ports, api.Ports...)
p.AvailabilityProfile = api.AvailabilityProfile
p.StorageProfile = api.StorageProfile
p.DiskSizesGB = []int{}
p.DiskSizesGB = append(p.DiskSizesGB, api.DiskSizesGB...)
p.VnetSubnetID = api.VnetSubnetID
p.SetSubnet(api.Subnet)
p.FQDN = api.FQDN
p.CustomNodeLabels = map[string]string{}
for k, v := range api.CustomNodeLabels {
p.CustomNodeLabels[k] = v
}
if api.PreprovisionExtension != nil {
vlabsExtension := &vlabs.Extension{}
convertExtensionToVLabs(api.PreprovisionExtension, vlabsExtension)
p.PreProvisionExtension = vlabsExtension
}
p.Extensions = []vlabs.Extension{}
for _, extension := range api.Extensions {
vlabsExtension := &vlabs.Extension{}
convertExtensionToVLabs(&extension, vlabsExtension)
p.Extensions = append(p.Extensions, *vlabsExtension)
}
p.Distro = vlabs.Distro(api.Distro)
if api.KubernetesConfig != nil {
p.KubernetesConfig = &vlabs.KubernetesConfig{}
convertKubernetesConfigToVLabs(api.KubernetesConfig, p.KubernetesConfig)
}
if api.ImageRef != nil {
p.ImageRef = &vlabs.ImageReference{}
p.ImageRef.Name = api.ImageRef.Name
p.ImageRef.ResourceGroup = api.ImageRef.ResourceGroup
}
}
func convertDiagnosticsProfileToV20160930(api *DiagnosticsProfile, dp *v20160930.DiagnosticsProfile) {
if api.VMDiagnostics != nil {
dp.VMDiagnostics = &v20160930.VMDiagnostics{}
convertVMDiagnosticsToV20160930(api.VMDiagnostics, dp.VMDiagnostics)
}
}
func convertVMDiagnosticsToV20160930(api *VMDiagnostics, v20160930 *v20160930.VMDiagnostics) {
v20160930.Enabled = api.Enabled
v20160930.StorageURL = api.StorageURL
}
func convertDiagnosticsProfileToV20160330(api *DiagnosticsProfile, dp *v20160330.DiagnosticsProfile) {
if api.VMDiagnostics != nil {
dp.VMDiagnostics = &v20160330.VMDiagnostics{}
convertVMDiagnosticsToV20160330(api.VMDiagnostics, dp.VMDiagnostics)
}
}
func convertVMDiagnosticsToV20160330(api *VMDiagnostics, v20160330 *v20160330.VMDiagnostics) {
v20160330.Enabled = api.Enabled
v20160330.StorageURL = api.StorageURL
}
func convertDiagnosticsProfileToV20170131(api *DiagnosticsProfile, dp *v20170131.DiagnosticsProfile) {
if api.VMDiagnostics != nil {
dp.VMDiagnostics = &v20170131.VMDiagnostics{}
convertVMDiagnosticsToV20170131(api.VMDiagnostics, dp.VMDiagnostics)
}
}
func convertVMDiagnosticsToV20170131(api *VMDiagnostics, v20170131 *v20170131.VMDiagnostics) {
v20170131.Enabled = api.Enabled
v20170131.StorageURL = api.StorageURL
}
func convertJumpboxProfileToV20160930(api *JumpboxProfile, jb *v20160930.JumpboxProfile) {
jb.OSType = v20160930.OSType(api.OSType)
jb.DNSPrefix = api.DNSPrefix
jb.FQDN = api.FQDN
}
func convertJumpboxProfileToV20160330(api *JumpboxProfile, jb *v20160330.JumpboxProfile) {
jb.OSType = v20160330.OSType(api.OSType)
jb.DNSPrefix = api.DNSPrefix
jb.FQDN = api.FQDN
}
func convertJumpboxProfileToV20170131(api *JumpboxProfile, jb *v20170131.JumpboxProfile) {