// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v3.21.12
// source: yandex/cloud/compute/v1/maintenance_service.proto

package compute

import (
	context "context"
	v2 "github.com/yandex-cloud/go-genproto/yandex/cloud/maintenance/v2"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	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 (
	MaintenanceService_List_FullMethodName       = "/yandex.cloud.compute.v1.MaintenanceService/List"
	MaintenanceService_Get_FullMethodName        = "/yandex.cloud.compute.v1.MaintenanceService/Get"
	MaintenanceService_Reschedule_FullMethodName = "/yandex.cloud.compute.v1.MaintenanceService/Reschedule"
)

// MaintenanceServiceClient is the client API for MaintenanceService 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.
//
// A set of methods for managing maintenances in a service.
type MaintenanceServiceClient interface {
	// Lists maintenances by conditions, specified in request.
	List(ctx context.Context, in *v2.ListMaintenancesRequest, opts ...grpc.CallOption) (*v2.ListMaintenancesResponse, error)
	// Retrieves the specific Maintenance by ID.
	Get(ctx context.Context, in *v2.GetMaintenanceRequest, opts ...grpc.CallOption) (*v2.Maintenance, error)
	// Allows user to reschedule Maintenance to another date and time.
	Reschedule(ctx context.Context, in *v2.RescheduleMaintenanceRequest, opts ...grpc.CallOption) (*operation.Operation, error)
}

type maintenanceServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewMaintenanceServiceClient(cc grpc.ClientConnInterface) MaintenanceServiceClient {
	return &maintenanceServiceClient{cc}
}

func (c *maintenanceServiceClient) List(ctx context.Context, in *v2.ListMaintenancesRequest, opts ...grpc.CallOption) (*v2.ListMaintenancesResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v2.ListMaintenancesResponse)
	err := c.cc.Invoke(ctx, MaintenanceService_List_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *maintenanceServiceClient) Get(ctx context.Context, in *v2.GetMaintenanceRequest, opts ...grpc.CallOption) (*v2.Maintenance, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v2.Maintenance)
	err := c.cc.Invoke(ctx, MaintenanceService_Get_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *maintenanceServiceClient) Reschedule(ctx context.Context, in *v2.RescheduleMaintenanceRequest, opts ...grpc.CallOption) (*operation.Operation, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(operation.Operation)
	err := c.cc.Invoke(ctx, MaintenanceService_Reschedule_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// MaintenanceServiceServer is the server API for MaintenanceService service.
// All implementations should embed UnimplementedMaintenanceServiceServer
// for forward compatibility.
//
// A set of methods for managing maintenances in a service.
type MaintenanceServiceServer interface {
	// Lists maintenances by conditions, specified in request.
	List(context.Context, *v2.ListMaintenancesRequest) (*v2.ListMaintenancesResponse, error)
	// Retrieves the specific Maintenance by ID.
	Get(context.Context, *v2.GetMaintenanceRequest) (*v2.Maintenance, error)
	// Allows user to reschedule Maintenance to another date and time.
	Reschedule(context.Context, *v2.RescheduleMaintenanceRequest) (*operation.Operation, error)
}

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

func (UnimplementedMaintenanceServiceServer) List(context.Context, *v2.ListMaintenancesRequest) (*v2.ListMaintenancesResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
}
func (UnimplementedMaintenanceServiceServer) Get(context.Context, *v2.GetMaintenanceRequest) (*v2.Maintenance, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedMaintenanceServiceServer) Reschedule(context.Context, *v2.RescheduleMaintenanceRequest) (*operation.Operation, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Reschedule not implemented")
}
func (UnimplementedMaintenanceServiceServer) testEmbeddedByValue() {}

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

func RegisterMaintenanceServiceServer(s grpc.ServiceRegistrar, srv MaintenanceServiceServer) {
	// If the following call pancis, it indicates UnimplementedMaintenanceServiceServer 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(&MaintenanceService_ServiceDesc, srv)
}

func _MaintenanceService_List_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v2.ListMaintenancesRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MaintenanceServiceServer).List(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: MaintenanceService_List_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MaintenanceServiceServer).List(ctx, req.(*v2.ListMaintenancesRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _MaintenanceService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v2.GetMaintenanceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MaintenanceServiceServer).Get(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: MaintenanceService_Get_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MaintenanceServiceServer).Get(ctx, req.(*v2.GetMaintenanceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _MaintenanceService_Reschedule_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v2.RescheduleMaintenanceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(MaintenanceServiceServer).Reschedule(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: MaintenanceService_Reschedule_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(MaintenanceServiceServer).Reschedule(ctx, req.(*v2.RescheduleMaintenanceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// MaintenanceService_ServiceDesc is the grpc.ServiceDesc for MaintenanceService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MaintenanceService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.compute.v1.MaintenanceService",
	HandlerType: (*MaintenanceServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "List",
			Handler:    _MaintenanceService_List_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _MaintenanceService_Get_Handler,
		},
		{
			MethodName: "Reschedule",
			Handler:    _MaintenanceService_Reschedule_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "yandex/cloud/compute/v1/maintenance_service.proto",
}
