Skip to content

Commit e22e2bd

Browse files
feat: [Many APIs] Add REST Interceptors which support reading metadata (#13496)
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: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LWxvZ2dpbmcvLk93bEJvdC55YW1sIiwiaCI6ImUyOTFjNGRkMWQ2NzBlZGExOTk5OGRlNzZmOTY3ZTE2MDNhNDg5OTMifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LW1pZ3JhdGlvbi8uT3dsQm90LnlhbWwiLCJoIjoiZTI5MWM0ZGQxZDY3MGVkYTE5OTk4ZGU3NmY5NjdlMTYwM2E0ODk5MyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LXJlc2VydmF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpbGxpbmctYnVkZ2V0cy8uT3dsQm90LnlhbWwiLCJoIjoiZTI5MWM0ZGQxZDY3MGVkYTE5OTk4ZGU3NmY5NjdlMTYwM2E0ODk5MyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpbGxpbmcvLk93bEJvdC55YW1sIiwiaCI6ImUyOTFjNGRkMWQ2NzBlZGExOTk5OGRlNzZmOTY3ZTE2MDNhNDg5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Tc2Zjk2N2UxNjAzYTQ4OTkzIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRhdGEtcW5hLy5Pd2xCb3QueWFtbCIsImgiOiJlMjkxYzRkZDFkNjcwZWRhMTk5OThkZTc2Zjk2N2UxNjAzYTQ4OTkzIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent eb554e8 commit e22e2bd

File tree

184 files changed

+14744
-971
lines changed

Some content is hidden

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

184 files changed

+14744
-971
lines changed

packages/google-cloud-bigquery-logging/google/cloud/bigquery_logging/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.5.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-logging/google/cloud/bigquery_logging_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.5.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration/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__ = "0.11.12" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration_v2/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__ = "0.11.12" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration_v2/services/migration_service/client.py

Lines changed: 29 additions & 0 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
@@ -514,6 +516,33 @@ def _validate_universe_domain(self):
514516
# NOTE (b/349488459): universe validation is disabled until further notice.
515517
return True
516518

519+
def _add_cred_info_for_auth_errors(
520+
self, error: core_exceptions.GoogleAPICallError
521+
) -> None:
522+
"""Adds credential info string to error details for 401/403/404 errors.
523+
524+
Args:
525+
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
526+
"""
527+
if error.code not in [
528+
HTTPStatus.UNAUTHORIZED,
529+
HTTPStatus.FORBIDDEN,
530+
HTTPStatus.NOT_FOUND,
531+
]:
532+
return
533+
534+
cred = self._transport._credentials
535+
536+
# get_cred_info is only available in google-auth>=2.35.0
537+
if not hasattr(cred, "get_cred_info"):
538+
return
539+
540+
# ignore the type check since pypy test fails when get_cred_info
541+
# is not available
542+
cred_info = cred.get_cred_info() # type: ignore
543+
if cred_info and hasattr(error._details, "append"):
544+
error._details.append(json.dumps(cred_info))
545+
517546
@property
518547
def api_endpoint(self):
519548
"""Return the API endpoint used by the client instance.

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration_v2alpha/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__ = "0.11.12" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration_v2alpha/services/migration_service/client.py

Lines changed: 29 additions & 0 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
@@ -514,6 +516,33 @@ def _validate_universe_domain(self):
514516
# NOTE (b/349488459): universe validation is disabled until further notice.
515517
return True
516518

519+
def _add_cred_info_for_auth_errors(
520+
self, error: core_exceptions.GoogleAPICallError
521+
) -> None:
522+
"""Adds credential info string to error details for 401/403/404 errors.
523+
524+
Args:
525+
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
526+
"""
527+
if error.code not in [
528+
HTTPStatus.UNAUTHORIZED,
529+
HTTPStatus.FORBIDDEN,
530+
HTTPStatus.NOT_FOUND,
531+
]:
532+
return
533+
534+
cred = self._transport._credentials
535+
536+
# get_cred_info is only available in google-auth>=2.35.0
537+
if not hasattr(cred, "get_cred_info"):
538+
return
539+
540+
# ignore the type check since pypy test fails when get_cred_info
541+
# is not available
542+
cred_info = cred.get_cred_info() # type: ignore
543+
if cred_info and hasattr(error._details, "append"):
544+
error._details.append(json.dumps(cred_info))
545+
517546
@property
518547
def api_endpoint(self):
519548
"""Return the API endpoint used by the client instance.

packages/google-cloud-bigquery-migration/google/cloud/bigquery_migration_v2alpha/services/sql_translation_service/client.py

Lines changed: 29 additions & 0 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
@@ -463,6 +465,33 @@ def _validate_universe_domain(self):
463465
# NOTE (b/349488459): universe validation is disabled until further notice.
464466
return True
465467

468+
def _add_cred_info_for_auth_errors(
469+
self, error: core_exceptions.GoogleAPICallError
470+
) -> None:
471+
"""Adds credential info string to error details for 401/403/404 errors.
472+
473+
Args:
474+
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
475+
"""
476+
if error.code not in [
477+
HTTPStatus.UNAUTHORIZED,
478+
HTTPStatus.FORBIDDEN,
479+
HTTPStatus.NOT_FOUND,
480+
]:
481+
return
482+
483+
cred = self._transport._credentials
484+
485+
# get_cred_info is only available in google-auth>=2.35.0
486+
if not hasattr(cred, "get_cred_info"):
487+
return
488+
489+
# ignore the type check since pypy test fails when get_cred_info
490+
# is not available
491+
cred_info = cred.get_cred_info() # type: ignore
492+
if cred_info and hasattr(error._details, "append"):
493+
error._details.append(json.dumps(cred_info))
494+
466495
@property
467496
def api_endpoint(self):
468497
"""Return the API endpoint used by the client instance.

packages/google-cloud-bigquery-migration/samples/generated_samples/snippet_metadata_google.cloud.bigquery.migration.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-migration",
11-
"version": "0.11.12"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-bigquery-migration/samples/generated_samples/snippet_metadata_google.cloud.bigquery.migration.v2alpha.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-migration",
11-
"version": "0.11.12"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)