
                         H   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  \R(                  " 5       r\
R,                  " \
R.                  R0                  \
R.                  R2                  5       " S S\
R4                  5      5       rg)z)Command to update labels for VPN tunnels.    )absolute_import)division)unicode_literals)base_classes)vpn_tunnels_utils)base)
exceptions)flags)labels_utilc                   .    \ rS rSrSr\S 5       rS rSrg)Update!   a  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                 X    [         R                  USS9  [        R                  " U5        g)zaAdds 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ArgsUpdate.Args7   s%     x@$$V,    c                    [         R                  " U R                  5       5      nUR                  R                  n[
        R                  " U5      n[        R                  UUR                  [        R                  " UR                  5      S9n[        R                  R                  U5      nUR                  5       (       d  [         R"                  " SS5      eUR%                  U5      nUR'                  UR(                  R*                  UR,                  5      nUR.                  (       d  U$ UR1                  XWR2                  UR,                  5      n	UR5                  XYSR7                  UR9                  5       5      5      $ )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   Run
Update.RunA   sL    **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____firstlineno____doc__classmethodr   r@   __static_attributes__rB   r   r   r   r   !   s!    ( - -"Mr   r   N)rG   
__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   rB   r   r   <module>rW      s    0 &  ' 7 H ( E E T < #446 D%%++T->->-C-CDAMT AM EAMr   