// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v6.33.3
// source: internal/module/workspaces/rpc/rpc.proto

package rpc

import (
	context "context"

	grpctool "gitlab.com/gitlab-org/cluster-integration/gitlab-agent/v18/internal/tool/grpctool"
	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 (
	Workspaces_TunnelHTTP_FullMethodName = "/gitlab.agent.workspaces.rpc.Workspaces/TunnelHTTP"
)

// WorkspacesClient is the client API for Workspaces 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 WorkspacesClient interface {
	TunnelHTTP(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[grpctool.HttpRequest, grpctool.HttpResponse], error)
}

type workspacesClient struct {
	cc grpc.ClientConnInterface
}

func NewWorkspacesClient(cc grpc.ClientConnInterface) WorkspacesClient {
	return &workspacesClient{cc}
}

func (c *workspacesClient) TunnelHTTP(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[grpctool.HttpRequest, grpctool.HttpResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Workspaces_ServiceDesc.Streams[0], Workspaces_TunnelHTTP_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[grpctool.HttpRequest, grpctool.HttpResponse]{ClientStream: stream}
	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 Workspaces_TunnelHTTPClient = grpc.BidiStreamingClient[grpctool.HttpRequest, grpctool.HttpResponse]

// WorkspacesServer is the server API for Workspaces service.
// All implementations must embed UnimplementedWorkspacesServer
// for forward compatibility.
type WorkspacesServer interface {
	TunnelHTTP(grpc.BidiStreamingServer[grpctool.HttpRequest, grpctool.HttpResponse]) error
	mustEmbedUnimplementedWorkspacesServer()
}

// UnimplementedWorkspacesServer 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 UnimplementedWorkspacesServer struct{}

func (UnimplementedWorkspacesServer) TunnelHTTP(grpc.BidiStreamingServer[grpctool.HttpRequest, grpctool.HttpResponse]) error {
	return status.Errorf(codes.Unimplemented, "method TunnelHTTP not implemented")
}
func (UnimplementedWorkspacesServer) mustEmbedUnimplementedWorkspacesServer() {}
func (UnimplementedWorkspacesServer) testEmbeddedByValue()                    {}

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

func RegisterWorkspacesServer(s grpc.ServiceRegistrar, srv WorkspacesServer) {
	// If the following call pancis, it indicates UnimplementedWorkspacesServer 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(&Workspaces_ServiceDesc, srv)
}

func _Workspaces_TunnelHTTP_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(WorkspacesServer).TunnelHTTP(&grpc.GenericServerStream[grpctool.HttpRequest, grpctool.HttpResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Workspaces_TunnelHTTPServer = grpc.BidiStreamingServer[grpctool.HttpRequest, grpctool.HttpResponse]

// Workspaces_ServiceDesc is the grpc.ServiceDesc for Workspaces service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Workspaces_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "gitlab.agent.workspaces.rpc.Workspaces",
	HandlerType: (*WorkspacesServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "TunnelHTTP",
			Handler:       _Workspaces_TunnelHTTP_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "internal/module/workspaces/rpc/rpc.proto",
}
