Skip to content
This repository has been archived by the owner on Feb 28, 2024. It is now read-only.

feat(v1): add support for condition in Feed #44

Merged
merged 9 commits into from Jun 23, 2020
4 changes: 2 additions & 2 deletions google/cloud/asset_v1/__init__.py
Expand Up @@ -26,8 +26,8 @@

if sys.version_info[:2] == (2, 7):
message = (
"A future version of this library will drop support for Python 2.7."
"More details about Python 2 support for Google Cloud Client Libraries"
"A future version of this library will drop support for Python 2.7. "
"More details about Python 2 support for Google Cloud Client Libraries "
"can be found at https://cloud.google.com/python/docs/python2-sunset/"
)
warnings.warn(message, DeprecationWarning)
Expand Down
36 changes: 20 additions & 16 deletions google/cloud/asset_v1/gapic/asset_service_client.py
Expand Up @@ -288,9 +288,15 @@ def export_assets(
):
"""
Exports assets with time and resource types to a given Cloud Storage
location. The output format is newline-delimited JSON. This API
implements the ``google.longrunning.Operation`` API allowing you to keep
track of the export.
location/BigQuery table. For Cloud Storage location destinations, the
output format is newline-delimited JSON. Each line represents a
``google.cloud.asset.v1.Asset`` in the JSON format; for BigQuery table
destinations, the output table stores the fields in asset proto as
columns. This API implements the ``google.longrunning.Operation`` API ,
which allows you to keep track of the export. We recommend intervals of
at least 2 seconds with exponential retry to poll the export operation
result. For regular-size resource parent, the export operation usually
finishes within 5 minutes.

Example:
>>> from google.cloud import asset_v1
Expand Down Expand Up @@ -320,7 +326,7 @@ def export_assets(
"projects/my-project-id"), or a project number (such as "projects/12345"),
or a folder number (such as "folders/123").
output_config (Union[dict, ~google.cloud.asset_v1.types.OutputConfig]): Required. Output configuration indicating where the results will be output
to. All results will be in newline delimited JSON format.
to.

If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.asset_v1.types.OutputConfig`
Expand All @@ -332,7 +338,7 @@ def export_assets(

If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.asset_v1.types.Timestamp`
asset_types (list[str]): A list of asset types of which to take a snapshot for. For example:
asset_types (list[str]): A list of asset types of which to take a snapshot for. Example:
"compute.googleapis.com/Disk". If specified, only matching assets will
be returned. See `Introduction to Cloud Asset
Inventory <https://cloud.google.com/asset-inventory/docs/overview>`__
Expand Down Expand Up @@ -411,11 +417,11 @@ def batch_get_assets_history(
):
"""
Batch gets the update history of assets that overlap a time window.
For RESOURCE content, this API outputs history with asset in both
non-delete or deleted status. For IAM_POLICY content, this API outputs
history when the asset and its attached IAM POLICY both exist. This can
create gaps in the output history. If a specified asset does not exist,
this API returns an INVALID_ARGUMENT error.
For IAM_POLICY content, this API outputs history when the asset and its
attached IAM POLICY both exist. This can create gaps in the output
history. Otherwise, this API outputs history with asset in both
non-delete or deleted status. If a specified asset does not exist, this
API returns an INVALID_ARGUMENT error.

Example:
>>> from google.cloud import asset_v1
Expand All @@ -431,13 +437,11 @@ def batch_get_assets_history(
parent (str): Required. The relative name of the root asset. It can only be an
organization number (such as "organizations/123"), a project ID (such as
"projects/my-project-id")", or a project number (such as "projects/12345").
asset_names (list[str]): A list of the full names of the assets. For example:
asset_names (list[str]): A list of the full names of the assets. See:
https://cloud.google.com/asset-inventory/docs/resource-name-format
Example:

``//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1``.
See `Resource
Names <https://cloud.google.com/apis/design/resource_names#full_resource_name>`__
and `Resource Name
Format <https://cloud.google.com/asset-inventory/docs/resource-name-format>`__
for more info.

The request becomes a no-op if the asset name list is empty, and the max
size of the asset name list is 100 in one request.
Expand Down
20 changes: 20 additions & 0 deletions google/cloud/asset_v1/gapic/enums.py
Expand Up @@ -179,3 +179,23 @@ class PerimeterType(enum.IntEnum):

PERIMETER_TYPE_REGULAR = 0
PERIMETER_TYPE_BRIDGE = 1


class TemporalAsset(object):
class PriorAssetState(enum.IntEnum):
"""
State of prior asset.

Attributes:
PRIOR_ASSET_STATE_UNSPECIFIED (int): prior_asset is not applicable for the current asset.
PRESENT (int): prior_asset is populated correctly.
INVALID (int): Failed to set prior_asset.
DOES_NOT_EXIST (int): Current asset is the first known state.
DELETED (int): prior_asset is a deletion.
"""

PRIOR_ASSET_STATE_UNSPECIFIED = 0
PRESENT = 1
INVALID = 2
DOES_NOT_EXIST = 3
DELETED = 4
Expand Up @@ -133,9 +133,15 @@ def export_assets(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.export_assets`.

Exports assets with time and resource types to a given Cloud Storage
location. The output format is newline-delimited JSON. This API
implements the ``google.longrunning.Operation`` API allowing you to keep
track of the export.
location/BigQuery table. For Cloud Storage location destinations, the
output format is newline-delimited JSON. Each line represents a
``google.cloud.asset.v1.Asset`` in the JSON format; for BigQuery table
destinations, the output table stores the fields in asset proto as
columns. This API implements the ``google.longrunning.Operation`` API ,
which allows you to keep track of the export. We recommend intervals of
at least 2 seconds with exponential retry to poll the export operation
result. For regular-size resource parent, the export operation usually
finishes within 5 minutes.

Returns:
Callable: A callable which accepts the appropriate
Expand All @@ -149,11 +155,11 @@ def batch_get_assets_history(self):
"""Return the gRPC stub for :meth:`AssetServiceClient.batch_get_assets_history`.

Batch gets the update history of assets that overlap a time window.
For RESOURCE content, this API outputs history with asset in both
non-delete or deleted status. For IAM_POLICY content, this API outputs
history when the asset and its attached IAM POLICY both exist. This can
create gaps in the output history. If a specified asset does not exist,
this API returns an INVALID_ARGUMENT error.
For IAM_POLICY content, this API outputs history when the asset and its
attached IAM POLICY both exist. This can create gaps in the output
history. Otherwise, this API outputs history with asset in both
non-delete or deleted status. If a specified asset does not exist, this
API returns an INVALID_ARGUMENT error.

Returns:
Callable: A callable which accepts the appropriate
Expand Down