
                         |    d Z ddlmZ ddlmZ ddlmZ ddlZddlmZ ddlmZ  G d d	ej                        Z
d
 Zy)z(Definitiones compute scopes (locations).    )absolute_import)division)unicode_literalsN)
exceptions)
propertiesc                       e Zd ZdZddej
                  j                  j                  j                  fZ	ddej
                  j                  j                  j                  fZddd fZd Zed	        Zy
)	ScopeEnumzEnum representing GCE scope.zoneza regionglobal c                       y N r       /lib/googlecloudsdk/command_lib/compute/scope.py<lambda>zScopeEnum.<lambda>!   s    $r   c                 <    || _         || _        || _        || _        y r   )
param_name	flag_nameprefixproperty_func)selfr   r   r   s       r   __init__zScopeEnum.__init__#   s    DODNDK&Dr   c                     || j                   k(  ry|| j                  k(  ryt        j                  dj	                  |            )Nzcompute.zoneszcompute.regionsz.Expected scope to be ZONE or REGION, got {0!r})ZONEREGIONr   Errorformat)clsscopes     r   CollectionForScopezScopeEnum.CollectionForScope*   sC    




8??FH Hr   N)__name__
__module____qualname____doc__r   VALUEScomputer
   Getr   r   r   GLOBALr   classmethodr"   r   r   r   r	   r	      st    $
$
))1166::	;$dJ--55<<@@A&b,'&' H Hr   r	   c                 ~    t        | dj                  |      d      duxs t        | dj                  |      d      duS )zReturns True if the scope is specified for the flag.

  Args:
    args: The command-line flags.
    flag_name: The name of the flag.
  z	{}_regionNz	global_{})getattrr   )argsr   s     r   IsSpecifiedForFlagr/   4   sH     $**95t
<D
H I
$**95t
<D
HJr   )r&   
__future__r   r   r   enumgooglecloudsdk.corer   r   Enumr	   r/   r   r   r   <module>r4      s4     / &  '  * *H		 H0Jr   