Skip to content

Commit d896a31

Browse files
feat: [google-maps-mapsplatformdatasets] added a new API FetchDatasetErrors (#12905)
- [ ] Regenerate this pull request now. Clients can now get the errors associated with a dataset. PiperOrigin-RevId: 651828351 Source-Link: googleapis/googleapis@ce39e78 Source-Link: googleapis/googleapis-gen@95efbc2 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLW1hcHMtbWFwc3BsYXRmb3JtZGF0YXNldHMvLk93bEJvdC55YW1sIiwiaCI6Ijk1ZWZiYzI4YjYwZjk4Nzk5MTUwZWZhNTE0MjhhZWY4MWM5ODcwYjEifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c6f70a6 commit d896a31

File tree

19 files changed

+2463
-514
lines changed

19 files changed

+2463
-514
lines changed

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
from google.maps.mapsplatformdatasets_v1.types.maps_platform_datasets import (
3434
CreateDatasetRequest,
3535
DeleteDatasetRequest,
36+
FetchDatasetErrorsRequest,
37+
FetchDatasetErrorsResponse,
3638
GetDatasetRequest,
3739
ListDatasetsRequest,
3840
ListDatasetsResponse,
@@ -50,6 +52,8 @@
5052
"Usage",
5153
"CreateDatasetRequest",
5254
"DeleteDatasetRequest",
55+
"FetchDatasetErrorsRequest",
56+
"FetchDatasetErrorsResponse",
5357
"GetDatasetRequest",
5458
"ListDatasetsRequest",
5559
"ListDatasetsResponse",

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

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
from .types.maps_platform_datasets import (
2828
CreateDatasetRequest,
2929
DeleteDatasetRequest,
30+
FetchDatasetErrorsRequest,
31+
FetchDatasetErrorsResponse,
3032
GetDatasetRequest,
3133
ListDatasetsRequest,
3234
ListDatasetsResponse,
@@ -38,6 +40,8 @@
3840
"CreateDatasetRequest",
3941
"Dataset",
4042
"DeleteDatasetRequest",
43+
"FetchDatasetErrorsRequest",
44+
"FetchDatasetErrorsResponse",
4145
"FileFormat",
4246
"GcsSource",
4347
"GetDatasetRequest",

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
"delete_dataset"
2121
]
2222
},
23+
"FetchDatasetErrors": {
24+
"methods": [
25+
"fetch_dataset_errors"
26+
]
27+
},
2328
"GetDataset": {
2429
"methods": [
2530
"get_dataset"
@@ -50,6 +55,11 @@
5055
"delete_dataset"
5156
]
5257
},
58+
"FetchDatasetErrors": {
59+
"methods": [
60+
"fetch_dataset_errors"
61+
]
62+
},
5363
"GetDataset": {
5464
"methods": [
5565
"get_dataset"
@@ -80,6 +90,11 @@
8090
"delete_dataset"
8191
]
8292
},
93+
"FetchDatasetErrors": {
94+
"methods": [
95+
"fetch_dataset_errors"
96+
]
97+
},
8398
"GetDataset": {
8499
"methods": [
85100
"get_dataset"

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets_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__ = "0.4.1" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets_v1/services/maps_platform_datasets/async_client.py

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
from google.protobuf import field_mask_pb2 # type: ignore
4747
from google.protobuf import timestamp_pb2 # type: ignore
48+
from google.rpc import status_pb2 # type: ignore
4849

4950
from google.maps.mapsplatformdatasets_v1.services.maps_platform_datasets import pagers
5051
from google.maps.mapsplatformdatasets_v1.types import data_source
@@ -619,6 +620,127 @@ async def sample_get_dataset():
619620
# Done; return the response.
620621
return response
621622

623+
async def fetch_dataset_errors(
624+
self,
625+
request: Optional[
626+
Union[maps_platform_datasets.FetchDatasetErrorsRequest, dict]
627+
] = None,
628+
*,
629+
dataset: Optional[str] = None,
630+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
631+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
632+
metadata: Sequence[Tuple[str, str]] = (),
633+
) -> pagers.FetchDatasetErrorsAsyncPager:
634+
r"""Gets all the errors of a dataset.
635+
636+
.. code-block:: python
637+
638+
# This snippet has been automatically generated and should be regarded as a
639+
# code template only.
640+
# It will require modifications to work:
641+
# - It may require correct/in-range values for request initialization.
642+
# - It may require specifying regional endpoints when creating the service
643+
# client as shown in:
644+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
645+
from google.maps import mapsplatformdatasets_v1
646+
647+
async def sample_fetch_dataset_errors():
648+
# Create a client
649+
client = mapsplatformdatasets_v1.MapsPlatformDatasetsAsyncClient()
650+
651+
# Initialize request argument(s)
652+
request = mapsplatformdatasets_v1.FetchDatasetErrorsRequest(
653+
dataset="dataset_value",
654+
)
655+
656+
# Make the request
657+
page_result = client.fetch_dataset_errors(request=request)
658+
659+
# Handle the response
660+
async for response in page_result:
661+
print(response)
662+
663+
Args:
664+
request (Optional[Union[google.maps.mapsplatformdatasets_v1.types.FetchDatasetErrorsRequest, dict]]):
665+
The request object. Request to list detailed errors
666+
belonging to a dataset.
667+
dataset (:class:`str`):
668+
Required. The name of the dataset to list all the errors
669+
for. Format: projects/{project}/datasets/{dataset_id}
670+
671+
This corresponds to the ``dataset`` field
672+
on the ``request`` instance; if ``request`` is provided, this
673+
should not be set.
674+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
675+
should be retried.
676+
timeout (float): The timeout for this request.
677+
metadata (Sequence[Tuple[str, str]]): Strings which should be
678+
sent along with the request as metadata.
679+
680+
Returns:
681+
google.maps.mapsplatformdatasets_v1.services.maps_platform_datasets.pagers.FetchDatasetErrorsAsyncPager:
682+
Response object of
683+
FetchDatasetErrors.
684+
Iterating over this object will yield
685+
results and resolve additional pages
686+
automatically.
687+
688+
"""
689+
# Create or coerce a protobuf request object.
690+
# - Quick check: If we got a request object, we should *not* have
691+
# gotten any keyword arguments that map to the request.
692+
has_flattened_params = any([dataset])
693+
if request is not None and has_flattened_params:
694+
raise ValueError(
695+
"If the `request` argument is set, then none of "
696+
"the individual field arguments should be set."
697+
)
698+
699+
# - Use the request object if provided (there's no risk of modifying the input as
700+
# there are no flattened fields), or create one.
701+
if not isinstance(request, maps_platform_datasets.FetchDatasetErrorsRequest):
702+
request = maps_platform_datasets.FetchDatasetErrorsRequest(request)
703+
704+
# If we have keyword arguments corresponding to fields on the
705+
# request, apply these.
706+
if dataset is not None:
707+
request.dataset = dataset
708+
709+
# Wrap the RPC method; this adds retry and timeout information,
710+
# and friendly error handling.
711+
rpc = self._client._transport._wrapped_methods[
712+
self._client._transport.fetch_dataset_errors
713+
]
714+
715+
# Certain fields should be provided within the metadata header;
716+
# add these here.
717+
metadata = tuple(metadata) + (
718+
gapic_v1.routing_header.to_grpc_metadata((("dataset", request.dataset),)),
719+
)
720+
721+
# Validate the universe domain.
722+
self._client._validate_universe_domain()
723+
724+
# Send the request.
725+
response = await rpc(
726+
request,
727+
retry=retry,
728+
timeout=timeout,
729+
metadata=metadata,
730+
)
731+
732+
# This method is paged; wrap the response in a pager, which provides
733+
# an `__aiter__` convenience method.
734+
response = pagers.FetchDatasetErrorsAsyncPager(
735+
method=rpc,
736+
request=request,
737+
response=response,
738+
metadata=metadata,
739+
)
740+
741+
# Done; return the response.
742+
return response
743+
622744
async def list_datasets(
623745
self,
624746
request: Optional[

packages/google-maps-mapsplatformdatasets/google/maps/mapsplatformdatasets_v1/services/maps_platform_datasets/client.py

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
from google.protobuf import field_mask_pb2 # type: ignore
5252
from google.protobuf import timestamp_pb2 # type: ignore
53+
from google.rpc import status_pb2 # type: ignore
5354

5455
from google.maps.mapsplatformdatasets_v1.services.maps_platform_datasets import pagers
5556
from google.maps.mapsplatformdatasets_v1.types import data_source
@@ -1025,6 +1026,124 @@ def sample_get_dataset():
10251026
# Done; return the response.
10261027
return response
10271028

1029+
def fetch_dataset_errors(
1030+
self,
1031+
request: Optional[
1032+
Union[maps_platform_datasets.FetchDatasetErrorsRequest, dict]
1033+
] = None,
1034+
*,
1035+
dataset: Optional[str] = None,
1036+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1037+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
1038+
metadata: Sequence[Tuple[str, str]] = (),
1039+
) -> pagers.FetchDatasetErrorsPager:
1040+
r"""Gets all the errors of a dataset.
1041+
1042+
.. code-block:: python
1043+
1044+
# This snippet has been automatically generated and should be regarded as a
1045+
# code template only.
1046+
# It will require modifications to work:
1047+
# - It may require correct/in-range values for request initialization.
1048+
# - It may require specifying regional endpoints when creating the service
1049+
# client as shown in:
1050+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
1051+
from google.maps import mapsplatformdatasets_v1
1052+
1053+
def sample_fetch_dataset_errors():
1054+
# Create a client
1055+
client = mapsplatformdatasets_v1.MapsPlatformDatasetsClient()
1056+
1057+
# Initialize request argument(s)
1058+
request = mapsplatformdatasets_v1.FetchDatasetErrorsRequest(
1059+
dataset="dataset_value",
1060+
)
1061+
1062+
# Make the request
1063+
page_result = client.fetch_dataset_errors(request=request)
1064+
1065+
# Handle the response
1066+
for response in page_result:
1067+
print(response)
1068+
1069+
Args:
1070+
request (Union[google.maps.mapsplatformdatasets_v1.types.FetchDatasetErrorsRequest, dict]):
1071+
The request object. Request to list detailed errors
1072+
belonging to a dataset.
1073+
dataset (str):
1074+
Required. The name of the dataset to list all the errors
1075+
for. Format: projects/{project}/datasets/{dataset_id}
1076+
1077+
This corresponds to the ``dataset`` field
1078+
on the ``request`` instance; if ``request`` is provided, this
1079+
should not be set.
1080+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
1081+
should be retried.
1082+
timeout (float): The timeout for this request.
1083+
metadata (Sequence[Tuple[str, str]]): Strings which should be
1084+
sent along with the request as metadata.
1085+
1086+
Returns:
1087+
google.maps.mapsplatformdatasets_v1.services.maps_platform_datasets.pagers.FetchDatasetErrorsPager:
1088+
Response object of
1089+
FetchDatasetErrors.
1090+
Iterating over this object will yield
1091+
results and resolve additional pages
1092+
automatically.
1093+
1094+
"""
1095+
# Create or coerce a protobuf request object.
1096+
# - Quick check: If we got a request object, we should *not* have
1097+
# gotten any keyword arguments that map to the request.
1098+
has_flattened_params = any([dataset])
1099+
if request is not None and has_flattened_params:
1100+
raise ValueError(
1101+
"If the `request` argument is set, then none of "
1102+
"the individual field arguments should be set."
1103+
)
1104+
1105+
# - Use the request object if provided (there's no risk of modifying the input as
1106+
# there are no flattened fields), or create one.
1107+
if not isinstance(request, maps_platform_datasets.FetchDatasetErrorsRequest):
1108+
request = maps_platform_datasets.FetchDatasetErrorsRequest(request)
1109+
# If we have keyword arguments corresponding to fields on the
1110+
# request, apply these.
1111+
if dataset is not None:
1112+
request.dataset = dataset
1113+
1114+
# Wrap the RPC method; this adds retry and timeout information,
1115+
# and friendly error handling.
1116+
rpc = self._transport._wrapped_methods[self._transport.fetch_dataset_errors]
1117+
1118+
# Certain fields should be provided within the metadata header;
1119+
# add these here.
1120+
metadata = tuple(metadata) + (
1121+
gapic_v1.routing_header.to_grpc_metadata((("dataset", request.dataset),)),
1122+
)
1123+
1124+
# Validate the universe domain.
1125+
self._validate_universe_domain()
1126+
1127+
# Send the request.
1128+
response = rpc(
1129+
request,
1130+
retry=retry,
1131+
timeout=timeout,
1132+
metadata=metadata,
1133+
)
1134+
1135+
# This method is paged; wrap the response in a pager, which provides
1136+
# an `__iter__` convenience method.
1137+
response = pagers.FetchDatasetErrorsPager(
1138+
method=rpc,
1139+
request=request,
1140+
response=response,
1141+
metadata=metadata,
1142+
)
1143+
1144+
# Done; return the response.
1145+
return response
1146+
10281147
def list_datasets(
10291148
self,
10301149
request: Optional[

0 commit comments

Comments
 (0)