diff --git a/src/cli/onefuzz/api.py b/src/cli/onefuzz/api.py index ff72cbc8c..4f57b21fb 100644 --- a/src/cli/onefuzz/api.py +++ b/src/cli/onefuzz/api.py @@ -1714,6 +1714,8 @@ class Onefuzz: client_secret: Optional[str] = None, authority: Optional[str] = None, tenant_domain: Optional[str] = None, + _dotnet_endpoint: Optional[str] = None, + _dotnet_functions: Optional[List[str]] = None, ) -> None: if endpoint: @@ -1726,6 +1728,10 @@ class Onefuzz: self._backend.client_secret = client_secret if tenant_domain is not None: self._backend.config.tenant_domain = tenant_domain + if _dotnet_endpoint is not None: + self._backend.config.dotnet_endpoint = _dotnet_endpoint + if _dotnet_functions is not None: + self._backend.config.dotnet_functions = _dotnet_functions if self._backend.is_feature_enabled(PreviewFeature.job_templates.name): self.job_templates._load_cache() @@ -1769,6 +1775,8 @@ class Onefuzz: client_id: Optional[str] = None, enable_feature: Optional[PreviewFeature] = None, tenant_domain: Optional[str] = None, + _dotnet_endpoint: Optional[str] = None, + _dotnet_functions: Optional[List[str]] = None, reset: Optional[bool] = None, ) -> BackendConfig: """Configure onefuzz CLI""" @@ -1799,6 +1807,10 @@ class Onefuzz: self._backend.enable_feature(enable_feature.name) if tenant_domain is not None: self._backend.config.tenant_domain = tenant_domain + if _dotnet_endpoint is not None: + self._backend.config.dotnet_endpoint = _dotnet_endpoint + if _dotnet_functions is not None: + self._backend.config.dotnet_functions = _dotnet_functions self._backend.app = None self._backend.save_config() diff --git a/src/cli/onefuzz/backend.py b/src/cli/onefuzz/backend.py index 1706553b3..03afd954c 100644 --- a/src/cli/onefuzz/backend.py +++ b/src/cli/onefuzz/backend.py @@ -92,6 +92,8 @@ class BackendConfig(BaseModel): endpoint: Optional[str] features: Set[str] = Field(default_factory=set) tenant_domain: Optional[str] + dotnet_endpoint: Optional[str] + dotnet_functions: Optional[List[str]] class Backend: @@ -280,9 +282,15 @@ class Backend: params: Optional[Any] = None, _retry_on_auth_failure: bool = True, ) -> Any: - if not self.config.endpoint: + if self.config.dotnet_functions and path in self.config.dotnet_functions: + endpoint = self.config.dotnet_endpoint + else: + endpoint = self.config.endpoint + + if not endpoint: raise Exception("endpoint not configured") - url = self.config.endpoint + "/api/" + path + + url = endpoint + "/api/" + path headers = self.headers() json_data = serialize(json_data)