示例#1
0
def stub(
    service_name, methods, host, port, metadata_transformer=None, secure=False,
    root_certificates=None, private_key=None, certificate_chain=None,
    server_host_override=None):
  """Constructs an interfaces.Stub.

  Args:
    service_name: The package-qualified full name of the service.
    methods: A dictionary from RPC method name to
      interfaces.RpcMethodInvocationDescription describing the RPCs to be
      supported by the created stub. The RPC method names in the dictionary are
      not qualified by the service name or decorated in any other way.
    host: The host to which to connect for RPC service.
    port: The port to which to connect for RPC service.
    metadata_transformer: A callable that given a metadata object produces
      another metadata object to be used in the underlying communication on the
      wire.
    secure: Whether or not to construct the stub with a secure connection.
    root_certificates: The PEM-encoded root certificates or None to ask for
      them to be retrieved from a default location.
    private_key: The PEM-encoded private key to use or None if no private key
      should be used.
    certificate_chain: The PEM-encoded certificate chain to use or None if no
      certificate chain should be used.
    server_host_override: (For testing only) the target name used for SSL
      host name checking.

  Returns:
    An interfaces.Stub affording RPC invocation.
  """
  breakdown = _face_utilities.break_down_invocation(service_name, methods)
  return _Stub(
      breakdown, host, port, secure, root_certificates, private_key,
      certificate_chain, server_host_override=server_host_override,
      metadata_transformer=metadata_transformer)
示例#2
0
def stub(service_name,
         methods,
         host,
         port,
         metadata_transformer=None,
         secure=False,
         root_certificates=None,
         private_key=None,
         certificate_chain=None,
         server_host_override=None,
         thread_pool_size=_DEFAULT_THREAD_POOL_SIZE):
    """Constructs an interfaces.Stub.

  Args:
    service_name: The package-qualified full name of the service.
    methods: A dictionary from RPC method name to
      interfaces.RpcMethodInvocationDescription describing the RPCs to be
      supported by the created stub. The RPC method names in the dictionary are
      not qualified by the service name or decorated in any other way.
    host: The host to which to connect for RPC service.
    port: The port to which to connect for RPC service.
    metadata_transformer: A callable that given a metadata object produces
      another metadata object to be used in the underlying communication on the
      wire.
    secure: Whether or not to construct the stub with a secure connection.
    root_certificates: The PEM-encoded root certificates or None to ask for
      them to be retrieved from a default location.
    private_key: The PEM-encoded private key to use or None if no private key
      should be used.
    certificate_chain: The PEM-encoded certificate chain to use or None if no
      certificate chain should be used.
    server_host_override: (For testing only) the target name used for SSL
      host name checking.
    thread_pool_size: The maximum number of threads to allow in the backing
      thread pool.

  Returns:
    An interfaces.Stub affording RPC invocation.
  """
    breakdown = _face_utilities.break_down_invocation(service_name, methods)
    return _Stub(breakdown,
                 host,
                 port,
                 secure,
                 root_certificates,
                 private_key,
                 certificate_chain,
                 server_host_override=server_host_override,
                 metadata_transformer=metadata_transformer,
                 thread_pool_size=thread_pool_size)
示例#3
0
def _build_stub(service_name,
                methods,
                host,
                port,
                secure,
                root_certificates,
                private_key,
                certificate_chain,
                server_host_override=None):
    breakdown = _face_utilities.break_down_invocation(service_name, methods)
    return _Stub(breakdown,
                 host,
                 port,
                 secure,
                 root_certificates,
                 private_key,
                 certificate_chain,
                 server_host_override=server_host_override)
示例#4
0
def stub(service_name,
         methods,
         host,
         port,
         secure=False,
         root_certificates=None,
         private_key=None,
         certificate_chain=None,
         server_host_override=None):
    """Constructs an interfaces.Stub.

  Args:
    service_name: The package-qualified full name of the service.
    methods: A dictionary from RPC method name to
      interfaces.RpcMethodInvocationDescription describing the RPCs to be
      supported by the created stub. The RPC method names in the dictionary are
      not qualified by the service name or decorated in any other way.
    host: The host to which to connect for RPC service.
    port: The port to which to connect for RPC service.
    secure: Whether or not to construct the stub with a secure connection.
    root_certificates: The PEM-encoded root certificates or None to ask for
      them to be retrieved from a default location.
    private_key: The PEM-encoded private key to use or None if no private key
      should be used.
    certificate_chain: The PEM-encoded certificate chain to use or None if no
      certificate chain should be used.
    server_host_override: (For testing only) the target name used for SSL
      host name checking.

  Returns:
    An interfaces.Stub affording RPC invocation.
  """
    breakdown = _face_utilities.break_down_invocation(service_name, methods)
    return _Stub(breakdown,
                 host,
                 port,
                 secure,
                 root_certificates,
                 private_key,
                 certificate_chain,
                 server_host_override=server_host_override)