|
47 | 47 | from google.cloud.datastore_admin_v1.services.datastore_admin import pagers
|
48 | 48 | from google.cloud.datastore_admin_v1.types import datastore_admin
|
49 | 49 | from google.cloud.datastore_admin_v1.types import index
|
| 50 | +from google.longrunning import operations_pb2 |
50 | 51 | from google.protobuf import empty_pb2 # type: ignore
|
51 | 52 | from .transports.base import DatastoreAdminTransport, DEFAULT_CLIENT_INFO
|
52 | 53 | from .transports.grpc_asyncio import DatastoreAdminGrpcAsyncIOTransport
|
@@ -1054,6 +1055,223 @@ async def sample_list_indexes():
|
1054 | 1055 | # Done; return the response.
|
1055 | 1056 | return response
|
1056 | 1057 |
|
| 1058 | + async def list_operations( |
| 1059 | + self, |
| 1060 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 1061 | + *, |
| 1062 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1063 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1064 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1065 | + ) -> operations_pb2.ListOperationsResponse: |
| 1066 | + r"""Lists operations that match the specified filter in the request. |
| 1067 | +
|
| 1068 | + Args: |
| 1069 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 1070 | + The request object. Request message for |
| 1071 | + `ListOperations` method. |
| 1072 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1073 | + if any, should be retried. |
| 1074 | + timeout (float): The timeout for this request. |
| 1075 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1076 | + sent along with the request as metadata. |
| 1077 | + Returns: |
| 1078 | + ~.operations_pb2.ListOperationsResponse: |
| 1079 | + Response message for ``ListOperations`` method. |
| 1080 | + """ |
| 1081 | + # Create or coerce a protobuf request object. |
| 1082 | + # The request isn't a proto-plus wrapped type, |
| 1083 | + # so it must be constructed via keyword expansion. |
| 1084 | + if isinstance(request, dict): |
| 1085 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1086 | + |
| 1087 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1088 | + # and friendly error handling. |
| 1089 | + rpc = gapic_v1.method.wrap_method( |
| 1090 | + self._client._transport.list_operations, |
| 1091 | + default_timeout=None, |
| 1092 | + client_info=DEFAULT_CLIENT_INFO, |
| 1093 | + ) |
| 1094 | + |
| 1095 | + # Certain fields should be provided within the metadata header; |
| 1096 | + # add these here. |
| 1097 | + metadata = tuple(metadata) + ( |
| 1098 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1099 | + ) |
| 1100 | + |
| 1101 | + # Send the request. |
| 1102 | + response = await rpc( |
| 1103 | + request, |
| 1104 | + retry=retry, |
| 1105 | + timeout=timeout, |
| 1106 | + metadata=metadata, |
| 1107 | + ) |
| 1108 | + |
| 1109 | + # Done; return the response. |
| 1110 | + return response |
| 1111 | + |
| 1112 | + async def get_operation( |
| 1113 | + self, |
| 1114 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 1115 | + *, |
| 1116 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1117 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1118 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1119 | + ) -> operations_pb2.Operation: |
| 1120 | + r"""Gets the latest state of a long-running operation. |
| 1121 | +
|
| 1122 | + Args: |
| 1123 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1124 | + The request object. Request message for |
| 1125 | + `GetOperation` method. |
| 1126 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1127 | + if any, should be retried. |
| 1128 | + timeout (float): The timeout for this request. |
| 1129 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1130 | + sent along with the request as metadata. |
| 1131 | + Returns: |
| 1132 | + ~.operations_pb2.Operation: |
| 1133 | + An ``Operation`` object. |
| 1134 | + """ |
| 1135 | + # Create or coerce a protobuf request object. |
| 1136 | + # The request isn't a proto-plus wrapped type, |
| 1137 | + # so it must be constructed via keyword expansion. |
| 1138 | + if isinstance(request, dict): |
| 1139 | + request = operations_pb2.GetOperationRequest(**request) |
| 1140 | + |
| 1141 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1142 | + # and friendly error handling. |
| 1143 | + rpc = gapic_v1.method.wrap_method( |
| 1144 | + self._client._transport.get_operation, |
| 1145 | + default_timeout=None, |
| 1146 | + client_info=DEFAULT_CLIENT_INFO, |
| 1147 | + ) |
| 1148 | + |
| 1149 | + # Certain fields should be provided within the metadata header; |
| 1150 | + # add these here. |
| 1151 | + metadata = tuple(metadata) + ( |
| 1152 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1153 | + ) |
| 1154 | + |
| 1155 | + # Send the request. |
| 1156 | + response = await rpc( |
| 1157 | + request, |
| 1158 | + retry=retry, |
| 1159 | + timeout=timeout, |
| 1160 | + metadata=metadata, |
| 1161 | + ) |
| 1162 | + |
| 1163 | + # Done; return the response. |
| 1164 | + return response |
| 1165 | + |
| 1166 | + async def delete_operation( |
| 1167 | + self, |
| 1168 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 1169 | + *, |
| 1170 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1171 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1172 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1173 | + ) -> None: |
| 1174 | + r"""Deletes a long-running operation. |
| 1175 | +
|
| 1176 | + This method indicates that the client is no longer interested |
| 1177 | + in the operation result. It does not cancel the operation. |
| 1178 | + If the server doesn't support this method, it returns |
| 1179 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1180 | +
|
| 1181 | + Args: |
| 1182 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 1183 | + The request object. Request message for |
| 1184 | + `DeleteOperation` method. |
| 1185 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1186 | + if any, should be retried. |
| 1187 | + timeout (float): The timeout for this request. |
| 1188 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1189 | + sent along with the request as metadata. |
| 1190 | + Returns: |
| 1191 | + None |
| 1192 | + """ |
| 1193 | + # Create or coerce a protobuf request object. |
| 1194 | + # The request isn't a proto-plus wrapped type, |
| 1195 | + # so it must be constructed via keyword expansion. |
| 1196 | + if isinstance(request, dict): |
| 1197 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 1198 | + |
| 1199 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1200 | + # and friendly error handling. |
| 1201 | + rpc = gapic_v1.method.wrap_method( |
| 1202 | + self._client._transport.delete_operation, |
| 1203 | + default_timeout=None, |
| 1204 | + client_info=DEFAULT_CLIENT_INFO, |
| 1205 | + ) |
| 1206 | + |
| 1207 | + # Certain fields should be provided within the metadata header; |
| 1208 | + # add these here. |
| 1209 | + metadata = tuple(metadata) + ( |
| 1210 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1211 | + ) |
| 1212 | + |
| 1213 | + # Send the request. |
| 1214 | + await rpc( |
| 1215 | + request, |
| 1216 | + retry=retry, |
| 1217 | + timeout=timeout, |
| 1218 | + metadata=metadata, |
| 1219 | + ) |
| 1220 | + |
| 1221 | + async def cancel_operation( |
| 1222 | + self, |
| 1223 | + request: Optional[operations_pb2.CancelOperationRequest] = None, |
| 1224 | + *, |
| 1225 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1226 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1227 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1228 | + ) -> None: |
| 1229 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 1230 | +
|
| 1231 | + The server makes a best effort to cancel the operation, but success |
| 1232 | + is not guaranteed. If the server doesn't support this method, it returns |
| 1233 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1234 | +
|
| 1235 | + Args: |
| 1236 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 1237 | + The request object. Request message for |
| 1238 | + `CancelOperation` method. |
| 1239 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1240 | + if any, should be retried. |
| 1241 | + timeout (float): The timeout for this request. |
| 1242 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1243 | + sent along with the request as metadata. |
| 1244 | + Returns: |
| 1245 | + None |
| 1246 | + """ |
| 1247 | + # Create or coerce a protobuf request object. |
| 1248 | + # The request isn't a proto-plus wrapped type, |
| 1249 | + # so it must be constructed via keyword expansion. |
| 1250 | + if isinstance(request, dict): |
| 1251 | + request = operations_pb2.CancelOperationRequest(**request) |
| 1252 | + |
| 1253 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1254 | + # and friendly error handling. |
| 1255 | + rpc = gapic_v1.method.wrap_method( |
| 1256 | + self._client._transport.cancel_operation, |
| 1257 | + default_timeout=None, |
| 1258 | + client_info=DEFAULT_CLIENT_INFO, |
| 1259 | + ) |
| 1260 | + |
| 1261 | + # Certain fields should be provided within the metadata header; |
| 1262 | + # add these here. |
| 1263 | + metadata = tuple(metadata) + ( |
| 1264 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1265 | + ) |
| 1266 | + |
| 1267 | + # Send the request. |
| 1268 | + await rpc( |
| 1269 | + request, |
| 1270 | + retry=retry, |
| 1271 | + timeout=timeout, |
| 1272 | + metadata=metadata, |
| 1273 | + ) |
| 1274 | + |
1057 | 1275 | async def __aenter__(self):
|
1058 | 1276 | return self
|
1059 | 1277 |
|
|
0 commit comments