
                         H   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 dd	lmZ dd	lmZ dd
lmZ  ej(                         Z e
j,                  e
j.                  j0                  e
j.                  j2                         G d de
j4                               Zy)z)Command to update labels for VPN tunnels.    )absolute_import)division)unicode_literals)base_classes)vpn_tunnels_utils)base)
exceptions)flags)labels_utilc                   &    e Zd ZdZed        Zd Zy)Updatea!  Update a Compute Engine VPN tunnel.

  *{command}* updates labels for a Compute Engine VPN tunnel.
  For example:

    $ {command} example-tunnel --region us-central1 \
      --update-labels=k0=value1,k1=value2 --remove-labels=k3

  will add/update labels ``k0'' and ``k1'' and remove labels with key ``k3''.

  Labels can be used to identify the VPN tunnel and to filter them as in

    $ {parent_command} list --filter='labels.k1:value2'

  To list existing labels

    $ {parent_command} describe example-tunnel --format="default(labels)"

  c                 \    t         j                  |d       t        j                  |       y)zmAdds arguments to the supplied parser.

    Args:
      parser: The argparse parser to add arguments to.
    update)operation_typeN)_VPN_TUNNEL_ARGAddArgumentr   AddUpdateLabelsFlags)clsparsers     )lib/surface/compute/vpn_tunnels/update.pyArgszUpdate.Args7   s%     x@$$V,    c                    t        j                  | j                               }|j                  j                  }t        j                  |      }t        j                  ||j                  t        j                  |j                              }t        j                  j                  |      }|j                         st!        j"                  dd      |j%                  |      }|j'                  |j(                  j*                  |j,                        }|j.                  s|S |j1                  ||j2                  |j,                        }	|j5                  ||	dj7                  |j9                                     S )zIssues API requests to update a VPN Tunnel.

    Args:
      args: argparse.Namespace, The arguments received by this command.
    Returns:
      [protorpc.messages.Message], A list of responses returned
      by the compute API.
    )scope_listerLABELSzEAt least one of --update-labels or --remove-labels must be specified.z#Updating labels of VPN tunnel [{0}])r   ComputeApiHolderReleaseTrackclientmessagesr   VpnTunnelHelperr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   DiffFromUpdateArgsMayHaveUpdatescalliope_exceptionsRequiredArgumentExceptionDescribeApplyRegionSetLabelsRequestLabelsValuelabelsneeds_update	SetLabelslabelFingerprintWaitForOperationformatName)
selfargsholderr   helpervpn_tunnel_reflabels_diff
vpn_tunnellabels_updateoperation_refs
             r   Runz
Update.RunA   sM    **4+<+<+>?F}}%%H..v6F$66"88G 7 IN
 ""11$7K%%'99
 /0 0 0J%%''33Z5F5FHM %%$$
33]5I5IKM""-44^5H5H5JKM Mr   N)__name__
__module____qualname____doc__classmethodr   r>    r   r   r   r   !   s!    ( - -"Mr   r   N)rB   
__future__r   r   r   googlecloudsdk.api_lib.computer   *googlecloudsdk.api_lib.compute.vpn_tunnelsr   googlecloudsdk.callioper   r	   r(   "googlecloudsdk.command_lib.computer
   r#   .googlecloudsdk.command_lib.compute.vpn_tunnelsvpn_tunnel_flags$googlecloudsdk.command_lib.util.argsr   VpnTunnelArgumentr   ReleaseTracksr   ALPHABETAUpdateCommandr   rD   r   r   <module>rR      s    0 &  ' 7 H ( E E T < 5"446 D%%++T->->-C-CDAMT AM EAMr   