
                         @    d Z ddlmZ ddlmZ ddlmZ ddlZd Zd Zy)zDCode that's shared between multiple service-attachments subcommands.    )absolute_import)division)unicode_literalsNc                     | j                   dk(  r |j                  j                  j                  S | j                   dk(  r |j                  j                  j                  S y)z4Get connection preference of the service attachment.ACCEPT_AUTOMATICACCEPT_MANUALN)connection_preferenceServiceAttachment#ConnectionPreferenceValueValuesEnumr   r   )argsmessagess     Wlib/googlecloudsdk/command_lib/compute/service_attachments/service_attachments_utils.pyGetConnectionPreferencer      sR    	#55%%IIZZZ	?2%%IIWWW	    c           
      .   g }| j                   D ]  }t        t        j                  |            D ]`  \  }}d|v r,|j	                  |j                  |t        |                   6|j	                  |j                  |t        |                   b  |S )z3Get consumer accept list of the service attachment.z
/networks/)
networkUrlconnectionLimit)projectIdOrNumr   )consumer_accept_listsortedsix	iteritemsappend%ServiceAttachmentConsumerProjectLimitint)r   r   r   project_limitproject_id_or_network_url
conn_limits         r   GetConsumerAcceptListr   "   s    00m17m$2&-!:	2	2##::4 #J ; 1	2
 	##::8 #J ; 1	22& 1 
r   )__doc__
__future__r   r   r   r   r   r    r   r   <module>r#      s!    K &  ' 
r   