Skip to content

Commit

Permalink
chore!: change map and filter from string to object
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Aug 30, 2021
1 parent b4376d0 commit 0d5175c
Show file tree
Hide file tree
Showing 24 changed files with 978 additions and 450 deletions.
6 changes: 4 additions & 2 deletions api/v1alpha1/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ package v1alpha1

import corev1 "k8s.io/api/core/v1"

type Filter string
type Filter struct {
Expression string `json:"expression" protobuf:"bytes,1,opt,name=expression"`
}

func (m Filter) getContainer(req getContainerReq) corev1.Container {
return containerBuilder{}.
init(req).
args("filter", string(m)).
args("filter", m.Expression).
build()
}
2 changes: 1 addition & 1 deletion api/v1alpha1/filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
)

func TestFilter_getContainer(t *testing.T) {
const x Filter = "my-filter"
x := &Filter{Expression: "my-filter"}
c := x.getContainer(getContainerReq{})
assert.Equal(t, []string{"filter", "my-filter"}, c.Args)
}
Loading

0 comments on commit 0d5175c

Please sign in to comment.