ó
    €Ï^  ã            
       óv  • S r SSKrSSKJrJr  SSKJr  SSKJr  Sr	Sr
SrS	r\" / S
Q5      r\R                  R                   \
\R                  R"                  \
\R                  R$                  \\R                  R&                  \0rS\R                  S\S\S\S\4   4S jrS\S\4S jrS\S\S\\   4S jrg)ztMethods for loading discovery documents for Google Cloud APIs.

Discovery Documents are used to create API Clients.
é    N)ÚOptionalÚUnion)Úlogging)Ú	bq_constsÚbigquery_clientzdiscovery_next/bigquery.jsonzdiscovery_next/iam-policy.jsonz6discovery_next/bigqueryreservation_google_rest_v1.json)zhttps://www.googleapis.comzhttps://bigquery.googleapis.comz*https://bigqueryreservation.googleapis.comÚserviceÚapiÚapi_versionÚreturnc           	      óÌ  • U [         ;  a  [        R                  " SU 5        gU [        R                  R
                  :X  a>  U[        ;  d  US:w  a.  [        R                  " SU UUSR                  [        5      5        gU [        R                  R                  :w  a7  U[        ;  a-  [        R                  " SU USR                  [        5      5        g[        [         U    5      $ )z+Loads the discovery document for a service.zPSkipping local %s discovery document load since the service is not yet supportedNÚv2zvLoading the "%s" discovery doc from the server since this is not v2 (%s) and the API endpoint (%s) is not one of (%s).z, z^Loading the "%s" discovery doc from the server since the API endpoint (%s) is not one of (%s).)
Ú#SERVICES_TO_LOCAL_DISCOVERY_DOC_MAPr   Úinfor   ÚServiceÚBIGQUERYÚSUPPORTED_BIGQUERY_APISÚjoinÚBQ_IAMÚload_local_discovery_doc)r   r	   r
   s      Ú<platform/bq/discovery_documents/discovery_document_loader.pyÚ%load_local_discovery_doc_from_servicer   *   sÑ   € ð Ô7Ó7Ü‡L‚Lð	àôð
 Ø”	×!Ñ!×*Ñ*Ó*Ø	Ô(Ó(¨K¸4Ó,?ô ‡L‚Lð	AàØØØ	‰	Ô)Ó*ôð Ø”	×!Ñ!×(Ñ(Ó(¨SÔ8OÓ-Oô ‡L‚Lð	$àØØ	‰	Ô)Ó*ôð Ü	!Ô"EÀgÑ"NÓ	OÐOó    Údoc_filenamec                 ób   • [        [        U 5      nU(       d  [        S[        < SU < 35      eU$ )aË  Loads the discovery document for `doc_filename` with `version` from package files.

Example:
  bq_disc_doc = discovery_document_loader
    .load_local_discovery_doc('discovery_next/bigquery.json')

Args:
  doc_filename: [str], The filename of the discovery document to be loaded.

Raises:
  FileNotFoundError: If no discovery doc could be loaded.

Returns:
  `bytes`, On success, A json object with the contents of the
  discovery document. On failure, None.
z1Failed to load discovery doc from resource path: Ú.)Ú_fetch_discovery_doc_from_pkgÚPKG_NAMEÚFileNotFoundError)r   Údocs     r   r   r   S   s1   € ô" 	&¤h°Ó=€#æ	Ý
ç’\ð	#óð ð
 
€*r   ÚpackageÚresourcec                 óÊ   •  [         R                  " X5      nU(       d  [        R                  " SU U5        U$ [        R
                  " SU U5        U$ ! [         a    Sn NIf = f)z_Loads a discovery doc as `bytes` specified by `package` and `resource` returning None on error.Nz=Failed to load discovery doc from (package, resource): %s, %szBSuccessfully loaded discovery doc from (package, resource): %s, %s)ÚpkgutilÚget_dataÚImportErrorr   Úwarningr   )r    r!   Úraw_docs      r   r   r   o   sl   € ðÜ×Ò˜wÓ1€Gö
 
Ü‡O‚OØGØØôð 
€.ô ‡L‚LØLØØôð
 
€.øô 
ó Ø‚Gðús   ‚A ÁA"Á!A")Ú__doc__r#   Útypingr   r   Úabslr   Úutilsr   r   ÚDISCOVERY_NEXT_BIGQUERYÚDISCOVERY_NEXT_IAM_POLICYÚDISCOVERY_NEXT_RESERVATIONSÚ	frozensetr   r   r   ÚCONNECTIONSÚRESERVATIONSr   r   ÚstrÚbytesr   r   r   © r   r   Ú<module>r5      s  ðñó
 ß "å å à€ð 9Ð à<Ð ð =ð ñ
 $ò %ó Ð ð ×Ñ×ÑÐ 7Ø×Ñ×!Ñ!Ð#:Ø×Ñ×"Ñ"Ð$?Ø×Ñ×ÑÐ7ð	'Ð #ð&PØ×Ñð&Pà	ð&Pð ð&Pð ˆ4ˆ;Ñô	&PðR¨3ð °5ô ð8ØðØðàˆe_õr   