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

Commit

Permalink
feat(v1): add support for condition in Feed (#44)
Browse files Browse the repository at this point in the history
* changes without context

        autosynth cannot find the source of changes triggered by earlier changes in this
        repository, or by version upgrades to tools such as linters.

* bazel: update protobuf, rules_go, gazelle, and gapic-generator-go versions - protobuf v3.12.1 - rules_go v0.23.0 - gazelle v0.21.0 - gapic-generator-go v0.14.1

PiperOrigin-RevId: 313460921

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed May 27 14:10:16 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: c4e37010d74071851ff24121f522e802231ac86e
Source-Link: googleapis/googleapis@c4e3701

* chore: update gapic-generator and go microgen

changes include:
- build_gen: go lro gapic used as dep
- go_gapic_library: fixes shading of go_library importpath

PiperOrigin-RevId: 314363155

Source-Author: Google APIs <noreply@google.com>
Source-Date: Tue Jun 2 10:56:09 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 3a4894c4f0da3e763aca2c67bd280ae915177450
Source-Link: googleapis/googleapis@3a4894c

* fix: migrate asset/v1p4beta1 to grpc_service_config

PiperOrigin-RevId: 315775276

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 10 14:57:50 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 8a81e7e3ea5bdf30e406cc06dc90948574ba1058
Source-Link: googleapis/googleapis@8a81e7e

* fix: migrate asset/v1p1beta1 to grpc_service_config

PiperOrigin-RevId: 315777943

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 10 15:09:22 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 203ed2605b5806578e9aeb63388bc6aa9bbac659
Source-Link: googleapis/googleapis@203ed26

* fix: migrate asset/v1beta1 to grpc_service_config

PiperOrigin-RevId: 315789764

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 10 16:15:36 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 00de455b588d7203012fec514d91b0eb63e41af3
Source-Link: googleapis/googleapis@00de455

* fix: migrate asset/v1p2beta1 to grpc_service_config

PiperOrigin-RevId: 315789780

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Jun 10 16:15:40 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: a8ebb52bc3b8ff0e41cb34b19c1c9a8af2a9c9eb
Source-Link: googleapis/googleapis@a8ebb52

* fix: use protoc-docs-plugin 0.8.0

Fixes issue with missing newline before 'Attributes' in Python docstrings.

PiperOrigin-RevId: 316182409

Source-Author: Google APIs <noreply@google.com>
Source-Date: Fri Jun 12 14:52:11 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 184661793fbe3b89f2b485c303e7466cef9d21a1
Source-Link: googleapis/googleapis@1846617

* 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 <noreply@google.com>
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 23, 2020
1 parent 6e48d8c commit 467ab58
Show file tree
Hide file tree
Showing 24 changed files with 1,003 additions and 233 deletions.
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

0 comments on commit 467ab58

Please sign in to comment.