
                         8    d Z ddlmZ ddlmZ ddlmZ d Zd Zy)zAHelper methods for parsing and displaying operation quota errors.    )absolute_import)division)unicode_literalsc                     	 | j                  d      D ]  }	 |j                  d      dk(  r y 	 y# t        t        t        f$ r Y 4w xY w# t        t        t        f$ r Y yw xY w)zNReturns true if the given loaded json is an operation quota exceeded error.
  detailsreason$CONCURRENT_OPERATIONS_QUOTA_EXCEEDEDTF)getKeyErrorAttributeError	TypeError)erroritems     ;lib/googlecloudsdk/api_lib/compute/operation_quota_utils.pyIsJsonOperationQuotaErrorr      sr    		)$88H!GG H % 
	 	2 
NI	. s6   A 1A A AA AA A"!A"c                 P   d}d}	 | j                  d      }|j                  d      D ]/  }|j                  d      dk(  r|}|j                  d      dk(  s.|}1 |j                  d      }d|v r|j                  d      }n|j                  d	      }|j                  d
      }|j                  d      }|j                  d      }	d||||	fv r|j                  d      S dj                  |j                  d      ||||	      S # t        t        f$ r j                  d      cY S w xY w)z4Constructs message to show for quota exceeded error.Nr   r   z@typez(type.googleapis.com/google.rpc.ErrorInfoz/type.googleapis.com/google.rpc.LocalizedMessagemessagemetadata	metadatascontainerTypecontainerIdlocationz{}
{}
	container type = {}
	container id = {}
	location = {}
Wait for other operations to be done, or view documentation on best practices for reducing concurrent operations: https://cloud.google.com/compute/quotas#best_practices.)r
   formatr   r   )
data
error_infolocalized_messager   r   localized_message_textr   container_typecontainer_idr   s
             r   CreateOperationQuotaExceededMsgr    %   s;   *$ HHWE		)$	'	H	H
	'	O	O 	 %
 /229= Z
+h,h\\/2N<<.L||J'H&hOOYYy!!F GMf		)$&<nhG(	) N	#  99Y s   AD BD #D  D%$D%N)__doc__
__future__r   r   r   r   r         r   <module>r%      s    H &  '( r$   