Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/longrunning/operations_pb2_grpc.py: 45%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

53 statements  

1# Copyright 2020 Google LLC 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14 

15# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 

16 

17"""Client and server classes corresponding to protobuf-defined services.""" 

18from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 

19import grpc 

20 

21from google.longrunning import ( 

22 operations_proto_pb2 as google_dot_longrunning_dot_operations__pb2, 

23) 

24 

25 

26class OperationsStub(object): 

27 """Manages long-running operations with an API service. 

28 

29 When an API method normally takes long time to complete, it can be designed 

30 to return [Operation][google.longrunning.Operation] to the client, and the client can use this 

31 interface to receive the real response asynchronously by polling the 

32 operation resource, or pass the operation resource to another API (such as 

33 Google Cloud Pub/Sub API) to receive the response. Any API service that 

34 returns long-running operations should implement the `Operations` interface 

35 so developers can have a consistent client experience. 

36 """ 

37 

38 def __init__(self, channel): 

39 """Constructor. 

40 

41 Args: 

42 channel: A grpc.Channel. 

43 """ 

44 self.ListOperations = channel.unary_unary( 

45 "/google.longrunning.Operations/ListOperations", 

46 request_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString, 

47 response_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString, 

48 ) 

49 self.GetOperation = channel.unary_unary( 

50 "/google.longrunning.Operations/GetOperation", 

51 request_serializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString, 

52 response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, 

53 ) 

54 self.DeleteOperation = channel.unary_unary( 

55 "/google.longrunning.Operations/DeleteOperation", 

56 request_serializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString, 

57 response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, 

58 ) 

59 self.CancelOperation = channel.unary_unary( 

60 "/google.longrunning.Operations/CancelOperation", 

61 request_serializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString, 

62 response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, 

63 ) 

64 self.WaitOperation = channel.unary_unary( 

65 "/google.longrunning.Operations/WaitOperation", 

66 request_serializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString, 

67 response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, 

68 ) 

69 

70 

71class OperationsServicer(object): 

72 """Manages long-running operations with an API service. 

73 

74 When an API method normally takes long time to complete, it can be designed 

75 to return [Operation][google.longrunning.Operation] to the client, and the client can use this 

76 interface to receive the real response asynchronously by polling the 

77 operation resource, or pass the operation resource to another API (such as 

78 Google Cloud Pub/Sub API) to receive the response. Any API service that 

79 returns long-running operations should implement the `Operations` interface 

80 so developers can have a consistent client experience. 

81 """ 

82 

83 def ListOperations(self, request, context): 

84 """Lists operations that match the specified filter in the request. If the 

85 server doesn't support this method, it returns `UNIMPLEMENTED`. 

86 

87 NOTE: the `name` binding allows API services to override the binding 

88 to use different resource name schemes, such as `users/*/operations`. To 

89 override the binding, API services can add a binding such as 

90 `"/v1/{name=users/*}/operations"` to their service configuration. 

91 For backwards compatibility, the default name includes the operations 

92 collection id, however overriding users must ensure the name binding 

93 is the parent resource, without the operations collection id. 

94 """ 

95 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

96 context.set_details("Method not implemented!") 

97 raise NotImplementedError("Method not implemented!") 

98 

99 def GetOperation(self, request, context): 

100 """Gets the latest state of a long-running operation. Clients can use this 

101 method to poll the operation result at intervals as recommended by the API 

102 service. 

103 """ 

104 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

105 context.set_details("Method not implemented!") 

106 raise NotImplementedError("Method not implemented!") 

107 

108 def DeleteOperation(self, request, context): 

109 """Deletes a long-running operation. This method indicates that the client is 

110 no longer interested in the operation result. It does not cancel the 

111 operation. If the server doesn't support this method, it returns 

112 `google.rpc.Code.UNIMPLEMENTED`. 

113 """ 

114 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

115 context.set_details("Method not implemented!") 

116 raise NotImplementedError("Method not implemented!") 

117 

118 def CancelOperation(self, request, context): 

119 """Starts asynchronous cancellation on a long-running operation. The server 

120 makes a best effort to cancel the operation, but success is not 

121 guaranteed. If the server doesn't support this method, it returns 

122 `google.rpc.Code.UNIMPLEMENTED`. Clients can use 

123 [Operations.GetOperation][google.longrunning.Operations.GetOperation] or 

124 other methods to check whether the cancellation succeeded or whether the 

125 operation completed despite cancellation. On successful cancellation, 

126 the operation is not deleted; instead, it becomes an operation with 

127 an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, 

128 corresponding to `Code.CANCELLED`. 

129 """ 

130 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

131 context.set_details("Method not implemented!") 

132 raise NotImplementedError("Method not implemented!") 

133 

134 def WaitOperation(self, request, context): 

135 """Waits until the specified long-running operation is done or reaches at most 

136 a specified timeout, returning the latest state. If the operation is 

137 already done, the latest state is immediately returned. If the timeout 

138 specified is greater than the default HTTP/RPC timeout, the HTTP/RPC 

139 timeout is used. If the server does not support this method, it returns 

140 `google.rpc.Code.UNIMPLEMENTED`. 

141 Note that this method is on a best-effort basis. It may return the latest 

142 state before the specified timeout (including immediately), meaning even an 

143 immediate response is no guarantee that the operation is done. 

144 """ 

145 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

146 context.set_details("Method not implemented!") 

147 raise NotImplementedError("Method not implemented!") 

148 

149 

150def add_OperationsServicer_to_server(servicer, server): 

