|
44 | 44 |
|
45 | 45 | from google.api_core import operation # type: ignore |
46 | 46 | from google.api_core import operation_async # type: ignore |
| 47 | +from google.cloud.location import locations_pb2 # type: ignore |
| 48 | +from google.longrunning import operations_pb2 |
47 | 49 | from google.protobuf import empty_pb2 # type: ignore |
48 | 50 | from google.protobuf import field_mask_pb2 # type: ignore |
49 | 51 | from google.protobuf import timestamp_pb2 # type: ignore |
@@ -2317,6 +2319,331 @@ async def sample_delete_vpn_connection(): |
2317 | 2319 | # Done; return the response. |
2318 | 2320 | return response |
2319 | 2321 |
|
| 2322 | + async def list_operations( |
| 2323 | + self, |
| 2324 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 2325 | + *, |
| 2326 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2327 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2328 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2329 | + ) -> operations_pb2.ListOperationsResponse: |
| 2330 | + r"""Lists operations that match the specified filter in the request. |
| 2331 | +
|
| 2332 | + Args: |
| 2333 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 2334 | + The request object. Request message for |
| 2335 | + `ListOperations` method. |
| 2336 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2337 | + if any, should be retried. |
| 2338 | + timeout (float): The timeout for this request. |
| 2339 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2340 | + sent along with the request as metadata. |
| 2341 | + Returns: |
| 2342 | + ~.operations_pb2.ListOperationsResponse: |
| 2343 | + Response message for ``ListOperations`` method. |
| 2344 | + """ |
| 2345 | + # Create or coerce a protobuf request object. |
| 2346 | + # The request isn't a proto-plus wrapped type, |
| 2347 | + # so it must be constructed via keyword expansion. |
| 2348 | + if isinstance(request, dict): |
| 2349 | + request = operations_pb2.ListOperationsRequest(**request) |
| 2350 | + |
| 2351 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2352 | + # and friendly error handling. |
| 2353 | + rpc = gapic_v1.method.wrap_method( |
| 2354 | + self._client._transport.list_operations, |
| 2355 | + default_timeout=None, |
| 2356 | + client_info=DEFAULT_CLIENT_INFO, |
| 2357 | + ) |
| 2358 | + |
| 2359 | + # Certain fields should be provided within the metadata header; |
| 2360 | + # add these here. |
| 2361 | + metadata = tuple(metadata) + ( |
| 2362 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2363 | + ) |
| 2364 | + |
| 2365 | + # Send the request. |
| 2366 | + response = await rpc( |
| 2367 | + request, |
| 2368 | + retry=retry, |
| 2369 | + timeout=timeout, |
| 2370 | + metadata=metadata, |
| 2371 | + ) |
| 2372 | + |
| 2373 | + # Done; return the response. |
| 2374 | + return response |
| 2375 | + |
| 2376 | + async def get_operation( |
| 2377 | + self, |
| 2378 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 2379 | + *, |
| 2380 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2381 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2382 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2383 | + ) -> operations_pb2.Operation: |
| 2384 | + r"""Gets the latest state of a long-running operation. |
| 2385 | +
|
| 2386 | + Args: |
| 2387 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 2388 | + The request object. Request message for |
| 2389 | + `GetOperation` method. |
| 2390 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2391 | + if any, should be retried. |
| 2392 | + timeout (float): The timeout for this request. |
| 2393 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2394 | + sent along with the request as metadata. |
| 2395 | + Returns: |
| 2396 | + ~.operations_pb2.Operation: |
| 2397 | + An ``Operation`` object. |
| 2398 | + """ |
| 2399 | + # Create or coerce a protobuf request object. |
| 2400 | + # The request isn't a proto-plus wrapped type, |
| 2401 | + # so it must be constructed via keyword expansion. |
| 2402 | + if isinstance(request, dict): |
| 2403 | + request = operations_pb2.GetOperationRequest(**request) |
| 2404 | + |
| 2405 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2406 | + # and friendly error handling. |
| 2407 | + rpc = gapic_v1.method.wrap_method( |
| 2408 | + self._client._transport.get_operation, |
| 2409 | + default_timeout=None, |
| 2410 | + client_info=DEFAULT_CLIENT_INFO, |
| 2411 | + ) |
| 2412 | + |
| 2413 | + # Certain fields should be provided within the metadata header; |
| 2414 | + # add these here. |
| 2415 | + metadata = tuple(metadata) + ( |
| 2416 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2417 | + ) |
| 2418 | + |
| 2419 | + # Send the request. |
| 2420 | + response = await rpc( |
| 2421 | + request, |
| 2422 | + retry=retry, |
| 2423 | + timeout=timeout, |
| 2424 | + metadata=metadata, |
| 2425 | + ) |
| 2426 | + |
| 2427 | + # Done; return the response. |
| 2428 | + return response |
| 2429 | + |
| 2430 | + async def delete_operation( |
| 2431 | + self, |
| 2432 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 2433 | + *, |
| 2434 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2435 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2436 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2437 | + ) -> None: |
| 2438 | + r"""Deletes a long-running operation. |
| 2439 | +
|
| 2440 | + This method indicates that the client is no longer interested |
| 2441 | + in the operation result. It does not cancel the operation. |
| 2442 | + If the server doesn't support this method, it returns |
| 2443 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 2444 | +
|
| 2445 | + Args: |
| 2446 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 2447 | + The request object. Request message for |
| 2448 | + `DeleteOperation` method. |
| 2449 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2450 | + if any, should be retried. |
| 2451 | + timeout (float): The timeout for this request. |
| 2452 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2453 | + sent along with the request as metadata. |
| 2454 | + Returns: |
| 2455 | + None |
| 2456 | + """ |
| 2457 | + # Create or coerce a protobuf request object. |
| 2458 | + # The request isn't a proto-plus wrapped type, |
| 2459 | + # so it must be constructed via keyword expansion. |
| 2460 | + if isinstance(request, dict): |
| 2461 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 2462 | + |
| 2463 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2464 | + # and friendly error handling. |
| 2465 | + rpc = gapic_v1.method.wrap_method( |
| 2466 | + self._client._transport.delete_operation, |
| 2467 | + default_timeout=None, |
| 2468 | + client_info=DEFAULT_CLIENT_INFO, |
| 2469 | + ) |
| 2470 | + |
| 2471 | + # Certain fields should be provided within the metadata header; |
| 2472 | + # add these here. |
| 2473 | + metadata = tuple(metadata) + ( |
| 2474 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2475 | + ) |
| 2476 | + |
| 2477 | + # Send the request. |
| 2478 | + await rpc( |
| 2479 | + request, |
| 2480 | + retry=retry, |
| 2481 | + timeout=timeout, |
| 2482 | + metadata=metadata, |
| 2483 | + ) |
| 2484 | + |
| 2485 | + async def cancel_operation( |
| 2486 | + self, |
| 2487 | + request: Optional[operations_pb2.CancelOperationRequest] = None, |
| 2488 | + *, |
| 2489 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2490 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2491 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2492 | + ) -> None: |
| 2493 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 2494 | +
|
| 2495 | + The server makes a best effort to cancel the operation, but success |
| 2496 | + is not guaranteed. If the server doesn't support this method, it returns |
| 2497 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 2498 | +
|
| 2499 | + Args: |
| 2500 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 2501 | + The request object. Request message for |
| 2502 | + `CancelOperation` method. |
| 2503 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2504 | + if any, should be retried. |
| 2505 | + timeout (float): The timeout for this request. |
| 2506 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2507 | + sent along with the request as metadata. |
| 2508 | + Returns: |
| 2509 | + None |
| 2510 | + """ |
| 2511 | + # Create or coerce a protobuf request object. |
| 2512 | + # The request isn't a proto-plus wrapped type, |
| 2513 | + # so it must be constructed via keyword expansion. |
| 2514 | + if isinstance(request, dict): |
| 2515 | + request = operations_pb2.CancelOperationRequest(**request) |
| 2516 | + |
| 2517 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2518 | + # and friendly error handling. |
| 2519 | + rpc = gapic_v1.method.wrap_method( |
| 2520 | + self._client._transport.cancel_operation, |
| 2521 | + default_timeout=None, |
| 2522 | + client_info=DEFAULT_CLIENT_INFO, |
| 2523 | + ) |
| 2524 | + |
| 2525 | + # Certain fields should be provided within the metadata header; |
| 2526 | + # add these here. |
| 2527 | + metadata = tuple(metadata) + ( |
| 2528 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2529 | + ) |
| 2530 | + |
| 2531 | + # Send the request. |
| 2532 | + await rpc( |
| 2533 | + request, |
| 2534 | + retry=retry, |
| 2535 | + timeout=timeout, |
| 2536 | + metadata=metadata, |
| 2537 | + ) |
| 2538 | + |
| 2539 | + async def get_location( |
| 2540 | + self, |
| 2541 | + request: Optional[locations_pb2.GetLocationRequest] = None, |
| 2542 | + *, |
| 2543 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2544 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2545 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2546 | + ) -> locations_pb2.Location: |
| 2547 | + r"""Gets information about a location. |
| 2548 | +
|
| 2549 | + Args: |
| 2550 | + request (:class:`~.location_pb2.GetLocationRequest`): |
| 2551 | + The request object. Request message for |
| 2552 | + `GetLocation` method. |
| 2553 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2554 | + if any, should be retried. |
| 2555 | + timeout (float): The timeout for this request. |
| 2556 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2557 | + sent along with the request as metadata. |
| 2558 | + Returns: |
| 2559 | + ~.location_pb2.Location: |
| 2560 | + Location object. |
| 2561 | + """ |
| 2562 | + # Create or coerce a protobuf request object. |
| 2563 | + # The request isn't a proto-plus wrapped type, |
| 2564 | + # so it must be constructed via keyword expansion. |
| 2565 | + if isinstance(request, dict): |
| 2566 | + request = locations_pb2.GetLocationRequest(**request) |
| 2567 | + |
| 2568 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2569 | + # and friendly error handling. |
| 2570 | + rpc = gapic_v1.method.wrap_method( |
| 2571 | + self._client._transport.get_location, |
| 2572 | + default_timeout=None, |
| 2573 | + client_info=DEFAULT_CLIENT_INFO, |
| 2574 | + ) |
| 2575 | + |
| 2576 | + # Certain fields should be provided within the metadata header; |
| 2577 | + # add these here. |
| 2578 | + metadata = tuple(metadata) + ( |
| 2579 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2580 | + ) |
| 2581 | + |
| 2582 | + # Send the request. |
| 2583 | + response = await rpc( |
| 2584 | + request, |
| 2585 | + retry=retry, |
| 2586 | + timeout=timeout, |
| 2587 | + metadata=metadata, |
| 2588 | + ) |
| 2589 | + |
| 2590 | + # Done; return the response. |
| 2591 | + return response |
| 2592 | + |
| 2593 | + async def list_locations( |
| 2594 | + self, |
| 2595 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 2596 | + *, |
| 2597 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 2598 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 2599 | + metadata: Sequence[Tuple[str, str]] = (), |
| 2600 | + ) -> locations_pb2.ListLocationsResponse: |
| 2601 | + r"""Lists information about the supported locations for this service. |
| 2602 | +
|
| 2603 | + Args: |
| 2604 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 2605 | + The request object. Request message for |
| 2606 | + `ListLocations` method. |
| 2607 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 2608 | + if any, should be retried. |
| 2609 | + timeout (float): The timeout for this request. |
| 2610 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 2611 | + sent along with the request as metadata. |
| 2612 | + Returns: |
| 2613 | + ~.location_pb2.ListLocationsResponse: |
| 2614 | + Response message for ``ListLocations`` method. |
| 2615 | + """ |
| 2616 | + # Create or coerce a protobuf request object. |
| 2617 | + # The request isn't a proto-plus wrapped type, |
| 2618 | + # so it must be constructed via keyword expansion. |
| 2619 | + if isinstance(request, dict): |
| 2620 | + request = locations_pb2.ListLocationsRequest(**request) |
| 2621 | + |
| 2622 | + # Wrap the RPC method; this adds retry and timeout information, |
| 2623 | + # and friendly error handling. |
| 2624 | + rpc = gapic_v1.method.wrap_method( |
| 2625 | + self._client._transport.list_locations, |
| 2626 | + default_timeout=None, |
| 2627 | + client_info=DEFAULT_CLIENT_INFO, |
| 2628 | + ) |
| 2629 | + |
| 2630 | + # Certain fields should be provided within the metadata header; |
| 2631 | + # add these here. |
| 2632 | + metadata = tuple(metadata) + ( |
| 2633 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 2634 | + ) |
| 2635 | + |
| 2636 | + # Send the request. |
| 2637 | + response = await rpc( |
| 2638 | + request, |
| 2639 | + retry=retry, |
| 2640 | + timeout=timeout, |
| 2641 | + metadata=metadata, |
| 2642 | + ) |
| 2643 | + |
| 2644 | + # Done; return the response. |
| 2645 | + return response |
| 2646 | + |
2320 | 2647 | async def __aenter__(self): |
2321 | 2648 | return self |
2322 | 2649 |
|
|
0 commit comments