
    !                     z   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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KJr  SSKJr  / SQr\
R6                  " \
R8                  R:                  5      \
R<                  " SSSS9\
R>                   " S S\
R@                  5      5       5       5       r!\
R6                  " \
R8                  RD                  5       " S S\!5      5       r#\
R6                  " \
R8                  RH                  5       " S S\!5      5       r%SSSS.\!l&        g) z<Command for importing machine images in OVF format into GCE.    )absolute_import)division)unicode_literals)base_classes)daisy_utils)image_utils)base)
exceptions)
completers)flags)
os_choices)labels_util)log)	resources)z[Daisyz[import-zstarting buildz  importERRORFzThis command is being deprecated. Instead, use the `gcloud migration vms machine-image-imports` command. For more information, See "gcloud alpha migration vms machine-image-imports --help".zThis command has been deprecated. Instead, use the `gcloud migration vms machine-image-imports` command. For more information, See "gcloud alpha migration vms machine-image-imports --help".)
is_removedwarningerrorc                   H    \ rS rSrSr\S 5       r\S	S j5       rS rS r	Sr
g)
Import&   z4Import a machine image into Compute Engine from OVF.c                    U R                  SS9nUR                  R                  nUR                  R	                  [
        R                  5        [
        R                  " 5       [        l	        [        R                  R                  USS9  UR                  SSS9  [        R                  " US5        [        R                  " US	5        [
        R                  " U5        [
        R                   " U5        [
        R"                  " U5        [
        R$                  " U5        [
        R&                  " U5        [(        R*                  " U5        [(        R,                  " U5        [.        R0                  " U5        [2        R4                  " US
S9  [2        R6                  " U5        [8        R:                  " X5        UR                  SS[=        [>        R@                  5      SS9  [2        RB                  " U5        [        RD                  " US	SS[        RF                  -   S9  [2        RH                  " US	5        UR                  RK                  [L        RN                  5        [2        RP                  " USSS9  [2        RR                  " US[2        RT                  5        [2        RV                  " US[2        RX                  5        [(        RZ                  " USSSS	S9  UR                  SSSSS9  g )NT)no_httpimport)operation_typez--descriptionz2Specifies a text description of the machine image.)helpzmachine image'szmachine imagez	an import)	operationz--osFz5Specifies the OS of the machine image being imported.)requiredchoicesr   z>The zone in which to perform the import of the machine image. )explanationzmachine image importzyhttps://cloud.google.com/nat/docs/gce-example#create-nat and https://cloud.google.com/vpc/docs/private-access-options#pga)docs_urlay  However, if neither `--scopes` nor `--no-scopes` are specified and the project has no default service account, then the machine image is imported with no scopes. Note that the level of access that a service account has is determined by a combination of access scopes and IAM roles so you must configure both access scopes and IAM roles for the service account to work properly.r   )extra_scopes_helpr   resourcez--cmd-deprecated
store_trueaE  
        The command you're using is deprecated and will be removed by December 31,
        2025. We recommend using `gcloud compute migration image-imports` instead.
        See our official documentation for more information.
        https://cloud.google.com/migrate/virtual-machines/docs/5.0/migrate/image_import.
        )actionr   r   )._GetComputeApiHolderclientmessagesdisplay_info	AddFormatmachine_image_flagsDEFAULT_LIST_FORMATMakeMachineImageArgr   MACHINE_IMAGE_ARGAddArgumentadd_argumentr   AddStorageLocationFlagAddGuestFlushFlagAddNoRestartOnFailureArgsAddTagsArgsAddCanIpForwardArgsAddNetworkArgsAddNetworkTierArgsinstances_flagsAddMachineTypeArgsAddCustomMachineTypeArgsr   AddCreateLabelsFlagsr   AddCommonDaisyArgsAddOVFSourceUriArgr   AddGuestOsFeaturesArgForImportsortedr   OS_CHOICES_INSTANCE_IMPORT_BETA
AddByolArgAddZoneFlagZONE_PROPERTY_EXPLANATIONAddGuestEnvironmentArgAddCacheUpdaterr   InstancesCompleterAddNoAddressArgAddComputeServiceAccountArg(IMPORT_ROLES_FOR_COMPUTE_SERVICE_ACCOUNTAddCloudBuildServiceAccountArg+IMPORT_ROLES_FOR_CLOUDBUILD_SERVICE_ACCOUNTAddServiceAccountAndScopeArgs)clsparsercompute_holderr(   s       ,lib/surface/compute/machine_images/import.pyArgsImport.Args8   sr   --d-;N$$--H
!!"5"I"IJ2FFHF
(((I
A  C 
  ):;	FO411&9##F+++F3&&v.**62&&v.,,V4$$V,""6[A""6*..v@
zAABD	  F
 6"	T

)
)*	+ &&v?
''
(E(EFO	Q ++&<<> ..??
 11   " 	  
    c                 L    [         R                  " U R                  5       U5      $ N)r   ComputeApiHolderReleaseTrack)rM   r   s     rP   r&   Import._GetComputeApiHolder   s    (()9)9);WEErS   c                 ^   [         R                  " U5        [         R                  " U5        [        R                  " X5        [         R
                  " U5         [        R                  " UR                  5      Ul        g ! [        R                   a    [        R                  " SS5      ef = f)Nz
source-uriz;must be a path to an object or a directory in Cloud Storage)r8   ValidateNicFlagsValidateNetworkTierArgsr   ValidateZone"ValidateServiceAccountAndScopeArgs
MakeGcsUri
source_urir   UnknownCollectionExceptionr
   InvalidArgumentException)selfargscompute_clients      rP   _ValidateArgsImport._ValidateArgs   s    $$T*++D1T266t<I#..t?do// I//

GI IIs   %B   ,B,c                 L   U R                  5       nUR                  nU R                  X5        [        R                  " S5        [
        R                  " U[        U R                  5       (       a(  U R                  5       R                  R                  5       OS UR                  S9$ )NzeImporting OVF. This may take 40 minutes for smaller OVFs and up to a couple of hours for larger OVFs.)rc   output_filterrelease_trackr(   )r&   r'   re   r   r   r   RunMachineImageOVFImportBuild_OUTPUT_FILTERrW   idlowerr(   )rb   rc   rO   rd   s       rP   Run
Import.Run   s    ..0N#**Nt,KK ? @ 44$++-- ((*--33537((* *rS    N)F)__name__
__module____qualname____firstlineno____doc__classmethodrQ   r&   re   rn   __static_attributes__rp   rS   rP   r   r   &   s=      =P Pd F F
I*rS   r   c                   6   ^  \ rS rSrSr\U 4S j5       rSrU =r$ )
ImportBeta   z=Import a machine image into Compute Engine from OVF for Beta.c                 X   > [         [        U ]  U5        [        R                  " U5        g rU   )superry   rQ   r   AddExtraCommonDaisyArgsrM   rN   	__class__s     rP   rQ   ImportBeta.Args   s     	*c'''/rS   rp   	rq   rr   rs   rt   ru   rv   rQ   rw   __classcell__r   s   @rP   ry   ry      s    E0 0rS   ry   c                   6   ^  \ rS rSrSr\U 4S j5       rSrU =r$ )ImportAlpha   z>Import a machine image into Compute Engine from OVF for Alpha.c                 X   > [         [        U ]  U5        [        R                  " U5        g rU   )r|   r   rQ   r   r}   r~   s     rP   rQ   ImportAlpha.Args   s     	+s (''/rS   rp   r   r   s   @rP   r   r      s    F0 0rS   r   zOCreate a Compute Engine machine image from virtual appliance in OVA/OVF format.a          *{command}* creates Compute Engine machine image from virtual appliance
        in OVA/OVF format.

        Importing OVF involves:
        *  Unpacking OVF package (if in OVA format) to Cloud Storage.
        *  Import disks from OVF to Compute Engine.
        *  Translate the boot disk to make it bootable in Compute Engine.
        *  Create a machine image using OVF metadata and imported disks.

        Virtual instances, images, machine images, and disks in Compute engine
        and files stored on Cloud Storage incur charges. See [](https://cloud.google.com/compute/docs/images/importing-virtual-disks#resource_cleanup).
        z        To import an OVF package from Cloud Storage into a machine image named
        `my-machine-image`, run:

          $ {command} my-machine-image --source-uri=gs://my-bucket/my-dir
        )briefDESCRIPTIONEXAMPLESN)'ru   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   r   googlecloudsdk.callioper	   r
   "googlecloudsdk.command_lib.computer   r   )googlecloudsdk.command_lib.compute.imagesr   ,googlecloudsdk.command_lib.compute.instancesr8   1googlecloudsdk.command_lib.compute.machine_imagesr+   $googlecloudsdk.command_lib.util.argsr   googlecloudsdk.corer   r   rk   ReleaseTracksrW   GA	DeprecateDefaultUniverseOnlyCreateCommandr   BETAry   ALPHAr   detailed_helprp   rS   rP   <module>r      s'   C &  ' 7 6 6 ( . 9 4 @ Q Z < # )N D%%(()	>
	> t*T t*  *t*n D%%**+0 0 ,0 D%%++,0& 0 -0			' rS   