|
43 | 43 |
|
44 | 44 | from google.api_core import operation # type: ignore
|
45 | 45 | from google.api_core import operation_async # type: ignore
|
| 46 | +from google.cloud.location import locations_pb2 # type: ignore |
| 47 | +from google.longrunning import operations_pb2 |
46 | 48 | from google.protobuf import timestamp_pb2 # type: ignore
|
47 | 49 |
|
48 | 50 | from google.cloud.tpu_v1.services.tpu import pagers
|
@@ -776,7 +778,8 @@ async def stop_node(
|
776 | 778 | timeout: Optional[float] = None,
|
777 | 779 | metadata: Sequence[Tuple[str, str]] = (),
|
778 | 780 | ) -> operation_async.AsyncOperation:
|
779 |
| - r"""Stops a node. |
| 781 | + r"""Stops a node, this operation is only available with |
| 782 | + single TPU nodes. |
780 | 783 |
|
781 | 784 | .. code-block:: python
|
782 | 785 |
|
@@ -1380,6 +1383,331 @@ async def sample_get_accelerator_type():
|
1380 | 1383 | # Done; return the response.
|
1381 | 1384 | return response
|
1382 | 1385 |
|
| 1386 | + async def list_operations( |
| 1387 | + self, |
| 1388 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 1389 | + *, |
| 1390 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1391 | + timeout: Optional[float] = None, |
| 1392 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1393 | + ) -> operations_pb2.ListOperationsResponse: |
| 1394 | + r"""Lists operations that match the specified filter in the request. |
| 1395 | +
|
| 1396 | + Args: |
| 1397 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 1398 | + The request object. Request message for |
| 1399 | + `ListOperations` method. |
| 1400 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1401 | + if any, should be retried. |
| 1402 | + timeout (float): The timeout for this request. |
| 1403 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1404 | + sent along with the request as metadata. |
| 1405 | + Returns: |
| 1406 | + ~.operations_pb2.ListOperationsResponse: |
| 1407 | + Response message for ``ListOperations`` method. |
| 1408 | + """ |
| 1409 | + # Create or coerce a protobuf request object. |
| 1410 | + # The request isn't a proto-plus wrapped type, |
| 1411 | + # so it must be constructed via keyword expansion. |
| 1412 | + if isinstance(request, dict): |
| 1413 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1414 | + |
| 1415 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1416 | + # and friendly error handling. |
| 1417 | + rpc = gapic_v1.method.wrap_method( |
| 1418 | + self._client._transport.list_operations, |
| 1419 | + default_timeout=None, |
| 1420 | + client_info=DEFAULT_CLIENT_INFO, |
| 1421 | + ) |
| 1422 | + |
| 1423 | + # Certain fields should be provided within the metadata header; |
| 1424 | + # add these here. |
| 1425 | + metadata = tuple(metadata) + ( |
| 1426 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1427 | + ) |
| 1428 | + |
| 1429 | + # Send the request. |
| 1430 | + response = await rpc( |
| 1431 | + request, |
| 1432 | + retry=retry, |
| 1433 | + timeout=timeout, |
| 1434 | + metadata=metadata, |
| 1435 | + ) |
| 1436 | + |
| 1437 | + # Done; return the response. |
| 1438 | + return response |
| 1439 | + |
| 1440 | + async def get_operation( |
| 1441 | + self, |
| 1442 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 1443 | + *, |
| 1444 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1445 | + timeout: Optional[float] = None, |
| 1446 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1447 | + ) -> operations_pb2.Operation: |
| 1448 | + r"""Gets the latest state of a long-running operation. |
| 1449 | +
|
| 1450 | + Args: |
| 1451 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1452 | + The request object. Request message for |
| 1453 | + `GetOperation` method. |
| 1454 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1455 | + if any, should be retried. |
| 1456 | + timeout (float): The timeout for this request. |
| 1457 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1458 | + sent along with the request as metadata. |
| 1459 | + Returns: |
| 1460 | + ~.operations_pb2.Operation: |
| 1461 | + An ``Operation`` object. |
| 1462 | + """ |
| 1463 | + # Create or coerce a protobuf request object. |
| 1464 | + # The request isn't a proto-plus wrapped type, |
| 1465 | + # so it must be constructed via keyword expansion. |
| 1466 | + if isinstance(request, dict): |
| 1467 | + request = operations_pb2.GetOperationRequest(**request) |
| 1468 | + |
| 1469 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1470 | + # and friendly error handling. |
| 1471 | + rpc = gapic_v1.method.wrap_method( |
| 1472 | + self._client._transport.get_operation, |
| 1473 | + default_timeout=None, |
| 1474 | + client_info=DEFAULT_CLIENT_INFO, |
| 1475 | + ) |
| 1476 | + |
| 1477 | + # Certain fields should be provided within the metadata header; |
| 1478 | + # add these here. |
| 1479 | + metadata = tuple(metadata) + ( |
| 1480 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1481 | + ) |
| 1482 | + |
| 1483 | + # Send the request. |
| 1484 | + response = await rpc( |
| 1485 | + request, |
| 1486 | + retry=retry, |
| 1487 | + timeout=timeout, |
| 1488 | + metadata=metadata, |
| 1489 | + ) |
| 1490 | + |
| 1491 | + # Done; return the response. |
| 1492 | + return response |
| 1493 | + |
| 1494 | + async def delete_operation( |
| 1495 | + self, |
| 1496 | + request: Optional[operations_pb2.DeleteOperationRequest] = None, |
| 1497 | + *, |
| 1498 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1499 | + timeout: Optional[float] = None, |
| 1500 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1501 | + ) -> None: |
| 1502 | + r"""Deletes a long-running operation. |
| 1503 | +
|
| 1504 | + This method indicates that the client is no longer interested |
| 1505 | + in the operation result. It does not cancel the operation. |
| 1506 | + If the server doesn't support this method, it returns |
| 1507 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1508 | +
|
| 1509 | + Args: |
| 1510 | + request (:class:`~.operations_pb2.DeleteOperationRequest`): |
| 1511 | + The request object. Request message for |
| 1512 | + `DeleteOperation` method. |
| 1513 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1514 | + if any, should be retried. |
| 1515 | + timeout (float): The timeout for this request. |
| 1516 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1517 | + sent along with the request as metadata. |
| 1518 | + Returns: |
| 1519 | + None |
| 1520 | + """ |
| 1521 | + # Create or coerce a protobuf request object. |
| 1522 | + # The request isn't a proto-plus wrapped type, |
| 1523 | + # so it must be constructed via keyword expansion. |
| 1524 | + if isinstance(request, dict): |
| 1525 | + request = operations_pb2.DeleteOperationRequest(**request) |
| 1526 | + |
| 1527 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1528 | + # and friendly error handling. |
| 1529 | + rpc = gapic_v1.method.wrap_method( |
| 1530 | + self._client._transport.delete_operation, |
| 1531 | + default_timeout=None, |
| 1532 | + client_info=DEFAULT_CLIENT_INFO, |
| 1533 | + ) |
| 1534 | + |
| 1535 | + # Certain fields should be provided within the metadata header; |
| 1536 | + # add these here. |
| 1537 | + metadata = tuple(metadata) + ( |
| 1538 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1539 | + ) |
| 1540
+ |
| 1541 | + # Send the request. |
| 1542 | + await rpc( |
| 1543 | + request, |
| 1544 | + retry=retry, |
| 1545 | + timeout=timeout, |
| 1546 | + metadata=metadata, |
| 1547 | + ) |
| 1548 | + |
| 1549 | + async def cancel_operation( |
| 1550 | + self, |
| 1551 | + request: Optional[operations_pb2.CancelOperationRequest] = None, |
| 1552 | + *, |
| 1553 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1554 | + timeout: Optional[float] = None, |
| 1555 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1556 | + ) -> None: |
| 1557 | + r"""Starts asynchronous cancellation on a long-running operation. |
| 1558 | +
|
| 1559 | + The server makes a best effort to cancel the operation, but success |
| 1560 | + is not guaranteed. If the server doesn't support this method, it returns |
| 1561 | + `google.rpc.Code.UNIMPLEMENTED`. |
| 1562 | +
|
| 1563 | + Args: |
| 1564 | + request (:class:`~.operations_pb2.CancelOperationRequest`): |
| 1565 | + The request object. Request message for |
| 1566 | + `CancelOperation` method. |
| 1567 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1568 | + if any, should be retried. |
| 1569 | + timeout (float): The timeout for this request. |
| 1570 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1571 | + sent along with the request as metadata. |
| 1572 | + Returns: |
| 1573 | + None |
| 1574 | + """ |
| 1575 | + # Create or coerce a protobuf request object. |
| 1576 | + # The request isn't a proto-plus wrapped type, |
| 1577 | + # so it must be constructed via keyword expansion. |
| 1578 | + if isinstance(request, dict): |
| 1579 | + request = operations_pb2.CancelOperationRequest(**request) |
| 1580 | + |
| 1581 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1582 | + # and friendly error handling. |
| 1583 | + rpc = gapic_v1.method.wrap_method( |
| 1584 | + self._client._transport.cancel_operation, |
| 1585 | + default_timeout=None, |
| 1586 | + client_info=DEFAULT_CLIENT_INFO, |
| 1587 | + ) |
| 1588 | + |
| 1589 | + # Certain fields should be provided within the metadata header; |
| 1590 | + # add these here. |
| 1591 | + metadata = tuple(metadata) + ( |
| 1592 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1593 | + ) |
| 1594 | + |
| 1595 | + # Send the request. |
| 1596 | + await rpc( |
| 1597 | + request, |
| 1598 | + retry=retry, |
| 1599 | + timeout=timeout, |
| 1600 | + metadata=metadata, |
| 1601 | + ) |
| 1602 | + |
| 1603 | + async def get_location( |
| 1604 | + self, |
| 1605 | + request: Optional[locations_pb2.GetLocationRequest] = None, |
| 1606 | + *, |
| 1607 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1608 | + timeout: Optional[float] = None, |
| 1609 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1610 | + ) -> locations_pb2.Location: |
| 1611 | + r"""Gets information about a location. |
| 1612 | +
|
| 1613 | + Args: |
| 1614 | + request (:class:`~.location_pb2.GetLocationRequest`): |
| 1615 | + The request object. Request message for |
| 1616 | + `GetLocation` method. |
| 1617 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1618 | + if any, should be retried. |
| 1619 | + timeout (float): The timeout for this request. |
| 1620 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1621 | + sent along with the request as metadata. |
| 1622 | + Returns: |
| 1623 | + ~.location_pb2.Location: |
| 1624 | + Location object. |
| 1625 | + """ |
| 1626 | + # Create or coerce a protobuf request object. |
| 1627 | + # The request isn't a proto-plus wrapped type, |
| 1628 | + # so it must be constructed via keyword expansion. |
| 1629 | + if isinstance(request, dict): |
| 1630 | + request = locations_pb2.GetLocationRequest(**request) |
| 1631 | + |
| 1632 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1633 | + # and friendly error handling. |
| 1634 | + rpc = gapic_v1.method.wrap_method( |
| 1635 | + self._client._transport.get_location, |
| 1636 | + default_timeout=None, |
| 1637 | + client_info=DEFAULT_CLIENT_INFO, |
| 1638 | + ) |
| 1639 | + |
| 1640 | + # Certain fields should be provided within the metadata header; |
| 1641 | + # add these here. |
| 1642 | + metadata = tuple(metadata) + ( |
| 1643 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1644 | + ) |
| 1645 | + |
| 1646 | + # Send the request. |
| 1647 | + response = await rpc( |
| 1648 | + request, |
| 1649 | + retry=retry, |
| 1650 | + timeout=timeout, |
| 1651 | + metadata=metadata, |
| 1652 | + ) |
| 1653 | + |
| 1654 | + # Done; return the response. |
| 1655 | + return response |
| 1656 | + |
| 1657 | + async def list_locations( |
| 1658 | + self, |
| 1659 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 1660 | + *, |
| 1661 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1662 | + timeout: Optional[float] = None, |
| 1663 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1664 | + ) -> locations_pb2.ListLocationsResponse: |
| 1665 | + r"""Lists information about the supported locations for this service. |
| 1666 | +
|
| 1667 | + Args: |
| 1668 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 1669 | + The request object. Request message for |
| 1670 | + `ListLocations` method. |
| 1671 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1672 | + if any, should be retried. |
| 1673 | + timeout (float): The timeout for this request. |
| 1674 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1675 | + sent along with the request as metadata. |
| 1676 | + Returns: |
| 1677 | + ~.location_pb2.ListLocationsResponse: |
| 1678 | + Response message for ``ListLocations`` method. |
| 1679 | + """ |
| 1680 | + # Create or coerce a protobuf request object. |
| 1681 | + # The request isn't a proto-plus wrapped type, |
| 1682 | + # so it must be constructed via keyword expansion. |
| 1683 | + if isinstance(request, dict): |
| 1684 | + request = locations_pb2.ListLocationsRequest(**request) |
| 1685 | + |
| 1686 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1687 | + # and friendly error handling. |
| 1688 | + rpc = gapic_v1.method.wrap_method( |
| 1689 | + self._client._transport.list_locations, |
| 1690 | + default_timeout=None, |
| 1691 | + client_info=DEFAULT_CLIENT_INFO, |
| 1692 | + ) |
| 1693 | + |
| 1694 | + # Certain fields should be provided within the metadata header; |
| 1695 | + # add these here. |
| 1696 | + metadata = tuple(metadata) + ( |
| 1697 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1698 | + ) |
| 1699 | + |
| 1700 | + # Send the request. |
| 1701 | + response = await rpc( |
| 1702 | + request, |
| 1703 | + retry=retry, |
| 1704 | + timeout=timeout, |
| 1705 | + metadata=metadata, |
| 1706 | + ) |
| 1707 | + |
| 1708 | + # Done; return the response. |
| 1709 | + return response |
| 1710 | + |
1383 | 1711 | async def __aenter__(self):
|
1384 | 1712 | return self
|
1385 | 1713 |
|
|
0 commit comments