
    }                         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Zd	Zd
 ZddZd Zd Zd Zd Zd Zd Zd Zy)z:Flags and helpers for the compute machine-images commands.    )absolute_import)division)unicode_literals)arg_parsers)
completers)flagsz)    table(
      name,
      status
    )z#DISK_DEVICE_NAME[,DISK_DEVICE_NAME]c            	      r    t        j                  ddt        j                  dddt         j                        S )Ninstancez--source-instanceTzcompute.instancesz3The source instance to create a machine image from.)resource_namename	completerrequiredzonal_collection
short_helpzone_explanation)compute_flagsResourceArgumentcompute_completersInstancesCompleterZONE_PROPERTY_EXPLANATION     >lib/googlecloudsdk/command_lib/compute/machine_images/flags.pyMakeSourceInstanceArgr   "   s6    		'	'"55*F$>>
 r   c                 R    t        j                  ddt        j                  | d      S )NIMAGEmachineImagezcompute.machineImages)r   r   r   pluralglobal_collection)r   r   r   MachineImagesCompleter)r   s    r   MakeMachineImageArgr!   .   s*    		'	'""99/
 r   c                 P    | j                  dd       | j                  dd       y)z2Set arguments for choosing the network/subnetwork.z	--networka        Specifies the network for the VMs that are created from the imported
      machine image. If `--subnet` is also specified, then the subnet must
      be a subnetwork of network specified by `--network`. If neither is
      specified, the `default` network is used.
      helpz--subnetz      Specifies the subnet for the VMs created from the imported machine
      image. If `--network` is also specified, the subnet must be
      a subnetwork of the network specified by `--network`.
      Nadd_argumentparsers    r   AddNetworkArgsr)   8   s:    
   	
  r   c                 .    | j                  dddd       y )Nz--restart-on-failure
store_trueTz      The VMs created from the imported machine image are restarted if
      they are terminated by Compute Engine. This does not affect terminations
      performed by the user.
      )actiondefaultr$   r%   r'   s    r   AddNoRestartOnFailureArgsr.   N   s#    
	  	r   c                 V    | j                  dt        j                  d      dd       y )Nz--tags   
min_lengthTAGa        Specifies a list of tags to apply to the VMs created from the
      imported machine image. These tags allow network firewall rules and routes
      to be applied to specified VMs. See
      gcloud_compute_firewall-rules_create(1) for more details.

      To read more about configuring network tags, read this guide:
      https://cloud.google.com/vpc/docs/add-remove-network-tags

      To list VMs with their respective status and tags, run:

        $ gcloud compute instances list --format='table(name,status,tags.list())'

      To list VMs tagged with a specific tag, `tag1`, run:

        $ gcloud compute instances list --filter='tags:tag1'
      )typemetavarr$   )r&   r   ArgListr'   s    r   AddTagsArgsr7   [   s.    !,
	  r   c                 .    | j                  dd d       y)z%Adds network tier flag to the parser.z--network-tierc                 "    | j                         S )N)upper)xs    r   <lambda>z$AddNetworkTierArgs.<locals>.<lambda>y   s
    QWWYr   z        Specifies the network tier that will be used to configure the machine
        image. ``NETWORK_TIER'' must be one of: `PREMIUM`, `STANDARD`. The
        default value is `PREMIUM`.
        )r4   r$   Nr%   r'   s    r   AddNetworkTierArgsr=   t   s"     	  r   c                 ,    | j                  ddd       y )Nz--can-ip-forwardr+   z        If provided, allows the VMs created from the imported machine
        image to send and receive packets with non-matching destination or
        source IP addresses.
        )r,   r$   r%   r'   s    r   AddCanIpForwardArgsr?      s       r   c                 *    | j                  dd       y)z2Set arguments for choosing the network IP address.z--private-network-ipz        Specifies the RFC1918 IP to assign to the VMs created from the
        imported machine image. The IP should be in the subnet or legacy network
        IP range.
      r#   Nr%   r'   s    r   AddPrivateNetworkIpArgsrA      s    
  r   c                     | j                  d      }|j                  dt        dt        j                  d      d       |j                  dt        d	t        j                  d      d       y
)z=Adds exclusion and inclusion filters for machine image disks.T)hiddenz--exclude-disksa          Specifies a filter for disks to be excluded from the machine image.
        The filter is a comma-separated list of disk device names. Excluding the
        boot disk device name is not permitted.
        Cannot be used in conjunction with --include-disks.
      r0   r1   )r5   r$   r4   rC   z--include-disksa          Specifies a filter for disks to be included in the machine image.
        The filter is a comma-separated list of disk device names. Always
        include the boot disk device name.
        Cannot be used in conjunction with --exclude-disks.
      N)add_mutually_exclusive_groupr&   DISK_FILTER_FORMATr   r6   )r(   groups     r   AddDiskFilterArgsrG      sy    

-
-T
-
:% 
 !,    
 !,  r   N)F)__doc__
__future__r   r   r   googlecloudsdk.callioper   "googlecloudsdk.command_lib.computer   r   r   r   DEFAULT_LIST_FORMATrE   r   r!   r)   r.   r7   r=   r?   rA   rG   r   r   r   <module>rM      sZ    A &  ' / O E	  ; 	,
2		r   