From 0f77db7fc8ea854a84868779aa386ce310ec8add Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Thu, 1 Aug 2019 14:23:59 -0700 Subject: [PATCH] Generate asset v1p2beta1. (#8888) --- asset/docs/gapic/v1p2beta1/api.rst | 6 + asset/docs/gapic/v1p2beta1/types.rst | 5 + asset/docs/index.rst | 25 + .../google/cloud/asset_v1p2beta1/__init__.py | 30 + .../cloud/asset_v1p2beta1/gapic/__init__.py | 0 .../gapic/asset_service_client.py | 827 ++++++++ .../gapic/asset_service_client_config.py | 58 + .../cloud/asset_v1p2beta1/gapic/enums.py | 54 + .../gapic/transports/__init__.py | 0 .../asset_service_grpc_transport.py | 208 ++ .../cloud/asset_v1p2beta1/proto/__init__.py | 0 .../asset_v1p2beta1/proto/asset_service.proto | 384 ++++ .../proto/asset_service_pb2.py | 1717 +++++++++++++++++ .../proto/asset_service_pb2_grpc.py | 163 ++ .../cloud/asset_v1p2beta1/proto/assets.proto | 135 ++ .../cloud/asset_v1p2beta1/proto/assets_pb2.py | 616 ++++++ .../asset_v1p2beta1/proto/assets_pb2_grpc.py | 2 + asset/google/cloud/asset_v1p2beta1/types.py | 63 + asset/synth.metadata | 24 +- asset/synth.py | 2 +- .../test_asset_service_client_v1p2beta1.py | 358 ++++ 21 files changed, 4665 insertions(+), 12 deletions(-) create mode 100644 asset/docs/gapic/v1p2beta1/api.rst create mode 100644 asset/docs/gapic/v1p2beta1/types.rst create mode 100644 asset/google/cloud/asset_v1p2beta1/__init__.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/__init__.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client_config.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/enums.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/transports/__init__.py create mode 100644 asset/google/cloud/asset_v1p2beta1/gapic/transports/asset_service_grpc_transport.py create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/__init__.py create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/asset_service.proto create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/assets.proto create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/assets_pb2.py create mode 100644 asset/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py create mode 100644 asset/google/cloud/asset_v1p2beta1/types.py create mode 100644 asset/tests/unit/gapic/v1p2beta1/test_asset_service_client_v1p2beta1.py diff --git a/asset/docs/gapic/v1p2beta1/api.rst b/asset/docs/gapic/v1p2beta1/api.rst new file mode 100644 index 000000000000..ca2696c24291 --- /dev/null +++ b/asset/docs/gapic/v1p2beta1/api.rst @@ -0,0 +1,6 @@ +Client for Cloud Asset API +========================== + +.. automodule:: google.cloud.asset_v1p2beta1 + :members: + :inherited-members: \ No newline at end of file diff --git a/asset/docs/gapic/v1p2beta1/types.rst b/asset/docs/gapic/v1p2beta1/types.rst new file mode 100644 index 000000000000..914469b3224f --- /dev/null +++ b/asset/docs/gapic/v1p2beta1/types.rst @@ -0,0 +1,5 @@ +Types for Cloud Asset API Client +================================ + +.. automodule:: google.cloud.asset_v1p2beta1.types + :members: \ No newline at end of file diff --git a/asset/docs/index.rst b/asset/docs/index.rst index d4d774fac6d7..cc1b49a90e90 100644 --- a/asset/docs/index.rst +++ b/asset/docs/index.rst @@ -2,14 +2,39 @@ Api Reference ------------- + +This package includes clients for multiple versions of the Cloud Asset API. By default, you will get ``v1`` +the latest stable version. + .. toctree:: :maxdepth: 2 gapic/v1/api gapic/v1/types + +A new beta release with additional features over the current stable version, spelled ``v1p2beta1``, is provided +to allow you to use these new features. These are expected to move into the stable release soon; until +then, the usual beta admonishment (changes are possible, etc.) applies. + +An API and type reference is provided for this beta: + +.. toctree:: + :maxdepth: 2 + + gapic/v1p2beta1/api + gapic/v1p2beta1/types + +The previous beta release, spelled ``v1p2beta1`` is also provided to continue to support code +previously written against it. In order to use it, you will want to import from +``google.cloud.asset_v1beta1`` in lieu of ``google.cloud.asset_v1``. + +.. toctree:: + :maxdepth: 2 + gapic/v1beta1/api gapic/v1beta1/types + Changelog --------- diff --git a/asset/google/cloud/asset_v1p2beta1/__init__.py b/asset/google/cloud/asset_v1p2beta1/__init__.py new file mode 100644 index 000000000000..07b349a3269b --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/__init__.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import + +from google.cloud.asset_v1p2beta1 import types +from google.cloud.asset_v1p2beta1.gapic import asset_service_client +from google.cloud.asset_v1p2beta1.gapic import enums + + +class AssetServiceClient(asset_service_client.AssetServiceClient): + __doc__ = asset_service_client.AssetServiceClient.__doc__ + enums = enums + + +__all__ = ("enums", "types", "AssetServiceClient") diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/__init__.py b/asset/google/cloud/asset_v1p2beta1/gapic/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client.py b/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client.py new file mode 100644 index 000000000000..ebfb82c0358c --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client.py @@ -0,0 +1,827 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Accesses the google.cloud.asset.v1p2beta1 AssetService API.""" + +import pkg_resources +import warnings + +from google.oauth2 import service_account +import google.api_core.client_options +import google.api_core.gapic_v1.client_info +import google.api_core.gapic_v1.config +import google.api_core.gapic_v1.method +import google.api_core.gapic_v1.routing_header +import google.api_core.grpc_helpers +import google.api_core.operation +import google.api_core.operations_v1 +import google.api_core.path_template +import grpc + +from google.cloud.asset_v1p2beta1.gapic import asset_service_client_config +from google.cloud.asset_v1p2beta1.gapic import enums +from google.cloud.asset_v1p2beta1.gapic.transports import asset_service_grpc_transport +from google.cloud.asset_v1p2beta1.proto import asset_service_pb2 +from google.cloud.asset_v1p2beta1.proto import asset_service_pb2_grpc +from google.cloud.asset_v1p2beta1.proto import assets_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from google.protobuf import timestamp_pb2 + + +_GAPIC_LIBRARY_VERSION = pkg_resources.get_distribution("google-cloud-asset").version + + +class AssetServiceClient(object): + """Asset service definition.""" + + SERVICE_ADDRESS = "cloudasset.googleapis.com:443" + """The default address of the service.""" + + # The name of the interface for this client. This is the key used to + # find the method configuration in the client_config dictionary. + _INTERFACE_NAME = "google.cloud.asset.v1p2beta1.AssetService" + + @classmethod + def from_service_account_file(cls, filename, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + AssetServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_file(filename) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + + from_service_account_json = from_service_account_file + + @classmethod + def feed_path(cls, project, feed): + """Return a fully-qualified feed string.""" + return google.api_core.path_template.expand( + "projects/{project}/feeds/{feed}", project=project, feed=feed + ) + + def __init__( + self, + transport=None, + channel=None, + credentials=None, + client_config=None, + client_info=None, + client_options=None, + ): + """Constructor. + + Args: + transport (Union[~.AssetServiceGrpcTransport, + Callable[[~.Credentials, type], ~.AssetServiceGrpcTransport]): A transport + instance, responsible for actually making the API calls. + The default transport uses the gRPC protocol. + This argument may also be a callable which returns a + transport instance. Callables will be sent the credentials + as the first argument and the default transport class as + the second argument. + channel (grpc.Channel): DEPRECATED. A ``Channel`` instance + through which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + This argument is mutually exclusive with providing a + transport instance to ``transport``; doing so will raise + an exception. + client_config (dict): DEPRECATED. A dictionary of call options for + each method. If not specified, the default configuration is used. + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing + your own client library. + client_options (Union[dict, google.api_core.client_options.ClientOptions]): + Client options used to set user options on the client. API Endpoint + should be set through client_options. + """ + # Raise deprecation warnings for things we want to go away. + if client_config is not None: + warnings.warn( + "The `client_config` argument is deprecated.", + PendingDeprecationWarning, + stacklevel=2, + ) + else: + client_config = asset_service_client_config.config + + if channel: + warnings.warn( + "The `channel` argument is deprecated; use " "`transport` instead.", + PendingDeprecationWarning, + stacklevel=2, + ) + + api_endpoint = self.SERVICE_ADDRESS + if client_options: + if type(client_options) == dict: + client_options = google.api_core.client_options.from_dict( + client_options + ) + if client_options.api_endpoint: + api_endpoint = client_options.api_endpoint + + # Instantiate the transport. + # The transport is responsible for handling serialization and + # deserialization and actually sending data to the service. + if transport: + if callable(transport): + self.transport = transport( + credentials=credentials, + default_class=asset_service_grpc_transport.AssetServiceGrpcTransport, + address=api_endpoint, + ) + else: + if credentials: + raise ValueError( + "Received both a transport instance and " + "credentials; these are mutually exclusive." + ) + self.transport = transport + else: + self.transport = asset_service_grpc_transport.AssetServiceGrpcTransport( + address=api_endpoint, channel=channel, credentials=credentials + ) + + if client_info is None: + client_info = google.api_core.gapic_v1.client_info.ClientInfo( + gapic_version=_GAPIC_LIBRARY_VERSION + ) + else: + client_info.gapic_version = _GAPIC_LIBRARY_VERSION + self._client_info = client_info + + # Parse out the default settings for retry and timeout for each RPC + # from the client configuration. + # (Ordinarily, these are the defaults specified in the `*_config.py` + # file next to this one.) + self._method_configs = google.api_core.gapic_v1.config.parse_method_configs( + client_config["interfaces"][self._INTERFACE_NAME] + ) + + # Save a dictionary of cached API call functions. + # These are the actual callables which invoke the proper + # transport methods, wrapped with `wrap_method` to add retry, + # timeout, and the like. + self._inner_api_calls = {} + + # Service calls + def export_assets( + self, + parent, + output_config, + read_time=None, + asset_types=None, + content_type=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + 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. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> # TODO: Initialize `parent`: + >>> parent = '' + >>> + >>> # TODO: Initialize `output_config`: + >>> output_config = {} + >>> + >>> response = client.export_assets(parent, output_config) + >>> + >>> def callback(operation_future): + ... # Handle result. + ... result = operation_future.result() + >>> + >>> response.add_done_callback(callback) + >>> + >>> # Handle metadata. + >>> metadata = response.metadata() + + Args: + parent (str): Required. The relative name of the root asset. This 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"). + output_config (Union[dict, ~google.cloud.asset_v1p2beta1.types.OutputConfig]): Required. Output configuration indicating where the results will be output + to. All results will be in newline delimited JSON format. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.OutputConfig` + read_time (Union[dict, ~google.cloud.asset_v1p2beta1.types.Timestamp]): Timestamp to take an asset snapshot. This can only be set to a timestamp + between 2018-10-02 UTC (inclusive) and the current time. If not specified, + the current time will be used. Due to delays in resource data collection + and indexing, there is a volatile window during which running the same + query may get different results. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.Timestamp` + asset_types (list[str]): A list of asset types of which to take a snapshot for. For example: + "compute.googleapis.com/Disk". If specified, only matching assets will + be returned. See `Introduction to Cloud Asset + Inventory `__ + for all supported asset types. + content_type (~google.cloud.asset_v1p2beta1.types.ContentType): Asset content type. If not specified, no content but the asset name will be + returned. + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types._OperationFuture` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "export_assets" not in self._inner_api_calls: + self._inner_api_calls[ + "export_assets" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.export_assets, + default_retry=self._method_configs["ExportAssets"].retry, + default_timeout=self._method_configs["ExportAssets"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.ExportAssetsRequest( + parent=parent, + output_config=output_config, + read_time=read_time, + asset_types=asset_types, + content_type=content_type, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + operation = self._inner_api_calls["export_assets"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + return google.api_core.operation.from_gapic( + operation, + self.transport._operations_client, + asset_service_pb2.ExportAssetsResponse, + metadata_type=asset_service_pb2.ExportAssetsRequest, + ) + + def batch_get_assets_history( + self, + parent, + asset_names, + content_type, + read_time_window=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + 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. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> from google.cloud.asset_v1p2beta1 import enums + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> # TODO: Initialize `parent`: + >>> parent = '' + >>> + >>> # TODO: Initialize `asset_names`: + >>> asset_names = [] + >>> + >>> # TODO: Initialize `content_type`: + >>> content_type = enums.ContentType.CONTENT_TYPE_UNSPECIFIED + >>> + >>> response = client.batch_get_assets_history(parent, asset_names, content_type) + + Args: + 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: + ``//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1``. + See `Resource + Names `__ + and `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. + content_type (~google.cloud.asset_v1p2beta1.types.ContentType): Required. The content type. + read_time_window (Union[dict, ~google.cloud.asset_v1p2beta1.types.TimeWindow]): Optional. The time window for the asset history. Both start\_time and + end\_time are optional and if set, it must be after 2018-10-02 UTC. If + end\_time is not set, it is default to current timestamp. If start\_time + is not set, the snapshot of the assets at end\_time will be returned. + The returned results contain all temporal assets whose time window + overlap with read\_time\_window. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.TimeWindow` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types.BatchGetAssetsHistoryResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "batch_get_assets_history" not in self._inner_api_calls: + self._inner_api_calls[ + "batch_get_assets_history" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.batch_get_assets_history, + default_retry=self._method_configs["BatchGetAssetsHistory"].retry, + default_timeout=self._method_configs["BatchGetAssetsHistory"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.BatchGetAssetsHistoryRequest( + parent=parent, + asset_names=asset_names, + content_type=content_type, + read_time_window=read_time_window, + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["batch_get_assets_history"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def create_feed( + self, + parent, + feed_id, + feed, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Creates a feed in a parent project/folder/organization to listen to its + asset updates. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> # TODO: Initialize `parent`: + >>> parent = '' + >>> + >>> # TODO: Initialize `feed_id`: + >>> feed_id = '' + >>> + >>> # TODO: Initialize `feed`: + >>> feed = {} + >>> + >>> response = client.create_feed(parent, feed_id, feed) + + Args: + parent (str): Required. The name of the project/folder/organization where this feed + should be created in. It can only be an organization number (such as + "organizations/123"), a folder number (such as "folders/123"), a project ID + (such as "projects/my-project-id")", or a project number (such as + "projects/12345"). + feed_id (str): Required. This is the client-assigned asset feed identifier and it needs to + be unique under a specific parent project/folder/organization. + feed (Union[dict, ~google.cloud.asset_v1p2beta1.types.Feed]): The feed details. The field ``name`` must be empty and it will be + generated in the format of: projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.Feed` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types.Feed` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "create_feed" not in self._inner_api_calls: + self._inner_api_calls[ + "create_feed" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.create_feed, + default_retry=self._method_configs["CreateFeed"].retry, + default_timeout=self._method_configs["CreateFeed"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.CreateFeedRequest( + parent=parent, feed_id=feed_id, feed=feed + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["create_feed"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def get_feed( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Gets details about an asset feed. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> name = client.feed_path('[PROJECT]', '[FEED]') + >>> + >>> response = client.get_feed(name) + + Args: + name (str): The name of the Feed and it must be in the format of: + projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types.Feed` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "get_feed" not in self._inner_api_calls: + self._inner_api_calls[ + "get_feed" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_feed, + default_retry=self._method_configs["GetFeed"].retry, + default_timeout=self._method_configs["GetFeed"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.GetFeedRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["get_feed"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def list_feeds( + self, + parent, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Lists all asset feeds in a parent project/folder/organization. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> # TODO: Initialize `parent`: + >>> parent = '' + >>> + >>> response = client.list_feeds(parent) + + Args: + parent (str): Required. The parent project/folder/organization whose feeds are to be + listed. It can only be using project/folder/organization number (such as + "folders/12345")", or a project ID (such as "projects/my-project-id"). + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types.ListFeedsResponse` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "list_feeds" not in self._inner_api_calls: + self._inner_api_calls[ + "list_feeds" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_feeds, + default_retry=self._method_configs["ListFeeds"].retry, + default_timeout=self._method_configs["ListFeeds"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.ListFeedsRequest(parent=parent) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("parent", parent)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["list_feeds"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def update_feed( + self, + feed, + update_mask, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Updates an asset feed configuration. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> # TODO: Initialize `feed`: + >>> feed = {} + >>> + >>> # TODO: Initialize `update_mask`: + >>> update_mask = {} + >>> + >>> response = client.update_feed(feed, update_mask) + + Args: + feed (Union[dict, ~google.cloud.asset_v1p2beta1.types.Feed]): The new values of feed details. It must match an existing feed and the + field ``name`` must be in the format of: + projects/project\_number/feeds/feed\_id or + folders/folder\_number/feeds/feed\_id or + organizations/organization\_number/feeds/feed\_id. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.Feed` + update_mask (Union[dict, ~google.cloud.asset_v1p2beta1.types.FieldMask]): Only updates the ``feed`` fields indicated by this mask. The field mask + must not be empty, and it must not contain fields that are immutable or + only set by the server. + + If a dict is provided, it must be of the same form as the protobuf + message :class:`~google.cloud.asset_v1p2beta1.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Returns: + A :class:`~google.cloud.asset_v1p2beta1.types.Feed` instance. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "update_feed" not in self._inner_api_calls: + self._inner_api_calls[ + "update_feed" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.update_feed, + default_retry=self._method_configs["UpdateFeed"].retry, + default_timeout=self._method_configs["UpdateFeed"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.UpdateFeedRequest( + feed=feed, update_mask=update_mask + ) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("feed.name", feed.name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + return self._inner_api_calls["update_feed"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def delete_feed( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Deletes an asset feed. + + Example: + >>> from google.cloud import asset_v1p2beta1 + >>> + >>> client = asset_v1p2beta1.AssetServiceClient() + >>> + >>> name = client.feed_path('[PROJECT]', '[FEED]') + >>> + >>> client.delete_feed(name) + + Args: + name (str): The name of the feed and it must be in the format of: + projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will not + be retried. + timeout (Optional[float]): The amount of time, in seconds, to wait + for the request to complete. Note that if ``retry`` is + specified, the timeout applies to each individual attempt. + metadata (Optional[Sequence[Tuple[str, str]]]): Additional metadata + that is provided to the method. + + Raises: + google.api_core.exceptions.GoogleAPICallError: If the request + failed for any reason. + google.api_core.exceptions.RetryError: If the request failed due + to a retryable error and retry attempts failed. + ValueError: If the parameters are invalid. + """ + # Wrap the transport method to add retry and timeout logic. + if "delete_feed" not in self._inner_api_calls: + self._inner_api_calls[ + "delete_feed" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.delete_feed, + default_retry=self._method_configs["DeleteFeed"].retry, + default_timeout=self._method_configs["DeleteFeed"].timeout, + client_info=self._client_info, + ) + + request = asset_service_pb2.DeleteFeedRequest(name=name) + if metadata is None: + metadata = [] + metadata = list(metadata) + try: + routing_header = [("name", name)] + except AttributeError: + pass + else: + routing_metadata = google.api_core.gapic_v1.routing_header.to_grpc_metadata( + routing_header + ) + metadata.append(routing_metadata) + + self._inner_api_calls["delete_feed"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client_config.py b/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client_config.py new file mode 100644 index 000000000000..f3eab9e21e3b --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/gapic/asset_service_client_config.py @@ -0,0 +1,58 @@ +config = { + "interfaces": { + "google.cloud.asset.v1p2beta1.AssetService": { + "retry_codes": { + "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "non_idempotent": [], + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000, + } + }, + "methods": { + "ExportAssets": { + "timeout_millis": 600000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "BatchGetAssetsHistory": { + "timeout_millis": 600000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "CreateFeed": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "GetFeed": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "ListFeeds": { + "timeout_millis": 10000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "UpdateFeed": { + "timeout_millis": 30000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, + "DeleteFeed": { + "timeout_millis": 30000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + }, + } + } +} diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/enums.py b/asset/google/cloud/asset_v1p2beta1/gapic/enums.py new file mode 100644 index 000000000000..a9541ab2c818 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/gapic/enums.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Wrappers for protocol buffer enum types.""" + +import enum + + +class ContentType(enum.IntEnum): + """ + Asset content type. + + Attributes: + CONTENT_TYPE_UNSPECIFIED (int): Unspecified content type. + RESOURCE (int): Resource metadata. + IAM_POLICY (int): The actual IAM policy set on a resource. + IAM_POLICY_NAME (int): The IAM policy name for the IAM policy set on a resource. + ORG_POLICY (int) + ACCESS_POLICY (int): The Cloud Access context mananger Policy set on an asset. + """ + + CONTENT_TYPE_UNSPECIFIED = 0 + RESOURCE = 1 + IAM_POLICY = 2 + IAM_POLICY_NAME = 3 + ORG_POLICY = 4 + ACCESS_POLICY = 5 + + +class NullValue(enum.IntEnum): + """ + ``NullValue`` is a singleton enumeration to represent the null value for + the ``Value`` type union. + + The JSON representation for ``NullValue`` is JSON ``null``. + + Attributes: + NULL_VALUE (int): Null value. + """ + + NULL_VALUE = 0 diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/transports/__init__.py b/asset/google/cloud/asset_v1p2beta1/gapic/transports/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/asset/google/cloud/asset_v1p2beta1/gapic/transports/asset_service_grpc_transport.py b/asset/google/cloud/asset_v1p2beta1/gapic/transports/asset_service_grpc_transport.py new file mode 100644 index 000000000000..5529a77b43a9 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/gapic/transports/asset_service_grpc_transport.py @@ -0,0 +1,208 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import google.api_core.grpc_helpers +import google.api_core.operations_v1 + +from google.cloud.asset_v1p2beta1.proto import asset_service_pb2_grpc + + +class AssetServiceGrpcTransport(object): + """gRPC transport class providing stubs for + google.cloud.asset.v1p2beta1 AssetService API. + + The transport provides access to the raw gRPC stubs, + which can be used to take advantage of advanced + features of gRPC. + """ + + # The scopes needed to make gRPC calls to all of the methods defined + # in this service. + _OAUTH_SCOPES = ("https://www.googleapis.com/auth/cloud-platform",) + + def __init__( + self, channel=None, credentials=None, address="cloudasset.googleapis.com:443" + ): + """Instantiate the transport class. + + Args: + channel (grpc.Channel): A ``Channel`` instance through + which to make calls. This argument is mutually exclusive + with ``credentials``; providing both will raise an exception. + credentials (google.auth.credentials.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If none + are specified, the client will attempt to ascertain the + credentials from the environment. + address (str): The address where the service is hosted. + """ + # If both `channel` and `credentials` are specified, raise an + # exception (channels come with credentials baked in already). + if channel is not None and credentials is not None: + raise ValueError( + "The `channel` and `credentials` arguments are mutually " "exclusive." + ) + + # Create the channel. + if channel is None: + channel = self.create_channel(address=address, credentials=credentials) + + self._channel = channel + + # gRPC uses objects called "stubs" that are bound to the + # channel and provide a basic method for each RPC. + self._stubs = { + "asset_service_stub": asset_service_pb2_grpc.AssetServiceStub(channel) + } + + # Because this API includes a method that returns a + # long-running operation (proto: google.longrunning.Operation), + # instantiate an LRO client. + self._operations_client = google.api_core.operations_v1.OperationsClient( + channel + ) + + @classmethod + def create_channel( + cls, address="cloudasset.googleapis.com:443", credentials=None, **kwargs + ): + """Create and return a gRPC channel object. + + Args: + address (str): The host for the channel to use. + credentials (~.Credentials): The + authorization credentials to attach to requests. These + credentials identify this application to the service. If + none are specified, the client will attempt to ascertain + the credentials from the environment. + kwargs (dict): Keyword arguments, which are passed to the + channel creation. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return google.api_core.grpc_helpers.create_channel( + address, credentials=credentials, scopes=cls._OAUTH_SCOPES, **kwargs + ) + + @property + def channel(self): + """The gRPC channel used by the transport. + + Returns: + grpc.Channel: A gRPC channel object. + """ + return self._channel + + @property + 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. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].ExportAssets + + @property + 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. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].BatchGetAssetsHistory + + @property + def create_feed(self): + """Return the gRPC stub for :meth:`AssetServiceClient.create_feed`. + + Creates a feed in a parent project/folder/organization to listen to its + asset updates. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].CreateFeed + + @property + def get_feed(self): + """Return the gRPC stub for :meth:`AssetServiceClient.get_feed`. + + Gets details about an asset feed. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].GetFeed + + @property + def list_feeds(self): + """Return the gRPC stub for :meth:`AssetServiceClient.list_feeds`. + + Lists all asset feeds in a parent project/folder/organization. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].ListFeeds + + @property + def update_feed(self): + """Return the gRPC stub for :meth:`AssetServiceClient.update_feed`. + + Updates an asset feed configuration. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].UpdateFeed + + @property + def delete_feed(self): + """Return the gRPC stub for :meth:`AssetServiceClient.delete_feed`. + + Deletes an asset feed. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["asset_service_stub"].DeleteFeed diff --git a/asset/google/cloud/asset_v1p2beta1/proto/__init__.py b/asset/google/cloud/asset_v1p2beta1/proto/__init__.py new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/asset/google/cloud/asset_v1p2beta1/proto/asset_service.proto b/asset/google/cloud/asset_v1p2beta1/proto/asset_service.proto new file mode 100644 index 000000000000..0d461d0fa81c --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/asset_service.proto @@ -0,0 +1,384 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.asset.v1p2beta1; + +import "google/api/annotations.proto"; +import "google/cloud/asset/v1p2beta1/assets.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/client.proto"; + +option csharp_namespace = "Google.Cloud.Asset.V1p2Beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetServiceProto"; +option java_package = "com.google.cloud.asset.v1p2beta1"; +option php_namespace = "Google\\Cloud\\Asset\\V1p2Beta1"; + +// Asset service definition. +service AssetService { + option (google.api.default_host) = "cloudasset.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // 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][google.longrunning.Operation] API allowing you + // to keep track of the export. + rpc ExportAssets(ExportAssetsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1p2beta1/{parent=*/*}:exportAssets" + body: "*" + }; + } + + // 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. + rpc BatchGetAssetsHistory(BatchGetAssetsHistoryRequest) returns (BatchGetAssetsHistoryResponse) { + option (google.api.http) = { + get: "/v1p2beta1/{parent=*/*}:batchGetAssetsHistory" + }; + } + + // Creates a feed in a parent project/folder/organization to listen to its + // asset updates. + rpc CreateFeed(CreateFeedRequest) returns (Feed) { + option (google.api.http) = { + post: "/v1p2beta1/{parent=*/*}/feeds" + body: "*" + }; + } + + // Gets details about an asset feed. + rpc GetFeed(GetFeedRequest) returns (Feed) { + option (google.api.http) = { + get: "/v1p2beta1/{name=*/*/feeds/*}" + }; + } + + // Lists all asset feeds in a parent project/folder/organization. + rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { + option (google.api.http) = { + get: "/v1p2beta1/{parent=*/*}/feeds" + }; + } + + // Updates an asset feed configuration. + rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { + option (google.api.http) = { + patch: "/v1p2beta1/{feed.name=*/*/feeds/*}" + body: "*" + }; + } + + // Deletes an asset feed. + rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1p2beta1/{name=*/*/feeds/*}" + }; + } +} + +// Export asset request. +message ExportAssetsRequest { + // Required. The relative name of the root asset. This 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"). + string parent = 1; + + // Timestamp to take an asset snapshot. This can only be set to a timestamp + // between 2018-10-02 UTC (inclusive) and the current time. If not specified, + // the current time will be used. Due to delays in resource data collection + // and indexing, there is a volatile window during which running the same + // query may get different results. + google.protobuf.Timestamp read_time = 2; + + // A list of asset types of which to take a snapshot for. For example: + // "compute.googleapis.com/Disk". If specified, only matching assets will be + // returned. See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name will be + // returned. + ContentType content_type = 4; + + // Required. Output configuration indicating where the results will be output + // to. All results will be in newline delimited JSON format. + OutputConfig output_config = 5; +} + +// The export asset response. This message is returned by the +// [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] method in the returned +// [google.longrunning.Operation.response][google.longrunning.Operation.response] field. +message ExportAssetsResponse { + // Time the snapshot was taken. + google.protobuf.Timestamp read_time = 1; + + // Output configuration indicating where the results were output to. + // All results are in JSON format. + OutputConfig output_config = 2; +} + +// Batch get assets history request. +message BatchGetAssetsHistoryRequest { + // 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"). + string parent = 1; + + // A list of the full names of the assets. For 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/resource-manager/docs/cloud-asset-inventory/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. + repeated string asset_names = 2; + + // Required. The content type. + ContentType content_type = 3; + + // Optional. The time window for the asset history. Both start_time and + // end_time are optional and if set, it must be after 2018-10-02 UTC. If + // end_time is not set, it is default to current timestamp. If start_time is + // not set, the snapshot of the assets at end_time will be returned. The + // returned results contain all temporal assets whose time window overlap with + // read_time_window. + TimeWindow read_time_window = 4; +} + +// Batch get assets history response. +message BatchGetAssetsHistoryResponse { + // A list of assets with valid time windows. + repeated TemporalAsset assets = 1; +} + +// Create asset feed request. +message CreateFeedRequest { + // Required. The name of the project/folder/organization where this feed + // should be created in. It can only be an organization number (such as + // "organizations/123"), a folder number (such as "folders/123"), a project ID + // (such as "projects/my-project-id")", or a project number (such as + // "projects/12345"). + string parent = 1; + + // Required. This is the client-assigned asset feed identifier and it needs to + // be unique under a specific parent project/folder/organization. + string feed_id = 2; + + // The feed details. The field `name` must be empty and it will be generated + // in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + Feed feed = 3; +} + +// Get asset feed request. +message GetFeedRequest { + // The name of the Feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1; +} + +// List asset feeds request. +message ListFeedsRequest { + // Required. The parent project/folder/organization whose feeds are to be + // listed. It can only be using project/folder/organization number (such as + // "folders/12345")", or a project ID (such as "projects/my-project-id"). + string parent = 1; +} + +// List asset feeds response. +message ListFeedsResponse { + // A list of feeds. + repeated Feed feeds = 1; +} + +// Update asset feed request. +message UpdateFeedRequest { + // The new values of feed details. It must match an existing feed and the + // field `name` must be in the format of: + // projects/project_number/feeds/feed_id or + // folders/folder_number/feeds/feed_id or + // organizations/organization_number/feeds/feed_id. + Feed feed = 1; + + // Only updates the `feed` fields indicated by this mask. + // The field mask must not be empty, and it must not contain fields that + // are immutable or only set by the server. + google.protobuf.FieldMask update_mask = 2; +} + +// Delete asset feed request. +message DeleteFeedRequest { + // The name of the feed and it must be in the format of: + // projects/project_number/feeds/feed_id + // folders/folder_number/feeds/feed_id + // organizations/organization_number/feeds/feed_id + string name = 1; +} + +// Output configuration for export assets destination. +message OutputConfig { + // Asset export destination. + oneof destination { + // Destination on Cloud Storage. + GcsDestination gcs_destination = 1; + + // Destination on Bigquery. The output table stores the fields in asset + // proto as columns in BigQuery. The resource/iam_policy field is converted + // to a record with each field to a column, except metadata to a single JSON + // string. + BigQueryDestination bigquery_destination = 2; + } +} + +// A Cloud Storage location. +message GcsDestination { + // Required. + oneof object_uri { + // The uri of the Cloud Storage object. It's the same uri that is used by + // gsutil. For example: "gs://bucket_name/object_name". See [Viewing and + // Editing Object + // Metadata](https://cloud.google.com/storage/docs/viewing-editing-metadata) + // for more information. + string uri = 1; + + // The uri prefix of all generated Cloud Storage objects. For example: + // "gs://bucket_name/object_name_prefix". Each object uri is in format: + // "gs://bucket_name/object_name_prefix// and only + // contains assets for that type. starts from 0. For example: + // "gs://bucket_name/object_name_prefix/compute.googleapis.com/Disk/0" is + // the first shard of output objects containing all + // compute.googleapis.com/Disk assets. An INVALID_ARGUMENT error will be + // returned if file with the same name "gs://bucket_name/object_name_prefix" + // already exists. + string uri_prefix = 2; + } +} + +// A Bigquery destination. +message BigQueryDestination { + // Required. The BigQuery dataset in format + // "projects/projectId/datasets/datasetId", to which the snapshot result + // should be exported. If this dataset does not exist, the export call returns + // an error. + string dataset = 1; + + // Required. The BigQuery table to which the snapshot result should be + // written. If this table does not exist, a new table with the given name + // will be created. + string table = 2; + + // If the destination table already exists and this flag is `TRUE`, the + // table will be overwritten by the contents of assets snapshot. If the flag + // is not set and the destination table already exists, the export call + // returns an error. + bool force = 3; +} + +// A Cloud Pubsub destination. +message PubsubDestination { + // The name of the Cloud Pub/Sub topic to publish to. + // For example: `projects/PROJECT_ID/topics/TOPIC_ID`. + string topic = 1; +} + +// Asset content type. +enum ContentType { + // Unspecified content type. + CONTENT_TYPE_UNSPECIFIED = 0; + + // Resource metadata. + RESOURCE = 1; + + // The actual IAM policy set on a resource. + IAM_POLICY = 2; + + // The IAM policy name for the IAM policy set on a resource. + IAM_POLICY_NAME = 3; + + ORG_POLICY = 4; + + // The Cloud Access context mananger Policy set on an asset. + ACCESS_POLICY = 5; +} + +// Output configuration for asset feed destination. +message FeedOutputConfig { + // Asset feed destination. + oneof destination { + // Destination on Cloud Pubsub. + PubsubDestination pubsub_destination = 1; + } +} + +// An asset feed used to export asset updates to a destinations. +// An asset feed filter controls what updates are exported. +// The asset feed must be created within a project, organization, or +// folder. Supported destinations are: +// Cloud Pub/Sub topics. +message Feed { + // Required. The format will be + // projects/{project_number}/feeds/{client-assigned_feed_identifier} or + // folders/{folder_number}/feeds/{client-assigned_feed_identifier} or + // organizations/{organization_number}/feeds/{client-assigned_feed_identifier} + // + // The client-assigned feed identifier must be unique within the parent + // project/folder/organization. + string name = 1; + + // A list of the full names of the assets to receive updates. You must specify + // either or both of asset_names and asset_types. Only asset updates matching + // specified asset_names and asset_types are exported to the feed. For + // 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) + // for more info. + repeated string asset_names = 2; + + // A list of types of the assets to receive updates. You must specify either + // or both of asset_names and asset_types. Only asset updates matching + // specified asset_names and asset_types are exported to the feed. + // For example: + // "compute.googleapis.com/Disk" See [Introduction to Cloud Asset + // Inventory](https://cloud.google.com/resource-manager/docs/cloud-asset-inventory/overview) + // for all supported asset types. + repeated string asset_types = 3; + + // Asset content type. If not specified, no content but the asset name and + // type will be returned. + ContentType content_type = 4; + + // Required. Feed output configuration defining where the asset updates are + // published to. + FeedOutputConfig feed_output_config = 5; +} diff --git a/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py b/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py new file mode 100644 index 000000000000..0275b6737a02 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py @@ -0,0 +1,1717 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/asset_v1p2beta1/proto/asset_service.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf.internal import enum_type_wrapper +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.cloud.asset_v1p2beta1.proto import ( + assets_pb2 as google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_assets__pb2, +) +from google.longrunning import ( + operations_pb2 as google_dot_longrunning_dot_operations__pb2, +) +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 +from google.protobuf import field_mask_pb2 as google_dot_protobuf_dot_field__mask__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 +from google.api import client_pb2 as google_dot_api_dot_client__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/asset_v1p2beta1/proto/asset_service.proto", + package="google.cloud.asset.v1p2beta1", + syntax="proto3", + serialized_options=_b( + "\n com.google.cloud.asset.v1p2beta1B\021AssetServiceProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset\252\002\034Google.Cloud.Asset.V1p2Beta1\312\002\034Google\\Cloud\\Asset\\V1p2Beta1" + ), + serialized_pb=_b( + '\n6google/cloud/asset_v1p2beta1/proto/asset_service.proto\x12\x1cgoogle.cloud.asset.v1p2beta1\x1a\x1cgoogle/api/annotations.proto\x1a/google/cloud/asset_v1p2beta1/proto/assets.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/api/client.proto"\xed\x01\n\x13\x45xportAssetsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12-\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12?\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32).google.cloud.asset.v1p2beta1.ContentType\x12\x41\n\routput_config\x18\x05 \x01(\x0b\x32*.google.cloud.asset.v1p2beta1.OutputConfig"\x88\x01\n\x14\x45xportAssetsResponse\x12-\n\tread_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x41\n\routput_config\x18\x02 \x01(\x0b\x32*.google.cloud.asset.v1p2beta1.OutputConfig"\xc8\x01\n\x1c\x42\x61tchGetAssetsHistoryRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12?\n\x0c\x63ontent_type\x18\x03 \x01(\x0e\x32).google.cloud.asset.v1p2beta1.ContentType\x12\x42\n\x10read_time_window\x18\x04 \x01(\x0b\x32(.google.cloud.asset.v1p2beta1.TimeWindow"\\\n\x1d\x42\x61tchGetAssetsHistoryResponse\x12;\n\x06\x61ssets\x18\x01 \x03(\x0b\x32+.google.cloud.asset.v1p2beta1.TemporalAsset"f\n\x11\x43reateFeedRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t\x12\x0f\n\x07\x66\x65\x65\x64_id\x18\x02 \x01(\t\x12\x30\n\x04\x66\x65\x65\x64\x18\x03 \x01(\x0b\x32".google.cloud.asset.v1p2beta1.Feed"\x1e\n\x0eGetFeedRequest\x12\x0c\n\x04name\x18\x01 \x01(\t""\n\x10ListFeedsRequest\x12\x0e\n\x06parent\x18\x01 \x01(\t"F\n\x11ListFeedsResponse\x12\x31\n\x05\x66\x65\x65\x64s\x18\x01 \x03(\x0b\x32".google.cloud.asset.v1p2beta1.Feed"v\n\x11UpdateFeedRequest\x12\x30\n\x04\x66\x65\x65\x64\x18\x01 \x01(\x0b\x32".google.cloud.asset.v1p2beta1.Feed\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask"!\n\x11\x44\x65leteFeedRequest\x12\x0c\n\x04name\x18\x01 \x01(\t"\xb9\x01\n\x0cOutputConfig\x12G\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32,.google.cloud.asset.v1p2beta1.GcsDestinationH\x00\x12Q\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32\x31.google.cloud.asset.v1p2beta1.BigQueryDestinationH\x00\x42\r\n\x0b\x64\x65stination"C\n\x0eGcsDestination\x12\r\n\x03uri\x18\x01 \x01(\tH\x00\x12\x14\n\nuri_prefix\x18\x02 \x01(\tH\x00\x42\x0c\n\nobject_uri"D\n\x13\x42igQueryDestination\x12\x0f\n\x07\x64\x61taset\x18\x01 \x01(\t\x12\r\n\x05table\x18\x02 \x01(\t\x12\r\n\x05\x66orce\x18\x03 \x01(\x08""\n\x11PubsubDestination\x12\r\n\x05topic\x18\x01 \x01(\t"p\n\x10\x46\x65\x65\x64OutputConfig\x12M\n\x12pubsub_destination\x18\x01 \x01(\x0b\x32/.google.cloud.asset.v1p2beta1.PubsubDestinationH\x00\x42\r\n\x0b\x64\x65stination"\xcb\x01\n\x04\x46\x65\x65\x64\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12?\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32).google.cloud.asset.v1p2beta1.ContentType\x12J\n\x12\x66\x65\x65\x64_output_config\x18\x05 \x01(\x0b\x32..google.cloud.asset.v1p2beta1.FeedOutputConfig*\x81\x01\n\x0b\x43ontentType\x12\x1c\n\x18\x43ONTENT_TYPE_UNSPECIFIED\x10\x00\x12\x0c\n\x08RESOURCE\x10\x01\x12\x0e\n\nIAM_POLICY\x10\x02\x12\x13\n\x0fIAM_POLICY_NAME\x10\x03\x12\x0e\n\nORG_POLICY\x10\x04\x12\x11\n\rACCESS_POLICY\x10\x05\x32\xf5\x08\n\x0c\x41ssetService\x12\x91\x01\n\x0c\x45xportAssets\x12\x31.google.cloud.asset.v1p2beta1.ExportAssetsRequest\x1a\x1d.google.longrunning.Operation"/\x82\xd3\xe4\x93\x02)"$/v1p2beta1/{parent=*/*}:exportAssets:\x01*\x12\xc7\x01\n\x15\x42\x61tchGetAssetsHistory\x12:.google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest\x1a;.google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryResponse"5\x82\xd3\xe4\x93\x02/\x12-/v1p2beta1/{parent=*/*}:batchGetAssetsHistory\x12\x8b\x01\n\nCreateFeed\x12/.google.cloud.asset.v1p2beta1.CreateFeedRequest\x1a".google.cloud.asset.v1p2beta1.Feed"(\x82\xd3\xe4\x93\x02""\x1d/v1p2beta1/{parent=*/*}/feeds:\x01*\x12\x82\x01\n\x07GetFeed\x12,.google.cloud.asset.v1p2beta1.GetFeedRequest\x1a".google.cloud.asset.v1p2beta1.Feed"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v1p2beta1/{name=*/*/feeds/*}\x12\x93\x01\n\tListFeeds\x12..google.cloud.asset.v1p2beta1.ListFeedsRequest\x1a/.google.cloud.asset.v1p2beta1.ListFeedsResponse"%\x82\xd3\xe4\x93\x02\x1f\x12\x1d/v1p2beta1/{parent=*/*}/feeds\x12\x90\x01\n\nUpdateFeed\x12/.google.cloud.asset.v1p2beta1.UpdateFeedRequest\x1a".google.cloud.asset.v1p2beta1.Feed"-\x82\xd3\xe4\x93\x02\'2"/v1p2beta1/{feed.name=*/*/feeds/*}:\x01*\x12|\n\nDeleteFeed\x12/.google.cloud.asset.v1p2beta1.DeleteFeedRequest\x1a\x16.google.protobuf.Empty"%\x82\xd3\xe4\x93\x02\x1f*\x1d/v1p2beta1/{name=*/*/feeds/*}\x1aM\xca\x41\x19\x63loudasset.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb8\x01\n com.google.cloud.asset.v1p2beta1B\x11\x41ssetServiceProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset\xaa\x02\x1cGoogle.Cloud.Asset.V1p2Beta1\xca\x02\x1cGoogle\\Cloud\\Asset\\V1p2Beta1b\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_assets__pb2.DESCRIPTOR, + google_dot_longrunning_dot_operations__pb2.DESCRIPTOR, + google_dot_protobuf_dot_empty__pb2.DESCRIPTOR, + google_dot_protobuf_dot_field__mask__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + google_dot_api_dot_client__pb2.DESCRIPTOR, + ], +) + +_CONTENTTYPE = _descriptor.EnumDescriptor( + name="ContentType", + full_name="google.cloud.asset.v1p2beta1.ContentType", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="CONTENT_TYPE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="RESOURCE", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="IAM_POLICY", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="IAM_POLICY_NAME", + index=3, + number=3, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ORG_POLICY", index=4, number=4, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="ACCESS_POLICY", index=5, number=5, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=2084, + serialized_end=2213, +) +_sym_db.RegisterEnumDescriptor(_CONTENTTYPE) + +ContentType = enum_type_wrapper.EnumTypeWrapper(_CONTENTTYPE) +CONTENT_TYPE_UNSPECIFIED = 0 +RESOURCE = 1 +IAM_POLICY = 2 +IAM_POLICY_NAME = 3 +ORG_POLICY = 4 +ACCESS_POLICY = 5 + + +_EXPORTASSETSREQUEST = _descriptor.Descriptor( + name="ExportAssetsRequest", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="read_time", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest.read_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset_types", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest.asset_types", + index=2, + number=3, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content_type", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest.content_type", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output_config", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsRequest.output_config", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=326, + serialized_end=563, +) + + +_EXPORTASSETSRESPONSE = _descriptor.Descriptor( + name="ExportAssetsResponse", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="read_time", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsResponse.read_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="output_config", + full_name="google.cloud.asset.v1p2beta1.ExportAssetsResponse.output_config", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=566, + serialized_end=702, +) + + +_BATCHGETASSETSHISTORYREQUEST = _descriptor.Descriptor( + name="BatchGetAssetsHistoryRequest", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset_names", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest.asset_names", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content_type", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest.content_type", + index=2, + number=3, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="read_time_window", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest.read_time_window", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=705, + serialized_end=905, +) + + +_BATCHGETASSETSHISTORYRESPONSE = _descriptor.Descriptor( + name="BatchGetAssetsHistoryResponse", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="assets", + full_name="google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryResponse.assets", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=907, + serialized_end=999, +) + + +_CREATEFEEDREQUEST = _descriptor.Descriptor( + name="CreateFeedRequest", + full_name="google.cloud.asset.v1p2beta1.CreateFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1p2beta1.CreateFeedRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="feed_id", + full_name="google.cloud.asset.v1p2beta1.CreateFeedRequest.feed_id", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="feed", + full_name="google.cloud.asset.v1p2beta1.CreateFeedRequest.feed", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1001, + serialized_end=1103, +) + + +_GETFEEDREQUEST = _descriptor.Descriptor( + name="GetFeedRequest", + full_name="google.cloud.asset.v1p2beta1.GetFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1p2beta1.GetFeedRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1105, + serialized_end=1135, +) + + +_LISTFEEDSREQUEST = _descriptor.Descriptor( + name="ListFeedsRequest", + full_name="google.cloud.asset.v1p2beta1.ListFeedsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1p2beta1.ListFeedsRequest.parent", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1137, + serialized_end=1171, +) + + +_LISTFEEDSRESPONSE = _descriptor.Descriptor( + name="ListFeedsResponse", + full_name="google.cloud.asset.v1p2beta1.ListFeedsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="feeds", + full_name="google.cloud.asset.v1p2beta1.ListFeedsResponse.feeds", + index=0, + number=1, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1173, + serialized_end=1243, +) + + +_UPDATEFEEDREQUEST = _descriptor.Descriptor( + name="UpdateFeedRequest", + full_name="google.cloud.asset.v1p2beta1.UpdateFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="feed", + full_name="google.cloud.asset.v1p2beta1.UpdateFeedRequest.feed", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_mask", + full_name="google.cloud.asset.v1p2beta1.UpdateFeedRequest.update_mask", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1245, + serialized_end=1363, +) + + +_DELETEFEEDREQUEST = _descriptor.Descriptor( + name="DeleteFeedRequest", + full_name="google.cloud.asset.v1p2beta1.DeleteFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1p2beta1.DeleteFeedRequest.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1365, + serialized_end=1398, +) + + +_OUTPUTCONFIG = _descriptor.Descriptor( + name="OutputConfig", + full_name="google.cloud.asset.v1p2beta1.OutputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="gcs_destination", + full_name="google.cloud.asset.v1p2beta1.OutputConfig.gcs_destination", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="bigquery_destination", + full_name="google.cloud.asset.v1p2beta1.OutputConfig.bigquery_destination", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="destination", + full_name="google.cloud.asset.v1p2beta1.OutputConfig.destination", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1401, + serialized_end=1586, +) + + +_GCSDESTINATION = _descriptor.Descriptor( + name="GcsDestination", + full_name="google.cloud.asset.v1p2beta1.GcsDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="uri", + full_name="google.cloud.asset.v1p2beta1.GcsDestination.uri", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="uri_prefix", + full_name="google.cloud.asset.v1p2beta1.GcsDestination.uri_prefix", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="object_uri", + full_name="google.cloud.asset.v1p2beta1.GcsDestination.object_uri", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1588, + serialized_end=1655, +) + + +_BIGQUERYDESTINATION = _descriptor.Descriptor( + name="BigQueryDestination", + full_name="google.cloud.asset.v1p2beta1.BigQueryDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="dataset", + full_name="google.cloud.asset.v1p2beta1.BigQueryDestination.dataset", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="table", + full_name="google.cloud.asset.v1p2beta1.BigQueryDestination.table", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="force", + full_name="google.cloud.asset.v1p2beta1.BigQueryDestination.force", + index=2, + number=3, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1657, + serialized_end=1725, +) + + +_PUBSUBDESTINATION = _descriptor.Descriptor( + name="PubsubDestination", + full_name="google.cloud.asset.v1p2beta1.PubsubDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="topic", + full_name="google.cloud.asset.v1p2beta1.PubsubDestination.topic", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1727, + serialized_end=1761, +) + + +_FEEDOUTPUTCONFIG = _descriptor.Descriptor( + name="FeedOutputConfig", + full_name="google.cloud.asset.v1p2beta1.FeedOutputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="pubsub_destination", + full_name="google.cloud.asset.v1p2beta1.FeedOutputConfig.pubsub_destination", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[ + _descriptor.OneofDescriptor( + name="destination", + full_name="google.cloud.asset.v1p2beta1.FeedOutputConfig.destination", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1763, + serialized_end=1875, +) + + +_FEED = _descriptor.Descriptor( + name="Feed", + full_name="google.cloud.asset.v1p2beta1.Feed", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1p2beta1.Feed.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset_names", + full_name="google.cloud.asset.v1p2beta1.Feed.asset_names", + index=1, + number=2, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset_types", + full_name="google.cloud.asset.v1p2beta1.Feed.asset_types", + index=2, + number=3, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="content_type", + full_name="google.cloud.asset.v1p2beta1.Feed.content_type", + index=3, + number=4, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="feed_output_config", + full_name="google.cloud.asset.v1p2beta1.Feed.feed_output_config", + index=4, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1878, + serialized_end=2081, +) + +_EXPORTASSETSREQUEST.fields_by_name[ + "read_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_EXPORTASSETSREQUEST.fields_by_name["content_type"].enum_type = _CONTENTTYPE +_EXPORTASSETSREQUEST.fields_by_name["output_config"].message_type = _OUTPUTCONFIG +_EXPORTASSETSRESPONSE.fields_by_name[ + "read_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_EXPORTASSETSRESPONSE.fields_by_name["output_config"].message_type = _OUTPUTCONFIG +_BATCHGETASSETSHISTORYREQUEST.fields_by_name["content_type"].enum_type = _CONTENTTYPE +_BATCHGETASSETSHISTORYREQUEST.fields_by_name[ + "read_time_window" +].message_type = ( + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_assets__pb2._TIMEWINDOW +) +_BATCHGETASSETSHISTORYRESPONSE.fields_by_name[ + "assets" +].message_type = ( + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_assets__pb2._TEMPORALASSET +) +_CREATEFEEDREQUEST.fields_by_name["feed"].message_type = _FEED +_LISTFEEDSRESPONSE.fields_by_name["feeds"].message_type = _FEED +_UPDATEFEEDREQUEST.fields_by_name["feed"].message_type = _FEED +_UPDATEFEEDREQUEST.fields_by_name[ + "update_mask" +].message_type = google_dot_protobuf_dot_field__mask__pb2._FIELDMASK +_OUTPUTCONFIG.fields_by_name["gcs_destination"].message_type = _GCSDESTINATION +_OUTPUTCONFIG.fields_by_name["bigquery_destination"].message_type = _BIGQUERYDESTINATION +_OUTPUTCONFIG.oneofs_by_name["destination"].fields.append( + _OUTPUTCONFIG.fields_by_name["gcs_destination"] +) +_OUTPUTCONFIG.fields_by_name[ + "gcs_destination" +].containing_oneof = _OUTPUTCONFIG.oneofs_by_name["destination"] +_OUTPUTCONFIG.oneofs_by_name["destination"].fields.append( + _OUTPUTCONFIG.fields_by_name["bigquery_destination"] +) +_OUTPUTCONFIG.fields_by_name[ + "bigquery_destination" +].containing_oneof = _OUTPUTCONFIG.oneofs_by_name["destination"] +_GCSDESTINATION.oneofs_by_name["object_uri"].fields.append( + _GCSDESTINATION.fields_by_name["uri"] +) +_GCSDESTINATION.fields_by_name["uri"].containing_oneof = _GCSDESTINATION.oneofs_by_name[ + "object_uri" +] +_GCSDESTINATION.oneofs_by_name["object_uri"].fields.append( + _GCSDESTINATION.fields_by_name["uri_prefix"] +) +_GCSDESTINATION.fields_by_name[ + "uri_prefix" +].containing_oneof = _GCSDESTINATION.oneofs_by_name["object_uri"] +_FEEDOUTPUTCONFIG.fields_by_name["pubsub_destination"].message_type = _PUBSUBDESTINATION +_FEEDOUTPUTCONFIG.oneofs_by_name["destination"].fields.append( + _FEEDOUTPUTCONFIG.fields_by_name["pubsub_destination"] +) +_FEEDOUTPUTCONFIG.fields_by_name[ + "pubsub_destination" +].containing_oneof = _FEEDOUTPUTCONFIG.oneofs_by_name["destination"] +_FEED.fields_by_name["content_type"].enum_type = _CONTENTTYPE +_FEED.fields_by_name["feed_output_config"].message_type = _FEEDOUTPUTCONFIG +DESCRIPTOR.message_types_by_name["ExportAssetsRequest"] = _EXPORTASSETSREQUEST +DESCRIPTOR.message_types_by_name["ExportAssetsResponse"] = _EXPORTASSETSRESPONSE +DESCRIPTOR.message_types_by_name[ + "BatchGetAssetsHistoryRequest" +] = _BATCHGETASSETSHISTORYREQUEST +DESCRIPTOR.message_types_by_name[ + "BatchGetAssetsHistoryResponse" +] = _BATCHGETASSETSHISTORYRESPONSE +DESCRIPTOR.message_types_by_name["CreateFeedRequest"] = _CREATEFEEDREQUEST +DESCRIPTOR.message_types_by_name["GetFeedRequest"] = _GETFEEDREQUEST +DESCRIPTOR.message_types_by_name["ListFeedsRequest"] = _LISTFEEDSREQUEST +DESCRIPTOR.message_types_by_name["ListFeedsResponse"] = _LISTFEEDSRESPONSE +DESCRIPTOR.message_types_by_name["UpdateFeedRequest"] = _UPDATEFEEDREQUEST +DESCRIPTOR.message_types_by_name["DeleteFeedRequest"] = _DELETEFEEDREQUEST +DESCRIPTOR.message_types_by_name["OutputConfig"] = _OUTPUTCONFIG +DESCRIPTOR.message_types_by_name["GcsDestination"] = _GCSDESTINATION +DESCRIPTOR.message_types_by_name["BigQueryDestination"] = _BIGQUERYDESTINATION +DESCRIPTOR.message_types_by_name["PubsubDestination"] = _PUBSUBDESTINATION +DESCRIPTOR.message_types_by_name["FeedOutputConfig"] = _FEEDOUTPUTCONFIG +DESCRIPTOR.message_types_by_name["Feed"] = _FEED +DESCRIPTOR.enum_types_by_name["ContentType"] = _CONTENTTYPE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +ExportAssetsRequest = _reflection.GeneratedProtocolMessageType( + "ExportAssetsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_EXPORTASSETSREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Export asset request. + + + Attributes: + parent: + Required. The relative name of the root asset. This 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"). + read_time: + Timestamp to take an asset snapshot. This can only be set to a + timestamp between 2018-10-02 UTC (inclusive) and the current + time. If not specified, the current time will be used. Due to + delays in resource data collection and indexing, there is a + volatile window during which running the same query may get + different results. + asset_types: + A list of asset types of which to take a snapshot for. For + example: "compute.googleapis.com/Disk". If specified, only + matching assets will be returned. See `Introduction to Cloud + Asset Inventory `__ for all + supported asset types. + content_type: + Asset content type. If not specified, no content but the asset + name will be returned. + output_config: + Required. Output configuration indicating where the results + will be output to. All results will be in newline delimited + JSON format. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.ExportAssetsRequest) + ), +) +_sym_db.RegisterMessage(ExportAssetsRequest) + +ExportAssetsResponse = _reflection.GeneratedProtocolMessageType( + "ExportAssetsResponse", + (_message.Message,), + dict( + DESCRIPTOR=_EXPORTASSETSRESPONSE, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""The export asset response. This message is returned by the + [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] + method in the returned + [google.longrunning.Operation.response][google.longrunning.Operation.response] + field. + + + Attributes: + read_time: + Time the snapshot was taken. + output_config: + Output configuration indicating where the results were output + to. All results are in JSON format. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.ExportAssetsResponse) + ), +) +_sym_db.RegisterMessage(ExportAssetsResponse) + +BatchGetAssetsHistoryRequest = _reflection.GeneratedProtocolMessageType( + "BatchGetAssetsHistoryRequest", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHGETASSETSHISTORYREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Batch get assets history request. + + + Attributes: + parent: + 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: + A list of the full names of the assets. For example: ``//compu + te.googleapis.com/projects/my_project_123/zones/zone1/instance + s/instance1``. See `Resource Names `__ and `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. + content_type: + Required. The content type. + read_time_window: + Optional. The time window for the asset history. Both + start\_time and end\_time are optional and if set, it must be + after 2018-10-02 UTC. If end\_time is not set, it is default + to current timestamp. If start\_time is not set, the snapshot + of the assets at end\_time will be returned. The returned + results contain all temporal assets whose time window overlap + with read\_time\_window. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryRequest) + ), +) +_sym_db.RegisterMessage(BatchGetAssetsHistoryRequest) + +BatchGetAssetsHistoryResponse = _reflection.GeneratedProtocolMessageType( + "BatchGetAssetsHistoryResponse", + (_message.Message,), + dict( + DESCRIPTOR=_BATCHGETASSETSHISTORYRESPONSE, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Batch get assets history response. + + + Attributes: + assets: + A list of assets with valid time windows. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.BatchGetAssetsHistoryResponse) + ), +) +_sym_db.RegisterMessage(BatchGetAssetsHistoryResponse) + +CreateFeedRequest = _reflection.GeneratedProtocolMessageType( + "CreateFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEFEEDREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Create asset feed request. + + + Attributes: + parent: + Required. The name of the project/folder/organization where + this feed should be created in. It can only be an organization + number (such as "organizations/123"), a folder number (such as + "folders/123"), a project ID (such as "projects/my-project- + id")", or a project number (such as "projects/12345"). + feed_id: + Required. This is the client-assigned asset feed identifier + and it needs to be unique under a specific parent + project/folder/organization. + feed: + The feed details. The field ``name`` must be empty and it will + be generated in the format of: + projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.CreateFeedRequest) + ), +) +_sym_db.RegisterMessage(CreateFeedRequest) + +GetFeedRequest = _reflection.GeneratedProtocolMessageType( + "GetFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETFEEDREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Get asset feed request. + + + Attributes: + name: + The name of the Feed and it must be in the format of: + projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.GetFeedRequest) + ), +) +_sym_db.RegisterMessage(GetFeedRequest) + +ListFeedsRequest = _reflection.GeneratedProtocolMessageType( + "ListFeedsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFEEDSREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""List asset feeds request. + + + Attributes: + parent: + Required. The parent project/folder/organization whose feeds + are to be listed. It can only be using + project/folder/organization number (such as "folders/12345")", + or a project ID (such as "projects/my-project-id"). + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.ListFeedsRequest) + ), +) +_sym_db.RegisterMessage(ListFeedsRequest) + +ListFeedsResponse = _reflection.GeneratedProtocolMessageType( + "ListFeedsResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFEEDSRESPONSE, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""List asset feeds response. + + + Attributes: + feeds: + A list of feeds. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.ListFeedsResponse) + ), +) +_sym_db.RegisterMessage(ListFeedsResponse) + +UpdateFeedRequest = _reflection.GeneratedProtocolMessageType( + "UpdateFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_UPDATEFEEDREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Update asset feed request. + + + Attributes: + feed: + The new values of feed details. It must match an existing feed + and the field ``name`` must be in the format of: + projects/project\_number/feeds/feed\_id or + folders/folder\_number/feeds/feed\_id or + organizations/organization\_number/feeds/feed\_id. + update_mask: + Only updates the ``feed`` fields indicated by this mask. The + field mask must not be empty, and it must not contain fields + that are immutable or only set by the server. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.UpdateFeedRequest) + ), +) +_sym_db.RegisterMessage(UpdateFeedRequest) + +DeleteFeedRequest = _reflection.GeneratedProtocolMessageType( + "DeleteFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEFEEDREQUEST, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Delete asset feed request. + + + Attributes: + name: + The name of the feed and it must be in the format of: + projects/project\_number/feeds/feed\_id + folders/folder\_number/feeds/feed\_id + organizations/organization\_number/feeds/feed\_id + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.DeleteFeedRequest) + ), +) +_sym_db.RegisterMessage(DeleteFeedRequest) + +OutputConfig = _reflection.GeneratedProtocolMessageType( + "OutputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_OUTPUTCONFIG, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Output configuration for export assets destination. + + + Attributes: + destination: + Asset export destination. + gcs_destination: + Destination on Cloud Storage. + bigquery_destination: + Destination on Bigquery. The output table stores the fields in + asset proto as columns in BigQuery. The resource/iam\_policy + field is converted to a record with each field to a column, + except metadata to a single JSON string. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.OutputConfig) + ), +) +_sym_db.RegisterMessage(OutputConfig) + +GcsDestination = _reflection.GeneratedProtocolMessageType( + "GcsDestination", + (_message.Message,), + dict( + DESCRIPTOR=_GCSDESTINATION, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""A Cloud Storage location. + + + Attributes: + object_uri: + Required. + uri: + The uri of the Cloud Storage object. It's the same uri that is + used by gsutil. For example: "gs://bucket\_name/object\_name". + See `Viewing and Editing Object Metadata + `__ for more information. + uri_prefix: + The uri prefix of all generated Cloud Storage objects. For + example: "gs://bucket\_name/object\_name\_prefix". Each object + uri is in format: "gs://bucket\_name/object\_name\_prefix// + and only contains assets for that type. starts from 0. For + example: "gs://bucket\_name/object\_name\_prefix/compute.googl + eapis.com/Disk/0" is the first shard of output objects + containing all compute.googleapis.com/Disk assets. An + INVALID\_ARGUMENT error will be returned if file with the same + name "gs://bucket\_name/object\_name\_prefix" already exists. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.GcsDestination) + ), +) +_sym_db.RegisterMessage(GcsDestination) + +BigQueryDestination = _reflection.GeneratedProtocolMessageType( + "BigQueryDestination", + (_message.Message,), + dict( + DESCRIPTOR=_BIGQUERYDESTINATION, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""A Bigquery destination. + + + Attributes: + dataset: + Required. The BigQuery dataset in format + "projects/projectId/datasets/datasetId", to which the snapshot + result should be exported. If this dataset does not exist, the + export call returns an error. + table: + Required. The BigQuery table to which the snapshot result + should be written. If this table does not exist, a new table + with the given name will be created. + force: + If the destination table already exists and this flag is + ``TRUE``, the table will be overwritten by the contents of + assets snapshot. If the flag is not set and the destination + table already exists, the export call returns an error. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.BigQueryDestination) + ), +) +_sym_db.RegisterMessage(BigQueryDestination) + +PubsubDestination = _reflection.GeneratedProtocolMessageType( + "PubsubDestination", + (_message.Message,), + dict( + DESCRIPTOR=_PUBSUBDESTINATION, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""A Cloud Pubsub destination. + + + Attributes: + topic: + The name of the Cloud Pub/Sub topic to publish to. For + example: ``projects/PROJECT_ID/topics/TOPIC_ID``. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.PubsubDestination) + ), +) +_sym_db.RegisterMessage(PubsubDestination) + +FeedOutputConfig = _reflection.GeneratedProtocolMessageType( + "FeedOutputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_FEEDOUTPUTCONFIG, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""Output configuration for asset feed destination. + + + Attributes: + destination: + Asset feed destination. + pubsub_destination: + Destination on Cloud Pubsub. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.FeedOutputConfig) + ), +) +_sym_db.RegisterMessage(FeedOutputConfig) + +Feed = _reflection.GeneratedProtocolMessageType( + "Feed", + (_message.Message,), + dict( + DESCRIPTOR=_FEED, + __module__="google.cloud.asset_v1p2beta1.proto.asset_service_pb2", + __doc__="""An asset feed used to export asset updates to a destinations. An asset + feed filter controls what updates are exported. The asset feed must be + created within a project, organization, or folder. Supported + destinations are: Cloud Pub/Sub topics. + + + Attributes: + name: + Required. The format will be + projects/{project\_number}/feeds/{client- + assigned\_feed\_identifier} or + folders/{folder\_number}/feeds/{client- + assigned\_feed\_identifier} or + organizations/{organization\_number}/feeds/{client- + assigned\_feed\_identifier} The client-assigned feed + identifier must be unique within the parent + project/folder/organization. + asset_names: + A list of the full names of the assets to receive updates. You + must specify either or both of asset\_names and asset\_types. + Only asset updates matching specified asset\_names and + asset\_types are exported to the feed. For example: ``//comput + e.googleapis.com/projects/my_project_123/zones/zone1/instances + /instance1``. See `Resource Names `__ for more info. + asset_types: + A list of types of the assets to receive updates. You must + specify either or both of asset\_names and asset\_types. Only + asset updates matching specified asset\_names and asset\_types + are exported to the feed. For example: + "compute.googleapis.com/Disk" See `Introduction to Cloud Asset + Inventory `__ for all + supported asset types. + content_type: + Asset content type. If not specified, no content but the asset + name and type will be returned. + feed_output_config: + Required. Feed output configuration defining where the asset + updates are published to. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.Feed) + ), +) +_sym_db.RegisterMessage(Feed) + + +DESCRIPTOR._options = None + +_ASSETSERVICE = _descriptor.ServiceDescriptor( + name="AssetService", + full_name="google.cloud.asset.v1p2beta1.AssetService", + file=DESCRIPTOR, + index=0, + serialized_options=_b( + "\312A\031cloudasset.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" + ), + serialized_start=2216, + serialized_end=3357, + methods=[ + _descriptor.MethodDescriptor( + name="ExportAssets", + full_name="google.cloud.asset.v1p2beta1.AssetService.ExportAssets", + index=0, + containing_service=None, + input_type=_EXPORTASSETSREQUEST, + output_type=google_dot_longrunning_dot_operations__pb2._OPERATION, + serialized_options=_b( + '\202\323\344\223\002)"$/v1p2beta1/{parent=*/*}:exportAssets:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="BatchGetAssetsHistory", + full_name="google.cloud.asset.v1p2beta1.AssetService.BatchGetAssetsHistory", + index=1, + containing_service=None, + input_type=_BATCHGETASSETSHISTORYREQUEST, + output_type=_BATCHGETASSETSHISTORYRESPONSE, + serialized_options=_b( + "\202\323\344\223\002/\022-/v1p2beta1/{parent=*/*}:batchGetAssetsHistory" + ), + ), + _descriptor.MethodDescriptor( + name="CreateFeed", + full_name="google.cloud.asset.v1p2beta1.AssetService.CreateFeed", + index=2, + containing_service=None, + input_type=_CREATEFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + '\202\323\344\223\002""\035/v1p2beta1/{parent=*/*}/feeds:\001*' + ), + ), + _descriptor.MethodDescriptor( + name="GetFeed", + full_name="google.cloud.asset.v1p2beta1.AssetService.GetFeed", + index=3, + containing_service=None, + input_type=_GETFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + "\202\323\344\223\002\037\022\035/v1p2beta1/{name=*/*/feeds/*}" + ), + ), + _descriptor.MethodDescriptor( + name="ListFeeds", + full_name="google.cloud.asset.v1p2beta1.AssetService.ListFeeds", + index=4, + containing_service=None, + input_type=_LISTFEEDSREQUEST, + output_type=_LISTFEEDSRESPONSE, + serialized_options=_b( + "\202\323\344\223\002\037\022\035/v1p2beta1/{parent=*/*}/feeds" + ), + ), + _descriptor.MethodDescriptor( + name="UpdateFeed", + full_name="google.cloud.asset.v1p2beta1.AssetService.UpdateFeed", + index=5, + containing_service=None, + input_type=_UPDATEFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + "\202\323\344\223\002'2\"/v1p2beta1/{feed.name=*/*/feeds/*}:\001*" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteFeed", + full_name="google.cloud.asset.v1p2beta1.AssetService.DeleteFeed", + index=6, + containing_service=None, + input_type=_DELETEFEEDREQUEST, + output_type=google_dot_protobuf_dot_empty__pb2._EMPTY, + serialized_options=_b( + "\202\323\344\223\002\037*\035/v1p2beta1/{name=*/*/feeds/*}" + ), + ), + ], +) +_sym_db.RegisterServiceDescriptor(_ASSETSERVICE) + +DESCRIPTOR.services_by_name["AssetService"] = _ASSETSERVICE + +# @@protoc_insertion_point(module_scope) diff --git a/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py b/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py new file mode 100644 index 000000000000..05ec4e44be0f --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py @@ -0,0 +1,163 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc + +from google.cloud.asset_v1p2beta1.proto import ( + asset_service_pb2 as google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2, +) +from google.longrunning import ( + operations_pb2 as google_dot_longrunning_dot_operations__pb2, +) +from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 + + +class AssetServiceStub(object): + """Asset service definition. + """ + + def __init__(self, channel): + """Constructor. + + Args: + channel: A grpc.Channel. + """ + self.ExportAssets = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/ExportAssets", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.SerializeToString, + response_deserializer=google_dot_longrunning_dot_operations__pb2.Operation.FromString, + ) + self.BatchGetAssetsHistory = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/BatchGetAssetsHistory", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.FromString, + ) + self.CreateFeed = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/CreateFeed", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.GetFeed = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/GetFeed", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.GetFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.ListFeeds = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/ListFeeds", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.FromString, + ) + self.UpdateFeed = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/UpdateFeed", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.DeleteFeed = channel.unary_unary( + "/google.cloud.asset.v1p2beta1.AssetService/DeleteFeed", + request_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.DeleteFeedRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) + + +class AssetServiceServicer(object): + """Asset service definition. + """ + + def ExportAssets(self, request, context): + """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][google.longrunning.Operation] API allowing you + to keep track of the export. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def BatchGetAssetsHistory(self, request, context): + """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. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def CreateFeed(self, request, context): + """Creates a feed in a parent project/folder/organization to listen to its + asset updates. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetFeed(self, request, context): + """Gets details about an asset feed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def ListFeeds(self, request, context): + """Lists all asset feeds in a parent project/folder/organization. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def UpdateFeed(self, request, context): + """Updates an asset feed configuration. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def DeleteFeed(self, request, context): + """Deletes an asset feed. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + +def add_AssetServiceServicer_to_server(servicer, server): + rpc_method_handlers = { + "ExportAssets": grpc.unary_unary_rpc_method_handler( + servicer.ExportAssets, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.FromString, + response_serializer=google_dot_longrunning_dot_operations__pb2.Operation.SerializeToString, + ), + "BatchGetAssetsHistory": grpc.unary_unary_rpc_method_handler( + servicer.BatchGetAssetsHistory, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.SerializeToString, + ), + "CreateFeed": grpc.unary_unary_rpc_method_handler( + servicer.CreateFeed, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "GetFeed": grpc.unary_unary_rpc_method_handler( + servicer.GetFeed, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.GetFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "ListFeeds": grpc.unary_unary_rpc_method_handler( + servicer.ListFeeds, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.SerializeToString, + ), + "UpdateFeed": grpc.unary_unary_rpc_method_handler( + servicer.UpdateFeed, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "DeleteFeed": grpc.unary_unary_rpc_method_handler( + servicer.DeleteFeed, + request_deserializer=google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.DeleteFeedRequest.FromString, + response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, + ), + } + generic_handler = grpc.method_handlers_generic_handler( + "google.cloud.asset.v1p2beta1.AssetService", rpc_method_handlers + ) + server.add_generic_rpc_handlers((generic_handler,)) diff --git a/asset/google/cloud/asset_v1p2beta1/proto/assets.proto b/asset/google/cloud/asset_v1p2beta1/proto/assets.proto new file mode 100644 index 000000000000..a9cda898a357 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/assets.proto @@ -0,0 +1,135 @@ +// Copyright 2019 Google LLC. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// + +syntax = "proto3"; + +package google.cloud.asset.v1p2beta1; + +import "google/api/annotations.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.Asset.v1p2beta1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset"; +option java_multiple_files = true; +option java_outer_classname = "AssetProto"; +option java_package = "com.google.cloud.asset.v1p2beta1"; +option php_namespace = "Google\\Cloud\\Asset\\v1p2beta1"; + +// Temporal asset. In addition to the asset, the temporal asset includes the +// status of the asset and valid from and to time of it. +message TemporalAsset { + // The time window when the asset data and state was observed. + TimeWindow window = 1; + + // If the asset is deleted or not. + bool deleted = 2; + + // Asset. + Asset asset = 3; +} + +// A time window of (start_time, end_time]. +message TimeWindow { + // Start time of the time window (exclusive). + google.protobuf.Timestamp start_time = 1; + + // End time of the time window (inclusive). + // Current timestamp if not specified. + google.protobuf.Timestamp end_time = 2; +} + +// Cloud asset. This includes all Google Cloud Platform resources, +// Cloud IAM policies, and other non-GCP assets. +message Asset { + // The full name of the asset. For 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) + // for more information. + string name = 1; + + // Type of the asset. Example: "compute.googleapis.com/Disk". + string asset_type = 2; + + // Representation of the resource. + Resource resource = 3; + + // Representation of the actual Cloud IAM policy set on a cloud resource. For + // each resource, there must be at most one Cloud IAM policy set on it. + google.iam.v1.Policy iam_policy = 4; + + // Cloud IAM policy name of the Cloud IAM policy set on a cloud resource. For + // each resource, there must be at most one Cloud IAM policy name associated + // with it. + bytes iam_policy_name = 5; + + // Asset's ancestry path in Cloud Resource Manager (CRM) hierarchy, + // represented as a list of relative resource names. Ancestry path starts with + // the closest CRM ancestor and ending at a visible root. If the asset is a + // CRM project/ folder/organization, this starts from the asset itself. + // + // Example: ["projects/123456789", "folders/5432", "organizations/1234"] + repeated string ancestors = 6; +} + +// Representation of a cloud resource. +message Resource { + // The API version. Example: "v1". + string version = 1; + + // The URL of the discovery document containing the resource's JSON schema. + // For example: + // `"https://www.googleapis.com/discovery/v1/apis/compute/v1/rest"`. + // It will be left unspecified for resources without a discovery-based API, + // such as Cloud Bigtable. + string discovery_document_uri = 2; + + // The JSON schema name listed in the discovery document. + // Example: "Project". It will be left unspecified for resources (such as + // Cloud Bigtable) without a discovery-based API. + string discovery_name = 3; + + // The REST URL for accessing the resource. An HTTP GET operation using this + // URL returns the resource itself. + // Example: + // `https://cloudresourcemanager.googleapis.com/v1/projects/my-project-123`. + // It will be left unspecified for resources without a REST API. + string resource_url = 4; + + // The full name of the immediate parent of this resource. See + // [Resource + // Names](https://cloud.google.com/apis/design/resource_names#full_resource_name) + // for more information. + // + // For GCP assets, it is the parent resource defined in the [Cloud IAM policy + // hierarchy](https://cloud.google.com/iam/docs/overview#policy_hierarchy). + // For example: + // `"//cloudresourcemanager.googleapis.com/projects/my_project_123"`. + // + // For third-party assets, it is up to the users to define. + string parent = 5; + + // The content of the resource, in which some sensitive fields are scrubbed + // away and may not be present. + google.protobuf.Struct data = 6; + + // The actual metadata content for the resource, only visible for internal + // users. + google.protobuf.Any internal_data = 7; +} diff --git a/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2.py b/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2.py new file mode 100644 index 000000000000..0e086f63c197 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2.py @@ -0,0 +1,616 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/asset_v1p2beta1/proto/assets.proto + +import sys + +_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 +from google.iam.v1 import iam_policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2 +from google.protobuf import any_pb2 as google_dot_protobuf_dot_any__pb2 +from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/asset_v1p2beta1/proto/assets.proto", + package="google.cloud.asset.v1p2beta1", + syntax="proto3", + serialized_options=_b( + "\n com.google.cloud.asset.v1p2beta1B\nAssetProtoP\001ZAgoogle.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset\370\001\001\252\002\034Google.Cloud.Asset.v1p2beta1\312\002\034Google\\Cloud\\Asset\\v1p2beta1" + ), + serialized_pb=_b( + '\n/google/cloud/asset_v1p2beta1/proto/assets.proto\x12\x1cgoogle.cloud.asset.v1p2beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x8e\x01\n\rTemporalAsset\x12\x38\n\x06window\x18\x01 \x01(\x0b\x32(.google.cloud.asset.v1p2beta1.TimeWindow\x12\x0f\n\x07\x64\x65leted\x18\x02 \x01(\x08\x12\x32\n\x05\x61sset\x18\x03 \x01(\x0b\x32#.google.cloud.asset.v1p2beta1.Asset"j\n\nTimeWindow\x12.\n\nstart_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12,\n\x08\x65nd_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp"\xba\x01\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nasset_type\x18\x02 \x01(\t\x12\x38\n\x08resource\x18\x03 \x01(\x0b\x32&.google.cloud.asset.v1p2beta1.Resource\x12)\n\niam_policy\x18\x04 \x01(\x0b\x32\x15.google.iam.v1.Policy\x12\x17\n\x0fiam_policy_name\x18\x05 \x01(\x0c\x12\x11\n\tancestors\x18\x06 \x03(\t"\xcd\x01\n\x08Resource\x12\x0f\n\x07version\x18\x01 \x01(\t\x12\x1e\n\x16\x64iscovery_document_uri\x18\x02 \x01(\t\x12\x16\n\x0e\x64iscovery_name\x18\x03 \x01(\t\x12\x14\n\x0cresource_url\x18\x04 \x01(\t\x12\x0e\n\x06parent\x18\x05 \x01(\t\x12%\n\x04\x64\x61ta\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x12+\n\rinternal_data\x18\x07 \x01(\x0b\x32\x14.google.protobuf.AnyB\xb4\x01\n com.google.cloud.asset.v1p2beta1B\nAssetProtoP\x01ZAgoogle.golang.org/genproto/googleapis/cloud/asset/v1p2beta1;asset\xf8\x01\x01\xaa\x02\x1cGoogle.Cloud.Asset.v1p2beta1\xca\x02\x1cGoogle\\Cloud\\Asset\\v1p2beta1b\x06proto3' + ), + dependencies=[ + google_dot_api_dot_annotations__pb2.DESCRIPTOR, + google_dot_iam_dot_v1_dot_policy__pb2.DESCRIPTOR, + google_dot_protobuf_dot_any__pb2.DESCRIPTOR, + google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + ], +) + + +_TEMPORALASSET = _descriptor.Descriptor( + name="TemporalAsset", + full_name="google.cloud.asset.v1p2beta1.TemporalAsset", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="window", + full_name="google.cloud.asset.v1p2beta1.TemporalAsset.window", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="deleted", + full_name="google.cloud.asset.v1p2beta1.TemporalAsset.deleted", + index=1, + number=2, + type=8, + cpp_type=7, + label=1, + has_default_value=False, + default_value=False, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset", + full_name="google.cloud.asset.v1p2beta1.TemporalAsset.asset", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=230, + serialized_end=372, +) + + +_TIMEWINDOW = _descriptor.Descriptor( + name="TimeWindow", + full_name="google.cloud.asset.v1p2beta1.TimeWindow", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="start_time", + full_name="google.cloud.asset.v1p2beta1.TimeWindow.start_time", + index=0, + number=1, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="end_time", + full_name="google.cloud.asset.v1p2beta1.TimeWindow.end_time", + index=1, + number=2, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=374, + serialized_end=480, +) + + +_ASSET = _descriptor.Descriptor( + name="Asset", + full_name="google.cloud.asset.v1p2beta1.Asset", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1p2beta1.Asset.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="asset_type", + full_name="google.cloud.asset.v1p2beta1.Asset.asset_type", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="resource", + full_name="google.cloud.asset.v1p2beta1.Asset.resource", + index=2, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="iam_policy", + full_name="google.cloud.asset.v1p2beta1.Asset.iam_policy", + index=3, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="iam_policy_name", + full_name="google.cloud.asset.v1p2beta1.Asset.iam_policy_name", + index=4, + number=5, + type=12, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b(""), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="ancestors", + full_name="google.cloud.asset.v1p2beta1.Asset.ancestors", + index=5, + number=6, + type=9, + cpp_type=9, + label=3, + has_default_value=False, + default_value=[], + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=483, + serialized_end=669, +) + + +_RESOURCE = _descriptor.Descriptor( + name="Resource", + full_name="google.cloud.asset.v1p2beta1.Resource", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="version", + full_name="google.cloud.asset.v1p2beta1.Resource.version", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="discovery_document_uri", + full_name="google.cloud.asset.v1p2beta1.Resource.discovery_document_uri", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="discovery_name", + full_name="google.cloud.asset.v1p2beta1.Resource.discovery_name", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="resource_url", + full_name="google.cloud.asset.v1p2beta1.Resource.resource_url", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1p2beta1.Resource.parent", + index=4, + number=5, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=_b("").decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="data", + full_name="google.cloud.asset.v1p2beta1.Resource.data", + index=5, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="internal_data", + full_name="google.cloud.asset.v1p2beta1.Resource.internal_data", + index=6, + number=7, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=672, + serialized_end=877, +) + +_TEMPORALASSET.fields_by_name["window"].message_type = _TIMEWINDOW +_TEMPORALASSET.fields_by_name["asset"].message_type = _ASSET +_TIMEWINDOW.fields_by_name[ + "start_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_TIMEWINDOW.fields_by_name[ + "end_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_ASSET.fields_by_name["resource"].message_type = _RESOURCE +_ASSET.fields_by_name[ + "iam_policy" +].message_type = ( + google_dot_iam_dot_v1_dot_policy__pb2.google_dot_iam_dot_v1_dot_policy__pb2._POLICY +) +_RESOURCE.fields_by_name[ + "data" +].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_RESOURCE.fields_by_name[ + "internal_data" +].message_type = google_dot_protobuf_dot_any__pb2._ANY +DESCRIPTOR.message_types_by_name["TemporalAsset"] = _TEMPORALASSET +DESCRIPTOR.message_types_by_name["TimeWindow"] = _TIMEWINDOW +DESCRIPTOR.message_types_by_name["Asset"] = _ASSET +DESCRIPTOR.message_types_by_name["Resource"] = _RESOURCE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +TemporalAsset = _reflection.GeneratedProtocolMessageType( + "TemporalAsset", + (_message.Message,), + dict( + DESCRIPTOR=_TEMPORALASSET, + __module__="google.cloud.asset_v1p2beta1.proto.assets_pb2", + __doc__="""Temporal asset. In addition to the asset, the temporal asset includes + the status of the asset and valid from and to time of it. + + + Attributes: + window: + The time window when the asset data and state was observed. + deleted: + If the asset is deleted or not. + asset: + Asset. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.TemporalAsset) + ), +) +_sym_db.RegisterMessage(TemporalAsset) + +TimeWindow = _reflection.GeneratedProtocolMessageType( + "TimeWindow", + (_message.Message,), + dict( + DESCRIPTOR=_TIMEWINDOW, + __module__="google.cloud.asset_v1p2beta1.proto.assets_pb2", + __doc__="""A time window of (start\_time, end\_time]. + + + Attributes: + start_time: + Start time of the time window (exclusive). + end_time: + End time of the time window (inclusive). Current timestamp if + not specified. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.TimeWindow) + ), +) +_sym_db.RegisterMessage(TimeWindow) + +Asset = _reflection.GeneratedProtocolMessageType( + "Asset", + (_message.Message,), + dict( + DESCRIPTOR=_ASSET, + __module__="google.cloud.asset_v1p2beta1.proto.assets_pb2", + __doc__="""Cloud asset. This includes all Google Cloud Platform resources, Cloud + IAM policies, and other non-GCP assets. + + + Attributes: + name: + + The full name of the asset. For example: + ``//compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1``. + See https://cloud.google.com/apis/design/resource_names#full_resource_name + for more information. + asset_type: + Type of the asset. Example: "compute.googleapis.com/Disk". + resource: + Representation of the resource. + iam_policy: + Representation of the actual Cloud IAM policy set on a cloud + resource. For each resource, there must be at most one Cloud + IAM policy set on it. + iam_policy_name: + Cloud IAM policy name of the Cloud IAM policy set on a cloud + resource. For each resource, there must be at most one Cloud + IAM policy name associated with it. + ancestors: + Asset's ancestry path in Cloud Resource Manager (CRM) + hierarchy, represented as a list of relative resource names. + Ancestry path starts with the closest CRM ancestor and ending + at a visible root. If the asset is a CRM project/ + folder/organization, this starts from the asset itself. + Example: ["projects/123456789", "folders/5432", + "organizations/1234"] + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.Asset) + ), +) +_sym_db.RegisterMessage(Asset) + +Resource = _reflection.GeneratedProtocolMessageType( + "Resource", + (_message.Message,), + dict( + DESCRIPTOR=_RESOURCE, + __module__="google.cloud.asset_v1p2beta1.proto.assets_pb2", + __doc__="""Representation of a cloud resource. + + + Attributes: + version: + The API version. Example: "v1". + discovery_document_uri: + The URL of the discovery document containing the resource's + JSON schema. For example: ``"https://www.googleapis.com/discov + ery/v1/apis/compute/v1/rest"``. It will be left unspecified + for resources without a discovery-based API, such as Cloud + Bigtable. + discovery_name: + The JSON schema name listed in the discovery document. + Example: "Project". It will be left unspecified for resources + (such as Cloud Bigtable) without a discovery-based API. + resource_url: + The REST URL for accessing the resource. An HTTP GET operation + using this URL returns the resource itself. Example: + ``https://cloudresourcemanager.googleapis.com/v1/projects/my- + project-123``. It will be left unspecified for resources + without a REST API. + parent: + The full name of the immediate parent of this resource. See + `Resource Names `__ for more information. For GCP + assets, it is the parent resource defined in the `Cloud IAM + policy hierarchy `__. For example: ``"//cloudresourcemanager.go + ogleapis.com/projects/my_project_123"``. For third-party + assets, it is up to the users to define. + data: + The content of the resource, in which some sensitive fields + are scrubbed away and may not be present. + internal_data: + The actual metadata content for the resource, only visible for + internal users. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1p2beta1.Resource) + ), +) +_sym_db.RegisterMessage(Resource) + + +DESCRIPTOR._options = None +# @@protoc_insertion_point(module_scope) diff --git a/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py b/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py new file mode 100644 index 000000000000..07cb78fe03a9 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py @@ -0,0 +1,2 @@ +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +import grpc diff --git a/asset/google/cloud/asset_v1p2beta1/types.py b/asset/google/cloud/asset_v1p2beta1/types.py new file mode 100644 index 000000000000..adaff8cd6862 --- /dev/null +++ b/asset/google/cloud/asset_v1p2beta1/types.py @@ -0,0 +1,63 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from __future__ import absolute_import +import sys + +from google.api_core.protobuf_helpers import get_messages + +from google.cloud.asset_v1p2beta1.proto import asset_service_pb2 +from google.cloud.asset_v1p2beta1.proto import assets_pb2 +from google.iam.v1 import policy_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import any_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 +from google.protobuf import struct_pb2 +from google.protobuf import timestamp_pb2 +from google.rpc import status_pb2 +from google.type import expr_pb2 + + +_shared_modules = [ + policy_pb2, + operations_pb2, + any_pb2, + empty_pb2, + field_mask_pb2, + struct_pb2, + timestamp_pb2, + status_pb2, + expr_pb2, +] + +_local_modules = [asset_service_pb2, assets_pb2] + +names = [] + +for module in _shared_modules: # pragma: NO COVER + for name, message in get_messages(module).items(): + setattr(sys.modules[__name__], name, message) + names.append(name) +for module in _local_modules: + for name, message in get_messages(module).items(): + message.__module__ = "google.cloud.asset_v1p2beta1.types" + setattr(sys.modules[__name__], name, message) + names.append(name) + + +__all__ = tuple(sorted(names)) diff --git a/asset/synth.metadata b/asset/synth.metadata index f5b4d7df6112..c22647965623 100644 --- a/asset/synth.metadata +++ b/asset/synth.metadata @@ -1,19 +1,11 @@ { - "updateTime": "2019-07-03T12:15:07.392129Z", + "updateTime": "2019-08-01T20:26:16.288701Z", "sources": [ { "generator": { "name": "artman", - "version": "0.29.3", - "dockerImage": "googleapis/artman@sha256:8900f94a81adaab0238965aa8a7b3648791f4f3a95ee65adc6a56cfcc3753101" - } - }, - { - "git": { - "name": "googleapis", - "remote": "https://github.com/googleapis/googleapis.git", - "sha": "69916b6ffbb7717fa009033351777d0c9909fb79", - "internalRef": "256241904" + "version": "0.31.0", + "dockerImage": "googleapis/artman@sha256:9aed6bbde54e26d2fcde7aa86d9f64c0278f741e58808c46573e488cbf6098f0" } }, { @@ -35,6 +27,16 @@ "config": "google/cloud/asset/artman_cloudasset_v1beta1.yaml" } }, + { + "client": { + "source": "googleapis", + "apiName": "asset", + "apiVersion": "v1p2beta1", + "language": "python", + "generator": "gapic", + "config": "google/cloud/asset/artman_cloudasset_v1p2beta1.yaml" + } + }, { "client": { "source": "googleapis", diff --git a/asset/synth.py b/asset/synth.py index 7d53c57fbcd9..9f4498bdbb58 100644 --- a/asset/synth.py +++ b/asset/synth.py @@ -19,7 +19,7 @@ gapic = gcp.GAPICGenerator() common = gcp.CommonTemplates() -versions = ["v1beta1", "v1"] +versions = ["v1beta1", "v1p2beta1", "v1"] excludes = ["setup.py", "nox*.py", "README.rst", "docs/conf.py", "docs/index.rst"] diff --git a/asset/tests/unit/gapic/v1p2beta1/test_asset_service_client_v1p2beta1.py b/asset/tests/unit/gapic/v1p2beta1/test_asset_service_client_v1p2beta1.py new file mode 100644 index 000000000000..b893a5d278af --- /dev/null +++ b/asset/tests/unit/gapic/v1p2beta1/test_asset_service_client_v1p2beta1.py @@ -0,0 +1,358 @@ +# -*- coding: utf-8 -*- +# +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Unit tests.""" + +import mock +import pytest + +from google.rpc import status_pb2 + +from google.cloud import asset_v1p2beta1 +from google.cloud.asset_v1p2beta1 import enums +from google.cloud.asset_v1p2beta1.proto import asset_service_pb2 +from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 + + +class MultiCallableStub(object): + """Stub for the grpc.UnaryUnaryMultiCallable interface.""" + + def __init__(self, method, channel_stub): + self.method = method + self.channel_stub = channel_stub + + def __call__(self, request, timeout=None, metadata=None, credentials=None): + self.channel_stub.requests.append((self.method, request)) + + response = None + if self.channel_stub.responses: + response = self.channel_stub.responses.pop() + + if isinstance(response, Exception): + raise response + + if response: + return response + + +class ChannelStub(object): + """Stub for the grpc.Channel interface.""" + + def __init__(self, responses=[]): + self.responses = responses + self.requests = [] + + def unary_unary(self, method, request_serializer=None, response_deserializer=None): + return MultiCallableStub(method, self) + + +class CustomException(Exception): + pass + + +class TestAssetServiceClient(object): + def test_export_assets(self): + # Setup Expected Response + expected_response = {} + expected_response = asset_service_pb2.ExportAssetsResponse(**expected_response) + operation = operations_pb2.Operation( + name="operations/test_export_assets", done=True + ) + operation.response.Pack(expected_response) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + parent = "parent-995424086" + output_config = {} + + response = client.export_assets(parent, output_config) + result = response.result() + assert expected_response == result + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.ExportAssetsRequest( + parent=parent, output_config=output_config + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_export_assets_exception(self): + # Setup Response + error = status_pb2.Status() + operation = operations_pb2.Operation( + name="operations/test_export_assets_exception", done=True + ) + operation.error.CopyFrom(error) + + # Mock the API response + channel = ChannelStub(responses=[operation]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + parent = "parent-995424086" + output_config = {} + + response = client.export_assets(parent, output_config) + exception = response.exception() + assert exception.errors[0] == error + + def test_batch_get_assets_history(self): + # Setup Expected Response + expected_response = {} + expected_response = asset_service_pb2.BatchGetAssetsHistoryResponse( + **expected_response + ) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + parent = "parent-995424086" + asset_names = [] + content_type = enums.ContentType.CONTENT_TYPE_UNSPECIFIED + + response = client.batch_get_assets_history(parent, asset_names, content_type) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.BatchGetAssetsHistoryRequest( + parent=parent, asset_names=asset_names, content_type=content_type + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_batch_get_assets_history_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + parent = "parent-995424086" + asset_names = [] + content_type = enums.ContentType.CONTENT_TYPE_UNSPECIFIED + + with pytest.raises(CustomException): + client.batch_get_assets_history(parent, asset_names, content_type) + + def test_create_feed(self): + # Setup Expected Response + name = "name3373707" + expected_response = {"name": name} + expected_response = asset_service_pb2.Feed(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + parent = "parent-995424086" + feed_id = "feedId-976011428" + feed = {} + + response = client.create_feed(parent, feed_id, feed) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.CreateFeedRequest( + parent=parent, feed_id=feed_id, feed=feed + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_create_feed_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + parent = "parent-995424086" + feed_id = "feedId-976011428" + feed = {} + + with pytest.raises(CustomException): + client.create_feed(parent, feed_id, feed) + + def test_get_feed(self): + # Setup Expected Response + name_2 = "name2-1052831874" + expected_response = {"name": name_2} + expected_response = asset_service_pb2.Feed(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + name = client.feed_path("[PROJECT]", "[FEED]") + + response = client.get_feed(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.GetFeedRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_feed_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + name = client.feed_path("[PROJECT]", "[FEED]") + + with pytest.raises(CustomException): + client.get_feed(name) + + def test_list_feeds(self): + # Setup Expected Response + expected_response = {} + expected_response = asset_service_pb2.ListFeedsResponse(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + parent = "parent-995424086" + + response = client.list_feeds(parent) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.ListFeedsRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_feeds_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + parent = "parent-995424086" + + with pytest.raises(CustomException): + client.list_feeds(parent) + + def test_update_feed(self): + # Setup Expected Response + name = "name3373707" + expected_response = {"name": name} + expected_response = asset_service_pb2.Feed(**expected_response) + + # Mock the API response + channel = ChannelStub(responses=[expected_response]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + feed = {} + update_mask = {} + + response = client.update_feed(feed, update_mask) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.UpdateFeedRequest( + feed=feed, update_mask=update_mask + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_update_feed_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + feed = {} + update_mask = {} + + with pytest.raises(CustomException): + client.update_feed(feed, update_mask) + + def test_delete_feed(self): + channel = ChannelStub() + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup Request + name = client.feed_path("[PROJECT]", "[FEED]") + + client.delete_feed(name) + + assert len(channel.requests) == 1 + expected_request = asset_service_pb2.DeleteFeedRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_delete_feed_exception(self): + # Mock the API response + channel = ChannelStub(responses=[CustomException()]) + patch = mock.patch("google.api_core.grpc_helpers.create_channel") + with patch as create_channel: + create_channel.return_value = channel + client = asset_v1p2beta1.AssetServiceClient() + + # Setup request + name = client.feed_path("[PROJECT]", "[FEED]") + + with pytest.raises(CustomException): + client.delete_feed(name)