Source code for airflow.providers.grpc.operators.grpc
## Licensed to the Apache Software Foundation (ASF) under one# or more contributor license agreements. See the NOTICE file# distributed with this work for additional information# regarding copyright ownership. The ASF licenses this file# to you under the Apache License, Version 2.0 (the# "License"); you may not use this file except in compliance# with the License. You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing,# software distributed under the License is distributed on an# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY# KIND, either express or implied. See the License for the# specific language governing permissions and limitations# under the License.from__future__importannotationsfromcollections.abcimportSequencefromtypingimportTYPE_CHECKING,Any,Callablefromairflow.modelsimportBaseOperatorfromairflow.providers.grpc.hooks.grpcimportGrpcHookifTYPE_CHECKING:fromairflow.utils.contextimportContext
[docs]classGrpcOperator(BaseOperator):""" Calls a gRPC endpoint to execute an action. :param stub_class: The stub client to use for this gRPC call :param call_func: The client function name to call the gRPC endpoint :param grpc_conn_id: The connection to run the operator against :param data: The data to pass to the rpc call :param interceptors: A list of gRPC interceptor objects to be used on the channel :param custom_connection_func: The customized connection function to return channel object. A callable that accepts the connection as its only arg. :param streaming: A flag to indicate if the call is a streaming call :param response_callback: The callback function to process the response from gRPC call, takes in response object and context object, context object can be used to perform push xcom or other after task actions :param log_response: A flag to indicate if we need to log the response """