
                         p   S r SSKJr  SSKJr  SSKJr  SSKJr  SSKJr	  SSK
Jr  SrSr\R                  R                  \0rS	r\R                  R$                  4S
\4S jjr\4S
\R                  4S jjr\R                  R$                  4S jr\R                  R$                  4S jrS\S\4S jrS rg)z3Utility functions for the Hypercompute Cluster API.    )
exceptions)apis)waiter)base)	resourceshypercomputeclusterv1alphaz1hypercomputecluster.projects.locations.operationsreturnc                 Z    U [         ;  a  [        R                  " SU  35      e[         U    $ )4Returns the API version for the given release track.zUnsupported release track: )TRACK_TO_API_VERSIONcalliope_exceptionsToolException)release_tracks    7lib/googlecloudsdk/api_lib/hypercomputecluster/utils.pyGetApiVersionr   "   s5    ..

+
+
%m_5  
m	,,    c                     U [         R                  5       ;  a  [        R                  " SU  35      e[         R	                  5        VVs/ s H  u  pX :X  d  M  UPM     snnS   $ s  snnf )r   zUnsupported API version: r   )r   valuesr   r   items)api_versionkeyvalues      r   GetReleaseTrackr   +   sm    ,3355

+
+
#K=1  1668
8jcE<Pc8

  
s   	A%A%c                 N    [        U 5      n[        R                  " [        U5      $ )z8Returns the client instance for the given release track.)r   r   GetClientInstanceAPI_NAMEr   r   s     r   r   r   6       m,+			+	66r   c                 N    [        U 5      n[        R                  " [        U5      $ )z8Returns the messages module for the given release track.)r   r   GetMessagesModuler   r   s     r   r!   r!   <   r   r   messagemax_wait_secc                     [         R                  R                  UR                  [        S9n[
        R                  " [
        R                  " U R                  U R                  5      UUUS-  S9$ )z*Waits for the given operation to complete.)
collectioni  )polleroperation_refr"   max_wait_ms)	r   REGISTRYParseRelativeNamenameOPERATIONS_COLLECTIONr   WaitForCloudOperationPollerprojects_locations_operations)client	operationr"   r#   r'   s        r   WaitForOperationr2   B   sj    $$66nn& 7 -
 
((

.
.

.
. "%
 r   c                    UR                   R                  R                  5       n U R                  R	                  UR                  UR                  5       S95      $ ! [        R                   a  n[        R                  " U5      eSnAff = f)zGReturns the cluster message for the cluster name derived from the args.)r+   N)CONCEPTSclusterParseprojects_locations_clustersGet6HypercomputeclusterProjectsLocationsClustersGetRequestRelativeNameapitools_exceptions	HttpErrorr   HttpException)r0   argsmessagescluster_referrors        r   
GetClusterrB   T   s    %%++-+3--11GG))+ 	H 	
 
 
	&	& 3

+
+E
223s   5A B0BBN)__doc__apitools.base.pyr   r;   googlecloudsdk.api_lib.utilr   r   googlecloudsdk.callioper   r   googlecloudsdk.corer   r   ALPHA_API_VERSIONReleaseTrackALPHAr   r,   GAstrr   r   r   r!   intr2   rB    r   r   <module>rO      s     : > , . ( E ) ! ))//1BC K  !% 1 1 4 4 - - !2 d6G6G  %)$5$5$8$8 7 %)$5$5$8$8 7 C $
3r   