@@ -112,38 +112,25 @@ class _ClientConfig:
112112
113113
114114class DefaultClient :
115- """CBC client for both production (mTLS + envoy) and local/mock environments .
115+ """CBC client implementation .
116116
117- **Production** (any ``https://`` or non-loopback URL): subdomain-per-tenant
118- routing rewrites the URL subdomain to the ``cbc_tenant_id`` for each request;
119- mTLS credentials must be provided via ``cert_path``/``key_path``,
120- ``cert_pem``/``key_pem``, or ``ssl_context``.
117+ Prefer :func:`create_client` over direct instantiation — it resolves
118+ credentials automatically (BTP Destination Service or environment variables,
119+ or accepts an explicit :class:`~sap_cloud_sdk.cbc.config.CBCConfig`)::
121120
122- **Local / mock** (``http://localhost``, ``http://127.0.0.1``, ``http://[::1]``):
123- no subdomain replacement, no mTLS — detected automatically from the URL.
124- Point it at the CBC mock server and it works without any extra arguments.
121+ client = create_client()
125122
126- Do **not** instantiate directly — use :func:`create_client` in production
127- code, which resolves credentials from the environment automatically.
128-
129- Example (local mock)::
130-
131- client = DefaultClient(base_url="http://localhost:8001")
132- config = client.get_configuration(
133- TenantContext(cbcTenantId="t1", appTenantId="app-t1")
134- )
135-
136- Example (production)::
137-
138- client = DefaultClient(
139- base_url="https://cbc.example.ondemand.com",
123+ # explicit config
124+ client = create_client(config=CBCConfig(
125+ base_url="https://service.app.prod-eu.cbc.services.cloud.sap",
140126 cert_path=Path("/run/secrets/tls.crt"),
141127 key_path=Path("/run/secrets/tls.key"),
142- )
128+ ))
129+
130+ Direct instantiation is supported for testing (inject a mock ``http_client``).
143131
144132 Args:
145- base_url: Base URL of the CBC service. Loopback addresses trigger
146- local mode automatically.
133+ base_url: Base URL of the CBC service.
147134 http_client: Optional pre-configured ``httpx.Client`` — takes full
148135 precedence over all mTLS arguments. Use for testing.
149136 ssl_context: Optional pre-built :class:`ssl.SSLContext` with mTLS loaded.
0 commit comments