codekingpro/portable-devtools
114k
1 2# Copyright 2020 Google LLC3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15 16# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!17 18"""Client and server classes corresponding to protobuf-defined services."""19import grpc20 21from google.longrunning import (22 operations_proto_pb2 as google_dot_longrunning_dot_operations__pb2,23)24from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb225 26 27class OperationsStub(object):28 """Manages long-running operations with an API service.29 30 When an API method normally takes long time to complete, it can be designed31 to return [Operation][google.longrunning.Operation] to the client, and the client can use this32 interface to receive the real response asynchronously by polling the33 operation resource, or pass the operation resource to another API (such as34 Google Cloud Pub/Sub API) to receive the response. Any API service that35 returns long-running operations should implement the `Operations` interface36 so developers can have a consistent client experience.37 """38 39 def __init__(self, channel):40 """Constructor.41 42 Args:43 channel: A grpc.Channel.44 """45 self.ListOperations = channel.unary_unary(46 "/google.longrunning.Operations/ListOperations",47 request_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString,48 response_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString,49 )50 self.GetOperation = channel.unary_unary(51 "/google.longrunning.Operations/GetOperation",52 request_serializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString,53 response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,54 )55 self.DeleteOperation = channel.unary_unary(56 "/google.longrunning.Operations/DeleteOperation",57 request_serializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString,58 response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,59 )60 self.CancelOperation = channel.unary_unary(61 "/google.longrunning.Operations/CancelOperation",62 request_serializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString,63 response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,64 )65 self.WaitOperation = channel.unary_unary(66 "/google.longrunning.Operations/WaitOperation",67 request_serializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString,68 response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString,69 )70 71 72class OperationsServicer(object):73 """Manages long-running operations with an API service.74 75 When an API method normally takes long time to complete, it can be designed76 to return [Operation][google.longrunning.Operation] to the client, and the client can use this77 interface to receive the real response asynchronously by polling the78 operation resource, or pass the operation resource to another API (such as79 Google Cloud Pub/Sub API) to receive the response. Any API service that80 returns long-running operations should implement the `Operations` interface81 so developers can have a consistent client experience.82 """83 84 def ListOperations(self, request, context):85 """Lists operations that match the specified filter in the request. If the86 server doesn't support this method, it returns `UNIMPLEMENTED`.87 88 NOTE: the `name` binding allows API services to override the binding89 to use different resource name schemes, such as `users/*/operations`. To90 override the binding, API services can add a binding such as91 `"/v1/{name=users/*}/operations"` to their service configuration.92 For backwards compatibility, the default name includes the operations93 collection id, however overriding users must ensure the name binding94 is the parent resource, without the operations collection id.95 """96 context.set_code(grpc.StatusCode.UNIMPLEMENTED)97 context.set_details("Method not implemented!")98 raise NotImplementedError("Method not implemented!")99 100 def GetOperation(self, request, context):101 """Gets the latest state of a long-running operation. Clients can use this102 method to poll the operation result at intervals as recommended by the API103 service.104 """105 context.set_code(grpc.StatusCode.UNIMPLEMENTED)106 context.set_details("Method not implemented!")107 raise NotImplementedError("Method not implemented!")108 109 def DeleteOperation(self, request, context):110 """Deletes a long-running operation. This method indicates that the client is111 no longer interested in the operation result. It does not cancel the112 operation. If the server doesn't support this method, it returns113 `google.rpc.Code.UNIMPLEMENTED`.114 """115 context.set_code(grpc.StatusCode.UNIMPLEMENTED)116 context.set_details("Method not implemented!")117 raise NotImplementedError("Method not implemented!")118 119 def CancelOperation(self, request, context):120 """Starts asynchronous cancellation on a long-running operation. The server121 makes a best effort to cancel the operation, but success is not122 guaranteed. If the server doesn't support this method, it returns123 `google.rpc.Code.UNIMPLEMENTED`. Clients can use124 [Operations.GetOperation][google.longrunning.Operations.GetOperation] or125 other methods to check whether the cancellation succeeded or whether the126 operation completed despite cancellation. On successful cancellation,127 the operation is not deleted; instead, it becomes an operation with128 an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,129 corresponding to `Code.CANCELLED`.130 """131 context.set_code(grpc.StatusCode.UNIMPLEMENTED)132 context.set_details("Method not implemented!")133 raise NotImplementedError("Method not implemented!")134 135 def WaitOperation(self, request, context):136 """Waits until the specified long-running operation is done or reaches at most137 a specified timeout, returning the latest state. If the operation is138 already done, the latest state is immediately returned. If the timeout139 specified is greater than the default HTTP/RPC timeout, the HTTP/RPC140 timeout is used. If the server does not support this method, it returns141 `google.rpc.Code.UNIMPLEMENTED`.142 Note that this method is on a best-effort basis. It may return the latest143 state before the specified timeout (including immediately), meaning even an144 immediate response is no guarantee that the operation is done.145 """146 context.set_code(grpc.StatusCode.UNIMPLEMENTED)147 context.set_details("Method not implemented!")148 raise NotImplementedError("Method not implemented!")149 150 151def add_OperationsServicer_to_server(servicer, server):152 rpc_method_handlers = {153 "ListOperations": grpc.unary_unary_rpc_method_handler(154 servicer.ListOperations,155 request_deserializer=google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.FromString,156 response_serializer=google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.SerializeToString,157 ),158 "GetOperation": grpc.unary_unary_rpc_method_handler(159 servicer.GetOperation,160 request_deserializer=google_dot_longrunning_dot_operations__pb2.GetOperationRequest.FromString,161 response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,162 ),163 "DeleteOperation": grpc.unary_unary_rpc_method_handler(164 servicer.DeleteOperation,165 request_deserializer=google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.FromString,166 response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,167 ),168 "CancelOperation": grpc.unary_unary_rpc_method_handler(169 servicer.CancelOperation,170 request_deserializer=google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.FromString,171 response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,172 ),173 "WaitOperation": grpc.unary_unary_rpc_method_handler(174 servicer.WaitOperation,175 request_deserializer=google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.FromString,176 response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString,177 ),178 }179 generic_handler = grpc.method_handlers_generic_handler(180 "google.longrunning.Operations", rpc_method_handlers181 )182 server.add_generic_rpc_handlers((generic_handler,))183 184 185# This class is part of an EXPERIMENTAL API.186class Operations(object):187 """Manages long-running operations with an API service.188 189 When an API method normally takes long time to complete, it can be designed190 to return [Operation][google.longrunning.Operation] to the client, and the client can use this191 interface to receive the real response asynchronously by polling the192 operation resource, or pass the operation resource to another API (such as193 Google Cloud Pub/Sub API) to receive the response. Any API service that194 returns long-running operations should implement the `Operations` interface195 so developers can have a consistent client experience.196 """197 198 @staticmethod199 def ListOperations(200 request,201 target,202 options=(),203 channel_credentials=None,204 call_credentials=None,205 insecure=False,206 compression=None,207 wait_for_ready=None,208 timeout=None,209 metadata=None,210 ):211 return grpc.experimental.unary_unary(212 request,213 target,214 "/google.longrunning.Operations/ListOperations",215 google_dot_longrunning_dot_operations__pb2.ListOperationsRequest.SerializeToString,216 google_dot_longrunning_dot_operations__pb2.ListOperationsResponse.FromString,217 options,218 channel_credentials,219 insecure,220 call_credentials,221 compression,222 wait_for_ready,223 timeout,224 metadata,225 )226 227 @staticmethod228 def GetOperation(229 request,230 target,231 options=(),232 channel_credentials=None,233 call_credentials=None,234 insecure=False,235 compression=None,236 wait_for_ready=None,237 timeout=None,238 metadata=None,239 ):240 return grpc.experimental.unary_unary(241 request,242 target,243 "/google.longrunning.Operations/GetOperation",244 google_dot_longrunning_dot_operations__pb2.GetOperationRequest.SerializeToString,245 google_dot_longrunning_dot_operations__pb2.Operation.FromString,246 options,247 channel_credentials,248 insecure,249 call_credentials,250 compression,251 wait_for_ready,252 timeout,253 metadata,254 )255 256 @staticmethod257 def DeleteOperation(258 request,259 target,260 options=(),261 channel_credentials=None,262 call_credentials=None,263 insecure=False,264 compression=None,265 wait_for_ready=None,266 timeout=None,267 metadata=None,268 ):269 return grpc.experimental.unary_unary(270 request,271 target,272 "/google.longrunning.Operations/DeleteOperation",273 google_dot_longrunning_dot_operations__pb2.DeleteOperationRequest.SerializeToString,274 google_dot_protobuf_dot_empty__pb2.Empty.FromString,275 options,276 channel_credentials,277 insecure,278 call_credentials,279 compression,280 wait_for_ready,281 timeout,282 metadata,283 )284 285 @staticmethod286 def CancelOperation(287 request,288 target,289 options=(),290 channel_credentials=None,291 call_credentials=None,292 insecure=False,293 compression=None,294 wait_for_ready=None,295 timeout=None,296 metadata=None,297 ):298 return grpc.experimental.unary_unary(299 request,300 target,301 "/google.longrunning.Operations/CancelOperation",302 google_dot_longrunning_dot_operations__pb2.CancelOperationRequest.SerializeToString,303 google_dot_protobuf_dot_empty__pb2.Empty.FromString,304 options,305 channel_credentials,306 insecure,307 call_credentials,308 compression,309 wait_for_ready,310 timeout,311 metadata,312 )313 314 @staticmethod315 def WaitOperation(316 request,317 target,318 options=(),319 channel_credentials=None,320 call_credentials=None,321 insecure=False,322 compression=None,323 wait_for_ready=None,324 timeout=None,325 metadata=None,326 ):327 return grpc.experimental.unary_unary(328 request,329 target,330 "/google.longrunning.Operations/WaitOperation",331 google_dot_longrunning_dot_operations__pb2.WaitOperationRequest.SerializeToString,332 google_dot_longrunning_dot_operations__pb2.Operation.FromString,333 options,334 channel_credentials,335 insecure,336 call_credentials,337 compression,338 wait_for_ready,339 timeout,340 metadata,341 )342 