
    #                        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	K
Jr  S
rSr " S S\R                  5      rSS jrS S jrS rSS jrS S jrS rS rS rS rS rS rS!S jrS rS!S jrS rS r S r!g)"z6Shared resource flags for Transfer Appliance commands.    N)concepts)deps)regions)concept_parsers)presentation_specs)
properties)	resourcesz/transferappliance.projects.locations.appliancesz+transferappliance.projects.locations.ordersc                   $    \ rS rSrSrSrSrSrSrg)ResourceVerb"   deletedescribelistupdate N)	__name__
__module____qualname____firstlineno__DELETEDESCRIBELISTUPDATE__static_attributes__r       Clib/googlecloudsdk/command_lib/transfer/appliances/resource_args.pyr   r   "   s    &(	$&r   r   c                 4    [         R                  " U SSS0SS9$ )Nz-The appliance affiliated with the {resource}.	fieldMasknamer   	help_textcompletion_request_paramscompletion_id_fieldr    ResourceParameterAttributeConfigr   s    r   appliance_attribute_configr'   )   s&    		2	2?!,f 5 	
" "r   c                 4    [         R                  " U SSS0SS9$ )Nz)The order affiliated with the {resource}.r   r   r    r$   r&   s    r   order_attribute_configr)   1   s&    		2	2;!,f 5 	
" "r   c                  X    [         R                  " SS[        R                  " S5      /S9$ )Nregionz*The region affiliated with the {resource}.--region)r   r!   fallthroughs)r   r%   r   ArgFallthroughr   r   r   region_attribute_configr/   9   s,    		2	2<''
34
6 6r   c           	      v    [         R                  " [        U [        U S9[	        5       [         R
                  SS9$ )Nr&   F)resource_nameappliancesIdlocationsId
projectsIddisable_auto_completers)r   ResourceSpecAPPLIANCES_COLLECTIONr'   r/    DEFAULT_PROJECT_ATTRIBUTE_CONFIGr1   s    r   get_appliance_resource_specr:   @   s5    			!-=A)+::#
% %r   c           	      v    [         R                  " [        U [        U S9[	        5       [         R
                  SS9$ )Nr&   F)r1   ordersIdr3   r4   r5   )r   r6   ORDERS_COLLECTIONr)   r/   r8   r9   s    r   get_order_resource_specr>   J   s5    			!%=9)+::#
% %r   c                     U R                  S[        R                  [        R                  SR                  UR                  5      S9  g)aI  Add region flag for appliances/orders.

Normally we'd rely on the argument output by region_attribute_config() but
we can set "choices" and convert the value to lower if we add it this way.

Args:
  parser (arg_parse.Parser): The parser for the command.
  verb (ResourceVerb): The action taken on the resource, such as 'update'.
r,   z7The location affiliated with the appliance order to {}.)choicestypehelpN)add_argumentr   CLOUD_REGIONSstrlowerformatvalueparserverbs     r   _add_region_flagrL   T   s?     	##99DKK
**	  r   c           	          [         R                  R                  S[        5       SR	                  UR
                  5      SS0SSS9R                  U 5        [        X5        g)a  Add a resource argument for a transfer appliance.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser (arg_parse.Parser): The parser for the command.
  verb (ResourceVerb): The action taken on the resource, such as 'update'.
	appliancezThe appliance to {}.r+    Tflag_name_overridesprefixesrequiredN)r   ConceptParserForResourcer:   rG   rH   AddToParserrL   rI   s     r   add_appliance_resource_argrW   f   sY     ++!###DJJ/#R. ,  ![(6 r   c           	          [         R                  R                  S[        5       SR	                  UR
                  5      SS0SSS9R                  U 5        [        X5        g)a
  Add a resource argument for a transfer appliance order.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser (arg_parse.Parser): The parser for the command.
  verb (ResourceVerb): The action taken on the resource, such as 'update'.
orderzThe order to {}.r+   rO   TrP   N)r   rT   rU   r>   rG   rH   rV   rL   rI   s     r   add_order_resource_argrZ   y   sY     ++

+#R. ,  ![(6 r   c                 t    [         R                  R                  S[        5       SSSS9R	                  U 5        g)zAdd a resource argument for cloning a transfer appliance.

NOTE: Must be used only if it's the only resource arg in the command.

Args:
  parser (arg_parse.Parser): The parser for the command.
z--clonezThe order to clone.TF)rR   rS   N)r   rT   rU   r>   rV   )rJ   s    r   add_clone_resource_argr\      s;     ++ , 
 "k&)r   c                     [         R                  R                  U R                  S[        R
                  R                  R                  R                  5       0[        S9R                  5       $ Nr4   )params
