forked from Azure/aks-engine
/
merge.go
31 lines (28 loc) · 874 Bytes
/
merge.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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
package v20170701
import (
"github.com/imdario/mergo"
)
// Merge existing containerService attribute into cs
func (cs *ContainerService) Merge(ecs *ContainerService) error {
if ecs.Properties.ServicePrincipalProfile != nil {
if cs.Properties.ServicePrincipalProfile == nil {
cs.Properties.ServicePrincipalProfile = &ServicePrincipalProfile{}
}
if err := mergo.Merge(cs.Properties.ServicePrincipalProfile,
*ecs.Properties.ServicePrincipalProfile); err != nil {
return err
}
}
if ecs.Properties.WindowsProfile != nil {
if cs.Properties.WindowsProfile == nil {
cs.Properties.WindowsProfile = &WindowsProfile{}
}
if err := mergo.Merge(cs.Properties.WindowsProfile,
*ecs.Properties.WindowsProfile); err != nil {
return err
}
}
return nil
}