ó
ùR_c           @   sg   d  d l  Z  d  d l m Z d  d l m Z d  d l m Z d Z d d  Z	 d d  Z
 d   Z d S(	   i˙˙˙˙N(   t   text_format(   t   _channel(   t   grpc_gcp_pb2s   grpc_gcp.api_configc         C   sk   | rT g  | D] } | d t  k r | ^ q rT t j |  | d k rJ d n | |  St j |  | |  Sd S(   s(  Creates a secure Channel to a server.

    Args:
      target: The server address.
      credentials: A ChannelCredentials instance.
      options: An optional list of key-value pairs (channel args
        in gRPC Core runtime) to configure the channel.

    Returns:
      A Channel object.
    i    N(    (   t   API_CONFIG_CHANNEL_ARGR   t   Channelt   Nonet   grpct   secure_channel(   t   targett   credentialst   optionst   arg(    (    sJ   /var/www/syncserver/local/lib/python2.7/site-packages/grpc_gcp/__init__.pyR      s
    	c         C   sS   | r? g  | D] } | d t  k r | ^ q r? t j |  |  St j |  |  Sd S(   sù   Creates an insecure Channel to a server.

    Args:
      target: The server address.
      options: An optional list of key-value pairs (channel args
        in gRPC Core runtime) to configure the channel.

    Returns:
      A Channel object.
    i    N(   R   R   R   R   t   insecure_channel(   R   R
   R   (    (    sJ   /var/www/syncserver/local/lib/python2.7/site-packages/grpc_gcp/__init__.pyR   ,   s    c         C   s    t  j   } t j |  |  | S(   sç   Creates an instance of ApiConfig with provided api configuration.

    Args:
      text_pb: The text representation of a protocol message defining api
        configuration.

    Returns:
      A grpc_gcp_pb2.ApiConfig object.
    (   R   t	   ApiConfigR    t   Merge(   t   text_pbt   config(    (    sJ   /var/www/syncserver/local/lib/python2.7/site-packages/grpc_gcp/__init__.pyt   api_config_from_text_pb>   s    
(   R   t   google.protobufR    t   grpc_gcpR   t   grpc_gcp.protoR   R   R   R   R   R   (    (    (    sJ   /var/www/syncserver/local/lib/python2.7/site-packages/grpc_gcp/__init__.pyt   <module>   s   