
    "                        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Z	 d#dZd$dZ	 d%dZd&dZ	 d'dZd Zd Z	 	 	 	 d(dZd Zd Zd Zd Zd Zd Zd Zd Zd Zd Zd Z d Z!d  Z"d! Z#y
))z$Flags for Fault Injection Cloud SDK.    )absolute_import)division)unicode_literals)arg_parsers)concepts)deps)concept_parsers)presentation_specsNc                 |      fd}t        j                  dd |       t         j                  t                     S )<Constructs and returns the Resource specification for Fault.c                  2    t        j                         S N)name	help_textr    ResourceParameterAttributeConfigarg_namer   s   7lib/googlecloudsdk/command_lib/fault_injection/flags.pyFaultAttributeConfigz2GetFaultResourceSpec.<locals>.FaultAttributeConfig       44     z/faultinjectiontesting.projects.locations.faultsfault)resource_namefaultsId
projectsIdlocationsIdr   ResourceSpec DEFAULT_PROJECT_ATTRIBUTE_CONFIGLocationAttributeConfig)r   r   r   s   `` r   GetFaultResourceSpecr"      s8    
 
		7#%::)+
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z3Constructs and returns the Fault Resource Argument.zName for the Fault{}{} --required)r	   ConceptParserForResourceformatr"   r   r   
positionalr(   s       r   GetFaultResourceArgr.   -   sK    
 //)		&	&	2	2mm*B$9	 
3 
 r   c                 |      fd}t        j                  dd |       t         j                  t                     S )r   c                  2    t        j                         S r   r   r   s   r   ExperimentAttributeConfigz<GetExperimentResourceSpec.<locals>.ExperimentAttributeConfig?   r   r   z4faultinjectiontesting.projects.locations.experiments
experiment)r   experimentsIdr   r   r   )r   r   r1   s   `` r   GetExperimentResourceSpecr4   <   s8    
 
		< -/::)+
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z8Constructs and returns the Experiment Resource Argument.zName for the Experimentr$   r%   r&   r'   )r	   r)   r*   r+   r4   r,   s       r   GetExperimentResourceArgr6   M   sK    
 44)		&	&	2	2mm*B$9!	 
3 
 r   c                 |      fd}t        j                  dd |       t         j                  t                     S )z:Constructs and returns the Resource specification for Job.c                  2    t        j                         S r   r   r   s   r   JobAttributeConfigz.GetJobResourceSpec.<locals>.JobAttributeConfig_   r   r   z-faultinjectiontesting.projects.locations.jobsjob)r   jobsIdr   r   r   )r   r   r9   s   `` r   GetJobResourceSpecr<   \   s8    
 
		5!::)+
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z1Constructs and returns the Job Resource Argument.zName of the Jobr$   r%   r&   r'   )r	   r)   r*   r+   r<   r,   s       r   GetJobResourceArgr>   m   sK    
 ,,)		&	&	2	2mm*B$9	 
3 
 r   c                  Z    t        j                  ddt        j                  d      g      S )Nlocationz&The Cloud location for the {resource}.
--location)r   r   fallthroughs)r   r   r   ArgFallthrough r   r   r!   r!   |   s.    		2	28


