
    %              
           d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 dZ
d	 Zd
 Zd Zdededededef
dZd Zd Zd Zd Zd Zd Zd Zy)z.Helper class to handle non-compute references.    )absolute_import)division)unicode_literals)network_security)network_services)	resourcesz-https://certificatemanager.googleapis.com/v1/c                 .    dj                  | |||||      S )zECreates a reference to a non-compute resource in the full URL format.z{}{}/{}/locations/{}/{}/{})format)base_uricontainer_typecontainer_namelocationcollection_nameresource_names         9lib/googlecloudsdk/command_lib/compute/reference_utils.pyBuildFullResourceUrlr      s'     
&	,	,X~-;X-<m
M M    c                 "    t        | d||||      S )Note: base_uri ends with slash.projectsr   r   project_namer   r   r   s        r   +BuildFullResourceUrlForProjectBasedResourcer   &   s     
h
L(-}
> >r   c                 "    t        | d|d||      S )r   organizationsglobalr   )r   org_idr   r   s       r   'BuildFullResourceUrlForOrgBasedResourcer   .   s     
h-}
> >r   r   r   bac_namerelease_trackreturnc                 H    t        t        j                  |      | |d|      S )a  Builds the URL for a BackendAuthenticationConfig resource.

  Args:
    project_name: The project name of the BackendAuthenticationConfig.
    location: The location of the BackendAuthenticationConfig.
    bac_name: The name of the BackendAuthenticationConfig.
    release_track: The release track of the BackendAuthenticationConfig.

  Returns:
    The URL for the BackendAuthenticationConfig resource.
  backendAuthenticationConfigsr   r   r   GetApiBaseUrl)r   r   r    r!   s       r   #BuildBackendAuthenticationConfigUrlr'   5   s+     
5--m<4
 r   c                 F    t        t        j                         | |d|      S )NserverTlsPoliciesr   r%   )r   r   policy_names      r   BuildServerTlsPolicyUrlr+   L   s'    	4--/)
! !r   c                 H    t        t        j                  |      | |d|      S )NserviceLbPoliciesr   )r   r   r&   )r   r   r*   r!   s       r   BuildServiceLbPolicyUrlr.   U   s)    	4--m<)
! !r   c                     t        t        j                  t        j                  j                  j
                        | |d|      S )NserviceBindingsr   )r   r   r&   baseReleaseTrackGA)r   r   binding_names      r   BuildServiceBindingUrlr5   ^   s>    	4--



,
,
/
/1' 
" "r   c                 ^    t        j                  dd      xs t        }t        || |d|      S )Ncertificatemanagerv1certificatesr   )r   r&   CERTIFICATE_MANAGER_BASE_APIr   )r   r   certificate_namer   s       r   BuildCcmCertificateUrlr<   h   s>    2D9 &	%  
5$$
 r   c                 T    | j                  d      d   |j                  d      d   k(  S )z8Compares relative resource references (skips namespace).r      )split)url1url2s     r   CompareUrlRelativeReferencesrB   v   s)    	J		"djj&<Q&?	??r   c                 F     t        t        t         fd|                  S )Nc                     t        |       S N)rB   )refurls    r   <lambda>z!UrlInReferences.<locals>.<lambda>~   s    9#sCr   )boollistfilter)rG   
referencess   ` r   UrlInReferencesrM   {   s&    	

C
 r   c                 4    t        t        fd|             S )Nc                     t        |        S rE   )rM   )rF   references_to_removes    r   rH   z"FilterReferences.<locals>.<lambda>   s    oc3GHIr   )rJ   rK   )rL   rP   s    `r   FilterReferencesrQ      s    	I
 r   N)__doc__
__future__r   r   r   googlecloudsdk.api_libr   r   googlecloudsdk.corer   r:   r   r   r   strr'   r+   r.   r5   r<   rB   rM   rQ    r   r   <module>rX      s    5 &  ' 3 3 )  O M>>!$03DG.!!"@
r   