Skip to content

Commit 411c9eb

Browse files
Excavator: Upgrade API Version (#337)
1 parent 04ced5f commit 411c9eb

4 files changed

Lines changed: 15 additions & 16 deletions

File tree

docs-snippets-npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"sls": {
2525
"dependencies": {
2626
"com.palantir.foundry.api:api-gateway": {
27-
"minVersion": "1.1542.0",
27+
"minVersion": "1.1545.0",
2828
"maxVersion": "1.x.x",
2929
"optional": false
3030
}

foundry_sdk/_core/client_init_helpers.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,17 @@ def _clean_hostname(hostname: str, config: Optional[Config] = None) -> str:
6464
def maybe_create_hostname_supplier(
6565
base_url: Optional[str] = None, config: Optional[Config] = None
6666
) -> Optional[HostnameSupplier]:
67+
"""Resolve hostname supplier with priority: explicit base_url > context/env vars > service discovery YAML."""
6768
config = config or Config()
6869

6970
if base_url is not None:
7071
assert_non_empty_string(base_url, "hostname")
7172
return StaticHostnameSupplier(_clean_hostname(base_url, config))
7273

74+
env_hostname = maybe_get_hostname_from_context_or_environment_vars()
75+
if env_hostname is not None:
76+
return StaticHostnameSupplier(_clean_hostname(env_hostname, config))
77+
7378
service_discovery_path = os.environ.get("FOUNDRY_SERVICE_DISCOVERY_V2", None)
7479
if service_discovery_path is not None:
7580
import yaml
@@ -78,10 +83,6 @@ def maybe_create_hostname_supplier(
7883
services = yaml.safe_load(f)
7984
return ServiceDiscoveryHostnameSupplier(services)
8085

81-
env_hostname = maybe_get_hostname_from_context_or_environment_vars()
82-
if env_hostname is not None:
83-
return StaticHostnameSupplier(_clean_hostname(env_hostname, config))
84-
8586
return None
8687

8788

foundry_sdk/_core/hostname_supplier.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,18 @@ def get_hostname( # pyright: ignore[reportIncompatibleMethodOverride]
6969
raise ValueError("ServiceDiscoveryHostnameSupplier requires an endpoint_type.")
7070

7171
if endpoint_type == EndpointType.GENERIC:
72-
return self._find_service_url("api-gateway")
72+
return self._find_service_url("api-gateway", "api_gateway")
7373
elif endpoint_type == EndpointType.AUTH:
7474
return self._find_service_url("multipass")
7575
elif endpoint_type == EndpointType.HIGH_SCALE:
76-
return self._find_service_url("stream-proxy")
76+
return self._find_service_url("stream-proxy", "stream_proxy")
7777
else:
7878
raise ValueError(f"Unsupported endpoint type: {endpoint_type}")
7979

80-
def _find_service_url(self, service_name: str) -> str:
81-
if service_name not in self._services:
82-
raise ValueError(f"Unable to discover service '{service_name}'.")
80+
def _find_service_url(self, *service_names: str) -> str:
81+
for name in service_names:
82+
urls = self._services.get(name)
83+
if urls:
84+
return urls[0]
8385

84-
urls = self._services[service_name]
85-
if not urls:
86-
raise ValueError(f"Unable to discover URLs for service '{service_name}'.")
87-
88-
return urls[0]
86+
raise ValueError(f"Unable to discover service '{service_names[0]}'.")

foundry_sdk/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
# using the autorelease bot
1818
__version__ = "0.0.0"
1919

20-
__openapi_document_version__ = "1.1542.0"
20+
__openapi_document_version__ = "1.1545.0"

0 commit comments

Comments
 (0)