
                         D   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  ej                   ej"                  j$                  ej"                  j&                  ej"                  j(                         G d	 d
ej*                               Zy)z"Command for updating target pools.    )absolute_import)division)unicode_literals)base_classes)base)
exceptions)flagsc                   .    e Zd ZdZdZdZed        Zd Zy)UpdatezUpdate a Compute Engine target pool.

  *{command}* updates a Compute Engine target pool.

  ## EXAMPLES

  To update the security policy run this:

    $ {command} TARGET_POOL --security-policy='my-policy'
  Nc                     t        j                         | _        | j                  j                  |d       t	        j
                  d      | _        | j                  j                  |       y )Nupdate)operation_typeztarget pool)resource)r	   TargetPoolArgumentTARGET_POOL_ARGAddArgumentsecurity_policy_flags/SecurityPolicyRegionalArgumentForTargetResourceSECURITY_POLICY_ARG)clsparsers     *lib/surface/compute/target_pools/update.pyArgszUpdate.Args0   s[    224C##F8#D	8	8"	$  ''/    c                    t        j                  | j                               }|j                  }| j                  j                  ||j                  t        j                  |            }t        |dd       t        |dd       r5| j                  j                  ||j                        j                         }nd }|j                  j                  |j                  |j                         |j                   |j                  j#                  |            }|j%                  |j&                  j(                  d|fg      S dg}t+        j,                  |d      )N)scope_listersecurity_policy)securityPolicy)project
targetPoolregionsecurityPolicyReferenceSetSecurityPolicyz--security-policyz.Please specify at least one property to update)r   ComputeApiHolderReleaseTrackclientr   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListergetattrr   SelfLinkmessages*ComputeTargetPoolsSetSecurityPolicyRequestr   Namer!   SecurityPolicyReferenceMakeRequestsapitools_clienttargetPoolsr   MinimumArgumentException)selfargsholderr&   target_pool_refsecurity_policy_refrequestparameter_namess           r   Runz
Update.Run:   sZ   **4+<+<+>?F]]F**<<"88@ = BO t&-9	($	/"66HH&""$$,HJ 	 #JJ!))$))+ ''"(//"I"I0 #J #	 K g   6#9#9#E#E#6#A "B C C ++O

-
-IK Kr   )	__name__
__module____qualname____doc__r   r   classmethodr   r<    r   r   r   r      s,    	 /0 0Kr   r   N)r@   
__future__r   r   r   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r)   4googlecloudsdk.command_lib.compute.security_policiesr   /googlecloudsdk.command_lib.compute.target_poolsReleaseTracksr%   ALPHABETAGAUpdateCommandr   rB   r   r   <module>rN      s    ) &  ' 7 ( . E$ A T..33T5F5F5I5I7KT 7K7Kr   