// 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/trustdomain/v1/trustdomain.proto

package trustdomain

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 (
	TrustDomain_ListFederationRelationships_FullMethodName       = "/spire.api.server.trustdomain.v1.TrustDomain/ListFederationRelationships"
	TrustDomain_GetFederationRelationship_FullMethodName         = "/spire.api.server.trustdomain.v1.TrustDomain/GetFederationRelationship"
	TrustDomain_BatchCreateFederationRelationship_FullMethodName = "/spire.api.server.trustdomain.v1.TrustDomain/BatchCreateFederationRelationship"
	TrustDomain_BatchUpdateFederationRelationship_FullMethodName = "/spire.api.server.trustdomain.v1.TrustDomain/BatchUpdateFederationRelationship"
	TrustDomain_BatchDeleteFederationRelationship_FullMethodName = "/spire.api.server.trustdomain.v1.TrustDomain/BatchDeleteFederationRelationship"
	TrustDomain_RefreshBundle_FullMethodName                     = "/spire.api.server.trustdomain.v1.TrustDomain/RefreshBundle"
)

// TrustDomainClient is the client API for TrustDomain 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.
//
// Manages the federation relationships with foreign trust domains.
type TrustDomainClient interface {
	// Lists federation relationships with foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	ListFederationRelationships(ctx context.Context, in *ListFederationRelationshipsRequest, opts ...grpc.CallOption) (*ListFederationRelationshipsResponse, error)
	// Gets a federation relationship with a foreign trust domain.
	// If there is no federation relationship with the specified
	// trust domain, NOT_FOUND is returned.
	//
	// The caller must be local or present an admin X509-SVID.
	GetFederationRelationship(ctx context.Context, in *GetFederationRelationshipRequest, opts ...grpc.CallOption) (*types.FederationRelationship, error)
	// Batch creates one or more federation relationships with
	// foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchCreateFederationRelationship(ctx context.Context, in *BatchCreateFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchCreateFederationRelationshipResponse, error)
	// Batch updates one or more federation relationships with
	// foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchUpdateFederationRelationship(ctx context.Context, in *BatchUpdateFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchUpdateFederationRelationshipResponse, error)
	// Batch deletes federation relationships with foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchDeleteFederationRelationship(ctx context.Context, in *BatchDeleteFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchDeleteFederationRelationshipResponse, error)
	// Refreshes the bundle from the specified federated trust domain.
	// If there is not a federation relationship configured with the
	// specified trust domain, NOT_FOUND is returned.
	//
	// The caller must be local or present an admin X509-SVID.
	RefreshBundle(ctx context.Context, in *RefreshBundleRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

type trustDomainClient struct {
	cc grpc.ClientConnInterface
}

func NewTrustDomainClient(cc grpc.ClientConnInterface) TrustDomainClient {
	return &trustDomainClient{cc}
}

func (c *trustDomainClient) ListFederationRelationships(ctx context.Context, in *ListFederationRelationshipsRequest, opts ...grpc.CallOption) (*ListFederationRelationshipsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(ListFederationRelationshipsResponse)
	err := c.cc.Invoke(ctx, TrustDomain_ListFederationRelationships_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *trustDomainClient) GetFederationRelationship(ctx context.Context, in *GetFederationRelationshipRequest, opts ...grpc.CallOption) (*types.FederationRelationship, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(types.FederationRelationship)
	err := c.cc.Invoke(ctx, TrustDomain_GetFederationRelationship_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *trustDomainClient) BatchCreateFederationRelationship(ctx context.Context, in *BatchCreateFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchCreateFederationRelationshipResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(BatchCreateFederationRelationshipResponse)
	err := c.cc.Invoke(ctx, TrustDomain_BatchCreateFederationRelationship_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *trustDomainClient) BatchUpdateFederationRelationship(ctx context.Context, in *BatchUpdateFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchUpdateFederationRelationshipResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(BatchUpdateFederationRelationshipResponse)
	err := c.cc.Invoke(ctx, TrustDomain_BatchUpdateFederationRelationship_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *trustDomainClient) BatchDeleteFederationRelationship(ctx context.Context, in *BatchDeleteFederationRelationshipRequest, opts ...grpc.CallOption) (*BatchDeleteFederationRelationshipResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(BatchDeleteFederationRelationshipResponse)
	err := c.cc.Invoke(ctx, TrustDomain_BatchDeleteFederationRelationship_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

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

// TrustDomainServer is the server API for TrustDomain service.
// All implementations must embed UnimplementedTrustDomainServer
// for forward compatibility.
//
// Manages the federation relationships with foreign trust domains.
type TrustDomainServer interface {
	// Lists federation relationships with foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	ListFederationRelationships(context.Context, *ListFederationRelationshipsRequest) (*ListFederationRelationshipsResponse, error)
	// Gets a federation relationship with a foreign trust domain.
	// If there is no federation relationship with the specified
	// trust domain, NOT_FOUND is returned.
	//
	// The caller must be local or present an admin X509-SVID.
	GetFederationRelationship(context.Context, *GetFederationRelationshipRequest) (*types.FederationRelationship, error)
	// Batch creates one or more federation relationships with
	// foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchCreateFederationRelationship(context.Context, *BatchCreateFederationRelationshipRequest) (*BatchCreateFederationRelationshipResponse, error)
	// Batch updates one or more federation relationships with
	// foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchUpdateFederationRelationship(context.Context, *BatchUpdateFederationRelationshipRequest) (*BatchUpdateFederationRelationshipResponse, error)
	// Batch deletes federation relationships with foreign trust domains.
	//
	// The caller must be local or present an admin X509-SVID.
	BatchDeleteFederationRelationship(context.Context, *BatchDeleteFederationRelationshipRequest) (*BatchDeleteFederationRelationshipResponse, error)
	// Refreshes the bundle from the specified federated trust domain.
	// If there is not a federation relationship configured with the
	// specified trust domain, NOT_FOUND is returned.
	//
	// The caller must be local or present an admin X509-SVID.
	RefreshBundle(context.Context, *RefreshBundleRequest) (*emptypb.Empty, error)
	mustEmbedUnimplementedTrustDomainServer()
}

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

func (UnimplementedTrustDomainServer) ListFederationRelationships(context.Context, *ListFederationRelationshipsRequest) (*ListFederationRelationshipsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ListFederationRelationships not implemented")
}
func (UnimplementedTrustDomainServer) GetFederationRelationship(context.Context, *GetFederationRelationshipRequest) (*types.FederationRelationship, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetFederationRelationship not implemented")
}
func (UnimplementedTrustDomainServer) BatchCreateFederationRelationship(context.Context, *BatchCreateFederationRelationshipRequest) (*BatchCreateFederationRelationshipResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BatchCreateFederationRelationship not implemented")
}
func (UnimplementedTrustDomainServer) BatchUpdateFederationRelationship(context.Context, *BatchUpdateFederationRelationshipRequest) (*BatchUpdateFederationRelationshipResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BatchUpdateFederationRelationship not implemented")
}
func (UnimplementedTrustDomainServer) BatchDeleteFederationRelationship(context.Context, *BatchDeleteFederationRelationshipRequest) (*BatchDeleteFederationRelationshipResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method BatchDeleteFederationRelationship not implemented")
}
func (UnimplementedTrustDomainServer) RefreshBundle(context.Context, *RefreshBundleRequest) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RefreshBundle not implemented")
}
func (UnimplementedTrustDomainServer) mustEmbedUnimplementedTrustDomainServer() {}
func (UnimplementedTrustDomainServer) testEmbeddedByValue()                     {}

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

func RegisterTrustDomainServer(s grpc.ServiceRegistrar, srv TrustDomainServer) {
	// If the following call pancis, it indicates UnimplementedTrustDomainServer 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(&TrustDomain_ServiceDesc, srv)
}

func _TrustDomain_ListFederationRelationships_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ListFederationRelationshipsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).ListFederationRelationships(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_ListFederationRelationships_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).ListFederationRelationships(ctx, req.(*ListFederationRelationshipsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TrustDomain_GetFederationRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetFederationRelationshipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).GetFederationRelationship(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_GetFederationRelationship_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).GetFederationRelationship(ctx, req.(*GetFederationRelationshipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TrustDomain_BatchCreateFederationRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BatchCreateFederationRelationshipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).BatchCreateFederationRelationship(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_BatchCreateFederationRelationship_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).BatchCreateFederationRelationship(ctx, req.(*BatchCreateFederationRelationshipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TrustDomain_BatchUpdateFederationRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BatchUpdateFederationRelationshipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).BatchUpdateFederationRelationship(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_BatchUpdateFederationRelationship_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).BatchUpdateFederationRelationship(ctx, req.(*BatchUpdateFederationRelationshipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TrustDomain_BatchDeleteFederationRelationship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(BatchDeleteFederationRelationshipRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).BatchDeleteFederationRelationship(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_BatchDeleteFederationRelationship_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).BatchDeleteFederationRelationship(ctx, req.(*BatchDeleteFederationRelationshipRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TrustDomain_RefreshBundle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RefreshBundleRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TrustDomainServer).RefreshBundle(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TrustDomain_RefreshBundle_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TrustDomainServer).RefreshBundle(ctx, req.(*RefreshBundleRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// TrustDomain_ServiceDesc is the grpc.ServiceDesc for TrustDomain service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TrustDomain_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "spire.api.server.trustdomain.v1.TrustDomain",
	HandlerType: (*TrustDomainServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "ListFederationRelationships",
			Handler:    _TrustDomain_ListFederationRelationships_Handler,
		},
		{
			MethodName: "GetFederationRelationship",
			Handler:    _TrustDomain_GetFederationRelationship_Handler,
		},
		{
			MethodName: "BatchCreateFederationRelationship",
			Handler:    _TrustDomain_BatchCreateFederationRelationship_Handler,
		},
		{
			MethodName: "BatchUpdateFederationRelationship",
			Handler:    _TrustDomain_BatchUpdateFederationRelationship_Handler,
		},
		{
			MethodName: "BatchDeleteFederationRelationship",
			Handler:    _TrustDomain_BatchDeleteFederationRelationship_Handler,
		},
		{
			MethodName: "RefreshBundle",
			Handler:    _TrustDomain_RefreshBundle_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "spire/api/server/trustdomain/v1/trustdomain.proto",
}
