// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v6.30.2
// source: spire/api/server/agent/v1/agent.proto

package agentv1

import (
	context "context"
	types "github.com/spiffe/spire-api-sdk/proto/spire/api/types"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// 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 (
	Agent_CountAgents_FullMethodName     = "/spire.api.server.agent.v1.Agent/CountAgents"
	Agent_ListAgents_FullMethodName      = "/spire.api.server.agent.v1.Agent/ListAgents"
	Agent_GetAgent_FullMethodName        = "/spire.api.server.agent.v1.Agent/GetAgent"
	Agent_DeleteAgent_FullMethodName     = "/spire.api.server.agent.v1.Agent/DeleteAgent"
	Agent_BanAgent_FullMethodName        = "/spire.api.server.agent.v1.Agent/BanAgent"
	Agent_AttestAgent_FullMethodName     = "/spire.api.server.agent.v1.Agent/AttestAgent"
	Agent_RenewAgent_FullMethodName      = "/spire.api.server.agent.v1.Agent/RenewAgent"
	Agent_CreateJoinToken_FullMethodName = "/spire.api.server.agent.v1.Agent/CreateJoinToken"
	Agent_PostStatus_FullMethodName      = "/spire.api.server.agent.v1.Agent/PostStatus"
)

// AgentClient is the client API for Agent 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 AgentClient interface {
	// Count agents.
	//
	// The caller must be local or present an admin X509-SVID.
	CountAgents(ctx context.Context, in *CountAgentsRequest, opts ...grpc.CallOption) (*CountAgentsResponse, error)
	// Lists agents.
	//
	// The caller must be local or present an admin X509-SVID.
	ListAgents(ctx context.Context, in *ListAgentsRequest, opts ...grpc.CallOption) (*ListAgentsResponse, error)
	// Gets an agent.
	//
	// The caller must be local or present an admin X509-SVID.
	GetAgent(ctx context.Context, in *GetAgentRequest, opts ...grpc.CallOption) (*types.Agent, error)
	// Deletes an agent. The agent can come back into the trust domain through
	// the Issuer AttestAgent RPC.
	//
	// The caller must be local or present an admin X509-SVID.
	DeleteAgent(ctx context.Context, in *DeleteAgentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Bans an agent. This evicts the agent and prevents it from rejoining the
	// trust domain through attestation until the ban is lifted via a call to
	// DeleteAgent.
	//
	// The caller must be local or present an admin X509-SVID.
	BanAgent(ctx context.Context, in *BanAgentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	// Attests the agent via node attestation, using a bidirectional stream to
	// faciliate attestation methods that require challenge/response.
	//
	// The caller is not authenticated.
	AttestAgent(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AttestAgentRequest, AttestAgentResponse], error)
	// Renews the agent and returns a new X509-SVID. The new SVID is not enabled
	// on the server side until its first use.
	//
	// The caller must present an active agent X509-SVID, i.e. the X509-SVID
	// returned by the AttestAgent or the most recent RenewAgent call.
	RenewAgent(ctx context.Context, in *RenewAgentRequest, opts ...grpc.CallOption) (*RenewAgentResponse, error)
	// Creates an agent join token. The token can be used with `join_token`
	// attestation to join the trust domain.
	//
	// The caller must be local or present an admin X509-SVID.
	CreateJoinToken(ctx context.Context, in *CreateJoinTokenRequest, opts ...grpc.CallOption) (*types.JoinToken, error)
	// PostStatus post Agent status, informing what's the current
	// bundle that is being used by the agent.
	//
	// The caller must present an active agent X509-SVID, i.e. the X509-SVID
	// returned by the AttestAgent or the most recent RenewAgent call.
	PostStatus(ctx context.Context, in *PostStatusRequest, opts ...grpc.CallOption) (*PostStatusResponse, error)
}

type agentClient struct {
	cc grpc.ClientConnInterface
}

func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
	return &agentClient{cc}
}