collection)r	   REGISTRYParser   r   VALUEScoreprojectGetr7   SelfLinkrN   s    r   _get_appliance_uriri      sV    				!	!nnJ--22::>>@A& 
" 
( )1
3r   c                     [         R                  R                  U R                  S[        R
                  R                  R                  R                  5       0[        S9R                  5       $ r^   )r	   ra   rb   r   r   rc   rd   re   rf   r=   rg   rY   s    r   _get_order_urirl      sV    				!	!jjJ--22::>>@A" 
" 
$ %-HJ/r   c           
         [         R                  nSnSnU(       aY  UR                  SUR                  5      nUR                  SSUR                  5      nU R                  R                  [        5        OXUR                  SUR                  5      nUR                  SSUR                  5      nU R                  R                  [        5        [        R                  " S[        S5      USS0SS	S
9[        R                  " S[        S5      USS0SSS
9/n[        R                  " U5      R                  U 5        [        X5        g)a  Add both order and appliance resource arguments for list commands.

Args:
  parser (arg_parse.Parser): The parser for the command.
  listing_orders (bool): Toggles the help text phrasing to match either orders
    or appliances being the resource being listed.
zThe {} to {}.z$The {} associated with the {} to {}.orders
appliancesz--appliancesr+   rO   TF)rQ   pluralrR   z--ordersN)r   r   rG   rH   display_info
AddUriFuncrl   ri   r   ResourcePresentationSpecr:   r>   r   rT   rV   rL   )rJ   listing_ordersrK   primary_helpsecondary_helporders_helpappliances_help	arg_specss           r   add_list_resource_argsrz      s!    
		$ ,9.%%h

;K$++L(DJJOO
"">2")),

CO '',

KK
""#56 11

%l
3
'n 11

!(
+
'n)" 	*66v>6 r   c                     U(       d  gU Vs/ s H"  nSR                  XR                  5       5      PM$     nnSR                  U5      nSR                  U5      $ s  snf )NrO   z{}:{}z OR z({}))rG   RelativeNamejoin)
filter_keyresource_refsreffilter_listresource_lists        r   !_get_filter_clause_from_resourcesr      sZ    	@M@MgnnZ!1!1!34   ++k*-	}	%%	s   )Ac                    U R                   (       a  U R                   /O/ nU R                  S5      (       aP  U R                  R                  R	                  5       nU(       a%  U(       a  SOSnUR                  [        XC5      5        U R                  S5      (       aP  U R                  R                  R	                  5       nU(       a%  U(       a  SOSnUR                  [        XE5      5        SR                  U5      $ )a'  Parses list resource args as a filter string.

Args:
  args (parser_extensions.Namespace): the parsed arguments for the command.
  listing_orders (bool): Toggles the appropriate keys for order and appliance
    depending on which resource is primarily being listed.

Returns:
  A filter string.
rn   r   rY   ro   z AND )	filterIsSpecifiedCONCEPTSrn   rb   appendr   ro   r}   )argsrt   r   
order_refsr~   appliance_refss         r   )parse_list_resource_args_as_filter_stringr      s     "&"+	h%%++-J+6j:
" #	l##]]--335N#1<vj:
& '	k	""r   c                     [         R                  R                  R                  R	                  5       nSR                  X=(       d    S5      $ )zHReturns a presentation string for list and create calls, given a region.zprojects/{}/locations/{}-)r   rc   rd   re   rf   rG   )r+   re   s     r   get_parent_stringr      s7    ""**..0'	#	*	*7Mc	BBr   c           	          [         R                  R                  [         R                  R	                  [
        UU [        R                  R                  R                  R                  5       S95      $ )z9Returns an appliance name to locations and appliances ID.)r2   r3   r4   )r	   Resourcer|   ra   Creater7   r   rc   rd   re   rf   )locations_idappliances_ids     r   get_appliance_namer      s[    				(	(
$"&&++33779	   ;
< <r   c           	          [         R                  R                  [         R                  R	                  [
        UU [        R                  R                  R                  R                  5       S95      $ )z5Returns an appliance name to locations and orders ID.)r<   r3   r4   )r	   r   r|   ra   r   r=   r   rc   rd   re   rf   )r   	orders_ids     r   get_order_namer     s[    				(	(
"&&++33779	   ;
< <r   rh   rk   )T)"__doc__enum googlecloudsdk.calliope.conceptsr   r   .googlecloudsdk.command_lib.transfer.appliancesr   (googlecloudsdk.command_lib.util.conceptsr   r   googlecloudsdk.corer   r	   r7   r=   Enumr   r'   r)   r/   r:   r>   rL   rW   rZ   r\   ri   rl   rz   r   r   r   r   r   r   r   r   <module>r      s     =  5 1 B D G * ) J A 499 ""6%%$!&!&* 3/&!R&#6C<<r   