
    6                     2    d Z ddlmZ ddlmZ d Zd Zd Zy)zUtilities for HA controllers.    )poller)waiterc                 f    | j                   j                  ||j                  |j                        S )N)haControllerprojectregion)messages!ComputeHaControllersInsertRequestr   r   )clientha_controllerha_controller_refs      :lib/googlecloudsdk/api_lib/compute/ha_controllers/utils.pyCreateInsertRequestr      s3    		:	: ''%% 
; 
     c           	         t        |j                  | |      }|j                  j                  j                  j	                  |      }|j
                  j                  |j                        }t        j                  t        j                  |j                  j                  j                        |dj                  | j                  |j                                     S )Nz/HA controller creation in progress for [{}]: {})message)r   r   apitools_clienthaControllersInsert	resourcesParseselfLinkr   WaitForr   PollerformatnameSelfLink)r   r   holderrequestresponseoperation_refs         r   r   r      s    }>OP']]**88??H(""(():):;-	mmFMM11??@
;
B
B  -"8"8":	
 r   c                 v    t        | ||      }| j                  | j                  j                  d|fg|      d   S )Nr   r   )r   AsyncRequestsr   r   )r   r   r   errors_to_collectr   s        r   InsertAsyncr%   ,   sJ    7HI'			,,h@A
 
 r   N)__doc__)googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   r   r   r%    r   r   <module>r*      s    $ < .r   