
                         ^   S r SSK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
S.r\R                  " \R                  R                   \R                  R"                  \R                  R$                  5      \R&                   " S S\R(                  5      5       5       r\\l        g).Update the configuration of an insight config.    N)insights_config)
exceptions)base)flags)resource_args)logzE
          Update the configuration of an insights config.
          a  
          To update the state of an insights config, run:

            $ {command} insights-config-name --run-discovery

          To update the Artifact Analysis project for an artifact in an insights config, run:

            $ {command} insights-config-name --artifact-uri=us-{location}-docker.pkg.dev/my-project/my-artifact-repo/my-image --build-project={build_project}
          )DESCRIPTIONEXAMPLESc                   .    \ rS rSrSr\S 5       rS rSrg)Update*   r   c                 n    [         R                  " U SS9  U R                  SSS9nUR                  5       n[        R                  " U5        [        R                  " U5        [        R                  " U5        g! [        R                   a&  n[        R
                  R                  S5        UeSnAff = f)z Adds arguments for this command.update)verbz/Failed to add insight config resource argument.NTzUpdate the insight config.)requiredhelp)r   AddInsightConfigResourceArgr   HttpExceptionr	   statusPrint	add_groupr   AddDiscoveryArgumentAddArtifactArgumentAddBuildProjectArgument)parsereupdate_groupartifact_groups       8lib/surface/developer_connect/insights_configs/update.pyArgsUpdate.Args1   s    //XF ##8 $ L "++-N	|,	n-	!!.1 ## 	jjHIgs   A: :B4!B//B4c                    [         R                  " SS9n[        R                  " [        R
                  R                  5      nUR                  R                  R                  5       n UR                  UUR                  UR                  UR                  S9n[        R                   R#                  SR%                  UR'                  5       5      5        UR)                  UR+                  U5      SR%                  UR+                  U5      R'                  5       5      SUS9$ ! [        R                   aC  n[        R                   R#                  SR%                  UR'                  5       5      5        UeS nAff = f)	N   )seconds)insight_config_ref	discoverybuild_projectartifact_uriz'Failed to update the insight config {}.zUpdating the insight config {}.z-Waiting for operation [{}] to be completed...T)operation_refmessage
has_resultmax_wait)datetime	timedeltar   InsightsConfigClientr   ReleaseTrackALPHACONCEPTSParser   run_discoveryr(   r)   r   r   r	   r   r   formatRelativeNamewait_for_operationget_operation_ref)selfargsr-   clientinsights_config_ref	operationr   s          r    Run
Update.RunC   sI   !!"-H11$2C2C2I2IJF--77==?--0&&**((	   i JJ6==((*  $$..y9?	$$Y/<<>
@ %   ## 	jj@GG

*
*
, 	 g	s   (0D! !E85>E33E8 N)	__name__
__module____qualname____firstlineno____doc__staticmethodr!   r?   __static_attributes__rA       r    r   r   *   s    
 72 2"rI   r   )rF   r.   9googlecloudsdk.api_lib.developer_connect.insights_configsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.developer_connectr   r   googlecloudsdk.corer	   DETAILED_HELPReleaseTracksr1   r2   BETAGADefaultUniverseOnlyUpdateCommandr   detailed_helprA   rI   r    <module>rV      s    5  U 2 ( > F #	  T..33T5F5F5I5I 1T 1 1d % rI   