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

Appearance settings

Commit a0910dd

Browse filesBrowse files
feat: [Many APIs] Add REST Interceptors which support reading metadata (#13499)
BEGIN_COMMIT_OVERRIDE feat: Add REST Interceptors which support reading metadata feat: Add support for reading selective GAPIC generation methods from service YAML chore: Update gapic-generator-python to v1.22.0 END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. feat: Add support for reading selective GAPIC generation methods from service YAML chore: Update gapic-generator-python to v1.22.0 PiperOrigin-RevId: 724026024 Source-Link: googleapis/googleapis@ad99638 Source-Link: googleapis/googleapis-gen@e291c4d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1hbmFnZWRrYWZrYS8uT3dsQm90LnlhbWwiLCJoIjoiZTI5MWM0ZGQxZDY3MGVkYTE5OTk4ZGU3NmY5NjdlMTYwM2E0ODk5MyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1lZGlhLXRyYW5zbGF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1lbWNhY2hlLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1lbW9yeXN0b3JlLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW1pZ3JhdGlvbmNlbnRlci8uT3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kLW9zLWxvZ2luLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXBhcmFsbGVsc3RvcmUvLk93bEJvdC55YW1sIiwiaCI6ImUyOTFjNGRkMWQ2NzBlZGExOTk5OGRlNzZmOTY3ZTE2MDNhNDg5OTMifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 5cdcc9d commit a0910dd
Copy full SHA for a0910dd

File tree

209 files changed

+20558
-1991
lines changed
Filter options

Some content is hidden

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

209 files changed

+20558
-1991
lines changed

‎packages/google-cloud-managedkafka/google/cloud/managedkafka/gapic_version.py

Copy file name to clipboardExpand all lines: packages/google-cloud-managedkafka/google/cloud/managedkafka/gapic_version.py
+1-1Lines 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__ = "0.1.6" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

‎packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/gapic_version.py

Copy file name to clipboardExpand all lines: packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/gapic_version.py
+1-1Lines 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__ = "0.1.6" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

‎packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/services/managed_kafka/client.py

Copy file name to clipboardExpand all lines: packages/google-cloud-managedkafka/google/cloud/managedkafka_v1/services/managed_kafka/client.py
+81-36Lines changed: 81 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# limitations under the License.
1515
#
1616
from collections import OrderedDict
17+
from http import HTTPStatus
18+
import json
1719
import logging as std_logging
1820
import os
1921
import re
@@ -564,6 +566,33 @@ def _validate_universe_domain(self):
564566
# NOTE (b/349488459): universe validation is disabled until further notice.
565567
return True
566568

569+
def _add_cred_info_for_auth_errors(
570+
self, error: core_exceptions.GoogleAPICallError
571+
) -> None:
572+
"""Adds credential info string to error details for 401/403/404 errors.
573+
574+
Args:
575+
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
576+
"""
577+
if error.code not in [
578+
HTTPStatus.UNAUTHORIZED,
579+
HTTPStatus.FORBIDDEN,
580+
HTTPStatus.NOT_FOUND,
581+
]:
582+
return
583+
584+
cred = self._transport._credentials
585+
586+
# get_cred_info is only available in google-auth>=2.35.0
587+
if not hasattr(cred, "get_cred_info"):
588+
return
589+
590+
# ignore the type check since pypy test fails when get_cred_info
591+
# is not available
592+
cred_info = cred.get_cred_info() # type: ignore
593+
if cred_info and hasattr(error._details, "append"):
594+
error._details.append(json.dumps(cred_info))
595+
567596
@property
568597
def api_endpoint(self):
569598
"""Return the API endpoint used by the client instance.
@@ -2463,16 +2492,20 @@ def list_operations(
24632492
# Validate the universe domain.
24642493
self._validate_universe_domain()
24652494

2466-
# Send the request.
2467-
response = rpc(
2468-
request,
2469-
retry=retry,
2470-
timeout=timeout,
2471-
metadata=metadata,
2472-
)
2495+
try:
2496+
# Send the request.
2497+
response = rpc(
2498+
request,
2499+
retry=retry,
2500+
timeout=timeout,
2501+
metadata=metadata,
2502+
)
24732503

2474-
# Done; return the response.
2475-
return response
2504+
# Done; return the response.
2505+
return response
2506+
except core_exceptions.GoogleAPICallError as e:
2507+
self._add_cred_info_for_auth_errors(e)
2508+
raise e
24762509

24772510
def get_operation(
24782511
self,
@@ -2518,16 +2551,20 @@ def get_operation(
25182551
# Validate the universe domain.
25192552
self._validate_universe_domain()
25202553

2521-
# Send the request.
2522-
response = rpc(
2523-
request,
2524-
retry=retry,
2525-
timeout=timeout,
2526-
metadata=metadata,
2527-
)
2554+
try:
2555+
# Send the request.
2556+
response = rpc(
2557+
request,
2558+
retry=retry,
2559+
timeout=timeout,
2560+
metadata=metadata,
2561+
)
25282562

2529-
# Done; return the response.
2530-
return response
2563+
# Done; return the response.
2564+
return response
2565+
except core_exceptions.GoogleAPICallError as e:
2566+
self._add_cred_info_for_auth_errors(e)
2567+
raise e
25312568

25322569
def delete_operation(
25332570
self,
@@ -2684,16 +2721,20 @@ def get_location(
26842721
# Validate the universe domain.
26852722
self._validate_universe_domain()
26862723

2687-
# Send the request.
2688-
response = rpc(
2689-
request,
2690-
retry=retry,
2691-
timeout=timeout,
2692-
metadata=metadata,
2693-
)
2724+
try:
2725+
# Send the request.
2726+
response = rpc(
2727+
request,
2728+
retry=retry,
2729+
timeout=timeout,
2730+
metadata=metadata,
2731+
)
26942732

2695-
# Done; return the response.
2696-
return response
2733+
# Done; return the response.
2734+
return response
2735+
except core_exceptions.GoogleAPICallError as e:
2736+
self._add_cred_info_for_auth_errors(e)
2737+
raise e
26972738

26982739
def list_locations(
26992740
self,
@@ -2739,16 +2780,20 @@ def list_locations(
27392780
# Validate the universe domain.
27402781
self._validate_universe_domain()
27412782

2742-
# Send the request.
2743-
response = rpc(
2744-
request,
2745-
retry=retry,
2746-
timeout=timeout,
2747-
metadata=metadata,
2748-
)
2783+
try:
2784+
# Send the request.
2785+
response = rpc(
2786+
request,
2787+
retry=retry,
2788+
timeout=timeout,
2789+
metadata=metadata,
2790+
)
27492791

2750-
# Done; return the response.
2751-
return response
2792+
# Done; return the response.
2793+
return response
2794+
except core_exceptions.GoogleAPICallError as e:
2795+
self._add_cred_info_for_auth_errors(e)
2796+
raise e
27522797

27532798

27542799
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.