Skip to content

Commit 71b9301

Browse files
feat: [google-cloud-dataplex] Added value NONE to the SyncMode enum (#13504)
BEGIN_COMMIT_OVERRIDE feat: Added value `NONE` to the `SyncMode` enum docs: Modified various comments END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. docs: Modified various comments PiperOrigin-RevId: 724120221 Source-Link: googleapis/googleapis@8e62267 Source-Link: googleapis/googleapis-gen@49ab8cf Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRhdGFwbGV4Ly5Pd2xCb3QueWFtbCIsImgiOiI0OWFiOGNmMDhmMGIxNDRmMzg1NjI0OWVmNThmM2MwZmEzYTg0NWIwIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <[email protected]>
1 parent b266867 commit 71b9301

File tree

22 files changed

+905
-262
lines changed

22 files changed

+905
-262
lines changed

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

packages/google-cloud-dataplex/google/cloud/dataplex_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.6.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-dataplex/google/cloud/dataplex_v1/services/catalog_service/async_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3092,8 +3092,8 @@ async def sample_create_metadata_job():
30923092
metadata_job = dataplex_v1.MetadataJob()
30933093
metadata_job.import_spec.scope.entry_groups = ['entry_groups_value1', 'entry_groups_value2']
30943094
metadata_job.import_spec.scope.entry_types = ['entry_types_value1', 'entry_types_value2']
3095-
metadata_job.import_spec.entry_sync_mode = "INCREMENTAL"
3096-
metadata_job.import_spec.aspect_sync_mode = "INCREMENTAL"
3095+
metadata_job.import_spec.entry_sync_mode = "NONE"
3096+
metadata_job.import_spec.aspect_sync_mode = "NONE"
30973097
metadata_job.type_ = "IMPORT"
30983098
30993099
request = dataplex_v1.CreateMetadataJobRequest(

packages/google-cloud-dataplex/google/cloud/dataplex_v1/services/catalog_service/client.py

Lines changed: 83 additions & 38 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
@@ -594,6 +596,33 @@ def _validate_universe_domain(self):
594596
# NOTE (b/349488459): universe validation is disabled until further notice.
595597
return True
596598

599+
def _add_cred_info_for_auth_errors(
600+
self, error: core_exceptions.GoogleAPICallError
601+
) -> None:
602+
"""Adds credential info string to error details for 401/403/404 errors.
603+
604+
Args:
605+
error (google.api_core.exceptions.GoogleAPICallError): The error to add the cred info.
606+
"""
607+
if error.code not in [
608+
HTTPStatus.UNAUTHORIZED,
609+
HTTPStatus.FORBIDDEN,
610+
HTTPStatus.NOT_FOUND,
611+
]:
612+
return
613+
614+
cred = self._transport._credentials
615+
616+
# get_cred_info is only available in google-auth>=2.35.0
617+
if not hasattr(cred, "get_cred_info"):
618+
return
619+
620+
# ignore the type check since pypy test fails when get_cred_info
621+
# is not available
622+
cred_info = cred.get_cred_info() # type: ignore
623+
if cred_info and hasattr(error._details, "append"):
624+
error._details.append(json.dumps(cred_info))
625+
597626
@property
598627
def api_endpoint(self):
599628
"""Return the API endpoint used by the client instance.
@@ -3507,8 +3536,8 @@ def sample_create_metadata_job():
35073536
metadata_job = dataplex_v1.MetadataJob()
35083537
metadata_job.import_spec.scope.entry_groups = ['entry_groups_value1', 'entry_groups_value2']
35093538
metadata_job.import_spec.scope.entry_types = ['entry_types_value1', 'entry_types_value2']
3510-
metadata_job.import_spec.entry_sync_mode = "INCREMENTAL"
3511-
metadata_job.import_spec.aspect_sync_mode = "INCREMENTAL"
3539+
metadata_job.import_spec.entry_sync_mode = "NONE"
3540+
metadata_job.import_spec.aspect_sync_mode = "NONE"
35123541
metadata_job.type_ = "IMPORT"
35133542
35143543
request = dataplex_v1.CreateMetadataJobRequest(
@@ -3999,16 +4028,20 @@ def list_operations(
39994028
# Validate the universe domain.
40004029
self._validate_universe_domain()
40014030

4002-
# Send the request.
4003-
response = rpc(
4004-
request,
4005-
retry=retry,
4006-
timeout=timeout,
4007-
metadata=metadata,
4008-
)
4031+
try:
4032+
# Send the request.
4033+
response = rpc(
4034+
request,
4035+
retry=retry,
4036+
timeout=timeout,
4037+
metadata=metadata,
4038+
)
40094039

4010-
# Done; return the response.
4011-
return response
4040+
# Done; return the response.
4041+
return response
4042+
except core_exceptions.GoogleAPICallError as e:
4043+
self._add_cred_info_for_auth_errors(e)
4044+
raise e
40124045

40134046
def get_operation(
40144047
self,
@@ -4054,16 +4087,20 @@ def get_operation(
40544087
# Validate the universe domain.
40554088
self._validate_universe_domain()
40564089

4057-
# Send the request.
4058-
response = rpc(
4059-
request,
4060-
retry=retry,
4061-
timeout=timeout,
4062-
metadata=metadata,
4063-
)
4090+
try:
4091+
# Send the request.
4092+
response = rpc(
4093+
request,
4094+
retry=retry,
4095+
timeout=timeout,
4096+
metadata=metadata,
4097+
)
40644098

4065-
# Done; return the response.
4066-
return response
4099+
# Done; return the response.
4100+
return response
4101+
except core_exceptions.GoogleAPICallError as e:
4102+
self._add_cred_info_for_auth_errors(e)
4103+
raise e
40674104

40684105
def delete_operation(
40694106
self,
@@ -4220,16 +4257,20 @@ def get_location(
42204257
# Validate the universe domain.
42214258
self._validate_universe_domain()
42224259

4223-
# Send the request.
4224-
response = rpc(
4225-
request,
4226-
retry=retry,
4227-
timeout=timeout,
4228-
metadata=metadata,
4229-
)
4260+
try:
4261+
# Send the request.
4262+
response = rpc(
4263+
request,
4264+
retry=retry,
4265+
timeout=timeout,
4266+
metadata=metadata,
4267+
)
42304268

4231-
# Done; return the response.
4232-
return response
4269+
# Done; return the response.
4270+
return response
4271+
except core_exceptions.GoogleAPICallError as e:
4272+
self._add_cred_info_for_auth_errors(e)
4273+
raise e
42334274

42344275
def list_locations(
42354276
self,
@@ -4275,16 +4316,20 @@ def list_locations(
42754316
# Validate the universe domain.
42764317
self._validate_universe_domain()
42774318

4278-
# Send the request.
4279-
response = rpc(
4280-
request,
4281-
retry=retry,
4282-
timeout=timeout,
4283-
metadata=metadata,
4284-
)
4319+
try:
4320+
# Send the request.
4321+
response = rpc(
4322+
request,
4323+
retry=retry,
4324+
timeout=timeout,
4325+
metadata=metadata,
4326+
)
42854327

4286-
# Done; return the response.
4287-
return response
4328+
# Done; return the response.
4329+
return response
4330+
except core_exceptions.GoogleAPICallError as e:
4331+
self._add_cred_info_for_auth_errors(e)
4332+
raise e
42884333

42894334

42904335
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(

packages/google-cloud-dataplex/google/cloud/dataplex_v1/services/content_service/client.py

Lines 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
@@ -515,6 +517,33 @@ def _validate_universe_domain(self):
515517
# NOTE (b/349488459): universe validation is disabled until further notice.
516518
return True
517519

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

1681-
# Send the request.
1682-
response = rpc(
1683-
request,
1684-
retry=retry,
1685-
timeout=timeout,
1686-
metadata=metadata,
1687-
)
1710+
try:
1711+
# Send the request.
1712+
response = rpc(
1713+
request,
1714+
retry=retry,
1715+
timeout=timeout,
1716+
metadata=metadata,
1717+
)
16881718

1689-
# Done; return the response.
1690-
return response
1719+
# Done; return the response.
1720+
return response
1721+
except core_exceptions.GoogleAPICallError as e:
1722+
self._add_cred_info_for_auth_errors(e)
1723+
raise e
16911724

16921725
def get_operation(
16931726
self,
@@ -1733,16 +1766,20 @@ def get_operation(
17331766
# Validate the universe domain.
17341767
self._validate_universe_domain()
17351768

1736-
# Send the request.
1737-
response = rpc(
1738-
request,
1739-
retry=retry,
1740-
timeout=timeout,
1741-
metadata=metadata,
1742-
)
1769+
try:
1770+
# Send the request.
1771+
response = rpc(
1772+
request,
1773+
retry=retry,
1774+
timeout=timeout,
1775+
metadata=metadata,
1776+
)
17431777

1744-
# Done; return the response.
1745-
return response
1778+
# Done; return the response.
1779+
return response
1780+
except core_exceptions.GoogleAPICallError as e:
1781+
self._add_cred_info_for_auth_errors(e)
1782+
raise e
17461783

17471784
def delete_operation(
17481785
self,
@@ -1899,16 +1936,20 @@ def get_location(
18991936
# Validate the universe domain.
19001937
self._validate_universe_domain()
19011938

1902-
# Send the request.
1903-
response = rpc(
1904-
request,
1905-
retry=retry,
1906-
timeout=timeout,
1907-
metadata=metadata,
1908-
)
1939+
try:
1940+
# Send the request.
1941+
response = rpc(
1942+
request,
1943+
retry=retry,
1944+
timeout=timeout,
1945+
metadata=metadata,
1946+
)
19091947

1910-
# Done; return the response.
1911-
return response
1948+
# Done; return the response.
1949+
return response
1950+
except core_exceptions.GoogleAPICallError as e:
1951+
self._add_cred_info_for_auth_errors(e)
1952+
raise e
19121953

19131954
def list_locations(
19141955
self,
@@ -1954,16 +1995,20 @@ def list_locations(
19541995
# Validate the universe domain.
19551996
self._validate_universe_domain()
19561997

1957-
# Send the request.
1958-
response = rpc(
1959-
request,
1960-
retry=retry,
1961-
timeout=timeout,
1962-
metadata=metadata,
1963-
)
1998+
try:
1999+
# Send the request.
2000+
response = rpc(
2001+
request,
2002+
retry=retry,
2003+
timeout=timeout,
2004+
metadata=metadata,
2005+
)
19642006

1965-
# Done; return the response.
1966-
return response
2007+
# Done; return the response.
2008+
return response
2009+
except core_exceptions.GoogleAPICallError as e:
2010+
self._add_cred_info_for_auth_errors(e)
2011+
raise e
19672012

19682013

19692014
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(

0 commit comments

Comments
 (0)