
    3
                         d Z ddlZddlmZ ddlmZ ddlmZ ddl	mZ
 ddl	mZ ddlZddlZddlZddlmZ ddlmZ ee
j&                  ej&                  ej&                  f   Zd	efd
Zy)z,Utilities to create Google Auth credentials.    N)Union)app)credentials)service_account)gcloud_credential_loader)bq_errorreturnc                  @   t         j                  j                  rt        j                  d      t         j
                  j                  t         j
                  j                  k7  r#t        j                  t        j                        t         j                  j                  rt        j                  d       t        j                  t         j                  j                  t        j                  t         j                   j                  t"        j$                  j                              S t        j                  d       t         j&                  j                  rot        j                  d       t)        j                  t        j                  t         j                   j                  t"        j$                  j                              S t        j                  d       t         j*                  j                  rt        j                  d      t-        j.                         S )	a  Returns credentials based on BQ CLI auth flags.

  Returns: An OAuth2, compute engine, or service account credentials objects
  based on BQ CLI auth flag values.

  Raises:
  app.UsageError, invalid flag values.
  bq_error.BigqueryError, error getting credentials.
  zThe --application_default_credential_file flag is being deprecated. For now, this flag can still be used by forcing the legacy authentication library with --nouse_google_auth.z2Loading auth credentials from --oauth_access_token)tokenquota_project_idz3No `oauth_access_token`, load credentials elsewherez7Loading auth credentials with --use_gce_service_account)r   z8No `use_gce_service_account`, load credentials elsewherezThe flag --service_account is not supported. To use a service account please follow https://cloud.google.com/docs/authentication/use-service-account-impersonation#gcloud-config.)bq_auth_flags#APPLICATION_DEFAULT_CREDENTIAL_FILEvaluer   
UsageError$SERVICE_ACCOUNT_PRIVATE_KEY_PASSWORDdefaultr   P12_DEPRECATION_MESSAGEOAUTH_ACCESS_TOKENlogginginfogoogle_oauth2Credentialsbq_utilsGetResolvedQuotaProjectIDQUOTA_PROJECT_IDbq_flags
PROJECT_IDUSE_GCE_SERVICE_ACCOUNTcompute_engineSERVICE_ACCOUNTr   LoadCredential     *platform/bq/auth/main_credential_loader.pyGetCredentialsFromFlagsr%      s}    66<<
..	<  88@@		;	;	A	AB ..99
::%%++LLEF$$..44!;;**00(2E2E2K2K
  LLFG**00LLJK%%!;;**00(2E2E2K2K
  LLKL""((
..	;  
"	0	0	22r#   )__doc__r   typingr   abslr   google.auth.compute_enginer   r   google.oauth2r   r   r   r   r   authr   utilsr   r   GoogleAuthCredentialsUnionTyper%   r"   r#   r$   <module>r.      sc    2    D 6 )    )  "' " 43!? 43r#   