Skip to content

Commit 8d6b772

Browse files
feat: Allow users to explicitly configure universe domain (#12244)
- [ ] Regenerate this pull request now. chore: Update gapic-generator-python to v1.14.0 PiperOrigin-RevId: 603108274 Source-Link: googleapis/googleapis@3d83e36 Source-Link: googleapis/googleapis-gen@baf5e9b Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYWNlLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRyYW5zbGF0ZS8uT3dsQm90LnlhbWwiLCJoIjoiYmFmNWU5YmJiMTRhNzY4YjJiNGM5ZWFlOWZlYjc4ZjE4ZjE3NTdmYSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvLWxpdmUtc3RyZWFtLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvLXN0aXRjaGVyLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvLXRyYW5zY29kZXIvLk93bEJvdC55YW1sIiwiaCI6ImJhZjVlOWJiYjE0YTc2OGIyYjRjOWVhZTlmZWI3OGYxOGYxNzU3ZmEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXZpZGVvaW50ZWxsaWdlbmNlLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: ey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.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent d51f832 commit 8d6b772

409 files changed

Lines changed: 46090 additions & 13125 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-trace/google/cloud/trace/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.12.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-trace/google/cloud/trace_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.12.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-trace/google/cloud/trace_v1/services/trace_service/async_client.py

Lines changed: 61 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
from google.cloud.trace_v1 import gapic_version as package_version
3939

4040
try:
41-
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault]
41+
OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None]
4242
except AttributeError: # pragma: NO COVER
43-
OptionalRetry = Union[retries.AsyncRetry, object] # type: ignore
43+
OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore
4444

4545
from google.cloud.trace_v1.services.trace_service import pagers
4646
from google.cloud.trace_v1.types import trace
@@ -61,8 +61,12 @@ class TraceServiceAsyncClient:
6161

6262
_client: TraceServiceClient
6363

64+
# Copy defaults from the synchronous client for use here.
65+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
6466
DEFAULT_ENDPOINT = TraceServiceClient.DEFAULT_ENDPOINT
6567
DEFAULT_MTLS_ENDPOINT = TraceServiceClient.DEFAULT_MTLS_ENDPOINT
68+
_DEFAULT_ENDPOINT_TEMPLATE = TraceServiceClient._DEFAULT_ENDPOINT_TEMPLATE
69+
_DEFAULT_UNIVERSE = TraceServiceClient._DEFAULT_UNIVERSE
6670

6771
common_billing_account_path = staticmethod(
6872
TraceServiceClient.common_billing_account_path
@@ -163,6 +167,25 @@ def transport(self) -> TraceServiceTransport:
163167
"""
164168
return self._client.transport
165169

170+
@property
171+
def api_endpoint(self):
172+
"""Return the API endpoint used by the client instance.
173+
174+
Returns:
175+
str: The API endpoint used by the client instance.
176+
"""
177+
return self._client._api_endpoint
178+
179+
@property
180+
def universe_domain(self) -> str:
181+
"""Return the universe domain used by the client instance.
182+
183+
Returns:
184+
str: The universe domain used
185+
by the client instance.
186+
"""
187+
return self._client._universe_domain
188+
166189
get_transport_class = functools.partial(
167190
type(TraceServiceClient).get_transport_class, type(TraceServiceClient)
168191
)
@@ -175,7 +198,7 @@ def __init__(
175198
client_options: Optional[ClientOptions] = None,
176199
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
177200
) -> None:
178-
"""Instantiates the trace service client.
201+
"""Instantiates the trace service async client.
179202
180203
Args:
181204
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -186,23 +209,38 @@ def __init__(
186209
transport (Union[str, ~.TraceServiceTransport]): The
187210
transport to use. If set to None, a transport is chosen
188211
automatically.
189-
client_options (ClientOptions): Custom options for the client. It
190-
won't take effect if a ``transport`` instance is provided.
191-
(1) The ``api_endpoint`` property can be used to override the
192-
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
193-
environment variable can also be used to override the endpoint:
212+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
213+
Custom options for the client.
214+
215+
1. The ``api_endpoint`` property can be used to override the
216+
default endpoint provided by the client when ``transport`` is
217+
not explicitly provided. Only if this property is not set and
218+
``transport`` was not explicitly provided, the endpoint is
219+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
220+
variable, which have one of the following values:
194221
"always" (always use the default mTLS endpoint), "never" (always
195-
use the default regular endpoint) and "auto" (auto switch to the
196-
default mTLS endpoint if client certificate is present, this is
197-
the default value). However, the ``api_endpoint`` property takes
198-
precedence if provided.
199-
(2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
222+
use the default regular endpoint) and "auto" (auto-switch to the
223+
default mTLS endpoint if client certificate is present; this is
224+
the default value).
225+
226+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
200227
is "true", then the ``client_cert_source`` property can be used
201-
to provide client certificate for mutual TLS transport. If
228+
to provide a client certificate for mTLS transport. If
202229
not provided, the default SSL client certificate will be used if
203230
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
204231
set, no client certificate will be used.
205232
233+
3. The ``universe_domain`` property can be used to override the
234+
default "googleapis.com" universe. Note that ``api_endpoint``
235+
property still takes precedence; and ``universe_domain`` is
236+
currently not supported for mTLS.
237+
238+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
239+
The client info used to send a user-agent string along with
240+
API requests. If ``None``, then default info will be used.
241+
Generally, you only need to set this if you're developing
242+
your own client library.
243+
206244
Raises:
207245
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
208246
creation failed for any reason.
@@ -321,6 +359,9 @@ async def sample_list_traces():
321359
),
322360
)
323361

362+
# Validate the universe domain.
363+
self._client._validate_universe_domain()
364+
324365
# Send the request.
325366
response = await rpc(
326367
request,
@@ -458,6 +499,9 @@ async def sample_get_trace():
458499
),
459500
)
460501

502+
# Validate the universe domain.
503+
self._client._validate_universe_domain()
504+
461505
# Send the request.
462506
response = await rpc(
463507
request,
@@ -576,6 +620,9 @@ async def sample_patch_traces():
576620
),
577621
)
578622

623+
# Validate the universe domain.
624+
self._client._validate_universe_domain()
625+
579626
# Send the request.
580627
await rpc(
581628
request,

0 commit comments

Comments
 (0)