
    M                     8   S r SSKJr  SSKJr  SSKJr  SSK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SKJr  SSKJr  SSS.r\R(                  \R*                  " \R,                  R.                  5       " S S\R0                  5      5       5       rg)z,Command to create transfer appliance orders.    )absolute_import)division)unicode_literalsN)operations_util)apis)
exceptions)base)flags)mapping_util)regions)resource_argsz
        *{command}* facilitates the creation of Transfer Appliance orders.
        When an order is created, an appliance record is created as well.
        ag  
        To order a rackable appliance with 40 TB of storage, named
        `my-appliance`, a Cloud Storage destination of `my-bucket` and the
        minimum amount of contact information.

          $ {command} my-appliance               --model=TA40_RACKABLE               --shipping-contact="name=Jane Doe,emails=[jane@example.com],phone=12345678910"               --offline-import=gs://my-bucket               --order-contact="name=John Doe,phone=123456578910,emails=[john@example.com]" --country=US               --address="lines=['1600 Amphitheatre Parkway'],locality=Mountain View,administrative-area=CA,postal-code=94043"

        To clone an appliance order with the ID `my-appliance` and location
        `us-central1`, only changing the name and Cloud Storage destination:

          $ {command}               my-other-appliance --country=US --clone=my-appliance               --clone-region=us-central1 --offline-import=my-other-bucket

        To use a flags file to create an appliance rather than provide a
        long list of flags:

          $ {command} my-appliance               --flags-file=FLAGS_FILE

        Example file with all possible flags set:

          --address:
            lines:
            - 1600 Amphitheatre Parkway
            locality: Mountain View
            administrative-area: California
            postal-code: 94043
          --cmek: projects/p/locations/global/keyRings/kr/cryptoKeys/ck
          --country: US
          --delivery-notes: None
          --display-name: test
          --internet-enabled:
          --model: TA40_RACKABLE
          --offline-export:
            source: gs://my-bucket/path
            manifest: gs://my-other-bucket/manifest
          --offline-import: gs://my-bucket/path
          --online-import: gs://my-bucket/path
          --order-contact:
            business: Google
            name: Jane Doe
            phone: 1234567890
            emails:
            - janedoe@example.com
          --shipping-contact:
            business: Google
            name: John Doe
            phone: 1234567890
            emails:
            - johndoe@example.com
        )DESCRIPTIONEXAMPLESc                   \    \ rS rSrSr\r\S 5       r\	R                  " S5      S 5       rSrg)Createe   z)Create an order for a transfer appliance.c                     U R                  SSS9  U R                  SSSS9  [        R                  " U 5        [        R                  " U 5        [        R
                  " U 5        g )Nnamez7Immutable ID that will uniquely identify the appliance.)helpz--submit
store_truezWhen specified the order will be submitted immediately. By default, orders are created in a draft state. Use `{parent_command} update --submit` to submit the order later.)actionr   )add_argumentr   add_clone_resource_argr
   add_appliance_settingsadd_delivery_information)parsers    0lib/surface/transfer/appliances/orders/create.pyArgsCreate.Argsl   si    
F  H L	  
 ((0	  (	""6*    z-Status code: {status_code}. {status_message}.c           	         [         R                  " SS5      n[         R                  " SS5      nUR                  5       nUR	                  5       n/ n[
        R                  UR                     n[        R                  " U5      nUR                  S5      (       a  UR                  R                  R                  5       n	UR                  R                  UR!                  U	R#                  5       S9S9nUR$                  (       a5  UR&                  R                  UR)                  UR$                  S   S95      n[*        R,                  " XA5        UR&                  R/                  UR1                  UUR2                  U[4        R6                  " 5       R8                  S95      n
UR;                  [<        R>                  " U
S5      5        [        R@                  " XqR2                  5      n[*        RB                  " XQU5        URD                  Ul#        UR                  R/                  URI                  UUR2                  U[4        R6                  " 5       R8                  S	95      n
UR;                  [<        RJ                  " U
S5      5        U$ )
Ntransferappliancev1alpha1clone)r   )requestr   )	applianceapplianceIdparent	requestIdcreate)orderorderIdr(   r)   )&r   GetClientInstanceGetMessagesModule	ApplianceOrderr   COUNTRY_TO_LOCATION_MAPcountryr   get_parent_stringIsSpecifiedCONCEPTSr$   Parseprojects_locations_ordersGet2TransferapplianceProjectsLocationsOrdersGetRequestRelativeName
appliancesprojects_locations_appliances6TransferapplianceProjectsLocationsAppliancesGetRequestr   apply_args_to_appliancer   9TransferapplianceProjectsLocationsAppliancesCreateRequestr   uuiduuid4hexappendr   wait_then_yield_applianceget_appliance_nameapply_args_to_ordersubmit	skipDraft5TransferapplianceProjectsLocationsOrdersCreateRequestwait_then_yield_order)selfargsclientmessagesr&   r+   resultsregionr(   	clone_ref	operationappliance_names               r   Run
Create.Run~   s(    ##$7DF%%&9:FH""$INNEG,,T\\:F,,V4F  --%%++-i..22MM))+ N - 3 .e 
		 88<<KK%%a( L *+	
 ((944;;JJ		jjl&&	 	K 	()I NN?<<8  #55fiiHN$$U.AkkEO0077FFIIjjl&&	 	G 	()I NN?888 Nr     N)__name__
__module____qualname____firstlineno____doc__DETAILED_HELPdetailed_helpstaticmethodr   gcloud_exception CatchHTTPErrorRaiseHTTPExceptionrT   __static_attributes__rV   r    r   r   r   e   s@     2-+ +" 445..r    r   )r[   
__future__r   r   r   r@   *googlecloudsdk.api_lib.transfer.appliancesr   googlecloudsdk.api_lib.utilr   r   r_   googlecloudsdk.callioper	   .googlecloudsdk.command_lib.transfer.appliancesr
   r   r   r   r\   DefaultUniverseOnlyReleaseTracksReleaseTrackALPHACommandr   rV   r    r   <module>rl      s    3 &  '  G , F ( @ G B H
	
8	@F D%%++,HT\\ H - Hr    