// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package pb

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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// ProvisionerClient is the client API for Provisioner 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 ProvisionerClient interface {
	// Server-to-client streaming RPC that returns an update to the state.
	GetStateUpdate(ctx context.Context, in *Infra, opts ...grpc.CallOption) (Provisioner_GetStateUpdateClient, error)
	// Server-to-client streaming RPC that returns a new log.
	GetLog(ctx context.Context, in *Infra, opts ...grpc.CallOption) (Provisioner_GetLogClient, error)
	// Client-to-server streaming RPC that streams logs to the provisioner.
	StoreLog(ctx context.Context, opts ...grpc.CallOption) (Provisioner_StoreLogClient, error)
}

type provisionerClient struct {
	cc grpc.ClientConnInterface
}

func NewProvisionerClient(cc grpc.ClientConnInterface) ProvisionerClient {
	return &provisionerClient{cc}
}

func (c *provisionerClient) GetStateUpdate(ctx context.Context, in *Infra, opts ...grpc.CallOption) (Provisioner_GetStateUpdateClient, error) {
	stream, err := c.cc.NewStream(ctx, &Provisioner_ServiceDesc.Streams[0], "/Provisioner/GetStateUpdate", opts...)
	if err != nil {
		return nil, err
	}
	x := &provisionerGetStateUpdateClient{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
}

type Provisioner_GetStateUpdateClient interface {
	Recv() (*StateUpdate, error)
	grpc.ClientStream
}

type provisionerGetStateUpdateClient struct {
	grpc.ClientStream
}

func (x *provisionerGetStateUpdateClient) Recv() (*StateUpdate, error) {
	m := new(StateUpdate)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *provisionerClient) GetLog(ctx context.Context, in *Infra, opts ...grpc.CallOption) (Provisioner_GetLogClient, error) {
	stream, err := c.cc.NewStream(ctx, &Provisioner_ServiceDesc.Streams[1], "/Provisioner/GetLog", opts...)
	if err != nil {
		return nil, err
	}
	x := &provisionerGetLogClient{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
}

type Provisioner_GetLogClient interface {
	Recv() (*LogString, error)
	grpc.ClientStream
}

type provisionerGetLogClient struct {
	grpc.ClientStream
}

func (x *provisionerGetLogClient) Recv() (*LogString, error) {
	m := new(LogString)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *provisionerClient) StoreLog(ctx context.Context, opts ...grpc.CallOption) (Provisioner_StoreLogClient, error) {
	stream, err := c.cc.NewStream(ctx, &Provisioner_ServiceDesc.Streams[2], "/Provisioner/StoreLog", opts...)
	if err != nil {
		return nil, err
	}
	x := &provisionerStoreLogClient{stream}
	return x, nil
}

type Provisioner_StoreLogClient interface {
	Send(*TerraformLog) error
	CloseAndRecv() (*TerraformStateMeta, error)
	grpc.ClientStream
}

type provisionerStoreLogClient struct {
	grpc.ClientStream
}

func (x *provisionerStoreLogClient) Send(m *TerraformLog) error {
	return x.ClientStream.SendMsg(m)
}

func (x *provisionerStoreLogClient) CloseAndRecv() (*TerraformStateMeta, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(TerraformStateMeta)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// ProvisionerServer is the server API for Provisioner service.
// All implementations must embed UnimplementedProvisionerServer
// for forward compatibility
type ProvisionerServer interface {
	// Server-to-client streaming RPC that returns an update to the state.
	GetStateUpdate(*Infra, Provisioner_GetStateUpdateServer) error
	// Server-to-client streaming RPC that returns a new log.
	GetLog(*Infra, Provisioner_GetLogServer) error
	// Client-to-server streaming RPC that streams logs to the provisioner.
	StoreLog(Provisioner_StoreLogServer) error
	mustEmbedUnimplementedProvisionerServer()
}

// UnimplementedProvisionerServer must be embedded to have forward compatible implementations.
type UnimplementedProvisionerServer struct {
}

func (UnimplementedProvisionerServer) GetStateUpdate(*Infra, Provisioner_GetStateUpdateServer) error {
	return status.Errorf(codes.Unimplemented, "method GetStateUpdate not implemented")
}
func (UnimplementedProvisionerServer) GetLog(*Infra, Provisioner_GetLogServer) error {
	return status.Errorf(codes.Unimplemented, "method GetLog not implemented")
}
func (UnimplementedProvisionerServer) StoreLog(Provisioner_StoreLogServer) error {
	return status.Errorf(codes.Unimplemented, "method StoreLog not implemented")
}
func (UnimplementedProvisionerServer) mustEmbedUnimplementedProvisionerServer() {}

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

func RegisterProvisionerServer(s grpc.ServiceRegistrar, srv ProvisionerServer) {
	s.RegisterService(&Provisioner_ServiceDesc, srv)
}

func _Provisioner_GetStateUpdate_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Infra)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ProvisionerServer).GetStateUpdate(m, &provisionerGetStateUpdateServer{stream})
}

type Provisioner_GetStateUpdateServer interface {
	Send(*StateUpdate) error
	grpc.ServerStream
}

type provisionerGetStateUpdateServer struct {
	grpc.ServerStream
}

func (x *provisionerGetStateUpdateServer) Send(m *StateUpdate) error {
	return x.ServerStream.SendMsg(m)
}

func _Provisioner_GetLog_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(Infra)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ProvisionerServer).GetLog(m, &provisionerGetLogServer{stream})
}

type Provisioner_GetLogServer interface {
	Send(*LogString) error
	grpc.ServerStream
}

type provisionerGetLogServer struct {
	grpc.ServerStream
}

func (x *provisionerGetLogServer) Send(m *LogString) error {
	return x.ServerStream.SendMsg(m)
}

func _Provisioner_StoreLog_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ProvisionerServer).StoreLog(&provisionerStoreLogServer{stream})
}

type Provisioner_StoreLogServer interface {
	SendAndClose(*TerraformStateMeta) error
	Recv() (*TerraformLog, error)
	grpc.ServerStream
}

type provisionerStoreLogServer struct {
	grpc.ServerStream
}

func (x *provisionerStoreLogServer) SendAndClose(m *TerraformStateMeta) error {
	return x.ServerStream.SendMsg(m)
}

func (x *provisionerStoreLogServer) Recv() (*TerraformLog, error) {
	m := new(TerraformLog)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// Provisioner_ServiceDesc is the grpc.ServiceDesc for Provisioner service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Provisioner_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "Provisioner",
	HandlerType: (*ProvisionerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "GetStateUpdate",
			Handler:       _Provisioner_GetStateUpdate_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetLog",
			Handler:       _Provisioner_GetLog_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "StoreLog",
			Handler:       _Provisioner_StoreLog_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "provisioner/pb/provisioner.proto",
}
