
    ?                     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,                  R.                  \R,                  R0                  5       " S S\R2                  5      5       rg)z'Command to update labels for addresses.    )absolute_import)division)unicode_literals)base_classes)poller)waiter)base)
exceptions)flags)labels_utilc                   2    \ rS rSrSrSr\S 5       rS rSr	g)Update   aF  Update a Compute Engine address.

*{command}* updates labels for a Compute Engine
address.

## EXAMPLES

To add/update labels 'k0' and 'k1' and remove labels with key 'k3' for address
'example-address', run:

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

Labels can be used to identify the address and to filter them as in:

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

To list existing labels for address 'example-address', run:

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

Nc                     [         R                  " SS9U l        U R                  R                  U5        [        R
                  " U5        g )NF)plural)r   AddressArgumentADDRESS_ARGAddArgumentr   AddUpdateLabelsFlags)clsparsers     'lib/surface/compute/addresses/update.pyArgsUpdate.Args:   s4    ++59COOO'$$V,    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#                  5       S:X  aP  UR$                  R'                  UR(                  " S0 UR+                  5       D65      nUR,                  R.                  nOOUR0                  R'                  UR2                  " S0 UR+                  5       D65      nUR4                  R.                  nUR7                  XR8                  5      n	U	R:                  (       d  U$ UR#                  5       S:X  a  UR=                  UR>                  URA                  5       UR-                  URB                  U	R8                  S9S9n
UR$                  RE                  U
5      nUR                  RG                  URH                  SS9n[J        RL                  " UR$                  5      nOURO                  UR>                  URA                  5       URP                  UR5                  URB                  U	R8                  S9S	9n
UR0                  RE                  U
5      nUR                  RG                  URH                  S
S9n[J        RL                  " UR0                  5      n[R        RT                  " XSRW                  URA                  5       5      5      $ )N)scope_listerLABELSzEAt least one of --update-labels or --remove-labels must be specified.zcompute.globalAddresses)labelFingerprintlabels)projectresourceglobalSetLabelsRequestzcompute.globalOperations)
collection)r!   r"   regionregionSetLabelsRequestzcompute.regionOperationsz Updating labels of address [{0}] ),r   ComputeApiHolderReleaseTrackclientapitools_clientmessagesr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerr   DiffFromUpdateArgsMayHaveUpdatescalliope_exceptionsRequiredArgumentException
CollectionglobalAddressesGet ComputeGlobalAddressesGetRequestAsDictGlobalSetLabelsRequestLabelsValue	addressesComputeAddressesGetRequestRegionSetLabelsRequestApplyr    needs_update&ComputeGlobalAddressesSetLabelsRequestr!   Namer   	SetLabelsParseselfLinkr   Poller ComputeAddressesSetLabelsRequestr%   r   WaitForformat)selfargsholderr*   r,   address_reflabels_diffaddresslabels_valuelabels_updaterequest	operationoperation_refoperation_pollers                 r   Run
Update.Run@   s   **4+<+<+>?F]]**F}}%%H""44"88G 5 IK
 ""11$7K%%''99
 /0 0 #<<&&**

3
3
Kk6H6H6J
KMg44@@l  $$

-
-
E0B0B0D
EGg44@@l%%lNNCM%%n#<<??%%##%!)!@!@&77")) "A "+ @ ,g ((227;i&&,,


)C - Em  v'='=>99%%##%##!)!@!@&77")) "A "+	 : ,g "",,W5i&&,,


)C - Em  v'7'78>>*11+2B2B2DEG Gr   r'   )
__name__
__module____qualname____firstlineno____doc__r   classmethodr   rW   __static_attributes__r'   r   r   r   r      s&    . +- -
<Gr   r   N)r]   
__future__r   r   r   googlecloudsdk.api_lib.computer   )googlecloudsdk.api_lib.compute.operationsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper	   r
   r4   "googlecloudsdk.command_lib.computer   r/   ,googlecloudsdk.command_lib.compute.addresses$googlecloudsdk.command_lib.util.argsr   ReleaseTracksr)   ALPHABETAUpdateCommandr   r'   r   r   <module>rl      sx    . &  ' 7 < . ( E E > < D%%++T->->-C-CD\GT \G E\Gr   