
                         F    S r SSKJr  SSKJr  SSKJr  SSKrS rS rS rg)	zDCode that's shared between multiple service-attachments subcommands.    )absolute_import)division)unicode_literalsNc                     U R                   S:X  a   UR                  R                  R                  $ U R                   S:X  a   UR                  R                  R                  $ g)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           
      R   / nU R                    H  n[        [        R                  " U5      5       Hn  u  pESU;   a*  UR	                  UR                  U[        U5      S95        M5  SU;   a  [        S5      eUR	                  UR                  U[        U5      S95        Mp     M     U$ )z3Get consumer accept list of the service attachment.
/networks/
networkUrlconnectionLimit/forwardingRules/zNPrivate Service Connect Endpoint URL is not supported for consumer accept listprojectIdOrNumr   )consumer_accept_listsortedsix	iteritemsappend%ServiceAttachmentConsumerProjectLimitint
ValueError)r   r   r   project_limitproject_id_or_network_url
conn_limits         r   GetConsumerAcceptListr$   "   s    00m17m$2-! 
2	2##::4 #J ; 	
 ";;
 	

 	##::8 #J ; 	
!2 1. 
r   c           
      6   / nU R                    GH  n[        [        R                  " U5      5       H  u  pESU;   a?  U(       d  [	        SU 35      eUR                  UR                  U[        U5      S95        MJ  SU;   aQ  U(       a*  UR                  UR                  U[        U5      S95        M  UR                  UR                  US95        M  U(       d  [	        SU 35      eUR                  UR                  U[        U5      S95        M     GM     U$ )	zZGet consumer accept list of the service attachment with endpoint based security supported.r   z.Connection limit is required for network URL: r   r   )endpointUrlr   )r&   z7Connection limit is required for project ID or number: r   )r   r   r   r   r    r   r   r   )r   r   r   r!   consumer_entryconn_limit_raws         r   .GetConsumerAcceptListWithEndpointBasedSecurityr)   ?   s>   00m*0}1M*N&		'>~>NO  	##::) #N 3 ; 	
 .0

%
%<<,"%n"5 =  
%
%<<, =   !#  	##::- #N 3 ; 	
G +O 1T 
r   )	__doc__
__future__r   r   r   r   r   r$   r)    r   r   <module>r-      s&    K &  ' 
:-r   