Skip to content

Commit e14d4b1

Browse files
feat: Allow users to explicitly configure universe domain (#12243)
- [ ] 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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNjaGVkdWxlci8uT3dsQm90LnlhbWwiLCJoIjoiYmFmNWU5YmJiMTRhNzY4YjJiNGM5ZWFlOWZlYjc4ZjE4ZjE3NTdmYSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3JldC1tYW5hZ2VyLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyZXNvdXJjZW1hbmFnZXIvLk93bEJvdC55YW1sIiwiaCI6ImJhZjVlOWJiYjE0YTc2OGIyYjRjOWVhZTlmZWI3OGYxOGYxNzU3ZmEifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5Y2VudGVyLy5Pd2xCb3QueWFtbCIsImgiOiJiYWY1ZTliYmIxNGE3NjhiMmI0YzllYWU5ZmViNzhmMThmMTc1N2ZhIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlY3VyaXR5Y2VudGVybWFuYWdlbWVudC8uT3dsQm90LnlhbWwiLCJoIjoiYmFmNWU5YmJiMTRhNzY4YjJiNGM5ZWFlOWZlYjc4ZjE4ZjE3NTdmYSJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXNlcnZpY2UtY29udHJvbC8uT3dsQm90LnlhbWwiLCJoIjoiYmFmNWU5YmJiMTRhNzY4YjJiNGM5ZWFlOWZlYjc4Zj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owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 8004d15 commit e14d4b1

464 files changed

Lines changed: 56378 additions & 16543 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-scheduler/google/cloud/scheduler/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__ = "2.12.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-scheduler/google/cloud/scheduler_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__ = "2.12.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-scheduler/google/cloud/scheduler_v1/services/cloud_scheduler/async_client.py

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
from google.cloud.scheduler_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.location import locations_pb2 # type: ignore
4646
from google.protobuf import duration_pb2 # type: ignore
@@ -66,8 +66,12 @@ class CloudSchedulerAsyncClient:
6666

6767
_client: CloudSchedulerClient
6868

69+
# Copy defaults from the synchronous client for use here.
70+
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
6971
DEFAULT_ENDPOINT = CloudSchedulerClient.DEFAULT_ENDPOINT
7072
DEFAULT_MTLS_ENDPOINT = CloudSchedulerClient.DEFAULT_MTLS_ENDPOINT
73+
_DEFAULT_ENDPOINT_TEMPLATE = CloudSchedulerClient._DEFAULT_ENDPOINT_TEMPLATE
74+
_DEFAULT_UNIVERSE = CloudSchedulerClient._DEFAULT_UNIVERSE
7175

7276
job_path = staticmethod(CloudSchedulerClient.job_path)
7377
parse_job_path = staticmethod(CloudSchedulerClient.parse_job_path)
@@ -176,6 +180,25 @@ def transport(self) -> CloudSchedulerTransport:
176180
"""
177181
return self._client.transport
178182

183+
@property
184+
def api_endpoint(self):
185+
"""Return the API endpoint used by the client instance.
186+
187+
Returns:
188+
str: The API endpoint used by the client instance.
189+
"""
190+
return self._client._api_endpoint
191+
192+
@property
193+
def universe_domain(self) -> str:
194+
"""Return the universe domain used by the client instance.
195+
196+
Returns:
197+
str: The universe domain used
198+
by the client instance.
199+
"""
200+
return self._client._universe_domain
201+
179202
get_transport_class = functools.partial(
180203
type(CloudSchedulerClient).get_transport_class, type(CloudSchedulerClient)
181204
)
@@ -188,7 +211,7 @@ def __init__(
188211
client_options: Optional[ClientOptions] = None,
189212
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
190213
) -> None:
191-
"""Instantiates the cloud scheduler client.
214+
"""Instantiates the cloud scheduler async client.
192215
193216
Args:
194217
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -199,23 +222,38 @@ def __init__(
199222
transport (Union[str, ~.CloudSchedulerTransport]): The
200223
transport to use. If set to None, a transport is chosen
201224
automatically.
202-
client_options (ClientOptions): Custom options for the client. It
203-
won't take effect if a ``transport`` instance is provided.
204-
(1) The ``api_endpoint`` property can be used to override the
205-
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
206-
environment variable can also be used to override the endpoint:
225+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]):
226+
Custom options for the client.
227+
228+
1. The ``api_endpoint`` property can be used to override the
229+
default endpoint provided by the client when ``transport`` is
230+
not explicitly provided. Only if this property is not set and
231+
``transport`` was not explicitly provided, the endpoint is
232+
determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment
233+
variable, which have one of the following values:
207234
"always" (always use the default mTLS endpoint), "never" (always
208-
use the default regular endpoint) and "auto" (auto switch to the
209-
default mTLS endpoint if client certificate is present, this is
210-
the default value). However, the ``api_endpoint`` property takes
211-
precedence if provided.
212-
(2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
235+
use the default regular endpoint) and "auto" (auto-switch to the
236+
default mTLS endpoint if client certificate is present; this is
237+
the default value).
238+
239+
2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
213240
is "true", then the ``client_cert_source`` property can be used
214-
to provide client certificate for mutual TLS transport. If
241+
to provide a client certificate for mTLS transport. If
215242
not provided, the default SSL client certificate will be used if
216243
present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
217244
set, no client certificate will be used.
218245
246+
3. The ``universe_domain`` property can be used to override the
247+
default "googleapis.com" universe. Note that ``api_endpoint``
248+
property still takes precedence; and ``universe_domain`` is
249+
currently not supported for mTLS.
250+
251+
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
252+
The client info used to send a user-agent string along with
253+
API requests. If ``None``, then default info will be used.
254+
Generally, you only need to set this if you're developing
255+
your own client library.
256+
219257
Raises:
220258
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
221259
creation failed for any reason.
@@ -332,6 +370,9 @@ async def sample_list_jobs():
332370
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
333371
)
334372

373+
# Validate the universe domain.
374+
self._client._validate_universe_domain()
375+
335376
# Send the request.
336377
response = await rpc(
337378
request,
@@ -454,6 +495,9 @@ async def sample_get_job():
454495
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
455496
)
456497

498+
# Validate the universe domain.
499+
self._client._validate_universe_domain()
500+
457501
# Send the request.
458502
response = await rpc(
459503
request,
@@ -573,6 +617,9 @@ async def sample_create_job():
573617
gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)),
574618
)
575619

620+
# Validate the universe domain.
621+
self._client._validate_universe_domain()
622+
576623
# Send the request.
577624
response = await rpc(
578625
request,
@@ -701,6 +748,9 @@ async def sample_update_job():
701748
gapic_v1.routing_header.to_grpc_metadata((("job.name", request.job.name),)),
702749
)
703750

751+
# Validate the universe domain.
752+
self._client._validate_universe_domain()
753+
704754
# Send the request.
705755
response = await rpc(
706756
request,
@@ -804,6 +854,9 @@ async def sample_delete_job():
804854
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
805855
)
806856

857+
# Validate the universe domain.
858+
self._client._validate_universe_domain()
859+
807860
# Send the request.
808861
await rpc(
809862
request,
@@ -915,6 +968,9 @@ async def sample_pause_job():
915968
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
916969
)
917970

971+
# Validate the universe domain.
972+
self._client._validate_universe_domain()
973+
918974
# Send the request.
919975
response = await rpc(
920976
request,
@@ -1028,6 +1084,9 @@ async def sample_resume_job():
10281084
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
10291085
)
10301086

1087+
# Validate the universe domain.
1088+
self._client._validate_universe_domain()
1089+
10311090
# Send the request.
10321091
response = await rpc(
10331092
request,
@@ -1134,6 +1193,9 @@ async def sample_run_job():
11341193
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
11351194
)
11361195

1196+
# Validate the universe domain.
1197+
self._client._validate_universe_domain()
1198+
11371199
# Send the request.
11381200
response = await rpc(
11391201
request,
@@ -1188,6 +1250,9 @@ async def get_location(
11881250
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
11891251
)
11901252

1253+
# Validate the universe domain.
1254+
self._client._validate_universe_domain()
1255+
11911256
# Send the request.
11921257
response = await rpc(
11931258
request,
@@ -1242,6 +1307,9 @@ async def list_locations(
12421307
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
12431308
)
12441309

1310+
# Validate the universe domain.
1311+
self._client._validate_universe_domain()
1312+
12451313
# Send the request.
12461314
response = await rpc(
12471315
request,

0 commit comments

Comments
 (0)