Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3069ef4

Browse files
ohmayrgcf-owl-bot[bot]parthea
authored
feat: add universe_domain attribute to ClientOptions (#546)
* feat: add universe_domain option for TPC* test: update options to include universe domain* update the docstring* 🦉 Updates from OwlBot post-processorSeehttps://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md* Update google/api_core/client_options.pyCo-authored-by: Anthonios Partheniou <partheniou@google.com>* Update client_options.py---------Co-authored-by: omair <omairn@google.com>Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parentfc12b40 commit3069ef4

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

‎google/api_core/client_options.py‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ class ClientOptions(object):
7575
authentication flows. Audience is typically a resource identifier.
7676
If not set, the service endpoint value will be used as a default.
7777
An example of a valid ``api_audience`` is: "https://language.googleapis.com".
78+
universe_domain (Optional[str]): The desired universe domain. This must match
79+
the one in credentials. If not set, the default universe domain is
80+
`googleapis.com`. If both `api_endpoint` and `universe_domain` are set,
81+
then `api_endpoint` is used as the service endpoint. If `api_endpoint` is
82+
not specified, the format will be `{service}.{universe_domain}`.
7883
7984
Raises:
8085
ValueError: If both ``client_cert_source`` and ``client_encrypted_cert_source``
@@ -91,6 +96,7 @@ def __init__(
9196
scopes=None,
9297
api_key=None,
9398
api_audience=None,
99+
universe_domain=None,
94100
):
95101
ifclient_cert_sourceandclient_encrypted_cert_source:
96102
raiseValueError(
@@ -106,6 +112,7 @@ def __init__(
106112
self.scopes=scopes
107113
self.api_key=api_key
108114
self.api_audience=api_audience
115+
self.universe_domain=universe_domain
109116

110117
def__repr__(self):
111118
return"ClientOptions: "+repr(self.__dict__)

‎tests/unit/test_client_options.py‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ def test_constructor():
3838
"https://www.googleapis.com/auth/cloud-platform.read-only",
3939
],
4040
api_audience="foo2.googleapis.com",
41+
universe_domain="googleapis.com",
4142
)
4243

4344
assertoptions.api_endpoint=="foo.googleapis.com"
@@ -49,6 +50,7 @@ def test_constructor():
4950
"https://www.googleapis.com/auth/cloud-platform.read-only",
5051
]
5152
assertoptions.api_audience=="foo2.googleapis.com"
53+
assertoptions.universe_domain=="googleapis.com"
5254

5355

5456
deftest_constructor_with_encrypted_cert_source():
@@ -110,6 +112,7 @@ def test_from_dict():
110112
options=client_options.from_dict(
111113
{
112114
"api_endpoint":"foo.googleapis.com",
115+
"universe_domain":"googleapis.com",
113116
"client_cert_source":get_client_cert,
114117
"quota_project_id":"quote-proj",
115118
"credentials_file":"path/to/credentials.json",
@@ -122,6 +125,7 @@ def test_from_dict():
122125
)
123126

124127
assertoptions.api_endpoint=="foo.googleapis.com"
128+
assertoptions.universe_domain=="googleapis.com"
125129
assertoptions.client_cert_source()== (b"cert",b"key")
126130
assertoptions.quota_project_id=="quote-proj"
127131
assertoptions.credentials_file=="path/to/credentials.json"
@@ -148,6 +152,7 @@ def test_repr():
148152
expected_keys=set(
149153
[
150154
"api_endpoint",
155+
"universe_domain",
151156
"client_cert_source",
152157
"client_encrypted_cert_source",
153158
"quota_project_id",

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp