/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v4.23.4
// source: staging/src/k8s.io/kubelet/pkg/apis/pods/v1alpha1/api.proto

package v1alpha1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Pods_WatchPods_FullMethodName = "/v1alpha1.Pods/WatchPods"
	Pods_ListPods_FullMethodName  = "/v1alpha1.Pods/ListPods"
	Pods_GetPod_FullMethodName    = "/v1alpha1.Pods/GetPod"
)

// PodsClient is the client API for Pods service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type PodsClient interface {
	// WatchPods will initially return an ADDED WatchPodsEvent for each
	// existing Pod, followed by an INITIAL_SYNC_COMPLETE WatchPodsEvent.
	// It then returns a WatchPodsEvent whenever a Pod is created, deleted, or updated.
	WatchPods(ctx context.Context, in *WatchPodsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchPodsEvent], error)
	// ListPods returns a of List of Pods
	ListPods(ctx context.Context, in *ListPodsRequest, opts ...grpc.CallOption) (*ListPodsResponse, error)
	// GetPod returns a Pod for given pod's UID
	GetPod(ctx context.Context, in *GetPodRequest, opts ...grpc.CallOption) (*GetPodResponse, error)
}

type podsClient struct {
	cc grpc.ClientConnInterface
}

func NewPodsClient(cc grpc.ClientConnInterface) PodsClient {
	return &podsClient{cc}
}

func (c *podsClient) WatchPods(ctx context.Context, in *WatchPodsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchPodsEvent], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Pods_ServiceDesc.Streams[0], Pods_WatchPods_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[WatchPodsRequest, WatchPodsEvent]{ClientStream: stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Pods_WatchPodsClient = grpc.ServerStreamingClient[WatchPodsEvent]

func (c *podsClient) ListPods(ctx context.Context, in *ListPodsRequest, opts ...grpc.CallOption) (*ListPodsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListPodsResponse)
	err := c.cc.Invoke(ctx, Pods_ListPods_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *podsClient) GetPod(ctx context.Context, in *GetPodRequest, opts ...grpc.CallOption) (*GetPodResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetPodResponse)
	err := c.cc.Invoke(ctx, Pods_GetPod_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// PodsServer is the server API for Pods service.
// All implementations must embed UnimplementedPodsServer
// for forward compatibility.
type PodsServer interface {
	// WatchPods will initially return an ADDED WatchPodsEvent for each
	// existing Pod, followed by an INITIAL_SYNC_COMPLETE WatchPodsEvent.
	// It then returns a WatchPodsEvent whenever a Pod is created, deleted, or updated.
	WatchPods(*WatchPodsRequest, grpc.ServerStreamingServer[WatchPodsEvent]) error
	// ListPods returns a of List of Pods
	ListPods(context.Context, *ListPodsRequest) (*ListPodsResponse, error)
	// GetPod returns a Pod for given pod's UID
	GetPod(context.Context, *GetPodRequest) (*GetPodResponse, error)
	mustEmbedUnimplementedPodsServer()
}

// UnimplementedPodsServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedPodsServer struct{}

func (UnimplementedPodsServer) WatchPods(*WatchPodsRequest, grpc.ServerStreamingServer[WatchPodsEvent]) error {
	return status.Errorf(codes.Unimplemented, "method WatchPods not implemented")
}
func (UnimplementedPodsServer) ListPods(context.Context, *ListPodsRequest) (*ListPodsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListPods not implemented")
}
func (UnimplementedPodsServer) GetPod(context.Context, *GetPodRequest) (*GetPodResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetPod not implemented")
}
func (UnimplementedPodsServer) mustEmbedUnimplementedPodsServer() {}
func (UnimplementedPodsServer) testEmbeddedByValue()              {}

// UnsafePodsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to PodsServer will
// result in compilation errors.
type UnsafePodsServer interface {
	mustEmbedUnimplementedPodsServer()
}

func RegisterPodsServer(s grpc.ServiceRegistrar, srv PodsServer) {
	// If the following call pancis, it indicates UnimplementedPodsServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&Pods_ServiceDesc, srv)
}

func _Pods_WatchPods_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(WatchPodsRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(PodsServer).WatchPods(m, &grpc.GenericServerStream[WatchPodsRequest, WatchPodsEvent]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Pods_WatchPodsServer = grpc.ServerStreamingServer[WatchPodsEvent]

func _Pods_ListPods_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListPodsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PodsServer).ListPods(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Pods_ListPods_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PodsServer).ListPods(ctx, req.(*ListPodsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Pods_GetPod_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetPodRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(PodsServer).GetPod(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Pods_GetPod_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(PodsServer).GetPod(ctx, req.(*GetPodRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Pods_ServiceDesc is the grpc.ServiceDesc for Pods service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Pods_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "v1alpha1.Pods",
	HandlerType: (*PodsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListPods",
			Handler:    _Pods_ListPods_Handler,
		},
		{
			MethodName: "GetPod",
			Handler:    _Pods_GetPod_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "WatchPods",
			Handler:       _Pods_WatchPods_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "staging/src/k8s.io/kubelet/pkg/apis/pods/v1alpha1/api.proto",
}
