Skip to content

Commit

Permalink
wip: embed objects
Browse files Browse the repository at this point in the history
  • Loading branch information
katallaxie committed Mar 7, 2024
1 parent 1135981 commit debf967
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 65 deletions.
3 changes: 2 additions & 1 deletion api/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ info:
url: 'https://www.apache.org/licenses/LICENSE-2.0.html'

servers:
- url: /v1
- url: http://localhost:8080/api/v1
description: Development server

tags:
- name: System
Expand Down
46 changes: 7 additions & 39 deletions pkg/apis/flow/v1alpha1/bridge_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"

"github.com/zeiss/typhoon/pkg/apis/common/v1alpha1"
)
Expand Down Expand Up @@ -30,46 +31,13 @@ type BridgeSpec struct {
}

// Component holds a component of a bridge.
// +k8s:deepcopy-gen=false
type Component struct {
Object isBridgeObject_BridgeObject `json:"object"`
}

// GetObject return the object of the component.
func (c *Component) GetObject() isBridgeObject_BridgeObject {
if c != nil {
return c.Object
}

return nil
}

// GetTransformation returns the transformation of the component.
func (c *Component) GetTransformation() *BridgeObject_Transformation {
if x, ok := c.GetObject().(*BridgeObject_Transformation); ok {
return x
}

return nil
}

// DeepCopy is a helper function for deepcopy-gen.
func (in *Component) DeepCopy() *Component {
if in == nil {
return nil
}
out := new(Component)
in.DeepCopyInto(out)

return out
}

// DeepCopyInto is a helper function for deepcopy-gen.
func (in *Component) DeepCopyInto(out *Component) {
*out = *in
if in.GetTransformation() != nil {
in.GetTransformation().DeepCopyInto(out.GetTransformation())
}
// Object is the component object.
// +optional
// +nullable
// +kubebuilder:pruning:PreserveUnknownFields
// x-kubernetes-embedded-resource: false
Object runtime.RawExtension `json:"object,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
Expand Down
17 changes: 17 additions & 0 deletions pkg/apis/flow/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 25 additions & 25 deletions pkg/apis/models.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit debf967

Please sign in to comment.