
                         r    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
\5      rg)z)Common classes and functions for regions.    )absolute_import)division)unicode_literals)request_helper)utils)
exceptions)
console_ioc                   *    \ rS rSrSrS rS rS rSrg)RegionResourceFetcher   z&Helper class for working with regions.c                     UR                   U l        UR                  U l        U R                  R                  U l        UR                  U l        g )N)apitools_clientcomputemessageshttp	batch_url)selfclients     3lib/googlecloudsdk/api_lib/compute/regions/utils.py__init__RegionResourceFetcher.__init__   s8    ))DLOODM!!DI%%DN    c           
         / n/ n[        5       nU H  nUR                  UR                  4U;  d  M!  UR                  UR                  UR                  45        UR	                  U R
                  R                  SU R                  R                  UR                  UR                  S945        M     U(       a5  [        [        R                  " UU R                  U R                  US95      nOgU(       a  gU$ )zFetches region resources.Get)projectregion)requestsr   r   errorsN)setr   r   addappendr   regionsr   ComputeRegionsGetRequestlistr   MakeRequestsr   r   )r   resource_refsr   r   region_namesresource_refress          r   
GetRegions RegionResourceFetcher.GetRegions$   s     FH5L%


 3 3	4L	H,..0C0CDELL  MM22$,,#** 3 ,- 	. & ,,yyNN	 c jr   c                    U R                  U5      nU(       d  g/ n/ nU H'  nUR                  (       d  M  UR                  U5        M)     U(       d  gU(       a  / n[        U5      S:X  a  SnOSnSR	                  US   US   US   5      n/ nU H  nUR                  R
                  (       aA  UR                  SR	                  UR                  UR                  R
                  5      5        M_  UR                  S	R	                  UR                  5      5        M     UR                  [        R                  " Xx5      5        S
R                  U5      n	[        R                  " U	S9(       d  [        R                  " S5      eg)z4Warns the user if a region has upcoming deprecation.N   )z	region iszthis regionthe)zregions arezthese regionstheirzn
WARNING: The following selected {0} deprecated. All resources in {1} will be deleted after {2} turndown date.r      z	[{0}] {1}z[{0}] )messagezCreation aborted by user.)r*   
deprecatedr!   lenformatdeletednamer   ConstructListjoinr	   PromptContinuer   AbortedError)
r   r&   r"   promptsregions_with_deprecatedr   phrasestitleprintable_deprecated_regionsfinal_messages
             r   WarnForRegionalCreation-RegionResourceFetcher.WarnForRegionalCreationA   sM   oom,GG 				&&v.  #g	$	%	*5;% &,VGAJ
GAJ%O  &("+&$$
&
-
-{.B.Bkk6,,44/6 7 '
-
-gnnV[[.I
J , nnU((MNHHW%M$$];##$?@@ <r   )r   r   r   r   N)	__name__
__module____qualname____firstlineno____doc__r   r*   rB   __static_attributes__ r   r   r   r      s    .&:$Ar   r   N)rH   
__future__r   r   r   googlecloudsdk.api_lib.computer   r   "googlecloudsdk.command_lib.computer   googlecloudsdk.core.consoler	   objectr   rJ   r   r   <module>rP      s/    0 &  ' 9 0 9 2JAF JAr   