-
Notifications
You must be signed in to change notification settings - Fork 33
/
conversions.go
42 lines (34 loc) · 1.57 KB
/
conversions.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
package applications
import (
argocdv1alpha1 "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1"
extv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
"k8s.io/apimachinery/pkg/runtime"
"github.com/crossplane-contrib/provider-argocd/apis/applications/v1alpha1"
)
// Converter helps to convert ArgoCD types to api types of this provider and vise-versa
// From & To shall both be defined for each type conversion, to prevent diverge from ArgoCD Types
// goverter:converter
// goverter:useZeroValueOnPointerInconsistency
// goverter:ignoreUnexported
// goverter:extend ExtV1JSONToRuntimeRawExtension
// goverter:struct:comment // +k8s:deepcopy-gen=false
// goverter:output:file ./zz_generated.conversion.go
// goverter:output:package github.com/crossplane-contrib/provider-argocd/pkg/clients/applications
// +k8s:deepcopy-gen=false
type Converter interface {
// goverter:ignore ServerRef
// goverter:ignore ServerSelector
// goverter:ignore NameRef
// goverter:ignore NameSelector
FromArgoDestination(in argocdv1alpha1.ApplicationDestination) v1alpha1.ApplicationDestination
ToArgoDestination(in v1alpha1.ApplicationDestination) argocdv1alpha1.ApplicationDestination
ToArgoApplicationSpec(in *v1alpha1.ApplicationParameters) *argocdv1alpha1.ApplicationSpec
FromArgoApplicationStatus(in *argocdv1alpha1.ApplicationStatus) *v1alpha1.ArgoApplicationStatus
}
// ExtV1JSONToRuntimeRawExtension converts an extv1.JSON into a
// *runtime.RawExtension.
func ExtV1JSONToRuntimeRawExtension(in extv1.JSON) *runtime.RawExtension {
return &runtime.RawExtension{
Raw: in.Raw,
}
}