151 rpc_method_handlers = { 

152 "ListOperations": grpc.unary_unary_rpc_method_handler( 

153 servicer.ListOperations, 

154 request_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.FromString, 

155 response_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.SerializeToString, 

156 ), 

157 "GetOperation": grpc.unary_unary_rpc_method_handler( 

158 servicer.GetOperation, 

159 request_deserializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.FromString, 

160 response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, 

161 ), 

162 "DeleteOperation": grpc.unary_unary_rpc_method_handler( 

163 servicer.DeleteOperation, 

164 request_deserializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.FromString, 

165 response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, 

166 ), 

167 "CancelOperation": grpc.unary_unary_rpc_method_handler( 

168 servicer.CancelOperation, 

169 request_deserializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.FromString, 

170 response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, 

171 ), 

172 "WaitOperation": grpc.unary_unary_rpc_method_handler( 

173 servicer.WaitOperation, 

174 request_deserializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.FromString, 

175 response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, 

176 ), 

177 } 

178 generic_handler = grpc.method_handlers_generic_handler( 

179 "google.longrunning.Operations", rpc_method_handlers 

180 ) 

181 server.add_generic_rpc_handlers((generic_handler,)) 

182 

183 

184# This class is part of an EXPERIMENTAL API. 

185class Operations(object): 

186 """Manages long-running operations with an API service. 

187 

188 When an API method normally takes long time to complete, it can be designed 

189 to return [Operation][google.longrunning.Operation] to the client, and the client can use this 

190 interface to receive the real response asynchronously by polling the 

191 operation resource, or pass the operation resource to another API (such as 

192 Google Cloud Pub/Sub API) to receive the response. Any API service that 

193 returns long-running operations should implement the `Operations` interface 

194 so developers can have a consistent client experience. 

195 """ 

196 

197 @staticmethod 

198 def ListOperations( 

199 request, 

200 target, 

201 options=(), 

202 channel_credentials=None, 

203 call_credentials=None, 

204 insecure=False, 

205 compression=None, 

206 wait_for_ready=None, 

207 timeout=None, 

208 metadata=None, 

209 ): 

210 return grpc.experimental.unary_unary( 

211 request, 

212 target, 

213 "/google.longrunning.Operations/ListOperations", 

214 google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString, 

215 google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString, 

216 options, 

217 channel_credentials, 

218 insecure, 

219 call_credentials, 

220 compression, 

221 wait_for_ready, 

222 timeout, 

223 metadata, 

224 ) 

225 

226 @staticmethod 

227 def GetOperation( 

228 request, 

229 target, 

230 options=(), 

231 channel_credentials=None, 

232 call_credentials=None, 

233 insecure=False, 

234 compression=None, 

235 wait_for_ready=None, 

236 timeout=None, 

237 metadata=None, 

238 ): 

239 return grpc.experimental.unary_unary( 

240 request, 

241 target, 

242 "/google.longrunning.Operations/GetOperation", 

243 google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString, 

244 google_dot_longrunning_dot_operations__pb2.Operation.FromString, 

245 options, 

246 channel_credentials, 

247 insecure, 

248 call_credentials, 

249 compression, 

250 wait_for_ready, 

251 timeout, 

252 metadata, 

253 ) 

254 

255 @staticmethod 

256 def DeleteOperation( 

257 request, 

258 target, 

259 options=(), 

260 channel_credentials=None, 

261 call_credentials=None, 

262 insecure=False, 

263 compression=None, 

264 wait_for_ready=None, 

265 timeout=None, 

266 metadata=None, 

267 ): 

268 return grpc.experimental.unary_unary( 

269 request, 

270 target, 

271 "/google.longrunning.Operations/DeleteOperation", 

272 google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString, 

273 google_dot_protobuf_dot_empty__pb2.Empty.FromString, 

274 options, 

275 channel_credentials, 

276 insecure, 

277 call_credentials, 

278 compression, 

279 wait_for_ready, 

280 timeout, 

281 metadata, 

282 ) 

283 

284 @staticmethod 

285 def CancelOperation( 

286 request, 

287 target, 

288 options=(), 

289 channel_credentials=None, 

290 call_credentials=None, 

291 insecure=False, 

292 compression=None, 

293 wait_for_ready=None, 

294 timeout=None, 

295 metadata=None, 

296 ): 

297 return grpc.experimental.unary_unary( 

298 request, 

299 target, 

300 "/google.longrunning.Operations/CancelOperation", 

301 google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString, 

302 google_dot_protobuf_dot_empty__pb2.Empty.FromString, 

303 options, 

304 channel_credentials, 

305 insecure, 

306 call_credentials, 

307 compression, 

308 wait_for_ready, 

309 timeout, 

310 metadata, 

311 ) 

312 

313 @staticmethod 

314 def WaitOperation( 

315 request, 

316 target, 

317 options=(), 

318 channel_credentials=None, 

319 call_credentials=None, 

320 insecure=False, 

321 compression=None, 

322 wait_for_ready=None, 

323 timeout=None, 

324 metadata=None, 

325 ): 

326 return grpc.experimental.unary_unary( 

327 request, 

328 target, 

329 "/google.longrunning.Operations/WaitOperation", 

330 google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString, 

331 google_dot_longrunning_dot_operations__pb2.Operation.FromString, 

332 options, 

333 channel_credentials, 

334 insecure, 

335 call_credentials, 

336 compression, 

337 wait_for_ready, 

338 timeout, 

339 metadata, 

340 )