
                            d 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  e	j                  d	d
d
      e	j                   e	j                  e	j                   j"                         G d de	j$                                             Zdddde_         e	j                  e	j                   j*                  e	j                   j,                         G d de             Zy)z8Command for creating VM instances running Docker images.    )absolute_import)division)unicode_literals)base_classes)containers_utils)base)flagsFzThe option to deploy a container during VM creation using the container startup agent is deprecated. Use alternative services to run containers on your VMs. Learn more at https://cloud.google.com/compute/docs/containers/migrate-containers.)
is_removedwarningerrorc                   &    e Zd ZdZed        Zd Zy)UpdateContainer;Command for updating VM instances running container images.c                 2    t        j                  | d       y)zRegister parser args.Tcontainer_mount_disk_enabledNinstances_flagsAddUpdateContainerArgsparsers    1lib/surface/compute/instances/update_container.pyArgszUpdateContainer.Args/   s     **T    c           	      $   t        j                  | j                               }|j                  }t        j
                  j                  ||j                  t	        j                  |            }|j                  j                  j                   |j                  j                  di |j                               }t	        j                  ||j                   |j"                  g d|j                        }t%        j&                  |||||d|       yz.Issues requests necessary to update Container.)scope_listerT)
for_updateclient)r   container_mount_diskN r   ComputeApiHolderReleaseTrackr   r   INSTANCE_ARGResolveAsResource	resourcesGetInstanceZoneScopeListerapitools_client	instancesGetmessagesComputeInstancesGetRequestAsDictGetValidatedContainerMountDiskr    disksr   UpdateInstanceselfargsholderr   instance_refinstancer    s          r   RunzUpdateContainer.Run6   s    **4+<+<+>?F]]F"//AA$??G B L %%//33222K\5H5H5JKH +II!!
%% ##%)1r   N__name__
__module____qualname____doc__staticmethodr   r8   r!   r   r   r   r      s    $ D  r   r   zW    Updates Compute Engine virtual machine instances running container
    images.
    a{      *{command}* updates Compute Engine virtual
    machines that runs a Docker image. For example:

      $ {command} instance-1 --zone us-central1-a         --container-image=gcr.io/google-containers/busybox

    updates an instance called instance-1, in the us-central1-a zone,
    to run the 'busybox' image.

    For more examples, refer to the *EXAMPLES* section below.
    a      To run the gcr.io/google-containers/busybox image on an instance named
    'instance-1' that executes 'echo "Hello world"' as a run command, run:

      $ {command} instance-1         --container-image=gcr.io/google-containers/busybox         --container-command='echo "Hello world"'

    To run the gcr.io/google-containers/busybox image in privileged mode, run:

      $ {command} instance-1         --container-image=gcr.io/google-containers/busybox         --container-privileged
    )briefDESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)UpdateContainerAlphar   c                 2    t        j                  | d       y )NTr   r   r   s    r   r   zUpdateContainerAlpha.Args   s    **Tr   c           	      $   t        j                  | j                               }|j                  }t        j
                  j                  ||j                  t	        j                  |            }|j                  j                  j                   |j                  j                  di |j                               }t	        j                  ||j                   |j"                  g d|j                        }t%        j&                  |||||d|       yr   r"   r2   s          r   r8   zUpdateContainerAlpha.Run   s    **4+<+<+>?F]]F"//AA$??G B L
 %%//33222K\5H5H5JKH +II!!
%% ##%)1r   Nr9   r!   r   r   rC   rC   {   s    C 
r   rC   N)r=   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.compute.instancesr	   r   	DeprecateDefaultUniverseOnlyReleaseTracksr$   GAUpdateCommandr   detailed_helpALPHABETArC   r!   r   r   <module>rR      s    ? &  ' 7 ; ( Q 	P	P D%%(()*d(( * * "*\#! D D%%++T->->-C-CD&? & E&r   