
    %                     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,                  j.                  e
j,                  j0                  e
j,                  j2                         G d de
j4                               Zy)z*Command to update labels for VPN gateways.    )absolute_import)division)unicode_literals)base_classes)vpn_gateways_utils)base)
exceptions)flags)labels_utilc                   .    e Zd ZdZddiZed        Zd Zy)UpdateaK  Update a Compute Engine Highly Available VPN gateway.

  *{command}* updates labels for a Compute Engine Highly Available 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 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 a VPN gateway, run:

              $ {command} my-gateway --region=us-central1                 --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)_VPN_GATEWAY_ARGAddArgumentr   AddUpdateLabelsFlags)clsparsers     *lib/surface/compute/vpn_gateways/update.pyArgszUpdate.ArgsB   s%        A$$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 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 VPN gateway [{0}])r   ComputeApiHolderReleaseTrackclientmessagesr   VpnGatewayHelperr   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_gateway_reflabels_diffvpn_gatewaylabels_updateoperation_refs
             r   Runz
Update.RunL   sM    **4+<+<+>?F}}%%H008F&88"88G 9 IO
 ""11$7K%%'99
 /0 0 ///2K%%''33[5G5GIM %%$$55}7K7KMM"".55o6J6J6LMO Or   N)__name__
__module____qualname____doc__detailed_helpclassmethodr   r?    r   r   r   r       s2    . 7- - -#Or   r   N)rC   
__future__r   r   r   googlecloudsdk.api_lib.computer   +googlecloudsdk.api_lib.compute.vpn_gatewaysr   googlecloudsdk.callioper   r	   r)   "googlecloudsdk.command_lib.computer
   r$   /googlecloudsdk.command_lib.compute.vpn_gateways$googlecloudsdk.command_lib.util.argsr   GetVpnGatewayArgumentr   ReleaseTracksr   ALPHABETAGAUpdateCommandr   rF   r   r   <module>rT      s    1 &  ' 7 J ( E E A <.5..0  D%%++T->->-C-C%%((*MOT MO*MOr   