|
45 | 45 |
|
46 | 46 | from google.api_core import operation # type: ignore |
47 | 47 | from google.api_core import operation_async # type: ignore |
| 48 | +from google.cloud.location import locations_pb2 # type: ignore |
| 49 | +from google.longrunning import operations_pb2 # type: ignore |
48 | 50 | from google.protobuf import empty_pb2 # type: ignore |
49 | 51 | from google.protobuf import field_mask_pb2 # type: ignore |
50 | 52 | from google.protobuf import timestamp_pb2 # type: ignore |
@@ -979,6 +981,282 @@ async def sample_update_workflow(): |
979 | 981 | # Done; return the response. |
980 | 982 | return response |
981 | 983 |
|
| 984 | + async def list_operations( |
| 985 | + self, |
| 986 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 987 | + *, |
| 988 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 989 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 990 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 991 | + ) -> operations_pb2.ListOperationsResponse: |
| 992 | + r"""Lists operations that match the specified filter in the request. |
| 993 | +
|
| 994 | + Args: |
| 995 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 996 | + The request object. Request message for |
| 997 | + `ListOperations` method. |
| 998 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 999 | + if any, should be retried. |
| 1000 | + timeout (float): The timeout for this request. |
| 1001 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 1002 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 1003 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 1004 | + be of type `bytes`. |
| 1005 | + Returns: |
| 1006 | + ~.operations_pb2.ListOperationsResponse: |
| 1007 | + Response message for ``ListOperations`` method. |
| 1008 | + """ |
| 1009 | + # Create or coerce a protobuf request object. |
| 1010 | + # The request isn't a proto-plus wrapped type, |
| 1011 | + # so it must be constructed via keyword expansion. |
| 1012 | + if isinstance(request, dict): |
| 1013 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1014 | + |
| 1015 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1016 | + # and friendly error handling. |
| 1017 | + rpc = self.transport._wrapped_methods[self._client._transport.list_operations] |
| 1018 | + |
| 1019 | + # Certain fields should be provided within the metadata header; |
| 1020 | + # add these here. |
| 1021 | + metadata = tuple(metadata) + ( |
| 1022 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1023 | + ) |
| 1024 | + |
| 1025 | + # Validate the universe domain. |
| 1026 | + self._client._validate_universe_domain() |
| 1027 | + |
| 1028 | + # Send the request. |
| 1029 | + response = await rpc( |
| 1030 | + request, |
| 1031 | + retry=retry, |
| 1032 | + timeout=timeout, |
| 1033 | + metadata=metadata, |
| 1034 | + ) |
| 1035 | + |
| 1036 | + # Done; return the response. |
| 1037 | + return response |
| 1038 | + |
| 1039 | + async def get_operation( |
| 1040 | + self, |
| 1041 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 1042 | + *, |
| 1043 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1044 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1045 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 1046 | + ) -> operations_pb2.Operation: |
| 1047 | + r"""Gets the latest state of a long-running operation. |
| 1048 | +
|
| 1049 | + Args: |
| 1050 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1051 | + The request object. Request message for |
| 1052 | + `GetOperation` method. |
| 1053 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 1054 | + if any, should be retried. |
| 1055 | + timeout (float): The timeout for this request. |
| 1056 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 1057 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 1058 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 1059 | + be of type `bytes`. |
| 1060 | + Returns: |
| 1061 | + ~.operations_pb2.Operation: |
| 1062 | + An ``Operation`` object. |
| 1063 | + """ |
| 1064 | + # Create or coerce a protobuf request object. |
| 1065 | + # The request isn't a proto-plus wrapped type, |
| 1066 | + # so it must be constructed via keyword expansion. |
| 1067 | + if isinstance(request, dict): |
| 1068 | + request = operations_pb2.GetOperationRequest(**request) |
| 1069 | + |
| 1070 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1071 | + # and friendly error handling. |
| 1072 | + rpc = self.transport._wrapped_methods[self._client._transport.get_operation] |
| 1073 | + |
| 1074 | + # Certain fields should be provided within the metadata header; |
| 1075 | + # add these here. |
| 1076 | + metadata = tuple(metadata) + ( |
| 1077 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1078 | + ) |
| 1079 | + |
| 1080 | + # Validate the universe domain. |
| 1081 | + self._client._validate_universe_domain() |
| 1082 | + |
| 1083 | + # Send the request. |
| 1084 | + response = await rpc( |
| 1085 | + request, |
| 1086 | + retry=retry, |
| 1087 | + timeout=timeout, |
| 1088 | + metadata=metadata, |
| 1089 | + ) |
| 1090 | + |
| 1091 | + # Done; return the response. |
| 1092 | + return response |
| 1093 | + |
| 1094 | + async def delete_operation( |
| 1095 | + self, |
| 1096 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 1097 | + *, |
| 1098 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1099 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1100 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 1101 | + ) -> None: |
| 1102 | + r"""Deletes a long-running operation. |
| 1103 | +
|
| 1104 | + This method indicates that the client is no longer interested |
| 1105 | + in the operation result. It does not cancel the operation. |
| 1106 | + If the server doesn't support this method, it returns |
| 1107 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1108 | +
|
| 1109 | + Args: |
| 1110 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 1111 | + The request object. Request message for |
| 1112 | + `DeleteOperation` method. |
| 1113 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 1114 | + if any, should be retried. |
| 1115 | + timeout (float): The timeout for this request. |
| 1116 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 1117 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 1118 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 1119 | + be of type `bytes`. |
| 1120 | + Returns: |
| 1121 | + None |
| 1122 | + """ |
| 1123 | + # Create or coerce a protobuf request object. |
| 1124 | + # The request isn't a proto-plus wrapped type, |
| 1125 | + # so it must be constructed via keyword expansion. |
| 1126 | + if isinstance(request, dict): |
| 1127 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 1128 | + |
| 1129 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1130 | + # and friendly error handling. |
| 1131 | + rpc = self.transport._wrapped_methods[self._client._transport.delete_operation] |
| 1132 | + |
| 1133 | + # Certain fields should be provided within the metadata header; |
| 1134 | + # add these here. |
| 1135 | + metadata = tuple(metadata) + ( |
| 1136 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1137 | + ) |
| 1138 | + |
| 1139 | + # Validate the universe domain. |
| 1140 | + self._client._validate_universe_domain() |
| 1141 | + |
| 1142 | + # Send the request. |
| 1143 | + await rpc( |
| 1144 | + request, |
| 1145 | + retry=retry, |
| 1146 | + timeout=timeout, |
| 1147 | + metadata=metadata, |
| 1148 | + ) |
| 1149 | + |
| 1150 | + async def get_location( |
| 1151 | + self, |
| 1152 | + request: Optional[locations_pb2.GetLocationRequest] = None, |
| 1153 | + *, |
| 1154 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1155 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1156 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 1157 | + ) -> locations_pb2.Location: |
| 1158 | + r"""Gets information about a location. |
| 1159 | +
|
| 1160 | + Args: |
| 1161 | + request (:class:`~.location_pb2.GetLocationRequest`): |
| 1162 | + The request object. Request message for |
| 1163 | + `GetLocation` method. |
| 1164 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 1165 | + if any, should be retried. |
| 1166 | + timeout (float): The timeout for this request. |
| 1167 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 1168 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 1169 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 1170 | + be of type `bytes`. |
| 1171 | + Returns: |
| 1172 | + ~.location_pb2.Location: |
| 1173 | + Location object. |
| 1174 | + """ |
| 1175 | + # Create or coerce a protobuf request object. |
| 1176 | + # The request isn't a proto-plus wrapped type, |
| 1177 | + # so it must be constructed via keyword expansion. |
| 1178 | + if isinstance(request, dict): |
| 1179 | + request = locations_pb2.GetLocationRequest(**request) |
| 1180 | + |
| 1181 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1182 | + # and friendly error handling. |
| 1183 | + rpc = self.transport._wrapped_methods[self._client._transport.get_location] |
| 1184 | + |
| 1185 | + # Certain fields should be provided within the metadata header; |
| 1186 | + # add these here. |
| 1187 | + metadata = tuple(metadata) + ( |
| 1188 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1189 | + ) |
| 1190 | + |
| 1191 | + # Validate the universe domain. |
| 1192 | + self._client._validate_universe_domain() |
| 1193 | + |
| 1194 | + # Send the request. |
| 1195 | + response = await rpc( |
| 1196 | + request, |
| 1197 | + retry=retry, |
| 1198 | + timeout=timeout, |
| 1199 | + metadata=metadata, |
| 1200 | + ) |
| 1201 | + |
| 1202 | + # Done; return the response. |
| 1203 | + return response |
| 1204 | + |
| 1205 | + async def list_locations( |
| 1206 | + self, |
| 1207 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 1208 | + *, |
| 1209 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1210 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1211 | + metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), |
| 1212 | + ) -> locations_pb2.ListLocationsResponse: |
| 1213 | + r"""Lists information about the supported locations for this service. |
| 1214 | +
|
| 1215 | + Args: |
| 1216 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 1217 | + The request object. Request message for |
| 1218 | + `ListLocations` method. |
| 1219 | + retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, |
| 1220 | + if any, should be retried. |
| 1221 | + timeout (float): The timeout for this request. |
| 1222 | + metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be |
| 1223 | + sent along with the request as metadata. Normally, each value must be of type `str`, |
| 1224 | + but for metadata keys ending with the suffix `-bin`, the corresponding values must |
| 1225 | + be of type `bytes`. |
| 1226 | + Returns: |
| 1227 | + ~.location_pb2.ListLocationsResponse: |
| 1228 | + Response message for ``ListLocations`` method. |
| 1229 | + """ |
| 1230 | + # Create or coerce a protobuf request object. |
| 1231 | + # The request isn't a proto-plus wrapped type, |
| 1232 | + # so it must be constructed via keyword expansion. |
| 1233 | + if isinstance(request, dict): |
| 1234 | + request = locations_pb2.ListLocationsRequest(**request) |
| 1235 | + |
| 1236 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1237 | + # and friendly error handling. |
| 1238 | + rpc = self.transport._wrapped_methods[self._client._transport.list_locations] |
| 1239 | + |
| 1240 | + # Certain fields should be provided within the metadata header; |
| 1241 | + # add these here. |
| 1242 | + metadata = tuple(metadata) + ( |
| 1243 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1244 | + ) |
| 1245 | + |
| 1246 | + # Validate the universe domain. |
| 1247 | + self._client._validate_universe_domain() |
| 1248 | + |
| 1249 | + # Send the request. |
| 1250 | + response = await rpc( |
| 1251 | + request, |
| 1252 | + retry=retry, |
| 1253 | + timeout=timeout, |
| 1254 | + metadata=metadata, |
| 1255 | + ) |
| 1256 | + |
| 1257 | + # Done; return the response. |
| 1258 | + return response |
| 1259 | + |
982 | 1260 | async def __aenter__(self) -> "WorkflowsAsyncClient": |
983 | 1261 | return self |
984 | 1262 |
|
|
0 commit comments