
    e                     2   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  \R,                  " \R.                  R0                  \R.                  R2                  5       " S S\R4                  5      5       rg)z1Command to update labels for target VPN gateways.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)
exceptions)flags)labels_utilc                   8    \ rS rSrSrSr\S 5       rS rS r	Sr
g)Update   aL  Update a Compute Engine Cloud VPN Classic Target VPN Gateway.

*{command}* updates labels for a Compute Engine Cloud VPN Classic
Target VPN gateway.  For example:

  $ {command} example-gateway --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 target VPN gateway and to filter them as in

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

To list existing labels

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

Nc                     [         R                  " 5       U l        U R                  R                  U5        [        R
                  " U5        g)zaAdds arguments to the supplied parser.

Args:
  parser: The argparse parser to add arguments to.
N)target_vpn_gateway_flagsTargetVpnGatewayArgumentTARGET_VPN_GATEWAY_ARGAddArgumentr   AddUpdateLabelsFlags)clsparsers     1lib/surface/compute/target_vpn_gateways/update.pyArgsUpdate.Args7   s:     	!99; **62$$V,    c           
          UR                  UR                  UR                  5       UR                  UR	                  UR
                  US9S9$ )a  Creates the API request to update labels on a Target VPN Gateway.

Args:
  messages: Module with request messages.
  target_vpn_gateway_ref: Resource reference for the target VPN gateway.
  target_vpn_gateway: The target_vpn_gateway being updated.
  replacement: A new labels request proto representing the update and remove
               edits.
Returns:
  Request to be sent to update the target VPN gateway's labels.
)labelFingerprintlabels)projectresourceregionregionSetLabelsRequest)(ComputeTargetVpnGatewaysSetLabelsRequestr   Namer!   RegionSetLabelsRequestr   )selfmessagestarget_vpn_gateway_reftarget_vpn_gatewayreplacements        r   _CreateRegionalSetLabelsRequest&Update._CreateRegionalSetLabelsRequestC   sY     <<&..',,.%,,'>>/@@  ?   	 = ! !r   c                    [         R                  " U R                  5       5      nUR                  R                  nUR                  R
                  nU R                  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"                  R%                  UR&                  " S0 UR)                  5       D65      nUR*                  R,                  nUR/                  XR0                  5      n	U	R2                  (       d  U$ U R5                  XEUU	R0                  5      n
UR"                  R7                  U
5      nUR                  R9                  UR:                  SS9n[<        R>                  " UR"                  5      n[@        RB                  " XSRE                  URG                  5       5      5      $ )zIssues API requests to update a Target VPN Gateway.

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compute.regionOperations)
collectionz+Updating labels of target VPN gateway [{0}] )$r   ComputeApiHolderReleaseTrackclientapitools_clientr'   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   DiffFromUpdateArgsMayHaveUpdatescalliope_exceptionsRequiredArgumentExceptiontargetVpnGatewaysGet"ComputeTargetVpnGatewaysGetRequestAsDictr%   LabelsValueApplyr   needs_updater+   	SetLabelsParseselfLinkr   Pollerr   WaitForformatr$   )r&   argsholderr4   r'   r(   labels_diffr)   labels_valuelabels_updaterequest	operationoperation_refoperation_pollers                 r   Run
Update.RunX   s    **4+<+<+>?F]]**F}}%%H!88JJ"88G K I
 ""11$7K%%''99
 /0 0  115533 	/$++-	/0 22>>L%%l4M4MNM%%22*<G ((227;I$$**'A + CM }}V%=%=>>>*GNN499;=> >r   r1   )__name__
__module____qualname____firstlineno____doc__r   classmethodr   r+   rU   __static_attributes__r1   r   r   r   r      s+    (  	- 	-!*.>r   r   N)r[   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   r
   r=   "googlecloudsdk.command_lib.computer   r8   6googlecloudsdk.command_lib.compute.target_vpn_gatewaysr   $googlecloudsdk.command_lib.util.argsr   ReleaseTracksr3   ALPHABETAUpdateCommandr   r1   r   r   <module>rj      su    8 &  ' 7 < . ( E E d < D%%++T->->-C-CDf>T f> Ef>r   