
    W                         S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  SSKJ
r
  SS	KJr  SS
KJr   " S S5      rg)zExtracts environment vars required for binary operations.

Binary operations like terraform tools requires extracting env vars. This file
exposes function that can be reused for extracting common env vars.
    )absolute_import)division)unicode_literalsN)
exceptions)log)
properties)GetFreshAccessToken)encodingc                   $    \ rS rSrSrS rS rSrg)EnvironmentVariables#   zExtracts env vars.
  c                 $    U R                  5         g )N)_ExtractEnvironmentVariables)selfs    4lib/googlecloudsdk/command_lib/terraform/env_vars.py__init__EnvironmentVariables.__init__'   s    %%'    c                 8   [        [        R                  R                  R                  R                  5       S9SS.U l        / SQn/ SQn[        R                  R                  5        H  u  p4X1;   d  M  X@R                  U'   M     [        R                  R                  R                  R                  5       U l
        U R                  (       a0  [        R                  " SR                  U R                  5      5        g	U Hp  n[        R                  " [        R                  U5      U l
        U R                  (       d  M@  [        R                  " SR                  U R                  U5      5          O   U R                  (       d  [         R"                  " S5      eg	)
zmExtractEnvironmentVariables can be used to extract environment variables required for binary operations.
    )accounttrue)GOOGLE_OAUTH_ACCESS_TOKENUSE_STRUCTURED_LOGGING)
HTTP_PROXY
http_proxyHTTPS_PROXYhttps_proxyNO_PROXYno_proxy)GOOGLE_PROJECTGOOGLE_CLOUD_PROJECTGCLOUD_PROJECTz%Setting project to {} from propertiesz!Setting project to {} from env {}zVFailed to retrieve the project id. Please specify the project id using --project flag.N)r	   r   VALUEScorer   Getenv_varsosenvironitemsprojectr   debugformatr
   GetEncodedValuer   Error)r   proxy_env_namesproject_env_namesenv_keyenv_vals        r   r   1EnvironmentVariables._ExtractEnvironmentVariables*   s-   
  
(9(9(>(>(F(F(J(J(LM	DMO JJ,,.		#!(g /
 $$))11557DL||	ii7>>t||LM&'//

GD<<<
))188wO  ' \\%
 	
 r   )r&   r*   N)__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes__ r   r   r   r   #   s    (+
r   r   )r8   
__future__r   r   r   os.pathr'   googlecloudsdk.corer   r   r   %googlecloudsdk.core.credentials.storer	   googlecloudsdk.core.utilr
   r   r:   r   r   <module>r@      s1     '  '  * # * E -2
 2
r   