
    5                         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\
R&                  5      rg)z5Commands for updating network edge security services.    )absolute_import)division)unicode_literals)base_classes)client)base)
exceptions)flags)	resourcesc                   <    \ rS rSrSrSrSr\S 5       rS r	S r
Srg)Update   a(  Update a network edge security service.

*{command}* is used to update network edge security services.

## EXAMPLES

To attach a new security policy 'my-policy' to a network edge security service
with the name 'my-service' in region 'us-central1', run:

  $ {command} my-service \
    --security-policy=my-policy \
    --region=us-central1

To remove the security policy attached to a network edge security service
with the name 'my-service' in region 'us-central1', run:

  $ {command} my-service \
    --security-policy="" \
    --region=us-central1
Nc                     [         R                  " 5       U l        U R                  R                  USS9  UR	                  SSS9  [
        R                  " SS9U l        U R                  R                  U5        g)	z"Set up arguments for this command.update)operation_type--descriptionzGAn optional, textual description for the network edge security service.)helpznetwork edge security service)resourceN)r
   "NetworkEdgeSecurityServiceArgument!NETWORK_EDGE_SECURITY_SERVICE_ARGAddArgumentadd_argumentsecurity_policy_flags/SecurityPolicyRegionalArgumentForTargetResourceSECURITY_POLICY_ARG)clsparsers     <lib/surface/compute/network_edge_security_services/update.pyArgsUpdate.Args8   s     	002 )))55x 6 )
/  1 	MM4	6  ''/    c                     UR                  S5      (       d2  UR                  S5      (       d  SS/n[        R                  " US5      egg)ztValidates that at least one field to update is specified.

Args:
  args: The arguments given to the update command.
descriptionsecurity_policyr   z--security_policyz.Please specify at least one property to updateN)IsSpecifiedr	   MinimumArgumentException)selfargsparameter_namess      r   _ValidateArgsUpdate._ValidateArgsI   sW     ]++.//(*=>o//
KM M 0 ,r!   c                    U R                  U5        [        R                  " U R                  5       5      nU R                  R                  XR                  5      n[        R                  " X2R                  S9nUR                  5       S   nUR                  nUR                  n/ nUR                  S5      (       a  UR                  nUR                  S5        [        USS 5      bE  UR                  S5         U R                  R                  XR                  5      R!                  5       nUR                  R&                  R                  UUUR(                  S9n	UR+                  U	US9$ ! ["        R$                   a    S n NWf = f)N)refcompute_clientr   r#   r$   securityPolicy)r#   r/   fingerprint)network_edge_security_serviceupdate_mask)r*   r   ComputeApiHolderReleaseTrackr   ResolveAsResourcer   r   NetworkEdgeSecurityServiceDescriber#   r/   r%   appendgetattrr   SelfLinkresources_exceptionsInvalidResourceExceptionmessagesr0   Patch)
r'   r(   holderr-   r1   &existing_network_edge_security_servicer#   r$   r2   %updated_network_edge_security_services
             r   Run
Update.RunU   sz   t**4+<+<+>?F

0
0
B
B C$*$E$E%/! 	&..03 +8DDK<KKOK&&$$k't&-9)*22DD""$$,HJ 	 	99#*>JJ 	: 	L * )..&K / ! ! ":: s   93E+ +FF )__name__
__module____qualname____firstlineno____doc__r   r   classmethodr   r*   rB   __static_attributes__rD   r!   r   r   r      s2    * '+#0 0 
M"!r!   r   N)rI   
__future__r   r   r   googlecloudsdk.api_lib.computer   =googlecloudsdk.api_lib.compute.network_edge_security_servicesr   googlecloudsdk.callioper   r	   Agooglecloudsdk.command_lib.compute.network_edge_security_servicesr
   4googlecloudsdk.command_lib.compute.security_policiesr   googlecloudsdk.corer   r;   UpdateCommandr   rD   r!   r   <module>rT      s>    < &  ' 7 P ( . S$ AX!T X!r!   