
                         ^   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)z.Update the configuration of an insight config.    N)insights_config)
exceptions)base)flags)resource_args)logz0
          Create an insights config.
          z
          To create an insights config with an apphub application, run:

            $ {command} insights-config-name --app-hub-application=projects/my-project/locations/us-central1/applications/my-app-hub-application
          )DESCRIPTIONEXAMPLESc                   .    \ rS rSrSr\S 5       rS rSrg)Create&   zCreate an insight config.c                 L    [         R                  " U SS9  U R                  SS9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.create)verbz/Failed to add insight config resource argument.NT)required)r   AddInsightConfigResourceArgr   HttpExceptionr   statusPrintadd_mutually_exclusive_groupr   AddAppHubApplicationArgumentAddTargetProjectsArgumentAddArtifactConfigsArgument)parseresource_groups      8lib/surface/developer_connect/insights_configs/create.pyArgsCreate.Args-   s    //XF 666EL	&&|4	##L1	$$V, ## 	jjHIgs   A) )B#=!BB#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app_hubtarget_projectsuser_artifact_configsz'Failed to create the insight config {}.zCreating 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   app_hub_applicationr%   artifact_configsr   r   r   r   r   formatRelativeNamewait_for_operationget_operation_ref)selfargsr*   clientinsights_config_ref	operationr   s          r   Run
Create.Run<   sI   !!"-H11$2C2C2I2IJF--77==?--0**.. $ 5 5	   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__r?       r   r   r   &   s    
 "- -rG   r   )rD   r+   9googlecloudsdk.api_lib.developer_connect.insights_configsr   googlecloudsdk.api_lib.utilr   googlecloudsdk.callioper   ,googlecloudsdk.command_lib.developer_connectr   r   googlecloudsdk.corer   DETAILED_HELPReleaseTracksr.   r/   BETAGADefaultUniverseOnlyCreateCommandr   detailed_helpr?   rG   r   <module>rT      s    5  U 2 ( > F #		 T..33T5F5F5I5I .T . .^ % rG   