Ë
    €Ï^  ã            
       óp  — d Z ddlZddlmZmZ ddlmZ ddlmZ dZ	dZ
dZd	Z eg d
¢«      Zej                  j                   e
ej                  j"                  e
ej                  j$                  eej                  j&                  eiZdej                  dedededef   fd„Zdedefd„Zdededee   fd„Zy)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           	      ó´  — | t         vrt        j                  d| «       y| t        j                  j
                  k(  r:|t        vs|dk7  r-t        j                  d| ||dj                  t        «      «       y| t        j                  j                  k7  r4|t        vr,t        j                  d| |dj                  t        «      «       yt        t         |    «      S )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Ü‡LLð	àôð
 Ø”	×!Ñ!×*Ñ*Ò*Ø	Ô(Ñ(¨K¸4Ò,?ô ‡LLð	AàØØØ	‰	Ô)Ó*ôð Ø”	×!Ñ!×(Ñ(Ò(¨SÔ8OÑ-Oô ‡LLð	$àØØ	‰	Ô)Ó*ôð Ü	!Ô"EÀgÑ"NÓ	OÐOó    Údoc_filenamec                 óT   — t        t        | «      }|st        dt        ›d| ›«      ‚|S )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                 óº   — 	 t        j                  | |«      }|st        j                  d| |«       |S t        j
                  d| |«       |S # t        $ r d}Y ŒAw xY w)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   sn   € ðÜ×Ñ˜w¨Ó1€Gñ
 
Ü‡OOØGØØôð 
€.ô ‡LLØ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   