l
+
 r   c                  `    t        j                  ddt               t         j                        S )Nz(faultinjectiontesting.projects.locationsr@   )r   r   r   )r   r   r!   r    rD   r   r   GetLocationResourceSpecrF      s*    			0)+::	
 r   c                     |xs d}t         j                  j                  dj                  |rdnd|       t	               ||      S )z6Constructs and returns the Location Resource Argument.Locationr$   r%   r&   r'   )r	   r)   r*   r+   rF   r,   s       r   GetLocationResourceArgrI      sJ     %:)		&	&	2	2mm*B$9	 
3 
 r   c                 6    t               j                  |        y Nr.   AddToParserparsers    r   AddDescribeFaultFlagsrP          ##F+r   c                 6    t               j                  |        y rK   rL   rN   s    r   AddDeleteFaultFlagsrS      rQ   r   c                     t               j                  |        | j                  dt        j                         ddd       y )N--fileFILEz,The file containing the fault to be created.Ttypemetavarhelpr(   r.   rM   add_argumentr   YAMLFileContentsrN   s    r   AddCreateFaultFlagsr^      s>    ##F+'')9  r   c                     t               j                  |        | j                  dt        j                         ddd       y )NrU   rV   z-The file containing the updated fault config.TrW   r[   rN   s    r   AddUpdateFaultFlagsr`      s>    ##F+''):  r   c                     t        d      j                  |        | j                  dt        dd       | j                  dt        dd       y )	NTr'   z--service-nameservice name.FrX   rZ   r(   z--experiment-namezexperiment name.rI   rM   r\   strrN   s    r   AddListFaultFlagsrf      sU    $'33F;	   		  r   c                 6    t               j                  |        y rK   r6   rM   rN   s    r   AddDescribeExperimentFlagsri          ((0r   c                 6    t               j                  |        y rK   rh   rN   s    r   AddDeleteExperimentFlagsrl      rj   r   c                     t               j                  |        | j                  dt        j                         ddd       y )NrU   rV   z1The file containing the experiment to be created.TrW   r6   rM   r\   r   r]   rN   s    r   AddCreateExperimentFlagsro      s>    ((0'')>  r   c                     t               j                  |        | j                  dt        j                         ddd       y )NrU   rV   z2The file containing the updated experiment config.TrW   rn   rN   s    r   AddUpdateExperimentFlagsrq      s>    ((0'')?  r   c                 l    t        d      j                  |        | j                  dt        dd       y )NTr'   z--sd-service-namerb   Frc   rd   rN   s    r   AddListExperimentFlagsrs      s4    $'33F;	  r   c                 6    t               j                  |        y rK   r>   rM   rN   s    r   AddDescribeJobFlagsrv          !!&)r   c           
      j   t        d      j                  |        t        j                  t	        j
                  dt               ddd      t	        j
                  dt               ddd      g      j                  |        | j                  d	t        d
d       | j                  dt        dd       y)zAdd job list Flags.Tr'   --experimentThe experiment resource.F)prefixesr(   z--faultzThe fault resource.z--target-nameztarget name.rc   z--dayszDays.N)rI   rM   r	   r)   r
   ResourcePresentationSpecr4   r"   r\   re   intrN   s    r   AddListJobFlagsr~      s     $'33F;11

#
%
$ 11


 
!  [	   		  r   c                 X   t        j                  t        j                  dt	               dddidd      t        j                  dt               dd	d	d
dd      g      j                  |        | j                  dt        j                         ddd       | j                  dddd       y)zAdd job Create Flags.JOBzThe Job resource.r@   rA   T)flag_name_overridesr{   r(   ry   rz   r%   )r@   projectz--fault-targetsLISTz>targets for the faults in experiment. Provide them in sequencerW   z	--dry-run
store_trueFzDry run mode.)actiondefaultrZ   N)
r	   r)   r
   r|   r<   r4   rM   r\   r   ArgListrN   s    r   AddCreateJobFlagsr     s     

5
5 "!#-|"< 
5
5')( !# . K K   		  r   c                 6    t               j                  |        y rK   ru   rN   s    r   AddDeleteJobFlagsr   H  rw   r   )r   N)r   NTT)r2   N)r2   NTT)r:   N)r:   NTT)r@   NFF)$__doc__
__future__r   r   r   googlecloudsdk.callioper    googlecloudsdk.calliope.conceptsr   r   (googlecloudsdk.command_lib.util.conceptsr	   r
   r"   r.   r4   r6   r<   r>   r!   rF   rI   rP   rS   r^   r`   rf   ri   rl   ro   rq   rs   rv   r~   r   r   rD   r   r   <module>r      s    + &  ' / 5 1 D G$ AE$ FJ$ ?C 	$,, 11*D(V*r   