Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 2f7428e

Browse files
committed
chore: cleanup deprecated code for default endpoint
1 parent e6e60bf commit 2f7428e

File tree

36 files changed

+12
-134
lines changed

36 files changed

+12
-134
lines changed

gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ class {{ service.async_client_name }}:
7070
_client: {{ service.client_name }}
7171

7272
# Copy defaults from the synchronous client for use here.
73-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
74-
DEFAULT_ENDPOINT = {{ service.client_name }}.DEFAULT_ENDPOINT
7573
DEFAULT_MTLS_ENDPOINT = {{ service.client_name }}.DEFAULT_MTLS_ENDPOINT
7674
_DEFAULT_ENDPOINT_TEMPLATE = {{ service.client_name }}._DEFAULT_ENDPOINT_TEMPLATE
7775
_DEFAULT_UNIVERSE = {{ service.client_name }}._DEFAULT_UNIVERSE

gapic/templates/%namespace/%name_%version/%sub/services/%service/client.py.j2

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,8 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
172172

173173
return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
174174

175-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
176-
DEFAULT_ENDPOINT = {% if service.host %}"{{ service.host }}"{% else %}None{% endif %}
177-
178175
DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
179-
DEFAULT_ENDPOINT
176+
_DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=_DEFAULT_UNIVERSE)
180177
)
181178

182179
_DEFAULT_ENDPOINT_TEMPLATE = {% if service.host %}"{{ service.host.replace("googleapis.com", "{UNIVERSE_DOMAIN}") }}"{% else %}None{% endif %}

gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,6 @@ def async_anonymous_credentials():
126126
return ga_credentials_async.AnonymousCredentials()
127127
return ga_credentials.AnonymousCredentials()
128128

129-
{#TODO(https://github.com/googleapis/gapic-generator-python/issues/1894): Remove this function as part of cleanup when DEFAULT_ENDPOINT is no longer used.#}
130-
# If default endpoint is localhost, then default mtls endpoint will be the same.
131-
# This method modifies the default endpoint so the client can produce a different
132-
# mtls endpoint for endpoint testing purposes.
133-
def modify_default_endpoint(client):
134-
return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT
135-
136129
# If default endpoint template is localhost, then default mtls endpoint will be the same.
137130
# This method modifies the default endpoint template so the client can produce a different
138131
# mtls endpoint for endpoint testing purposes.

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ class AssetServiceAsyncClient:
6262
_client: AssetServiceClient
6363

6464
# Copy defaults from the synchronous client for use here.
65-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
66-
DEFAULT_ENDPOINT = AssetServiceClient.DEFAULT_ENDPOINT
6765
DEFAULT_MTLS_ENDPOINT = AssetServiceClient.DEFAULT_MTLS_ENDPOINT
6866
_DEFAULT_ENDPOINT_TEMPLATE = AssetServiceClient._DEFAULT_ENDPOINT_TEMPLATE
6967
_DEFAULT_UNIVERSE = AssetServiceClient._DEFAULT_UNIVERSE

tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,8 @@ def _get_default_mtls_endpoint(api_endpoint):
130130

131131
return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
132132

133-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
134-
DEFAULT_ENDPOINT = "cloudasset.googleapis.com"
135133
DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
136-
DEFAULT_ENDPOINT
134+
_DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=_DEFAULT_UNIVERSE)
137135
)
138136

139137
_DEFAULT_ENDPOINT_TEMPLATE = "cloudasset.{UNIVERSE_DOMAIN}"

tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@ def async_anonymous_credentials():
9595
return ga_credentials_async.AnonymousCredentials()
9696
return ga_credentials.AnonymousCredentials()
9797

98-
# If default endpoint is localhost, then default mtls endpoint will be the same.
99-
# This method modifies the default endpoint so the client can produce a different
100-
# mtls endpoint for endpoint testing purposes.
101-
def modify_default_endpoint(client):
102-
return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT
103-
10498
# If default endpoint template is localhost, then default mtls endpoint will be the same.
10599
# This method modifies the default endpoint template so the client can produce a different
106100
# mtls endpoint for endpoint testing purposes.

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ class IAMCredentialsAsyncClient:
6565
_client: IAMCredentialsClient
6666

6767
# Copy defaults from the synchronous client for use here.
68-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
69-
DEFAULT_ENDPOINT = IAMCredentialsClient.DEFAULT_ENDPOINT
7068
DEFAULT_MTLS_ENDPOINT = IAMCredentialsClient.DEFAULT_MTLS_ENDPOINT
7169
_DEFAULT_ENDPOINT_TEMPLATE = IAMCredentialsClient._DEFAULT_ENDPOINT_TEMPLATE
7270
_DEFAULT_UNIVERSE = IAMCredentialsClient._DEFAULT_UNIVERSE

tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/client.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@ def _get_default_mtls_endpoint(api_endpoint):
133133

134134
return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com")
135135

136-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
137-
DEFAULT_ENDPOINT = "iamcredentials.googleapis.com"
138136
DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore
139-
DEFAULT_ENDPOINT
137+
_DEFAULT_ENDPOINT_TEMPLATE.format(UNIVERSE_DOMAIN=_DEFAULT_UNIVERSE)
140138
)
141139

142140
_DEFAULT_ENDPOINT_TEMPLATE = "iamcredentials.{UNIVERSE_DOMAIN}"

tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ def async_anonymous_credentials():
8585
return ga_credentials_async.AnonymousCredentials()
8686
return ga_credentials.AnonymousCredentials()
8787

88-
# If default endpoint is localhost, then default mtls endpoint will be the same.
89-
# This method modifies the default endpoint so the client can produce a different
90-
# mtls endpoint for endpoint testing purposes.
91-
def modify_default_endpoint(client):
92-
return "foo.googleapis.com" if ("localhost" in client.DEFAULT_ENDPOINT) else client.DEFAULT_ENDPOINT
93-
9488
# If default endpoint template is localhost, then default mtls endpoint will be the same.
9589
# This method modifies the default endpoint template so the client can produce a different
9690
# mtls endpoint for endpoint testing purposes.

tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ class EventarcAsyncClient:
7474
_client: EventarcClient
7575

7676
# Copy defaults from the synchronous client for use here.
77-
# Note: DEFAULT_ENDPOINT is deprecated. Use _DEFAULT_ENDPOINT_TEMPLATE instead.
78-
DEFAULT_ENDPOINT = EventarcClient.DEFAULT_ENDPOINT
7977
DEFAULT_MTLS_ENDPOINT = EventarcClient.DEFAULT_MTLS_ENDPOINT
8078
_DEFAULT_ENDPOINT_TEMPLATE = EventarcClient._DEFAULT_ENDPOINT_TEMPLATE
8179
_DEFAULT_UNIVERSE = EventarcClient._DEFAULT_UNIVERSE

0 commit comments

Comments
 (0)