|
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 |
47 | 48 | from google.iam.v1 import iam_policy_pb2 # type: ignore
|
48 | 49 | from google.iam.v1 import policy_pb2 # type: ignore
|
| 50 | +from google.longrunning import operations_pb2 |
49 | 51 | from google.protobuf import duration_pb2 # type: ignore
|
50 | 52 | from google.protobuf import empty_pb2 # type: ignore
|
51 | 53 | from google.protobuf import timestamp_pb2 # type: ignore
|
@@ -396,7 +398,7 @@ async def sample_get_function():
|
396 | 398 | google.cloud.functions_v1.types.CloudFunction:
|
397 | 399 | Describes a Cloud Function that
|
398 | 400 | contains user computation executed in
|
399 |
| - response to an event. It encapsulate |
| 401 | + response to an event. It encapsulates |
400 | 402 | function and triggers configurations.
|
401 | 403 |
|
402 | 404 | """
|
@@ -464,7 +466,7 @@ async def create_function(
|
464 | 466 | ) -> operation_async.AsyncOperation:
|
465 | 467 | r"""Creates a new function. If a function with the given name
|
466 | 468 | already exists in the specified project, the long running
|
467 |
| - operation will return ``ALREADY_EXISTS`` error. |
| 469 | + operation returns an ``ALREADY_EXISTS`` error. |
468 | 470 |
|
469 | 471 | .. code-block:: python
|
470 | 472 |
|
@@ -527,7 +529,7 @@ async def sample_create_function():
|
527 | 529 | An object representing a long-running operation.
|
528 | 530 |
|
529 | 531 | The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
|
530 |
| - response to an event. It encapsulate function and |
| 532 | + response to an event. It encapsulates function and |
531 | 533 | triggers configurations.
|
532 | 534 |
|
533 | 535 | """
|
@@ -648,7 +650,7 @@ async def sample_update_function():
|
648 | 650 | An object representing a long-running operation.
|
649 | 651 |
|
650 | 652 | The result type for the operation will be :class:`google.cloud.functions_v1.types.CloudFunction` Describes a Cloud Function that contains user computation executed in
|
651 |
| - response to an event. It encapsulate function and |
| 653 | + response to an event. It encapsulates function and |
652 | 654 | triggers configurations.
|
653 | 655 |
|
654 | 656 | """
|
@@ -725,8 +727,7 @@ async def delete_function(
|
725 | 727 | ) -> operation_async.AsyncOperation:
|
726 | 728 | r"""Deletes a function with the given name from the
|
727 | 729 | specified project. If the given function is used by some
|
728 |
| - trigger, the trigger will be updated to remove this |
729 |
| - function. |
| 730 | + trigger, the trigger is updated to remove this function. |
730 | 731 |
|
731 | 732 | .. code-block:: python
|
732 | 733 |
|
@@ -990,13 +991,13 @@ async def generate_upload_url(
|
990 | 991 | credentials would be used, but that identity does not have
|
991 | 992 | permissions to upload files to the URL.
|
992 | 993 |
|
993 |
| - When making a HTTP PUT request, these two headers need to be |
| 994 | + When making an HTTP PUT request, these two headers must be |
994 | 995 | specified:
|
995 | 996 |
|
996 | 997 | - ``content-type: application/zip``
|
997 | 998 | - ``x-goog-content-length-range: 0,104857600``
|
998 | 999 |
|
999 |
| - And this header SHOULD NOT be specified: |
| 1000 | + And this header must NOT be specified: |
1000 | 1001 |
|
1001 | 1002 | - ``Authorization: Bearer YOUR_TOKEN``
|
1002 | 1003 |
|
@@ -1076,9 +1077,9 @@ async def generate_download_url(
|
1076 | 1077 | ) -> functions.GenerateDownloadUrlResponse:
|
1077 | 1078 | r"""Returns a signed URL for downloading deployed
|
1078 | 1079 | function source code. The URL is only valid for a
|
1079 |
| - limited period and should be used within minutes after |
| 1080 | + limited period and must be used within minutes after |
1080 | 1081 | generation.
|
1081 |
| - For more information about the signed URL usage see: |
| 1082 | + For more information about the signed URL usage, see: |
1082 | 1083 | https://cloud.google.com/storage/docs/access-control/signed-urls
|
1083 | 1084 |
|
1084 | 1085 | .. code-block:: python
|
@@ -1443,8 +1444,8 @@ async def test_iam_permissions(
|
1443 | 1444 | metadata: Sequence[Tuple[str, str]] = (),
|
1444 | 1445 | ) -> iam_policy_pb2.TestIamPermissionsResponse:
|
1445 | 1446 | r"""Tests the specified permissions against the IAM access control
|
1446 |
| - policy for a function. If the function does not exist, this will |
1447 |
| - return an empty set of permissions, not a NOT_FOUND error. |
| 1447 | + policy for a function. If the function does not exist, this |
| 1448 | + returns an empty set of permissions, not a NOT_FOUND error. |
1448 | 1449 |
|
1449 | 1450 | .. code-block:: python
|
1450 | 1451 |
|
@@ -1518,6 +1519,168 @@ async def sample_test_iam_permissions():
|
1518 | 1519 | # Done; return the response.
|
1519 | 1520 | return response
|
1520 | 1521 |
|
| 1522 | + async def list_operations( |
| 1523 | + self, |
| 1524 | + request: Optional[operations_pb2.ListOperationsRequest] = None, |
| 1525 | + *, |
| 1526 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1527 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1528 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1529 | + ) -> operations_pb2.ListOperationsResponse: |
| 1530 | + r"""Lists operations that match the specified filter in the request. |
| 1531 | +
|
| 1532 | + Args: |
| 1533 | + request (:class:`~.operations_pb2.ListOperationsRequest`): |
| 1534 | + The request object. Request message for |
| 1535 | + `ListOperations` method. |
| 1536 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1537 | + if any, should be retried. |
| 1538 | + timeout (float): The timeout for this request. |
| 1539 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1540 | + sent along with the request as metadata. |
| 1541 | + Returns: |
| 1542 | + ~.operations_pb2.ListOperationsResponse: |
| 1543 | + Response message for ``ListOperations`` method. |
| 1544 | + """ |
| 1545 | + # Create or coerce a protobuf request object. |
| 1546 | + # The request isn't a proto-plus wrapped type, |
| 1547 | + # so it must be constructed via keyword expansion. |
| 1548 | + if isinstance(request, dict): |
| 1549 | + request = operations_pb2.ListOperationsRequest(**request) |
| 1550 | + |
| 1551 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1552 | + # and friendly error handling. |
| 1553 | + rpc = gapic_v1.method.wrap_method( |
| 1554 | + self._client._transport.list_operations, |
| 1555 | + default_timeout=None, |
| 1556 | + client_info=DEFAULT_CLIENT_INFO, |
| 1557 | + ) |
| 1558 | + |
| 1559 | + # Certain fields should be provided within the metadata header; |
| 1560 | + # add these here. |
| 1561 | + metadata = tuple(metadata) + ( |
| 1562 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1563 | + ) |
| 1564 | + |
| 1565 | + # Send the request. |
| 1566 | + response = await rpc( |
| 1567 | + request, |
| 1568 | + retry=retry, |
| 1569 | + timeout=timeout, |
| 1570 | + metadata=metadata, |
| 1571 | + ) |
| 1572 | + |
| 1573 | + # Done; return the response. |
| 1574 | + return response |
| 1575 | + |
| 1576 | + async def get_operation( |
| 1577 | + self, |
| 1578 | + request: Optional[operations_pb2.GetOperationRequest] = None, |
| 1579 | + *, |
| 1580 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1581 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1582 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1583 | + ) -> operations_pb2.Operation: |
| 1584 | + r"""Gets the latest state of a long-running operation. |
| 1585 | +
|
| 1586 | + Args: |
| 1587 | + request (:class:`~.operations_pb2.GetOperationRequest`): |
| 1588 | + The request object. Request message for |
| 1589 | + `GetOperation` method. |
| 1590 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1591 | + if any, should be retried. |
| 1592 | + timeout (float): The timeout for this request. |
| 1593 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1594 | + sent along with the request as metadata. |
| 1595 | + Returns: |
| 1596 | + ~.operations_pb2.Operation: |
| 1597 | + An ``Operation`` object. |
| 1598 | + """ |
| 1599 | + # Create or coerce a protobuf request object. |
| 1600 | + # The request isn't a proto-plus wrapped type, |
| 1601 | + # so it must be constructed via keyword expansion. |
| 1602 | + if isinstance(request, dict): |
| 1603 | + request = operations_pb2.GetOperationRequest(**request) |
| 1604 | + |
| 1605 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1606 | + # and friendly error handling. |
| 1607 | + rpc = gapic_v1.method.wrap_method( |
| 1608 | + self._client._transport.get_operation, |
| 1609 | + default_timeout=None, |
| 1610 | + client_info=DEFAULT_CLIENT_INFO, |
| 1611 | + ) |
| 1612 | + |
| 1613 | + # Certain fields should be provided within the metadata header; |
| 1614 | + # add these here. |
| 1615 | + metadata = tuple(metadata) + ( |
| 1616 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1617 | + ) |
| 1618 | + |
| 1619 | + # Send the request. |
| 1620 | + response = await rpc( |
| 1621 | + request, |
| 1622 | + retry=retry, |
| 1623 | + timeout=timeout, |
| 1624 | + metadata=metadata, |
| 1625 | + ) |
| 1626 | + |
| 1627 | + # Done; return the response. |
| 1628 | + return response |
| 1629 | + |
| 1630 | + async def list_locations( |
| 1631 | + self, |
| 1632 | + request: Optional[locations_pb2.ListLocationsRequest] = None, |
| 1633 | + *, |
| 1634 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, |
| 1635 | + timeout: Union[float, object] = gapic_v1.method.DEFAULT, |
| 1636 | + metadata: Sequence[Tuple[str, str]] = (), |
| 1637 | + ) -> locations_pb2.ListLocationsResponse: |
| 1638 | + r"""Lists information about the supported locations for this service. |
| 1639 | +
|
| 1640 | + Args: |
| 1641 | + request (:class:`~.location_pb2.ListLocationsRequest`): |
| 1642 | + The request object. Request message for |
| 1643 | + `ListLocations` method. |
| 1644 | + retry (google.api_core.retry.Retry): Designation of what errors, |
| 1645 | + if any, should be retried. |
| 1646 | + timeout (float): The timeout for this request. |
| 1647 | + metadata (Sequence[Tuple[str, str]]): Strings which should be |
| 1648 | + sent along with the request as metadata. |
| 1649 | + Returns: |
| 1650 | + ~.location_pb2.ListLocationsResponse: |
| 1651 | + Response message for ``ListLocations`` method. |
| 1652 | + """ |
| 1653 | + # Create or coerce a protobuf request object. |
| 1654 | + # The request isn't a proto-plus wrapped type, |
| 1655 | + # so it must be constructed via keyword expansion. |
| 1656 | + if isinstance(request, dict): |
| 1657 | + request = locations_pb2.ListLocationsRequest(**request) |
| 1658 | + |
| 1659 | + # Wrap the RPC method; this adds retry and timeout information, |
| 1660 | + # and friendly error handling. |
| 1661 | + rpc = gapic_v1.method.wrap_method( |
| 1662 | + self._client._transport.list_locations, |
| 1663 | + default_timeout=None, |
| 1664 | + client_info=DEFAULT_CLIENT_INFO, |
| 1665 | + ) |
| 1666 | + |
| 1667 | + # Certain fields should be provided within the metadata header; |
| 1668 | + # add these here. |
| 1669 | + metadata = tuple(metadata) + ( |
| 1670 | + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), |
| 1671 | + ) |
| 1672 | + |
| 1673 | + # Send the request. |
| 1674 | + response = await rpc( |
| 1675 | + request, |
| 1676 | + retry=retry, |
| 1677 | + timeout=timeout, |
| 1678 | + metadata=metadata, |
| 1679 | + ) |
| 1680 | + |
| 1681 | + # Done; return the response. |
| 1682 | + return response |
| 1683 | + |
1521 | 1684 | async def __aenter__(self):
|
1522 | 1685 | return self
|
1523 | 1686 |
|
|
0 commit comments