
    
                     P    S r SSKJr  SSKJr  SSKJr  SSKJ	r	  S
S\
4S jjrS rg	)z3Calls cloud run service of a Google Cloud Function.    )util)config_helper)	call_util)storeimpersonate_service_accountc                     Sn[         R                  " USS9n[         R                  " X S9  [        R                  " U5      nUR
                  nU$ )zGenerate an expiring Google-signed OAuth2 identity token.

Args:
  impersonate_service_account: bool, whether to enable a service account
    impersonationwhen generating the token.

Returns:
  token: str, expiring Google-signed OAuth2 identity token
NT)allow_account_impersonation)is_impersonated_credential)r   LoadRefreshr   
Credentialid_token)r   accountcred
credentialtokens        ;lib/googlecloudsdk/command_lib/functions/v2/call/command.pyGenerateIdTokenr      sO     ' 
"&
$ --M''-* 

%	,    c                    [         R                  " US9nUR                  nU R                  R                  R                  5       nUR                  R                  UR                  UR                  5       S95      n[        R                  " XSU5        UR                  R                  n[        U R                  S5      5      nSSR!                  U5      0n[        R"                  " X`US9$ )z Call a v2 Google Cloud Function.)release_track)namev2r   Authorizationz	Bearer {})extra_headers)v2_api_utilGetClientInstanceMESSAGES_MODULECONCEPTSr   Parseprojects_locations_functionsGet2CloudfunctionsProjectsLocationsFunctionsGetRequestRelativeNamer   UpdateHttpTimeoutserviceConfigurir   IsSpecifiedformatMakePostRequest)	argsr   	v2_clientv2_messagesfunction_reffunctioncloud_run_urir   auth_headers	            r   Runr2   :   s    ++-H)))+##))+, 3377DD((* E ,-( ddMB((,,-
$**+HI
J% +"4"4U";<+		"	"
6 6r   N)F)__doc__#googlecloudsdk.api_lib.functions.v2r   r   !googlecloudsdk.command_lib.configr   $googlecloudsdk.command_lib.functionsr   googlecloudsdk.core.credentialsr   boolr   r2    r   r   <module>r:      s+    : D ; : 1 D6r   