
                            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dZej$                  j&                  ej$                  j(                  fZej,                   ej.                  ej$                  j&                  ej$                  j(                  ej$                  j0                         G d dej2                                      Zee_        y)z;Update command to update a security profile group resource.    )absolute_import)division)unicode_literals)spg_api)base)	spg_flags)labels_util)
exceptions)logzA

          Update details of a Security Profile Group.

        a  
          To update a Security Profile Group with new threat prevention profile `my-new-security-profile`, run:

              $ {command} my-security-profile-group --organization=1234 --location=global --threat-prevention-profile=`organizations/1234/locations/global/securityProfiles/my-new-security-profile` --description='New Security Profile of type threat prevention'

        )DESCRIPTIONEXAMPLESc                   ,    e Zd ZdZed        Zd Zd Zy)UpdateProfileGroupz Update a Security Profile Group.c                    t        j                  || j                                t        j                  |       d }| j                         t        v r&|j                  d      }|j                  ddd       t        j                  || j                         d|dd	g
       | j                         t        v rN|j                  d      }|j                  ddd       t        j                  || j                         d|d       t        j                  |       t        j                  j                  |       t        j                  j                  |d       y )NT)mutexz!--clear-threat-prevention-profile
store_truezA            Clear the threat-prevention-profile field.
          )actionhelpzthreat-prevention-profileFzsecurity-profile)grouprequiredarg_aliasesz--clear-url-filtering-profilez=            Clear the url-filtering-profile field.
          zurl-filtering-profile)r   r   )r   AddSecurityProfileGroupResourceReleaseTrackAddProfileGroupDescription_URL_FILTERING_SUPPORTED	add_groupadd_argumentAddSecurityProfileResourcer	   AddUpdateLabelsFlagsr   
ASYNC_FLAGAddToParser
SetDefault)clsparserthreat_prevention_groupurl_filtering_groups       >lib/surface/network_security/security_profile_groups/update.pyArgszUpdateProfileGroup.Args6   sE   --fc6F6F6HI((0"
55 & 0 0t 0 <**
- +  ((#%'( 55",,4,8&&
) '  **





!# $$V,OO'OOvu-    c                 T    |j                  |j                               j                  S N)GetSecurityProfileGroupRelativeNamelabels)selfclientsecurity_profile_groups      r'   getLabelzUpdateProfileGroup.getLabelb   s&    ))++-fr)   c           	      t   
 t        j                   j                               
|j                  j                  j                         |j                  r$|j                  j                  j                         nd } j                         t        v r1|j                  r%|j                  j                  j                         }nd }|j                  }|j                  }t        j                  |
j                  j                  j                  
 fd      }|j                   dk7  r"t#        j$                  d|j                   z        g }|" j                         t        v r|j&                  r|j)                  d       |" j                         t        v r|j*                  r|j)                  d       ||j)                  d       |st#        j$                  d      
j-                  j/                         ||nd ||j/                         nd ||j/                         nd d	j1                  |      |j3                         
      }|r.|j4                  }	t6        j8                  j;                  d|	       |S 
j=                  
j?                  |      djA                  j/                               d      S )Nc                  (    j                         S r+   )r2   )r0   r1   r/   s   r'   <lambda>z(UpdateProfileGroup.Run.<locals>.<lambda>|   s    $--8N"Or)   )orig_labels_thunkglobalz0Only `global` location is supported, but got: %sthreatPreventionProfileurlFilteringProfiledescriptionzOperation failed to satisfy minimum qualification. Please specify the attribute which needs an update. `description` and/or `security profile` can be updated.,)security_profile_group_namer:   threat_prevention_profileurl_filtering_profileupdate_maskr.   z9Check for operation completion status using operation ID:z5Waiting for security-profile-group [{}] to be updatedT)operation_refmessage
has_result)!r   Clientr   CONCEPTSr1   Parser=   r   r>   r:   async_r	   ProcessUpdateArgsLazymessagesSecurityProfileGroupLabelsValuelocationcore_exceptionsErrorclear_threat_prevention_profileappendclear_url_filtering_profileUpdateSecurityProfileGroupr-   join	GetOrNonenamer   statusPrintWaitForOperationGetOperationsRefformat)r/   argsr=   r>   r:   is_asynclabels_updater?   responseoperation_idr0   r1   s   `         @@r'   RunzUpdateProfileGroup.Rung   s   ^^D--/0F!]]AAGGI )) 	//557  	77&&"mmAAGGI"""K{{H55,,88OM }} !!
<t}}
L  K!-"::0023)"::,,./'!!&  00$:$G$G$I#.#:K$0 #<"H"H"J , 4@@BHH[)&&( 1 H ]]l	jj
E
 o ""--h7GNN"//1
  #  r)   N)__name__
__module____qualname____doc__classmethodr(   r2   r_    r)   r'   r   r   /   s%    
 )). ).V
Nr)   r   N)rc   
__future__r   r   r   ?googlecloudsdk.api_lib.network_security.security_profile_groupsr   googlecloudsdk.callioper   +googlecloudsdk.command_lib.network_securityr   $googlecloudsdk.command_lib.util.argsr	   googlecloudsdk.corer
   rL   r   _detailed_helpr   ALPHABETAr   DefaultUniverseOnlyReleaseTracksGAUpdateCommandr   detailed_helpre   r)   r'   <module>rt      s    B &  ' S ( A < = #
 	T..33 
 T..33T5F5F5I5IB++ B BJ $2   r)   