Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 def __init__(self, connection, secure):
     if secure:
         self._stub = make_secure_stub(connection.credentials,
                                       connection.USER_AGENT,
                                       datastore_grpc_pb2.DatastoreStub,
                                       connection.host)
     else:
         self._stub = make_insecure_stub(datastore_grpc_pb2.DatastoreStub,
                                         connection.host)
Exemplo n.º 3
0
 def __init__(self, client=None):
     self._client = client
     credentials = self._client._connection.credentials
     channel = make_secure_channel(credentials, DEFAULT_USER_AGENT,
                                   SpeechApi.SERVICE_ADDRESS)
     self._gapic_api = SpeechApi(channel=channel)
     self._operations_stub = make_secure_stub(
         credentials, DEFAULT_USER_AGENT, operations_grpc.OperationsStub,
         OPERATIONS_API_HOST)
Exemplo n.º 4
0
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.
    """
    return make_secure_stub(client.credentials, client.user_agent,
                            bigtable_pb2.BigtableStub, DATA_API_HOST)
Exemplo n.º 5
0
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.
    """
    return make_secure_stub(client.credentials, client.user_agent,
                            bigtable_table_admin_pb2.BigtableTableAdminStub,
                            TABLE_ADMIN_HOST)
Exemplo n.º 6
0
 def __init__(self, client=None):
     self._client = client
     credentials = self._client._connection.credentials
     channel = make_secure_channel(
         credentials, DEFAULT_USER_AGENT,
         SpeechClient.SERVICE_ADDRESS)
     self._gapic_api = SpeechClient(channel=channel)
     self._operations_stub = make_secure_stub(
         credentials,
         DEFAULT_USER_AGENT,
         operations_grpc.OperationsStub,
         OPERATIONS_API_HOST)
Exemplo n.º 7
0
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:`._generated.operations_grpc_pb2.OperationsStub`
    :returns: A gRPC stub object.
    """
    return make_secure_stub(client.credentials, client.user_agent,
                            operations_grpc_pb2.OperationsStub,
                            OPERATIONS_API_HOST)
Exemplo n.º 8
0
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)
Exemplo n.º 9
0
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,
                                extra_options=_GRPC_MAX_LENGTH_OPTIONS)
    else:
        return make_insecure_stub(bigtable_pb2.BigtableStub,
                                  client.emulator_host)
Exemplo n.º 10
0
 def __init__(self, client=None):
     self._client = client
     credentials = self._client._credentials
     channel = make_secure_channel(credentials, DEFAULT_USER_AGENT,
                                   SpeechClient.SERVICE_ADDRESS)
     self._gapic_api = SpeechClient(
         channel=channel,
         lib_name='gccl',
         lib_version=__version__,
     )
     self._operations_stub = make_secure_stub(
         credentials,
         DEFAULT_USER_AGENT,
         operations_grpc.OperationsStub,
         OPERATIONS_API_HOST,
     )
Exemplo n.º 11
0
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)
Exemplo n.º 12
0
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)
Exemplo n.º 13
0
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)
Exemplo n.º 14
0
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)
Exemplo n.º 15
0
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)
Exemplo n.º 16
0
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)
Exemplo n.º 17
0
    def _call_fut(self, *args, **kwargs):
        from google.cloud._helpers import make_secure_stub

        return make_secure_stub(*args, **kwargs)
    def _call_fut(self, *args, **kwargs):
        from google.cloud._helpers import make_secure_stub

        return make_secure_stub(*args, **kwargs)