forked from Azure/azure-service-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azuresqlfailovergroup_conversion.go
56 lines (43 loc) · 1.71 KB
/
azuresqlfailovergroup_conversion.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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
package v1alpha1
import (
"github.com/Azure/azure-service-operator/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
func (src *AzureSqlFailoverGroup) ConvertTo(dstRaw conversion.Hub) error {
dst := dstRaw.(*v1beta1.AzureSqlFailoverGroup)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.FailoverGracePeriod = src.Spec.FailoverGracePeriod
dst.Spec.FailoverPolicy = v1beta1.ReadWriteEndpointFailoverPolicy(src.Spec.FailoverPolicy)
dst.Spec.SecondaryServer = src.Spec.SecondaryServer
dst.Spec.SecondaryServerResourceGroup = src.Spec.SecondaryServerResourceGroup
dst.Spec.DatabaseList = src.Spec.DatabaseList
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets
// Status
dst.Status = v1beta1.ASOStatus(src.Status)
return nil
}
func (dst *AzureSqlFailoverGroup) ConvertFrom(srcRaw conversion.Hub) error {
src := srcRaw.(*v1beta1.AzureSqlFailoverGroup)
// ObjectMeta
dst.ObjectMeta = src.ObjectMeta
// Spec
dst.Spec.ResourceGroup = src.Spec.ResourceGroup
dst.Spec.Location = src.Spec.Location
dst.Spec.Server = src.Spec.Server
dst.Spec.FailoverGracePeriod = src.Spec.FailoverGracePeriod
dst.Spec.FailoverPolicy = ReadWriteEndpointFailoverPolicy(src.Spec.FailoverPolicy)
dst.Spec.SecondaryServer = src.Spec.SecondaryServer
dst.Spec.SecondaryServerResourceGroup = src.Spec.SecondaryServerResourceGroup
dst.Spec.DatabaseList = src.Spec.DatabaseList
dst.Spec.KeyVaultToStoreSecrets = src.Spec.KeyVaultToStoreSecrets
// Status
dst.Status = ASOStatus(src.Status)
return nil
}