def __add_gate_service_config(self, configs): if not self.options.test_gate_service_base_url: return service_config = { 'base_url': self.options.test_gate_service_base_url, } credentials_path = self.options.test_gate_iap_credentials # This can be None, which would mean we use the Application Default Credentials client_id = self.options.test_gate_iap_client_id if client_id: service_config[ 'service_account_email'] = get_service_account_email( credentials_path) service_config['bearer_auth_token'] = generate_auth_token( client_id, credentials_path) configs['gate'] = service_config
def __add_gate_service_config(self, configs): if not self.options.test_gate_service_base_url: return service_config = { 'base_url': self.options.test_gate_service_base_url, } credentials_path = self.options.test_gate_iap_credentials # This can be None, which would mean we use the Application Default Credentials client_id = self.options.test_gate_iap_client_id impersonated_service_account = self.options.test_gate_iap_impersonated_service_account if client_id: service_config['service_account_email'] = impersonated_service_account or get_service_account_email(credentials_path) service_config['bearer_auth_token'] = generate_auth_token(client_id, service_account_file=credentials_path, impersonate_service_account_email=impersonated_service_account) configs['gate'] = service_config
def __add_gate_service_config(self, configs): if not self.options.test_gate_service_base_url: return service_config = { "base_url": self.options.test_gate_service_base_url, } credentials_path = ( self.options.test_gate_iap_credentials ) # This can be None, which would mean we use the Application Default Credentials client_id = self.options.test_gate_iap_client_id impersonated_service_account = ( self.options.test_gate_iap_impersonated_service_account) if client_id: service_config[ "service_account_email"] = impersonated_service_account or get_service_account_email( credentials_path) service_config["bearer_auth_token"] = generate_auth_token( client_id, service_account_file=credentials_path, impersonate_service_account_email=impersonated_service_account, ) configs["gate"] = service_config
def __bearer_auth_token_or_none(self, service_name, client_id, credentials_path=None): return generate_auth_token(client_id, credentials_path)