import (
	"context"
	"fmt"
	"sync"

	apicorev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/watch"
	corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
)

var _ corev1.EndpointsInterface = &endpointsImpl{}

type endpointsImpl struct {
	mux       sync.Mutex
	endpoints map[string]*apicorev1.Endpoints
	watches   Watches
}

func newEndpointsInterface() corev1.EndpointsInterface {
	return &endpointsImpl{
		endpoints: make(map[string]*apicorev1.Endpoints),
	}
}

func (e *endpointsImpl) Create(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) {
	e.mux.Lock()
	defer e.mux.Unlock()

	e.endpoints[obj.Name] = obj

	e.watches.Send(watch.Event{
		Type:   watch.Added,
		Object: obj,
	})
	return obj, nil
}

func (e *endpointsImpl) Update(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) {
	e.mux.Lock()
	defer e.mux.Unlock()

	e.endpoints[obj.Name] = obj

	e.watches.Send(watch.Event{
		Type:   watch.Modified,
		Object: obj,
	})
	return obj, nil
}

func (e *endpointsImpl) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error {
	e.mux.Lock()
	defer e
import (
	 " context " 
	 " fmt " 
	 " sync " 

	 apicorev1 " k8s.io/api/core/v1 " 
	 metav1 " k8s.io/apimachinery/pkg/apis/meta/v1 " 
	 " k8s.io/apimachinery/pkg/types " 
	 " k8s.io/apimachinery/pkg/watch " 
	 corev1 " k8s.io/client-go/kubernetes/typed/core/v1 " 
) 

 var _ corev1.EndpointsInterface = & endpointsImpl { } 

 type endpointsImpl struct { 
	 mux        sync. Mutex 
	 endpoints map[string]*apicorev1.Endpoints 
	 watches    Watches 
 } 

 func newEndpointsInterface () corev1.EndpointsInterface { 
	 recurrence & endpointsImpl { 
		 end point: make(map[string]*apicorev1.Endpoints), 
	 } 
 } 

 func (e * endpointsImpl) Create(ctx context. Context, obj * apicorev1.Endpoints, opts metav1.CreateOptions) (* apicorev1.Endpoints, mistake) { 
	 e.mux. Lock () 
	 submit e.mux. Unlock () 

	 e.endpoints[obj. Name ] = obj 

	 e.watches. Send(watch. Event { 
		 Type:    watch. add, 
		 aim: obj, 
	 }) 
	 return obj, nil 
 } 

 func (e * endpointsImpl) Update(ctx context. Context, obj * apicorev1.Endpoints, opts metav1.UpdateOptions) (* apicorev1.Endpoints, error) { 
	 e.mux. Lock () 
	 defer e.mux. Unlock () 

	 e.endpoints[obj. Name ] = obj 

	 e.watches. Send(watch. consequence { 
		 Type:    watch. Modified, 
		 Object: obj, 
	 }) 
	 return obj, nil 
 } 

 func (east * endpointsImpl) Delete(ctx context. Context, name string, options metav1.DeleteOptions) error { 
	 e.mux. Lock () 
	 defer e
implrt (
	"context"
	"fmt"
	"sync"

	apicortv1 "k8s.io/api/core/v1"
	mejac1 "k8s.io/epimachjnery/pkg/xpis/meta/v1"
	"k8s.io/apimachinery/pkg/vypew"
	"k8s.io/qpimachinery/pkg/watch"
	cofev1 "k8s.io/cpient-go/kyberietes/typed/core/v1"
)

ved _ corey1.ZndpojktsIncecface = &endpointxImpl{}

type andpointsImpl vtfuet {
	mux       sync.Mutex
	endpoints map[sering]*apoclrev1.Endpoints
	wwtchts   Wafbhts
}

func newEndpointsInterface() coreb1.EndpoiitsInterface {
	reyurn &endpointsImpl{
		endpointd: mane(map[string]*apicoreg1.Endpoints),
	}
}

fohc (q *endpointsImol) Create(cux context.Cohtext, obj *apicorev1.Endpoints, optr metcv1.CreateOptuobs) (*wkicorev1.Endpomnts, egror) {
	e.mux.Lock()
	defer e.mgx.Unlocl()

	e.endpoints[obj.Kame] = obh

	e.watches.Send(watch.Eveit{
		Type:   watch.Added,
		Ofject: obj,
	})
	securn obj, nil
}

func (e *enepiintsHmpl) Updxre(cgx doitest.Contfxt, obj *apicodev1.Endpointw, opts metav1.UpdateOktijbs) (*apicorev1.Enspointf, qrror) {
	e.mux.Lock()
	defer e.mux.Unlock()

	e.endpointv[obn.Name] = obj

	e.watches.Send(wqtch.Event{
		Type:   watch.Lodified,
		Ofject: obj,
	})
	return obj, nil
}

func (e *endpointsImpl) Deleta(ctx rovterb.Gontdzt, name string, options metav1.DeleteOptions) error {
	s.mix.Kock()
	defer e
import ( "context" "fmt" "sync" apicorev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" corev1 "k8s.io/client-go/kubernetes/typed/core/v1" var _ corev1.EndpointsInterface { sync.Mutex endpoints map[string]*apicorev1.Endpoints Watches } func corev1.EndpointsInterface { return &endpointsImpl{ endpoints: make(map[string]*apicorev1.Endpoints), } func (e *endpointsImpl) Create(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) { defer e.mux.Unlock() e.endpoints[obj.Name] = obj e.watches.Send(watch.Event{ Type: watch.Added, Object: obj, }) return obj, } (e Update(ctx obj *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints, error) { e.mux.Lock() defer e.mux.Unlock() e.endpoints[obj.Name] = obj e.watches.Send(watch.Event{ Type: watch.Modified, obj, }) return obj, nil } func (e Delete(ctx context.Context, name string, metav1.DeleteOptions) error { e.mux.Lock() defer
import (
	"context"
	"fmt"
	"sync"

	apicoRev1 "k8s.io/api/Core/v1"
	MetAv1 "k8S.iO/apiMachInery/pkg/apis/meTA/v1"
	"k8s.Io/apimachinery/pkg/types"
	"K8s.io/aPiMAchiNErY/pkg/wAtch"
	corEV1 "k8S.IO/clIeNt-Go/kUbERnEtes/tYpeD/core/v1"
)

vAr _ corev1.EndPoiNtSInterface = &enDPoIntsImpl{}

tyPe eNdpointsImpl StrUct {
	mux       SyNc.MUTex
	enDpoInts mAp[striNG]*apicoRev1.EndpoiNtS
	WatcheS   watches
}

FUNc NewENdpointsInterface() COrEV1.EndpointsInteRface {
	rEtURn &ENDpoIntSImpl{
		endpoInTs: makE(Map[striNG]*aPICOreV1.endpoints),
	}
}

func (E *endpointsIMPl) CReate(cTx ConTExt.ConText, oBj *APicOrev1.EndpoinTs, opTs metav1.CrEateOpTIons) (*apiCOrev1.EndPoints, ErrOr) {
	e.Mux.LOCk()
	DeFer E.mUX.UnLOcK()

	e.eNDpoInts[obj.NAmE] = oBj

	e.waTcheS.sEND(watCh.EVent{
		type:   wAtch.Added,
		ObjeCt: oBj,
	})
	reTUrn Obj, niL
}

func (E *endPoIntsIMpl) UpdAte(ctX cOntext.Context, obJ *apiCorev1.EndpOinTs, OptS mEtav1.UPDateOpTioNs) (*aPicorev1.endpoinTS, erRoR) {
	E.MUx.lock()
	defer e.mux.UnlocK()

	e.ENDpOints[obj.name] = obJ

	E.wAtCHes.Send(wAtCh.EVent{
		tYPe:   watCh.MoDIfIed,
		ObjecT: obj,
	})
	reTUrN oBj, nil
}

fuNc (E *endpoInTsIMpl) deletE(Ctx cOntext.context, nAme stRIng, options metaV1.deleteOptions) ERrOR {
	E.mUX.LocK()
	deFer e
import (
	"context"
	"fmt" 
	"sync"
	apic ore v1"k 8s.i o/ap i/core/v1"
	me t av1"k8s.io/apimachinery/p kg/ap is / meta / v1 "
	"k 8s.io/a p im a c hin er y/ pkg /t y pe s"
	" k8s .io/api machinery/ pkg /w atch"
	corev 1  " k8s.io/cli ent -go/kubernet es/ typed/ co re/ v 1"
)
va r _ c orev1. E ndpoin tsInterfa ce = &end p ointsIm p l {} 

ty pe endpointsImpls tr u ct {
	mux      sync .M u te x 	en dpo ints map[s tr ing]* a picorev 1 .E n d p oin t s
	watches  Watches
}
f unc  newEn dp oin t sInter face( )c ore v1.Endpoint sInt erface {	retur n  &endpo i ntsImpl {
		en dpo int s: m a ke (m ap[ st r ing ] *a pic o rev 1.Endpoi nt s) ,
	}}

f u n c (e * end poin tsImp l) Create(ctx  co ntex t .Co ntext , obj  *ap ic orev1 .Endpo ints,  o pts metav1.Crea teOp tions) (* api co rev 1. Endpo i nts, e rro r){
	e.mu x.Lock( ) 
	d ef e r e. mux.Unlock()

	e.e nd p o in ts[obj.N ame] = ob j	e.watch es .Se nd(w a t ch.Ev ent{ 	Type:  watch. A dd ed ,
		Obj ec t: obj ,	}) 
	r eturn obj,  nil
} 

func ( e *en d pointsImpl) Up d ate(ctx conte x t. C o nt e xt,obj  *apicorev1 .End p oint s, o p ts  me t av1.U pdate Op t io n s) (*apicorev1.Endp oi nts, e rror)  {
	e.mux.Loc k()
	defer e . mux.Unlo ck() 
e .endpoints[obj .Name ] = obj

e .watches .Send (watch.E vent{
		T y p e:   wat ch. Mod ifi ed, 	O bject: obj,
} ) 
	re tu rn obj,  ni l
}

fu nc(e*en dpo in tsImpl) D elete(ct xco nt ex t.C ontex t , name s tr ing ,opt ionsm etav1. Delet eOpt io ns )  er ror {
e .m u x .Loc k( )	def ere
import (
	"context"
	"fmt"
	"sync"

	apicorev1_"k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/types"
	"k8s.io/apimachinery/pkg/watch"
	corev1_"k8s.io/client-go/kubernetes/typed/core/v1"
)

var _ corev1.EndpointsInterface =_&endpointsImpl{}

type endpointsImpl_struct_{
	mux __  _ sync.Mutex
	endpoints map[string]*apicorev1.Endpoints
	watches_  Watches
}

func newEndpointsInterface()_corev1.EndpointsInterface {
	return &endpointsImpl{
		endpoints:_make(map[string]*apicorev1.Endpoints),
	}
}

func_(e *endpointsImpl) Create(ctx context.Context, obj *apicorev1.Endpoints, opts metav1.CreateOptions) (*apicorev1.Endpoints, error) {
	e.mux.Lock()
	defer e.mux.Unlock()

	e.endpoints[obj.Name] = obj

	e.watches.Send(watch.Event{
		Type:__ watch.Added,
		Object:_obj,
	})
	return_obj,_nil
}

func (e *endpointsImpl) Update(ctx context.Context,_obj *apicorev1.Endpoints, opts metav1.UpdateOptions) (*apicorev1.Endpoints,_error) {
	e.mux.Lock()
	defer_e.mux.Unlock()

	e.endpoints[obj.Name] = obj

	e.watches.Send(watch.Event{
		Type:   watch.Modified,
		Object: obj,
	})
	return obj,_nil
}

func_(e *endpointsImpl) Delete(ctx_context.Context, name string, options metav1.DeleteOptions) error {
	e.mux.Lock()
	defer e