Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add interface for WebhooksClient #303

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions pkg/client/executors/v1/mock_webhooks.go

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

12 changes: 12 additions & 0 deletions pkg/client/executors/v1/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,24 @@ import (
"fmt"

executorsv1 "github.com/kubeshop/testkube-operator/api/executor/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/labels"
"sigs.k8s.io/controller-runtime/pkg/client"
)

//go:generate mockgen -destination=./mock_webhooks.go -package=executors "github.com/kubeshop/testkube-operator/pkg/client/executors/v1" WebhooksInterface
type WebhooksInterface interface {
List(selector string) (*executorsv1.WebhookList, error)
Get(name string) (*executorsv1.Webhook, error)
GetByEvent(event executorsv1.EventType) (*executorsv1.WebhookList, error)
Create(webhook *executorsv1.Webhook) (*executorsv1.Webhook, error)
Update(webhook *executorsv1.Webhook) (*executorsv1.Webhook, error)
Delete(name string) error
DeleteByLabels(selector string) error
}

// NewWebhooksClient returns new client instance, needs kubernetes client to be passed as dependecy
func NewWebhooksClient(client client.Client, namespace string) *WebhooksClient {
return &WebhooksClient{
Expand Down
Loading