
    
                     D    S r SSKJr  SSKJr  S rS rS rS\S\4S	 jrg
)zUtilities for bms commands.    )
properties)	resourcesc                      g)zDReturns 'global' to be used as a fallthrough hook in resources.yaml.global r       *lib/googlecloudsdk/command_lib/bms/util.pyDefaultToGlobalr
      s    	r   c                    U R                  5       nUR                  5       nUR                  SUR                  5       5      n[        R                  R                  US   UUR                  5       S.SS9R                  5       $ )z<Returns the full GCP name of the NFS allowed client network.znetwork-project-idnetwork)
projectsIdlocationsIdz-baremetalsolution.projects.locations.networks)params
collection)ParentgetNamer   REGISTRYParseRelativeName)nfs_share_resourceallowed_client_dict
nfs_regionnfs_projectnetwork_project_ids        r	   NFSNetworkFullNamer      s     "((**!!#+*../C/:/?/?/AC				!	!)$*#* A 
" 
B CO,.Qr   c                 R   [        5       nU H"  n[        U US9nUR                  XTS   45        M$     / nU HD  nUR                  UR                  4nX;   a  UR                  U5        M3  UR                  U5        MF     U H"  n	[        SR                  U	S   U	S   5      5      e   U$ )zORemoves the allowed clients specified by remove_key_dicts from allowed_clients.)r   r   cidrzECannot find an existing allowed client for network [{}] and CIDR [{}]r      )	setr   addr   allowedClientsCidrremoveappendLookupErrorformat)
r   allowed_clientsremove_key_dictskeys_to_removekey_dictkey_network_full_nameoutallowed_clientcurr_keykeys
             r	   RemoveAllowedClientsr0   +   s     5."h.-$ -/?@A # 	#'n&&(I(IJH!H%	jj  ( c
 ,,2F3q636q6-;< <  
*r   regionreturnc                     U b  U R                  5       $ [        R                  R                  R                  R                  SS9nSR                  U5      $ )zIReturns projects/$project/location/$location parent path based on region.T)requiredzprojects/{}/locations/global)r   r   VALUEScoreprojectGetr&   )r1   r7   s     r	   FixParentPathWithGlobalRegionr9   D   sM      ""**...='	'	.	.w	77r   N)	__doc__googlecloudsdk.corer   r   r
   r   r0   strr9   r   r   r	   <module>r=      s5    " + )
Q 28# 8# 8r   