
    p                     8   d Z ddlmZ ddlmZ ddlmZ ddl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ddZej*                   ej,                  ej.                  j0                         G d dej2                                      Zy)z,Command to update transfer appliance orders.    )absolute_import)division)unicode_literalsN)operations_util)apis)
exceptions)base)flags)mapping_util)resource_args)logzR
        *{command}* facilitates the update of Transfer Appliance Orders.
        z
        To update the shipping contact of an appliance called `my-appliance`:

          $ {command} my-appliance --shipping-contact="name=Jane Doe,emails=[jane@example.com],phone=12345678910"
        )DESCRIPTIONEXAMPLESc                   T    e Zd ZdZeZed        Z ej                  d      d        Z
y)Updatez)Update an order for a transfer appliance.c                     t        j                  | t         j                  j                         | j	                  ddd       t        j                  | d       t        j                  | d       y )Nz--submit
store_truez"Submits an order that is in draft.)actionhelpF)for_create_command)r   add_order_resource_argResourceVerbUPDATEadd_argumentr
   add_appliance_settingsadd_delivery_information)parsers    0lib/surface/transfer/appliances/orders/update.pyArgszUpdate.Args5   s_    ((**113
1  3 
  EB	""6eD    z-Status code: {status_code}. {status_message}.c                    t        j                  dd      }t        j                  dd      }|j                  j                  j                         j                         }g }|j                  j                  |j                  |            }|j                  r|j                  d   }t        |j                        dkD  r$t        j                  dj                  |             |j                         }t!        j"                  ||      }	|	ro|j$                  j'                  |j)                  ||t+        j,                         j.                  |	            }
|j1                  t3        j4                  |
d             t!        j6                  ||      }	|	ro|j                  j'                  |j9                  ||t+        j,                         j.                  |		            }
|j1                  t3        j:                  |
d             |j<                  ri|j                  j?                  |jA                  |            }
|	rt3        jB                  |
d
       n%|j1                  t3        j:                  |
d
             |st        j                  d       |S )Ntransferappliancev1alpha1)namer      z[Only 1 appliance per order is supported. {} will be updated and all others will be ignored.)r$   	appliance	requestId
updateMaskupdate)r$   orderr'   r(   submitzNo updates were performed.)"r   GetClientInstanceGetMessagesModuleCONCEPTSr*   ParseRelativeNameprojects_locations_ordersGet2TransferapplianceProjectsLocationsOrdersGetRequest
applianceslenr   warningformat	Appliancer   apply_args_to_applianceprojects_locations_appliancesPatch8TransferapplianceProjectsLocationsAppliancesPatchRequestuuiduuid4hexappendr   wait_then_yield_applianceapply_args_to_order4TransferapplianceProjectsLocationsOrdersPatchRequestwait_then_yield_orderr+   Submit5TransferapplianceProjectsLocationsOrdersSubmitRequestwait_then_yield_nothing)selfargsclientmessagesr$   resultsr*   appliance_namer&   update_mask	operations              r   Runz
Update.Run@   s?    ##$7DF%%&9:FH==$$&335DG,,00CCCNPE  ''*n	U		"++16.+A	C $$&i 88DIk	88>>MM##**,**&	 N 
	 	@@x! 	" 225$?K2288

G
G

(($	 H i nn_::9hOP{{2299

H
H I i 
 	//	8D 	<<x! 	"	kk./Nr    N)__name__
__module____qualname____doc__DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrP    r    r   r   r   .   sE     2-E E 544599r    r   )rT   
__future__r   r   r   r=   *googlecloudsdk.api_lib.transfer.appliancesr   googlecloudsdk.api_lib.utilr   r   rX   googlecloudsdk.callioper	   .googlecloudsdk.command_lib.transfer.appliancesr
   r   r   googlecloudsdk.corer   rU   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHACommandr   rZ   r    r   <module>rf      s    3 &  '  F , F ( @ G H #		 D%%++,LT\\ L - Lr    