
    A                     r   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                  e
j.                  j4                         G d de
j6                               Zy)z2Command to update labels for external VPN gateway.    )absolute_import)division)unicode_literals)base_classes)external_vpn_gateways_utils)base)
exceptions)flags)labels_utilc                   .    e Zd ZdZddiZed        Zd Zy)Updatea.  Update a Compute Engine external VPN gateway.

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

    $ {command} example-gateway \
      --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 External 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)"

  EXAMPLESz          To update labels for an external VPN gateway, run:

              $ {command} my-external-gateway                 --update-labels=k0=value1,k1=value2c                 \    t         j                  |d       t        j                  |       y)zmAdds arguments to the supplied parser.

    Args:
      parser: The argparse parser to add arguments to.
    update)operation_typeN)_EXTERNAL_VPN_GATEWAY_ARGAddArgumentr   AddUpdateLabelsFlags)clsparsers     3lib/surface/compute/external_vpn_gateways/update.pyArgszUpdate.ArgsC   s%     ))&)J$$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 External 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-Updating labels of external VPN gateway [{0}])r   ComputeApiHolderReleaseTrackclientmessagesr   ExternalVpnGatewayHelperr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   DiffFromUpdateArgsMayHaveUpdatescalliope_exceptionsRequiredArgumentExceptionDescribeApplyGlobalSetLabelsRequestLabelsValuelabelsneeds_update	SetLabelslabelFingerprintWaitForOperationformatName)
selfargsholderr    helperexternal_gateway_reflabels_diffexternal_vpn_gatewaylabels_updateoperation_refs
             r   Runz
Update.RunM   sU    **4+<+<+>?F}}%%H(AA&IF4FF"88G G I
 ""11$7K%%'99
 9: : "??+?@%%''33##%M %%!!$$%9%9%J%J%2%9%9;M ""m7>> %%'	)* *r   N)__name__
__module____qualname____doc__detailed_helpclassmethodr   r?    r   r   r   r   "   s1    , 7- - -%*r   r   N)rC   
__future__r   r   r   googlecloudsdk.api_lib.computer   4googlecloudsdk.api_lib.compute.external_vpn_gatewaysr   googlecloudsdk.callioper   r	   r)   "googlecloudsdk.command_lib.computer
   r$   8googlecloudsdk.command_lib.compute.external_vpn_gatewaysexternal_vpn_gateway_flag$googlecloudsdk.command_lib.util.argsr   ExternalVpnGatewayArgumentr   ReleaseTracksr   ALPHABETAGAUpdateCommandr   rF   r   r   <module>rU      s    9 &  ' 7 \ ( E E g < 988:  D%%++T->->-C-C%%((*N*T N**N*r   