
    `                         d Z ddlmZ ddlmZ ddlmZ ddl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dZ G d de	j                         Zee_        y)zUpdate endpoint command.    )absolute_import)division)unicode_literalsN)activation_api)base)
exceptions)activation_flags)labels_utilz
          Update a firewall endpoint. Check the progress of endpoint update
          by using `gcloud network-security firewall-endpoints describe`.

          For more examples, refer to the EXAMPLES section below.

        a  
            To update labels k1 and k2, run:

            $ {command} my-endpoint --zone=us-central1-a --organization=1234 --update-labels=k1=v1,k2=v2

            To remove labels k3 and k4, run:

            $ {command} my-endpoint --zone=us-central1-a --organization=1234 --remove-labels=k3,k4

            To clear all labels from the firewall endpoint, run:

            $ {command} my-endpoint --zone=us-central1-a --organization=1234 --clear-labels
        )DESCRIPTIONEXAMPLESc                   &    e Zd ZdZed        Zd Zy)Updatez]Update a Firewall Plus endpoint.

  This command is used to update labels on the endpoint.
  c                 t   t        j                  | j                         |       t        j                  |d       t        j                  |       t        j
                  |       t        j                  j                  |       t        j                  j                  |d       t        j                  |       y )N60mT)r	   AddEndpointResourceReleaseTrack
AddMaxWaitAddDescriptionArgAddUpdateBillingProjectArgr   
ASYNC_FLAGAddToParser
SetDefaultr
   AddUpdateLabelsFlags)clsparsers     9lib/surface/network_security/firewall_endpoints/update.pyArgszUpdate.Args:   s{    (()9)9);VD.&&v.//7OO'OOvt,$$V,    c                 @   t        j                  | j                               }|j                  j                  j                         }|j                  |j                               }|t        j                  dd      g }d }t        j                  j                  |      }|j                         ro|j                  d       |j                  }|j!                  |j"                  j$                  j&                  |j                        }|j(                  r|j                  }|j*                  }	|	r|j                  d       |st        j,                  g d      |j.                  }
t1        j2                  |j4                        }|j7                  |j                         t9        |dd       dj;                  |      ||		      }|
r|j=                  d
      sd|_        |S |jA                  |jC                  |      dj?                  |j                               d|      S )Nzfirewall-endpointz!Firewall endpoint does not exist.labelsbilling_project_id)z--clear-labelsz--remove-labelsz--update-labelsz--update-billing-project)secondsdescription,)namer#   update_maskr    r!   formatdefaultz0waiting for firewall endpoint [{}] to be updatedT)operation_refmessage
has_resultmax_wait)"r   Clientr   CONCEPTSfirewall_endpointParseDescribeEndpointRelativeNamer   InvalidArgumentExceptionr
   DiffFromUpdateArgsMayHaveUpdatesappendr    ApplymessagesFirewallEndpointLabelsValueneeds_updateupdate_billing_projectMinimumArgumentExceptionasync_datetime	timedeltar,   UpdateEndpointgetattrjoinIsSpecifiedr'   WaitForOperationGetOperationRef)selfargsclientendpointoriginalr&   r    labels_difflabels_updater!   is_asyncr,   	operations                r   Runz
Update.RunD   s   ""4#4#4#67F}}..446H&&x'<'<'>?H//

-/ / KF""11$7K!!#"f!''
//
*
*
6
6
//m 
	#	#%%44-.// 1 	 	 {{H!!$--8H%%""$D-6HH[)- & I  h'"",,Y7BII!!#
  #  r   N)__name__
__module____qualname____doc__classmethodr   rQ    r   r   r   r   4   s     
 - -<r   r   )rU   
__future__r   r   r   r@   :googlecloudsdk.api_lib.network_security.firewall_endpointsr   googlecloudsdk.callioper   r   +googlecloudsdk.command_lib.network_securityr	   $googlecloudsdk.command_lib.util.argsr
   DETAILED_HELPUpdateCommandr   detailed_helprW   r   r   <module>r`      sU     &  '  U ( . H <0LT L^ % r   