Skip to content

Commit

Permalink
feat: add interface for WebhooksClient (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
rangoo94 authored Oct 18, 2024
1 parent b25a048 commit 515e6a3
Show file tree
Hide file tree
Showing 2 changed files with 150 additions and 0 deletions.
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

0 comments on commit 515e6a3

Please sign in to comment.