def __init__(self, connection, secure): if secure: self._stub = make_secure_stub( connection.credentials, connection.USER_AGENT, datastore_pb2_grpc.DatastoreStub, connection.host ) else: self._stub = make_insecure_stub(datastore_pb2_grpc.DatastoreStub, connection.host)
def _make_data_stub(client): """Creates gRPC stub to make requests to the Data API. :type client: :class:`Client` :param client: The client that will hold the stub. :rtype: :class:`._generated.bigtable_pb2.BigtableStub` :returns: A gRPC stub object. """ if client.emulator_host is None: return make_secure_stub(client.credentials, client.user_agent, bigtable_pb2.BigtableStub, DATA_API_HOST) else: return make_insecure_stub(bigtable_pb2.BigtableStub, client.emulator_host)
def _make_instance_stub(client): """Creates gRPC stub to make requests to the Instance Admin API. :type client: :class:`Client` :param client: The client that will hold the stub. :rtype: :class:`.bigtable_instance_admin_pb2.BigtableInstanceAdminStub` :returns: A gRPC stub object. """ if client.emulator_host is None: return make_secure_stub( client.credentials, client.user_agent, bigtable_instance_admin_pb2.BigtableInstanceAdminStub, INSTANCE_ADMIN_HOST) else: return make_insecure_stub( bigtable_instance_admin_pb2.BigtableInstanceAdminStub, client.emulator_host)
def _make_table_stub(client): """Creates gRPC stub to make requests to the Table Admin API. :type client: :class:`Client` :param client: The client that will hold the stub. :rtype: :class:`.bigtable_instance_admin_pb2.BigtableTableAdminStub` :returns: A gRPC stub object. """ if client.emulator_host is None: return make_secure_stub( client.credentials, client.user_agent, bigtable_table_admin_pb2.BigtableTableAdminStub, TABLE_ADMIN_HOST, extra_options=_GRPC_EXTRA_OPTIONS) else: return make_insecure_stub( bigtable_table_admin_pb2.BigtableTableAdminStub, client.emulator_host)
def _make_operations_stub(client): """Creates gRPC stub to make requests to the Operations API. These are for long-running operations of the Instance Admin API, hence the host and port matching. :type client: :class:`Client` :param client: The client that will hold the stub. :rtype: :class:`google.longrunning.operations_grpc.OperationsStub` :returns: A gRPC stub object. """ if client.emulator_host is None: return make_secure_stub(client.credentials, client.user_agent, operations_grpc.OperationsStub, OPERATIONS_API_HOST) else: return make_insecure_stub(operations_grpc.OperationsStub, client.emulator_host)
def _make_operations_stub(client): """Creates gRPC stub to make requests to the Operations API. These are for long-running operations of the Instance Admin API, hence the host and port matching. :type client: :class:`Client` :param client: The client that will hold the stub. :rtype: :class:`google.longrunning.operations_grpc.OperationsStub` :returns: A gRPC stub object. """ if client.emulator_host is None: return make_secure_stub(client.credentials, client.user_agent, operations_grpc.OperationsStub, OPERATIONS_API_HOST, extra_options=_GRPC_EXTRA_OPTIONS) else: return make_insecure_stub(operations_grpc.OperationsStub, client.emulator_host)
def _call_fut(self, *args, **kwargs): from google.cloud._helpers import make_insecure_stub return make_insecure_stub(*args, **kwargs)