forked from Azure/acs-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
merge.go
28 lines (26 loc) · 777 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
package v20170131
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
}