operation_service_grpc.pb.go raw
1 // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
2 // versions:
3 // - protoc-gen-go-grpc v1.5.1
4 // - protoc v3.21.12
5 // source: yandex/cloud/operation/operation_service.proto
6
7 package operation
8
9 import (
10 context "context"
11 grpc "google.golang.org/grpc"
12 codes "google.golang.org/grpc/codes"
13 status "google.golang.org/grpc/status"
14 )
15
16 // This is a compile-time assertion to ensure that this generated file
17 // is compatible with the grpc package it is being compiled against.
18 // Requires gRPC-Go v1.64.0 or later.
19 const _ = grpc.SupportPackageIsVersion9
20
21 const (
22 OperationService_Get_FullMethodName = "/yandex.cloud.operation.OperationService/Get"
23 OperationService_Cancel_FullMethodName = "/yandex.cloud.operation.OperationService/Cancel"
24 )
25
26 // OperationServiceClient is the client API for OperationService service.
27 //
28 // 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.
29 //
30 // A set of methods for managing operations for asynchronous API requests.
31 type OperationServiceClient interface {
32 // Returns the specified Operation resource.
33 Get(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
34 // Cancels the specified operation.
35 //
36 // Note that currently Object Storage API does not support cancelling operations.
37 Cancel(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*Operation, error)
38 }
39
40 type operationServiceClient struct {
41 cc grpc.ClientConnInterface
42 }
43
44 func NewOperationServiceClient(cc grpc.ClientConnInterface) OperationServiceClient {
45 return &operationServiceClient{cc}
46 }
47
48 func (c *operationServiceClient) Get(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
49 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
50 out := new(Operation)
51 err := c.cc.Invoke(ctx, OperationService_Get_FullMethodName, in, out, cOpts...)
52 if err != nil {
53 return nil, err
54 }
55 return out, nil
56 }
57
58 func (c *operationServiceClient) Cancel(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
59 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
60 out := new(Operation)
61 err := c.cc.Invoke(ctx, OperationService_Cancel_FullMethodName, in, out, cOpts...)
62 if err != nil {
63 return nil, err
64 }
65 return out, nil
66 }
67
68 // OperationServiceServer is the server API for OperationService service.
69 // All implementations should embed UnimplementedOperationServiceServer
70 // for forward compatibility.
71 //
72 // A set of methods for managing operations for asynchronous API requests.
73 type OperationServiceServer interface {
74 // Returns the specified Operation resource.
75 Get(context.Context, *GetOperationRequest) (*Operation, error)
76 // Cancels the specified operation.
77 //
78 // Note that currently Object Storage API does not support cancelling operations.
79 Cancel(context.Context, *CancelOperationRequest) (*Operation, error)
80 }
81
82 // UnimplementedOperationServiceServer should be embedded to have
83 // forward compatible implementations.
84 //
85 // NOTE: this should be embedded by value instead of pointer to avoid a nil
86 // pointer dereference when methods are called.
87 type UnimplementedOperationServiceServer struct{}
88
89 func (UnimplementedOperationServiceServer) Get(context.Context, *GetOperationRequest) (*Operation, error) {
90 return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
91 }
92 func (UnimplementedOperationServiceServer) Cancel(context.Context, *CancelOperationRequest) (*Operation, error) {
93 return nil, status.Errorf(codes.Unimplemented, "method Cancel not implemented")
94 }
95 func (UnimplementedOperationServiceServer) testEmbeddedByValue() {}
96
97 // UnsafeOperationServiceServer may be embedded to opt out of forward compatibility for this service.
98 // Use of this interface is not recommended, as added methods to OperationServiceServer will
99 // result in compilation errors.
100 type UnsafeOperationServiceServer interface {
101 mustEmbedUnimplementedOperationServiceServer()
102 }
103
104 func RegisterOperationServiceServer(s grpc.ServiceRegistrar, srv OperationServiceServer) {
105 // If the following call pancis, it indicates UnimplementedOperationServiceServer was
106 // embedded by pointer and is nil. This will cause panics if an
107 // unimplemented method is ever invoked, so we test this at initialization
108 // time to prevent it from happening at runtime later due to I/O.
109 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
110 t.testEmbeddedByValue()
111 }
112 s.RegisterService(&OperationService_ServiceDesc, srv)
113 }
114
115 func _OperationService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
116 in := new(GetOperationRequest)
117 if err := dec(in); err != nil {
118 return nil, err
119 }
120 if interceptor == nil {
121 return srv.(OperationServiceServer).Get(ctx, in)
122 }
123 info := &grpc.UnaryServerInfo{
124 Server: srv,
125 FullMethod: OperationService_Get_FullMethodName,
126 }
127 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
128 return srv.(OperationServiceServer).Get(ctx, req.(*GetOperationRequest))
129 }
130 return interceptor(ctx, in, info, handler)
131 }
132
133 func _OperationService_Cancel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
134 in := new(CancelOperationRequest)
135 if err := dec(in); err != nil {
136 return nil, err
137 }
138 if interceptor == nil {
139 return srv.(OperationServiceServer).Cancel(ctx, in)
140 }
141 info := &grpc.UnaryServerInfo{
142 Server: srv,
143 FullMethod: OperationService_Cancel_FullMethodName,
144 }
145 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
146 return srv.(OperationServiceServer).Cancel(ctx, req.(*CancelOperationRequest))
147 }
148 return interceptor(ctx, in, info, handler)
149 }
150
151 // OperationService_ServiceDesc is the grpc.ServiceDesc for OperationService service.
152 // It's only intended for direct use with grpc.RegisterService,
153 // and not to be introspected or modified (even as a copy)
154 var OperationService_ServiceDesc = grpc.ServiceDesc{
155 ServiceName: "yandex.cloud.operation.OperationService",
156 HandlerType: (*OperationServiceServer)(nil),
157 Methods: []grpc.MethodDesc{
158 {
159 MethodName: "Get",
160 Handler: _OperationService_Get_Handler,
161 },
162 {
163 MethodName: "Cancel",
164 Handler: _OperationService_Cancel_Handler,
165 },
166 },
167 Streams: []grpc.StreamDesc{},
168 Metadata: "yandex/cloud/operation/operation_service.proto",
169 }
170