func (c *agentClient) CountAgents(ctx context.Context, in *CountAgentsRequest, opts ...grpc.CallOption) (*CountAgentsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CountAgentsResponse)
	err := c.cc.Invoke(ctx, Agent_CountAgents_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) ListAgents(ctx context.Context, in *ListAgentsRequest, opts ...grpc.CallOption) (*ListAgentsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListAgentsResponse)
	err := c.cc.Invoke(ctx, Agent_ListAgents_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) GetAgent(ctx context.Context, in *GetAgentRequest, opts ...grpc.CallOption) (*types.Agent, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(types.Agent)
	err := c.cc.Invoke(ctx, Agent_GetAgent_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) DeleteAgent(ctx context.Context, in *DeleteAgentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, Agent_DeleteAgent_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) BanAgent(ctx context.Context, in *BanAgentRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, Agent_BanAgent_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) AttestAgent(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[AttestAgentRequest, AttestAgentResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Agent_ServiceDesc.Streams[0], Agent_AttestAgent_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[AttestAgentRequest, AttestAgentResponse]{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 Agent_AttestAgentClient = grpc.BidiStreamingClient[AttestAgentRequest, AttestAgentResponse]

func (c *agentClient) RenewAgent(ctx context.Context, in *RenewAgentRequest, opts ...grpc.CallOption) (*RenewAgentResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(RenewAgentResponse)
	err := c.cc.Invoke(ctx, Agent_RenewAgent_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) CreateJoinToken(ctx context.Context, in *CreateJoinTokenRequest, opts ...grpc.CallOption) (*types.JoinToken, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(types.JoinToken)
	err := c.cc.Invoke(ctx, Agent_CreateJoinToken_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *agentClient) PostStatus(ctx context.Context, in *PostStatusRequest, opts ...grpc.CallOption) (*PostStatusResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(PostStatusResponse)
	err := c.cc.Invoke(ctx, Agent_PostStatus_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// AgentServer is the server API for Agent service.
// All implementations must embed UnimplementedAgentServer
// for forward compatibility.
type AgentServer interface {
	// Count agents.
	//
	// The caller must be local or present an admin X509-SVID.
	CountAgents(context.Context, *CountAgentsRequest) (*CountAgentsResponse, error)
	// Lists agents.
	//
	// The caller must be local or present an admin X509-SVID.
	ListAgents(context.Context, *ListAgentsRequest) (*ListAgentsResponse, error)
	// Gets an agent.
	//
	// The caller must be local or present an admin X509-SVID.
	GetAgent(context.Context, *GetAgentRequest) (*types.Agent, error)
	// Deletes an agent. The agent can come back into the trust domain through
	// the Issuer AttestAgent RPC.
	//
	// The caller must be local or present an admin X509-SVID.
	DeleteAgent(context.Context, *DeleteAgentRequest) (*emptypb.Empty, error)
	// Bans an agent. This evicts the agent and prevents it from rejoining the
	// trust domain through attestation until the ban is lifted via a call to
	// DeleteAgent.
	//
	// The caller must be local or present an admin X509-SVID.
	BanAgent(context.Context, *BanAgentRequest) (*emptypb.Empty, error)
	// Attests the agent via node attestation, using a bidirectional stream to
	// faciliate attestation methods that require challenge/response.
	//
	// The caller is not authenticated.
	AttestAgent(grpc.BidiStreamingServer[AttestAgentRequest, AttestAgentResponse]) error
	// Renews the agent and returns a new X509-SVID. The new SVID is not enabled
	// on the server side until its first use.
	//
	// The caller must present an active agent X509-SVID, i.e. the X509-SVID
	// returned by the AttestAgent or the most recent RenewAgent call.
	RenewAgent(context.Context, *RenewAgentRequest) (*RenewAgentResponse, error)
	// Creates an agent join token. The token can be used with `join_token`
	// attestation to join the trust domain.
	//
	// The caller must be local or present an admin X509-SVID.
	CreateJoinToken(context.Context, *CreateJoinTokenRequest) (*types.JoinToken, error)
	// PostStatus post Agent status, informing what's the current
	// bundle that is being used by the agent.
	//
	// The caller must present an active agent X509-SVID, i.e. the X509-SVID
	// returned by the AttestAgent or the most recent RenewAgent call.
	PostStatus(context.Context, *PostStatusRequest) (*PostStatusResponse, error)
	mustEmbedUnimplementedAgentServer()
}

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

func (UnimplementedAgentServer) CountAgents(context.Context, *CountAgentsRequest) (*CountAgentsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CountAgents not implemented")
}
func (UnimplementedAgentServer) ListAgents(context.Context, *ListAgentsRequest) (*ListAgentsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListAgents not implemented")
}
func (UnimplementedAgentServer) GetAgent(context.Context, *GetAgentRequest) (*types.Agent, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetAgent not implemented")
}
func (UnimplementedAgentServer) DeleteAgent(context.Context, *DeleteAgentRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method DeleteAgent not implemented")
}
func (UnimplementedAgentServer) BanAgent(context.Context, *BanAgentRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BanAgent not implemented")
}
func (UnimplementedAgentServer) AttestAgent(grpc.BidiStreamingServer[AttestAgentRequest, AttestAgentResponse]) error {
	return status.Errorf(codes.Unimplemented, "method AttestAgent not implemented")
}
func (UnimplementedAgentServer) RenewAgent(context.Context, *RenewAgentRequest) (*RenewAgentResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RenewAgent not implemented")
}
func (UnimplementedAgentServer) CreateJoinToken(context.Context, *CreateJoinTokenRequest) (*types.JoinToken, error) {
	return nil, status.Errorf(codes.Unimplemented, "method CreateJoinToken not implemented")
}
func (UnimplementedAgentServer) PostStatus(context.Context, *PostStatusRequest) (*PostStatusResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method PostStatus not implemented")
}
func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
func (UnimplementedAgentServer) testEmbeddedByValue()               {}

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

func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
	// If the following call pancis, it indicates UnimplementedAgentServer 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(&Agent_ServiceDesc, srv)
}

func _Agent_CountAgents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CountAgentsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).CountAgents(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_CountAgents_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).CountAgents(ctx, req.(*CountAgentsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_ListAgents_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListAgentsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).ListAgents(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_ListAgents_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).ListAgents(ctx, req.(*ListAgentsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_GetAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetAgentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).GetAgent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_GetAgent_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).GetAgent(ctx, req.(*GetAgentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_DeleteAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(DeleteAgentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).DeleteAgent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_DeleteAgent_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).DeleteAgent(ctx, req.(*DeleteAgentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_BanAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BanAgentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).BanAgent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_BanAgent_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).BanAgent(ctx, req.(*BanAgentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_AttestAgent_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(AgentServer).AttestAgent(&grpc.GenericServerStream[AttestAgentRequest, AttestAgentResponse]{ServerStream: stream})
}

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

func _Agent_RenewAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RenewAgentRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).RenewAgent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_RenewAgent_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).RenewAgent(ctx, req.(*RenewAgentRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_CreateJoinToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(CreateJoinTokenRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).CreateJoinToken(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_CreateJoinToken_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).CreateJoinToken(ctx, req.(*CreateJoinTokenRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Agent_PostStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PostStatusRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(AgentServer).PostStatus(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Agent_PostStatus_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(AgentServer).PostStatus(ctx, req.(*PostStatusRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Agent_ServiceDesc is the grpc.ServiceDesc for Agent service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Agent_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "spire.api.server.agent.v1.Agent",
	HandlerType: (*AgentServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CountAgents",
			Handler:    _Agent_CountAgents_Handler,
		},
		{
			MethodName: "ListAgents",
			Handler:    _Agent_ListAgents_Handler,
		},
		{
			MethodName: "GetAgent",
			Handler:    _Agent_GetAgent_Handler,
		},
		{
			MethodName: "DeleteAgent",
			Handler:    _Agent_DeleteAgent_Handler,
		},
		{
			MethodName: "BanAgent",
			Handler:    _Agent_BanAgent_Handler,
		},
		{
			MethodName: "RenewAgent",
			Handler:    _Agent_RenewAgent_Handler,
		},
		{
			MethodName: "CreateJoinToken",
			Handler:    _Agent_CreateJoinToken_Handler,
		},
		{
			MethodName: "PostStatus",
			Handler:    _Agent_PostStatus_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "AttestAgent",
			Handler:       _Agent_AttestAgent_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "spire/api/server/agent/v1/agent.proto",
}
