Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
Prev Previous commit
feat: added support for condition in Feed docs: updated existing docs.
Clients can now specify conditions in Asset Feed. For details, see https://cloud.google.com/asset-inventory/docs/monitoring-asset-changes.

PiperOrigin-RevId: 316789767

Source-Author: Google APIs <[email protected]>
Source-Date: Tue Jun 16 17:24:55 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 3dcb344dd2a03043708b3ba40c4df141a3d5b06b
Source-Link: googleapis/googleapis@3dcb344
  • Loading branch information
yoshi-automation committed Jun 20, 2020
commit b40782b2fd57a077321d95aa0c82b926b99b5ae4
36 changes: 20 additions & 16 deletions google/cloud/asset_v1/gapic/asset_service_client.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading