
    6
                         S r SSKrSSKJr  \R                  " S5      rS rSS0rS r\R                  " S	5      r	S
 r
\R                  " S5      rS rS rg)zBUtilities for converting resource names between OP and KRM styles.    N)
propertiesz6namespaces/(?P<NAMESPACE>.*?)/services/(?P<SERVICE>.*)c                     [         R                  R                  R                  R	                  SS9n[
        R                  U R                  5       5      nUR                  S5      nSR                  UUUS9$ )zDConvert the Kubernetes-style service resource to One Platform-style.T)requiredSERVICEz:projects/{project}/locations/{location}/services/{service})projectlocationservice)
r   VALUEScorer   Getkubernetes_refmatchRelativeNamegroupformat)service_resourceregionr   partsr	   s        >lib/googlecloudsdk/command_lib/run/resource_name_conversion.pyK8sToOnePlatformr      sq    ""**...='


/<<>
?%KK	"'	E	L	L 
M 
     workerPools
WorkerPoolc                 ,    U [         ;   a	  [         U    $ U $ )N)display_kinds_map)kinds    r   _GetKindr   +   s    	T""	+r   zLprojects/(?P<PROJECT>.*?)/locations/(?P<REGION>.*)/(?P<KIND>.*)/(?P<NAME>.*)c                     [         R                  U 5      nUR                  S5      UR                  S5      [        UR                  S5      5      UR                  S5      4$ )OExtracts project, region, resource kind, and name from One Platform-style name.PROJECTREGIONKINDNAME)one_platform_resource_refr   r   r   	full_namer   s     r   GetInfoFromFullNamer'   6   sQ    
#
)
))
4%kk)kk(u{{6"#kk&	
 r   ztprojects/(?P<PROJECT>.*?)/locations/(?P<REGION>.*)/(?P<PARENT_KIND>.*)/(?P<PARENT_NAME>.*)/(?P<KIND>.*)/(?P<NAME>.*)c           	         [         R                  U 5      nUR                  S5      UR                  S5      UR                  S5      UR                  S5      [        UR                  S5      5      UR                  S5      4$ )r   r    r!   PARENT_KINDPARENT_NAMEr"   r#   )one_platform_child_resource_refr   r   r   r%   s     r   GetInfoFromFullChildNamer,   F   si    
)
/
/	
:%kk)kk(kk- kk- u{{6"#kk&
 r   c                      [        U 5      Gt pU$ )z+Extracts name from One Platform-style name.)r,   )r&   _names      r   GetNameFromFullChildNamer0   S   s    %i0(1	+r   )__doc__regooglecloudsdk.corer   compiler   r   r   r   r$   r'   r+   r,   r0    r   r   <module>r6      sv    I 
 * =? < 
 JJS 
 #%**{# 

r   