-
Notifications
You must be signed in to change notification settings - Fork 119
/
zz_generated.conversion_spokes.go
executable file
·54 lines (47 loc) · 2.19 KB
/
zz_generated.conversion_spokes.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
// SPDX-FileCopyrightText: 2024 The Crossplane Authors <https://crossplane.io>
//
// SPDX-License-Identifier: Apache-2.0
// Code generated by upjet. DO NOT EDIT.
package v1beta1
import (
ujconversion "github.com/crossplane/upjet/pkg/controller/conversion"
"github.com/crossplane/upjet/pkg/resource"
"github.com/pkg/errors"
"sigs.k8s.io/controller-runtime/pkg/conversion"
)
// ConvertTo converts this Pipeline to the hub type.
func (tr *Pipeline) ConvertTo(dstRaw conversion.Hub) error {
spokeVersion := tr.GetObjectKind().GroupVersionKind().Version
hubVersion := dstRaw.GetObjectKind().GroupVersionKind().Version
if err := ujconversion.RoundTrip(dstRaw.(resource.Terraformed), tr); err != nil {
return errors.Wrapf(err, "cannot convert from the spoke version %q to the hub version %q", spokeVersion, hubVersion)
}
return nil
}
// ConvertFrom converts from the hub type to the Pipeline type.
func (tr *Pipeline) ConvertFrom(srcRaw conversion.Hub) error {
spokeVersion := tr.GetObjectKind().GroupVersionKind().Version
hubVersion := srcRaw.GetObjectKind().GroupVersionKind().Version
if err := ujconversion.RoundTrip(tr, srcRaw.(resource.Terraformed)); err != nil {
return errors.Wrapf(err, "cannot convert from the hub version %q to the spoke version %q", hubVersion, spokeVersion)
}
return nil
}
// ConvertTo converts this Preset to the hub type.
func (tr *Preset) ConvertTo(dstRaw conversion.Hub) error {
spokeVersion := tr.GetObjectKind().GroupVersionKind().Version
hubVersion := dstRaw.GetObjectKind().GroupVersionKind().Version
if err := ujconversion.RoundTrip(dstRaw.(resource.Terraformed), tr); err != nil {
return errors.Wrapf(err, "cannot convert from the spoke version %q to the hub version %q", spokeVersion, hubVersion)
}
return nil
}
// ConvertFrom converts from the hub type to the Preset type.
func (tr *Preset) ConvertFrom(srcRaw conversion.Hub) error {
spokeVersion := tr.GetObjectKind().GroupVersionKind().Version
hubVersion := srcRaw.GetObjectKind().GroupVersionKind().Version
if err := ujconversion.RoundTrip(tr, srcRaw.(resource.Terraformed)); err != nil {
return errors.Wrapf(err, "cannot convert from the hub version %q to the spoke version %q", hubVersion, spokeVersion)
}
return nil
}