2024-04-29 16:03:48 +00:00
|
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
|
2024-09-08 19:57:29 +00:00
|
|
|
package kubeclient
|
2024-04-29 16:03:48 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net"
|
2024-09-08 18:06:07 +00:00
|
|
|
|
2024-09-08 19:57:29 +00:00
|
|
|
"tailscale.com/kube/kubeapi"
|
2024-04-29 16:03:48 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var _ Client = &FakeClient{}
|
|
|
|
|
|
|
|
type FakeClient struct {
|
2024-09-08 18:06:07 +00:00
|
|
|
GetSecretImpl func(context.Context, string) (*kubeapi.Secret, error)
|
2024-04-29 16:03:48 +00:00
|
|
|
CheckSecretPermissionsImpl func(ctx context.Context, name string) (bool, bool, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (fc *FakeClient) CheckSecretPermissions(ctx context.Context, name string) (bool, bool, error) {
|
|
|
|
return fc.CheckSecretPermissionsImpl(ctx, name)
|
|
|
|
}
|
2024-09-08 18:06:07 +00:00
|
|
|
func (fc *FakeClient) GetSecret(ctx context.Context, name string) (*kubeapi.Secret, error) {
|
2024-04-29 16:03:48 +00:00
|
|
|
return fc.GetSecretImpl(ctx, name)
|
|
|
|
}
|
|
|
|
func (fc *FakeClient) SetURL(_ string) {}
|
|
|
|
func (fc *FakeClient) SetDialer(dialer func(ctx context.Context, network, addr string) (net.Conn, error)) {
|
|
|
|
}
|
2024-09-08 18:06:07 +00:00
|
|
|
func (fc *FakeClient) StrategicMergePatchSecret(context.Context, string, *kubeapi.Secret, string) error {
|
2024-04-29 16:03:48 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (fc *FakeClient) JSONPatchSecret(context.Context, string, []JSONPatch) error {
|
|
|
|
return nil
|
|
|
|
}
|
2024-09-08 18:06:07 +00:00
|
|
|
func (fc *FakeClient) UpdateSecret(context.Context, *kubeapi.Secret) error { return nil }
|
|
|
|
func (fc *FakeClient) CreateSecret(context.Context, *kubeapi.Secret) error { return nil }
|