
                         "   S r SSKJr  SSKJr  SSKJ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  \	R&                  \	R(                  " \	R*                  R,                  5       " S S\	R.                  5      5       5       rg)zACommand for downloading a named set from a Compute Engine router.    )absolute_import)division)unicode_literalsN)base_classes)base)
exceptions)flags)resource_printer)filesc                   >    \ rS rSrSrSr\S 5       rS rS r	S r
Srg)	DownloadNamedSet!   ztDownload a named set from a Compute Engine router.

*{command}* downloads a named set from a Compute Engine router.
Nc                     [         R                  " 5       [        l        [        R                  R	                  USS9  UR                  SSSS9  UR                  SSSS9  UR                  S	S
S/SS9  g )Nexport)operation_typez
--set-nameTz"Name of the named set to download.)requiredhelpz--file-namez9The name of the file to download the named set config to.z--file-formatjsonyamlz(Format of the file passed to --file-name)choicesr   )r	   RouterArgumentr   
ROUTER_ARGAddArgumentadd_argument)clsparsers     1lib/surface/compute/routers/download_named_set.pyArgsDownloadNamedSet.Args+   s    "'"6"6"8++F8+L
1  
 H  
  7      c                    [         R                  " U R                  5       5      nUR                  n[        R
                  R                  UUR                  [        R                  " U5      S9n[        R                  R                  UR                  5      (       a/  [        R                  " SR!                  UR                  5      5      eU R#                  X4UR$                  5      nU R'                  XQR                  UR(                  5        g)z<Downloads a named set from a Router into the specified file.)scope_listerz[{0}] is a directoryN)r   ComputeApiHolderReleaseTrackclientr   r   ResolveAsResource	resourcescompute_flagsGetDefaultScopeListerospathisdir	file_namer   BadFileExceptionformatGetNamedSetset_nameWriteToFilefile_format)selfargsholderr%   
router_ref	named_sets         r   RunDownloadNamedSet.Run?   s    **4+<+<+>?F]]F!,,>>"88@ ? J 
ww}}T^^$$''
 
'
'
7    T]]CIY0@0@Ar    c                     UR                   R                  SUR                  R                  " S0 UR	                  5       DSU0D64nUR                  U/5      S   $ )Nr0   namedSetr    )apitools_clientroutersmessages ComputeRoutersGetNamedSetRequestAsDictMakeRequests)r4   r%   r7   r1   requests        r   r0   DownloadNamedSet.GetNamedSetQ   s`    &&88 	
!	
,4	
G y)!,,r    c                     Uc  Sn[         R                  " U5       n[        R                  " UUUS9  S S S 5        g ! , (       d  f       g = f)Nr   )r'   print_formatout)r   
FileWriterr
   Print)r4   messager-   r3   export_files        r   r2   DownloadNamedSet.WriteToFile[   s@    k			)	$" 
%	$	$s	   <
A
r=   )__name__
__module____qualname____firstlineno____doc__r   classmethodr   r9   r0   r2   __static_attributes__r=   r    r   r   r   !   s0    
 * &B$-r    r   )rR   
__future__r   r   r   r*   googlecloudsdk.api_lib.computer   googlecloudsdk.callioper   r   "googlecloudsdk.command_lib.computer	   r(   *googlecloudsdk.command_lib.compute.routersgooglecloudsdk.core.resourcer
   googlecloudsdk.core.utilr   HiddenReleaseTracksr$   ALPHADescribeCommandr   r=   r    r   <module>r`      ss     H &  ' 	 7 ( . E < 9 * D%%++,@t++ @ - @r    