
                             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dlm
Z
 dd	lmZ d
ZdZdZdZd Zd Zd Zd Zd Zd ZddZd Zd Zd Zy)z3General utilities for Certificate Manager commands.    )absolute_import)division)unicode_literals)
api_client)
operations)log)
properties)	resourcesz0certificatemanager.projects.locations.operationsz5certificatemanager.projects.locations.certificateMapszKcertificatemanager.projects.locations.certificateMaps.certificateMapEntriesz2certificatemanager.projects.locations.certificatesc                  j    t         j                  j                  j                  j	                  d      S )NT)required)r	   VALUEScoreprojectGet     :lib/googlecloudsdk/command_lib/certificate_manager/util.py<lambda>r      s$    :$$))1155t5Dr   c                      t         j                  j                         } | j                  dt        j
                         | S )Ncertificatemanager)r
   REGISTRYCloneRegisterApiByNamer   API_VERSION)registrys    r   _GetRegistryr   "   s2    %%'(
1:3I3IJ	/r   c                 P    t               j                  | t        ddt              S Nglobal)
projectsIdlocationsIdparams
collection)r   Parse_PROJECT_OPERATIONS_COLLECTION)	operations    r   _ParseOperationr)   (   s/    			 ! ( 
 
) )r   c                 P    t               j                  | t        ddt              S r   )r   r%   r&   _CERTIFICATE_MAPS_COLLECTION)certificate_maps    r   _ParseCertificateMapr-   2   s/    			 ! . 
 
/ /r   c                 Z    t               j                  | t        dt        dt              S )Nr   )r    r!   certificateMapIdr"   )r   r%   r&   r+   #_CERTIFICATE_MAP_ENTRIES_COLLECTION)certificate_map_entrys    r   _ParseCertificateMapEntryr2   <   s2    			 !:
 5 
 
6 6r   c                 P    t               j                  | t        ddt              S r   )r   r%   r&   _CERTIFICATES_COLLECTION)certificates    r   _ParseCertificater6   G   s/    			 ! * 
 
+ +r   c                 :   t        | j                        }|r>t        j                  j	                  dj                  |j                                      | S d}t        j                         }|j                  ||j                  |j                                     } | S )zHandles waiting for the operation and printing information about it.

  Args:
    response: Response from the API call
    is_async: If true, do not wait for the operation

  Returns:
    The last information about the operation.
  zStarted '{}'zWaiting for '{}' to complete)
r)   namer   statusPrintformatNamer   OperationClientWaitForOperation)responseis_asyncoperation_refmessageoperations_clients        r   r>   r>   Q   s     "(--0-JJ%,,]-?-?-ABC 
/	 /G"224 11w~~m&8&8&:;=H	/r   c                 H    t        | j                        j                         S N)r-   r8   SelfLinkresources    r   CertificateMapUriFuncrI   f   s    	hmm	,	5	5	77r   c                 H    t        | j                        j                         S rE   )r2   r8   rF   rG   s    r   CertificateMapEntryUriFuncrK   j   s    	"8==	1	:	:	<<r   c                 H    t        | j                        j                         S rE   )r6   r8   rF   rG   s    r   CertificateUriFuncrM   n   s    	8==	)	2	2	44r   N)F)__doc__
__future__r   r   r   *googlecloudsdk.api_lib.certificate_managerr   r   googlecloudsdk.corer   r	   r
   r'   r+   r0   r4   r&   r   r)   r-   r2   r6   r>   rI   rK   rM   r   r   r   <module>rR      sl    : &  ' A A # * )K V &s #O D)/6+*8=5r   