
    m                        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  SPS jrS r    SQS jrS rS r    SRS jrSSS jr STS jrS rSUS jr SVS jrS rS rS rS rS r S r!S r"S  r#S! r$\RJ                  RL                  4S" jr'\RJ                  RL                  4S# jr(S$ r) SWS% jr*    SXS& jr+ SYS' jr,    SZS( jr- S[S) jr.    S\S* jr/ S]S+ jr0    S^S, jr1S- r2S. r3S/ r4S0 r5S1 r6S2 r7S3 r8S4 r9S5 r:S6 r;S7 r<S_S8 jr= S`S9 jr>S: r?S; r@S< rAS= rBS> rC\RJ                  RL                  4S? jrD\RJ                  RL                  4S@ jrES\RJ                  RL                  4SA jrFSB rGSC rHSD rI\RJ                  RL                  4SE jrJ\RJ                  RL                  4SF jrKSG rLSH rMSI rNSJ rOSK rP SaSL jrQ    SbSM jrRSN rSSO rTg)czApphub Command Lib Flags.    )absolute_import)division)unicode_literals)arg_parsers)base)concepts)deps)utils)concept_parsers)presentation_specsNc                     [         R                  " S[        R                  " [        R
                  SS9/U (       a  U S9$ SS9$ )zCreate basic attributes that fallthrough location to global in resource argument.

Args:
  help_text: If set, overrides default help text

Returns:
  Resource argument parameter config
locationz8Service project attachments only support global location)functionhintzLocation of the {resource}.)namefallthroughs	help_text)r    ResourceParameterAttributeConfigr	   Fallthroughapphub_utilsDefaultToGlobal)r   s    .lib/googlecloudsdk/command_lib/apphub/flags.py'_DefaultToGlobalLocationAttributeConfigr      sP     
	2	2


#33M '		
 	 .K	
 	    c                  \    [         R                  " SS[        5       [         R                  S9$ Napphub.projects.locationsr   )resource_namelocationsId
projectsId)r   ResourceSpecr    DEFAULT_PROJECT_ATTRIBUTE_CONFIG r   r   GetGlobalLocationResourceSpecr$   3   s*    			!9;::	
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ z6Constructs and returns the Location Resource Argument.z	Location.{}{} --required)r   ConceptParserForResourceformatr$   arg_namer   
positionalr+   s       r   GetGlobalLocationResourceArgr2   <   sJ     &;)		&	&	2	2mm*B$9#%	 
3 
 r   c                  ,    [         R                  " SSS9$ )Nr   z&The Cloud location for the {resource}.r   r   r   r   r#   r   r   LocationAttributeConfigr6   N   s    		2	28
 r   c                  \    [         R                  " SS[        5       [         R                  S9$ r   )r   r!   r6   r"   r#   r   r   GetLocationResourceSpecr8   U   s*    			!)+::	
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ r&   )r   r,   r-   r.   r8   r/   s       r   GetLocationResourceArgr:   ^   sJ     &;)		&	&	2	2mm*B$9	 
3 
 r   c                 z   ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       S9$ )zFConstructs and returns the Resource specification for Service project.c                  .   > [         R                  " T TS9$ Nr4   r5   r0   r   s   r   ServiceProjectAttributeConfigDGetServiceProjectResourceSpec.<locals>.ServiceProjectAttributeConfigs       44 r   z3apphub.projects.locations.serviceProjectAttachmentsServiceProjectAttachment)r   serviceProjectAttachmentsIdr    r   )r   r!   r"   r   )r0   r   r?   s   `` r   GetServiceProjectResourceSpecrD   p   s8     
		;."?"A::9;
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )z=Constructs and returns the Service Project Resource Argument.zThe Service Project ID.r'   r(   r)   r*   )r   r,   r-   r.   rD   r/   s       r   GetServiceProjectResourceArgrF      sK    
 44)		&	&	2	2mm*B$9#%	 
3 
 r   c                 ,    [         R                  " U US9$ )z9Helper function for constructing ResourceAttributeConfig.r4   r5   r>   s     r   "ApplicationResourceAttributeConfigrH      s     
	2	2
 r   applicationc                 p    [         R                  " SS[        X5      [         R                  [	        5       S9$ )zBConstructs and returns the Resource specification for Application.z&apphub.projects.locations.applicationsrI   )r   applicationsIdr    r   )r   r!   rH   r"   r6   r>   s     r   GetApplicationResourceSpecrL      s4     
		.!7L::)+
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )z<Constructs and returns the Application ID Resource Argument.zThe Application ID.r'   r(   r)   r*   )r   r,   r-   r.   rL   r/   s       r   GetApplicationResourceArgrN      sK    
 00)		&	&	2	2mm*B$9 "	 
3 
 r   c                  ^    [         R                  " SSS[         R                  [        5       S9$ )zAConstructs and returns the Resource specification for a Boundary.r   boundaryv1alpha)r   api_versionr    r   r   r!   r"   r6   r#   r   r   GetBoundaryResourceSpecrT      s-    			!::)+
 r   c                 p    [         R                  R                  S[        5       SR	                  U 5      SS9$ )z6Constructs and returns the Boundary Resource Argument.
--locationz+The location of the App Hub boundary to {}.Tr*   )r   r,   r-   rT   r.   )verbs    r   GetBoundaryResourceArgrX      s:    		&	&	2	23::4@	 
3 
 r   c                 8    [        S5      R                  U 5        g)z=Adds the resource argument for the boundary describe command.describeN)rX   AddToParserparsers    r   AddDescribeBoundaryFlagsr^      s    $008r   c                     [        S5      R                  U 5        [        R                  R                  U 5        U R	                  S5      nUR                  SSS9  U R                  SSS9  g)	z3Adds the arguments for the boundary update command.updatezUpdate Boundary Optionsz
--crm-nodez,The CRM node to associate with the boundary.helpz--request-idz,An optional request ID to identify requests.N)rX   r[   r   
ASYNC_FLAGadd_argument_groupadd_argument)r]   update_groups     r   AddUpdateBoundaryFlagsrg      sl    "..v6//f%**+DE,G   	I  r   c                 6    [        5       R                  U 5        g N)rF   r[   r\   s    r   AddDescribeServiceProjectFlagsrj           ,,V4r   c                 6    [        5       R                  U 5        g ri   rN   r[   r\   s    r   AddDescribeApplicationFlagsrn          ))&1r   c                 6    [        5       R                  U 5        g ri   )r2   r[   r\   s    r   AddListServiceProjectFlagsrq      rk   r   c                 6    [        5       R                  U 5        g ri   r:   r[   r\   s    r   AddListApplicationFlagsrt          &&v.r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g N--asyncasync_
store_trueFNReturn immediately, without waiting for the operation in progress to complete.destactiondefaultrb   rF   r[   re   r\   s    r   AddServiceProjectFlagsr      7     ,,V4  	r   c                     [        5       R                  U 5        [        U SUS9  U R                  SSSS.SSS	9  U R                  S
SS9  U R                  SSS9  U R                  SSSSSS9  g)-Adds flags required to create an application.rI   r   release_trackz--scope-typez!Represents a regional applicationzRepresents a global application)REGIONALGLOBALzScope of the ApplicationT)choicesrb   r+   --display-nameHuman-friendly display namera   --descriptionDescription of the Applicationrx   ry   rz   Fr{   r|   N)rN   r[   AddAttributesFlagsre   r]   r   s     r   CreateApplicationFlagsr      s     ))&1M 	95 &   	&-JKo,LM  	r   c                     [        5       R                  U 5        U R                  SSS9  U R                  SSS9  [        U SUS9  U R                  SS	S
SSS9  g)r   r   r   ra   r   r   rI   r   rx   ry   rz   Fr{   r|   N)rN   r[   re   r   r   s     r   UpdateApplicationFlagsr     ss     ))&1&-JKo,LMM 	  	r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g rw   r   r\   s    r   AddRemoveServiceProjectFlagsr   .  r   r   c                 z   ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       S9$ )zIConstructs and returns the Resource specification for Discovered Service.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r    DiscoveredServiceAttributeConfigJGetDiscoveredServiceResourceSpec.<locals>.DiscoveredServiceAttributeConfigA  rA   r   z,apphub.projects.locations.discoveredServicesdiscoveredService)r   discoveredServicesIdr    r   rS   )r0   r   r   s   `` r    GetDiscoveredServiceResourceSpecr   <  s8    
 
		4';=::)+
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )z@Constructs and returns the Discovered Service Resource Argument.zThe Discovered Service ID.r'   r(   r)   r*   )r   r,   r-   r.   r   r/   s       r   GetDiscoveredServiceResourceArgr   P  sK     77)		&	&	2	2mm*B$9&(	 
3 
 r   c                 z   ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       S9$ )zJConstructs and returns the Resource specification for Discovered Workload.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r   !DiscoveredWorkloadAttributeConfigLGetDiscoveredWorkloadResourceSpec.<locals>.DiscoveredWorkloadAttributeConfigg  rA   r   z-apphub.projects.locations.discoveredWorkloadsdiscoveredWorkload)r   discoveredWorkloadsIdr    r   rS   )r0   r   r   s   `` r   !GetDiscoveredWorkloadResourceSpecr   b  s8    
 
		5(=?::)+
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )zAConstructs and returns the Discovered Workload Resource Argument.zThe Discovered Workload ID.r'   r(   r)   r*   )r   r,   r-   r.   r   r/   s       r    GetDiscoveredWorkloadResourceArgr   v  sK     88)		&	&	2	2mm*B$9')	 
3 
 r   c                    ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       [	        SSS9S9$ )zKConstructs and returns the Resource specification for Application Workload.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r   "ApplicationWorkloadAttributeConfigNGetApplicationWorkloadResourceSpec.<locals>.ApplicationWorkloadAttributeConfig  rA   r   z0apphub.projects.locations.applications.workloadsworkloadrI   Name for the applicationr>   )r   workloadsIdr    r   rK   r   r!   r"   r6   rH   )r0   r   r   s   `` r   "GetApplicationWorkloadResourceSpecr     sF    
 
		846::)+7 .

 
r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )zBConstructs and returns the application workload Resource Argument.zThe Workload ID.r'   r(   r)   r*   )r   r,   r-   r.   r   r/   s       r   !GetApplicationWorkloadResourceArgr     sK     --)		&	&	2	2mm*B$9(*	 
3 
 r   c                    ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       [	        SSS9S9$ )zJConstructs and returns the Resource specification for Application Service.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r   !ApplicationServiceAttributeConfigLGetApplicationServiceResourceSpec.<locals>.ApplicationServiceAttributeConfig  rA   r   z/apphub.projects.locations.applications.servicesservicerI   r   r>   )r   
servicesIdr    r   rK   r   )r0   r   r   s   `` r   !GetApplicationServiceResourceSpecr     sF    
 
		724::)+7 .

 
r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )zAConstructs and returns the application service Resource Argument.zThe Service ID.r'   r(   r)   r*   )r   r,   r-   r.   r   r/   s       r    GetApplicationServiceResourceArgr     sK     ,,)		&	&	2	2mm*B$9')	 
3 
 r   c                 6    [        5       R                  U 5        g ri   )r   r[   r\   s    r   !AddDescribeDiscoveredServiceFlagsr     s    !#//7r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddListDiscoveredServiceFlagsr     ru   r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddFindUnregisteredServiceFlagsr     ru   r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddFindDiscoveredServiceFlagsr     ru   r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g )N--uriURIresource_uriTz:Google Cloud Platform resource URI to look up service for.metavarr}   r+   rb   r:   r[   re   r\   s    r   AddLookupDiscoveredServiceFlagsr     s5    &&v.G  r   c                 6    [        5       R                  U 5        g ri   )r   r[   r\   s    r   "AddDescribeDiscoveredWorkloadFlagsr         "$008r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddListDiscoveredWorkloadFlagsr     ru   r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r    AddFindUnregisteredWorkloadFlagsr     ru   r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddFindDiscoveredWorkloadFlagsr     ru   r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g )Nr   r   r   Tz;Google Cloud Platform resource URI to look up workload for.r   r   r\   s    r    AddLookupDiscoveredWorkloadFlagsr     s5    &&v.H  r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g rw   )rN   r[   re   r\   s    r   AddDeleteApplicationFlagsr     s7    ))&1  	r   c                 z   ^ ^ U U4S jn[         R                  " SSU" 5       [         R                  [        5       S9$ )z@Constructs and returns the Resource specification for Operation.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r   OperationAttributeConfig:GetOperationResourceSpec.<locals>.OperationAttributeConfig#  rA   r   z$apphub.projects.locations.operations	operation)r   operationsIdr    r   rS   )r0   r   r   s   `` r   GetOperationResourceSpecr      s8     
		,+-::)+
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )z7Constructs and returns the Operation Resource Argument.zThe Operation ID.r'   r(   r)   r*   )r   r,   r-   r.   r   r/   s       r   GetOperationResourceArgr   2  sK    
 ..)		&	&	2	2mm*B$9 	 
3 
 r   c                 6    [        5       R                  U 5        g ri   )r   r[   r\   s    r   AddDescribeOperationFlagsr   A  s    ''/r   c                 6    [        5       R                  U 5        g ri   rs   r\   s    r   AddListOperationsFlagsr   E  ru   r   c                 4    [        SS9R                  U 5        g NFr1   rm   r\   s    r   AddListApplicationWorkloadFlagsr   I      u-99&Ar   c                 6    [        5       R                  U 5        g ri   )r   r[   r\   s    r   #AddDescribeApplicationWorkloadFlagsr   M  s    #%11&9r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g rw   )r   r[   re   r\   s    r   !AddDeleteApplicationWorkloadFlagsr   Q  s7    #%11&9  	r   c                 Z   [         R                  " [        R                  " S[	        5       SSSS.SSS9[        R                  " S[        5       S	S
S
S.SSS9/SS/0S9R                  U 5        [        U SUS9  U R                  SSS9  U R                  SSS9  U R                  SSSSSS9  g)z6Adds flags required to create an application workload.WORKLOADzThe Workload resource.rV   --applicationr   rI   Tflag_name_overridesprefixesr+   z--discovered-workloadz!The discovered workload resource.r(   r   projectz--discovered-workload.locationzWORKLOAD.locationcommand_level_fallthroughsr   r   r   r   ra   r   Description of the Workloadrx   ry   rz   Fr{   r|   N)	r   r,   r   ResourcePresentationSpecr   r   r[   r   re   r   s     r   !AddCreateApplicationWorkloadFlagsr   _  s     

5
502&*!0# 
 
5
5%/11 !# : +-@,A"; @ KJm 	&-JKo,IJ  	r   c                     [        5       R                  U 5        [        U SUS9  U R                  SSS9  U R                  SSS9  U R                  SS	S
SSS9  g)z6Adds flags required to update an application workload.r   r   r   r   ra   r   r   rx   ry   rz   Fr{   r|   N)r   r[   r   re   r   s     r   !AddUpdateApplicationWorkloadFlagsr     ss    
 $%11&9Jm 	&-JKo,IJ  	r   c           	      6   U R                  SSSSSSS.SR                  U5      S	9  U R                  S
SSSSSS.SR                  U5      S	9  U[        R                  R                  :X  a  U R                  S[
        R                  " [        [        [        S.S/S9SSR                  U5      S9  U R                  S[
        R                  " [        [        [        S.S/S9SSR                  U5      S9  U R                  S[
        R                  " [        [        [        S.S/S9SSR                  U5      S9  gU[        R                  R                  :X  a  U R                  S[
        R                  " [        [        S.S/S9SSR                  U5      S9  U R                  S[
        R                  " [        [        S.S/S9SSR                  U5      S9  U R                  S[
        R                  " [        [        S.S/S9SSR                  U5      S9  gg)z*Adds flags required for attributes fields.z--criticality-typezUnspecified criticality typez1Mission critical service, application or workloadzHigh impactzMedium impactz
Low impact)TYPE_UNSPECIFIEDMISSION_CRITICALHIGHMEDIUMLOWzCriticality Type of the {})r   rb   z--environment-typezUnspecified environment typezProduction environmentzStaging environmentzTest environmentzDevelopment environment)r   
PRODUCTIONSTAGINGTESTDEVELOPMENTzEnvironment Type of the {}z--business-owners)display-nameemailzchannel-urir	  )specrequired_keysappendzBusiness owners of the {})typer~   rb   z--developer-ownerszDeveloper owners of the {}z--operator-ownerszOperator owners of the {})r  r	  N)	re   r.   r   ReleaseTrackALPHAr   ArgDictstrGA)r]   r   r   s      r   r   r     sr    	<A# (..}=   	<0*$2 (..}=  
 d''---
   #"
 #)
 (//>      #"
 #)
 )00?      #"
 #)
 (//>   )),,,
   # #)
 (//>      # #)
 )00?      # #)
 (//>  3 -r   c                 4    [        SS9R                  U 5        g r   rm   r\   s    r   AddListApplicationServiceFlagsr    r   r   c                 6    [        5       R                  U 5        g ri   )r   r[   r\   s    r   "AddDescribeApplicationServiceFlagsr    r   r   c                 \    [        5       R                  U 5        U R                  SSSSSS9  g rw   )r   r[   re   r\   s    r    AddDeleteApplicationServiceFlagsr  #  s7    "$008  	r   c                 Z   [         R                  " [        R                  " S[	        5       SSSS.SSS9[        R                  " S[        5       S	S
S
S.SSS9/SS/0S9R                  U 5        [        U SUS9  U R                  SSS9  U R                  SSS9  U R                  SSSSSS9  g)z5Adds flags required to create an application service.SERVICEzThe Service resource.rV   r   r   Tr   z--discovered-servicez The discovered service resource.r(   r   z--discovered-service.locationzSERVICE.locationr   r   r   r   r   ra   r   Description of the servicerx   ry   rz   Fr{   r|   N)	r   r,   r   r   r   r   r[   r   re   r   s     r    AddCreateApplicationServiceFlagsr  1  s     

5
5/1%*!0# 
 
5
5$.00 !# : *,>+?"; @ KI] 	&-JKo,HI  	r   c                     [        5       R                  U 5        [        U SUS9  U R                  SSS9  U R                  SSS9  U R                  SS	S
SSS9  g)z5Adds flags required to update an application service.r   r   r   r   ra   r   r  rx   ry   rz   Fr{   r|   N)r   r[   r   re   r   s     r    AddUpdateApplicationServiceFlagsr  i  ss    
 #$008I] 	&-JKo,HI  	r   c                 6    [        5       R                  U 5        g ri   rm   r\   s    r   AddGetIamPolicyFlagsr     ro   r   c                 6    [        5       R                  U 5        g ri   rm   r\   s    r   AddAddIamPolicyBindingFlagsr"    ro   r   c                 6    [        5       R                  U 5        g ri   rm   r\   s    r   AddRemoveIamPolicyBindingFlagsr$    ro   r   c                 6    [        5       R                  U 5        g ri   rm   r\   s    r   AddSetIamPolicyFlagsr&    ro   r   c                 4    [        SS9R                  U 5        g )NTr   rs   r\   s    r   AddDescribeLocationFlagsr(    s    D)55f=r   c           	      |   ^ ^ U U4S jn[         R                  " SSSU" 5       [         R                  [        5       S9$ )zOConstructs and returns the Resource specification for Extended Metadata Schema.c                  .   > [         R                  " T TS9$ r=   r5   r>   s   r   %ExtendedMetadataSchemaAttributeConfigTGetExtendedMetadataSchemaResourceSpec.<locals>.ExtendedMetadataSchemaAttributeConfig  rA   r   z1apphub.projects.locations.extendedMetadataSchemasextendedMetadataSchemarQ   )r   rR   extendedMetadataSchemasIdr    r   rS   )r0   r   r+  s   `` r   %GetExtendedMetadataSchemaResourceSpecr/    s;    
 
		9, E G::)+
 r   c                     U=(       d    Sn[         R                  R                  SR                  U(       a  SOSU 5      [	        5       UUS9$ )zFConstructs and returns the Extended Metadata Schema Resource Argument.z The Extended Metadata Schema ID.r'   r(   r)   r*   )r   r,   r-   r.   r/  r/   s       r   $GetExtendedMetadataSchemaResourceArgr1    sK     ==)		&	&	2	2mm*B$9+-	 
3 
 r   c                 6    [        5       R                  U 5        g ri   )r1  r[   r\   s    r   &AddDescribeExtendedMetadataSchemaFlagsr3    s    &(44V<r   c                 4    [        SS9R                  U 5        g )NTr*   rs   r\   s    r   "AddListExtendedMetadataSchemaFlagsr5    s    $'33F;r   ri   )r   NFF)r   NFT)service_projectN)r6  NTT)rI   N)rI   NTT)discovered_serviceN)r7  NTT)discovered_workloadN)r8  NTT)r   zName for the workload)r   NTT)r   zName for the service)r   NTT)r   N)r   NTT)extended_metadata_schemaN)r9  NTT)U__doc__
__future__r   r   r   googlecloudsdk.callioper   r    googlecloudsdk.calliope.conceptsr   r	   !googlecloudsdk.command_lib.apphubr
   r   (googlecloudsdk.command_lib.util.conceptsr   r   r   r$   r2   r6   r8   r:   rD   rF   rH   rL   rN   rT   rX   r^   rg   rj   rn   rq   rt   r   r  r  r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r  r  r   r"  r$  r&  r(  r/  r1  r3  r5  r#   r   r   <module>r@     s     &  ' / ( 5 1 C D G* 	$ 	$& KO	 GK9
525/ 261B1B1H1H < 261B1B1H1H * .2* "	& /3* #	& $;2 	& #92 	$8///9///& EI0/B: ++115r ++114 (t7H7H7N7NhVB9 ++115r ++1122222>
 48, (	$=<r   