diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client.py b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client.py index fa3c32625d6d..3cbcc7f5936e 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client.py @@ -38,6 +38,8 @@ from google.cloud.asset_v1.proto import asset_service_pb2_grpc from google.cloud.asset_v1.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 @@ -74,6 +76,18 @@ def from_service_account_file(cls, filename, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def feed_path(cls, project, feed): + """DEPRECATED. Return a fully-qualified feed string.""" + warnings.warn( + "Resource name helper functions are deprecated.", + PendingDeprecationWarning, + stacklevel=1, + ) + return google.api_core.path_template.expand( + "projects/{project}/feeds/{feed}", project=project, feed=feed + ) + @classmethod def project_path(cls, project): """DEPRECATED. Return a fully-qualified project string.""" @@ -434,3 +448,399 @@ def batch_get_assets_history( 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_v1 + >>> + >>> client = asset_v1.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_v1.types.Feed]): Required. 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_v1.types.Feed` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + 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_v1.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_v1 + >>> + >>> client = asset_v1.AssetServiceClient() + >>> + >>> name = client.feed_path('[PROJECT]', '[FEED]') + >>> + >>> response = client.get_feed(name) + + Args: + name (str): Required. 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 + be retried using a default configuration. + 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_v1.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_v1 + >>> + >>> client = asset_v1.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 + be retried using a default configuration. + 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_v1.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_v1 + >>> + >>> client = asset_v1.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_v1.types.Feed]): Required. 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_v1.types.Feed` + update_mask (Union[dict, ~google.cloud.asset_v1.types.FieldMask]): Required. 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_v1.types.FieldMask` + retry (Optional[google.api_core.retry.Retry]): A retry object used + to retry requests. If ``None`` is specified, requests will + be retried using a default configuration. + 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_v1.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_v1 + >>> + >>> client = asset_v1.AssetServiceClient() + >>> + >>> name = client.feed_path('[PROJECT]', '[FEED]') + >>> + >>> client.delete_feed(name) + + Args: + name (str): Required. 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 + be retried using a default configuration. + 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/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client_config.py b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client_config.py index 885ad4f0968c..5086fc0e4dce 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client_config.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/asset_service_client_config.py @@ -27,6 +27,31 @@ "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/packages/google-cloud-asset/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py index b6849225d4f5..557505597065 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py @@ -148,3 +148,69 @@ def batch_get_assets_history(self): 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/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service.proto b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service.proto index 33dde9cd365b..6566d03995fc 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service.proto +++ b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service.proto @@ -66,6 +66,49 @@ service AssetService { get: "/v1/{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: "/v1/{parent=*/*}/feeds" + body: "*" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about an asset feed. + rpc GetFeed(GetFeedRequest) returns (Feed) { + option (google.api.http) = { + get: "/v1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists all asset feeds in a parent project/folder/organization. + rpc ListFeeds(ListFeedsRequest) returns (ListFeedsResponse) { + option (google.api.http) = { + get: "/v1/{parent=*/*}/feeds" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an asset feed configuration. + rpc UpdateFeed(UpdateFeedRequest) returns (Feed) { + option (google.api.http) = { + patch: "/v1/{feed.name=*/*/feeds/*}" + body: "*" + }; + option (google.api.method_signature) = "feed"; + } + + // Deletes an asset feed. + rpc DeleteFeed(DeleteFeedRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=*/*/feeds/*}" + }; + option (google.api.method_signature) = "name"; + } } // Export asset request. @@ -158,6 +201,82 @@ message BatchGetAssetsHistoryResponse { 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 [(google.api.field_behavior) = REQUIRED]; + + // 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 [(google.api.field_behavior) = REQUIRED]; + + // Required. 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 [(google.api.field_behavior) = REQUIRED]; +} + +// Get asset feed request. +message GetFeedRequest { + // Required. 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 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/Feed" + } + ]; +} + +// 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 [(google.api.field_behavior) = REQUIRED]; +} + +message ListFeedsResponse { + // A list of feeds. + repeated Feed feeds = 1; +} + +// Update asset feed request. +message UpdateFeedRequest { + // Required. 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 [(google.api.field_behavior) = REQUIRED]; + + // Required. 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 [(google.api.field_behavior) = REQUIRED]; +} + +message DeleteFeedRequest { + // Required. 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 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudasset.googleapis.com/Feed" + } + ]; +} + // Output configuration for export assets destination. message OutputConfig { // Asset export destination. @@ -217,6 +336,13 @@ message BigQueryDestination { 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. @@ -234,3 +360,63 @@ enum ContentType { // 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 { + option (google.api.resource) = { + type: "cloudasset.googleapis.com/Feed" + pattern: "projects/{project}/feeds/{feed}" + pattern: "folders/{folder}/feeds/{feed}" + pattern: "organizations/{organization}/feeds/{feed}" + history: ORIGINALLY_SINGLE_PATTERN + }; + + // 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 [(google.api.field_behavior) = REQUIRED]; + + // 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 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2.py b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2.py index b382992b04c8..075cda631a79 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2.py @@ -39,7 +39,7 @@ "\n\031com.google.cloud.asset.v1B\021AssetServiceProtoP\001Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\Asset\\V1" ), serialized_pb=_b( - '\n/google/cloud/asset_v1/proto/asset_service.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/asset_v1/proto/assets.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x8d\x02\n\x13\x45xportAssetsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12-\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12?\n\routput_config\x18\x05 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfigB\x03\xe0\x41\x02"\x81\x01\n\x14\x45xportAssetsResponse\x12-\n\tread_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\routput_config\x18\x02 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfig"\xed\x01\n\x1c\x42\x61tchGetAssetsHistoryRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12=\n\x0c\x63ontent_type\x18\x03 \x01(\x0e\x32".google.cloud.asset.v1.ContentTypeB\x03\xe0\x41\x01\x12@\n\x10read_time_window\x18\x04 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindowB\x03\xe0\x41\x01"U\n\x1d\x42\x61tchGetAssetsHistoryResponse\x12\x34\n\x06\x61ssets\x18\x01 \x03(\x0b\x32$.google.cloud.asset.v1.TemporalAsset"\xab\x01\n\x0cOutputConfig\x12@\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32%.google.cloud.asset.v1.GcsDestinationH\x00\x12J\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32*.google.cloud.asset.v1.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"N\n\x13\x42igQueryDestination\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05table\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08*l\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\x0e\n\nORG_POLICY\x10\x04\x12\x11\n\rACCESS_POLICY\x10\x05\x32\xf3\x03\n\x0c\x41ssetService\x12\xde\x01\n\x0c\x45xportAssets\x12*.google.cloud.asset.v1.ExportAssetsRequest\x1a\x1d.google.longrunning.Operation"\x82\x01\x82\xd3\xe4\x93\x02""\x1d/v1/{parent=*/*}:exportAssets:\x01*\xca\x41W\n*google.cloud.asset.v1.ExportAssetsResponse\x12)google.cloud.asset.v1.ExportAssetsRequest\x12\xb2\x01\n\x15\x42\x61tchGetAssetsHistory\x12\x33.google.cloud.asset.v1.BatchGetAssetsHistoryRequest\x1a\x34.google.cloud.asset.v1.BatchGetAssetsHistoryResponse".\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=*/*}:batchGetAssetsHistory\x1aM\xca\x41\x19\x63loudasset.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x9c\x01\n\x19\x63om.google.cloud.asset.v1B\x11\x41ssetServiceProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' + '\n/google/cloud/asset_v1/proto/asset_service.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a(google/cloud/asset_v1/proto/assets.proto\x1a#google/longrunning/operations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x8d\x02\n\x13\x45xportAssetsRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12-\n\tread_time\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12?\n\routput_config\x18\x05 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfigB\x03\xe0\x41\x02"\x81\x01\n\x14\x45xportAssetsResponse\x12-\n\tread_time\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12:\n\routput_config\x18\x02 \x01(\x0b\x32#.google.cloud.asset.v1.OutputConfig"\xed\x01\n\x1c\x42\x61tchGetAssetsHistoryRequest\x12\x37\n\x06parent\x18\x01 \x01(\tB\'\xe0\x41\x02\xfa\x41!\x12\x1f\x63loudasset.googleapis.com/Asset\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12=\n\x0c\x63ontent_type\x18\x03 \x01(\x0e\x32".google.cloud.asset.v1.ContentTypeB\x03\xe0\x41\x01\x12@\n\x10read_time_window\x18\x04 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindowB\x03\xe0\x41\x01"U\n\x1d\x42\x61tchGetAssetsHistoryResponse\x12\x34\n\x06\x61ssets\x18\x01 \x03(\x0b\x32$.google.cloud.asset.v1.TemporalAsset"n\n\x11\x43reateFeedRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x14\n\x07\x66\x65\x65\x64_id\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12.\n\x04\x66\x65\x65\x64\x18\x03 \x01(\x0b\x32\x1b.google.cloud.asset.v1.FeedB\x03\xe0\x41\x02"F\n\x0eGetFeedRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x63loudasset.googleapis.com/Feed"\'\n\x10ListFeedsRequest\x12\x13\n\x06parent\x18\x01 \x01(\tB\x03\xe0\x41\x02"?\n\x11ListFeedsResponse\x12*\n\x05\x66\x65\x65\x64s\x18\x01 \x03(\x0b\x32\x1b.google.cloud.asset.v1.Feed"y\n\x11UpdateFeedRequest\x12.\n\x04\x66\x65\x65\x64\x18\x01 \x01(\x0b\x32\x1b.google.cloud.asset.v1.FeedB\x03\xe0\x41\x02\x12\x34\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMaskB\x03\xe0\x41\x02"I\n\x11\x44\x65leteFeedRequest\x12\x34\n\x04name\x18\x01 \x01(\tB&\xe0\x41\x02\xfa\x41 \n\x1e\x63loudasset.googleapis.com/Feed"\xab\x01\n\x0cOutputConfig\x12@\n\x0fgcs_destination\x18\x01 \x01(\x0b\x32%.google.cloud.asset.v1.GcsDestinationH\x00\x12J\n\x14\x62igquery_destination\x18\x02 \x01(\x0b\x32*.google.cloud.asset.v1.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"N\n\x13\x42igQueryDestination\x12\x14\n\x07\x64\x61taset\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x12\n\x05table\x18\x02 \x01(\tB\x03\xe0\x41\x02\x12\r\n\x05\x66orce\x18\x03 \x01(\x08""\n\x11PubsubDestination\x12\r\n\x05topic\x18\x01 \x01(\t"i\n\x10\x46\x65\x65\x64OutputConfig\x12\x46\n\x12pubsub_destination\x18\x01 \x01(\x0b\x32(.google.cloud.asset.v1.PubsubDestinationH\x00\x42\r\n\x0b\x64\x65stination"\xdb\x02\n\x04\x46\x65\x65\x64\x12\x11\n\x04name\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x13\n\x0b\x61sset_names\x18\x02 \x03(\t\x12\x13\n\x0b\x61sset_types\x18\x03 \x03(\t\x12\x38\n\x0c\x63ontent_type\x18\x04 \x01(\x0e\x32".google.cloud.asset.v1.ContentType\x12H\n\x12\x66\x65\x65\x64_output_config\x18\x05 \x01(\x0b\x32\'.google.cloud.asset.v1.FeedOutputConfigB\x03\xe0\x41\x02:\x91\x01\xea\x41\x8d\x01\n\x1e\x63loudasset.googleapis.com/Feed\x12\x1fprojects/{project}/feeds/{feed}\x12\x1d\x66olders/{folder}/feeds/{feed}\x12)organizations/{organization}/feeds/{feed} \x01*l\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\x0e\n\nORG_POLICY\x10\x04\x12\x11\n\rACCESS_POLICY\x10\x05\x32\xf0\x08\n\x0c\x41ssetService\x12\xde\x01\n\x0c\x45xportAssets\x12*.google.cloud.asset.v1.ExportAssetsRequest\x1a\x1d.google.longrunning.Operation"\x82\x01\x82\xd3\xe4\x93\x02""\x1d/v1/{parent=*/*}:exportAssets:\x01*\xca\x41W\n*google.cloud.asset.v1.ExportAssetsResponse\x12)google.cloud.asset.v1.ExportAssetsRequest\x12\xb2\x01\n\x15\x42\x61tchGetAssetsHistory\x12\x33.google.cloud.asset.v1.BatchGetAssetsHistoryRequest\x1a\x34.google.cloud.asset.v1.BatchGetAssetsHistoryResponse".\x82\xd3\xe4\x93\x02(\x12&/v1/{parent=*/*}:batchGetAssetsHistory\x12\x7f\n\nCreateFeed\x12(.google.cloud.asset.v1.CreateFeedRequest\x1a\x1b.google.cloud.asset.v1.Feed"*\x82\xd3\xe4\x93\x02\x1b"\x16/v1/{parent=*/*}/feeds:\x01*\xda\x41\x06parent\x12t\n\x07GetFeed\x12%.google.cloud.asset.v1.GetFeedRequest\x1a\x1b.google.cloud.asset.v1.Feed"%\x82\xd3\xe4\x93\x02\x18\x12\x16/v1/{name=*/*/feeds/*}\xda\x41\x04name\x12\x87\x01\n\tListFeeds\x12\'.google.cloud.asset.v1.ListFeedsRequest\x1a(.google.cloud.asset.v1.ListFeedsResponse"\'\x82\xd3\xe4\x93\x02\x18\x12\x16/v1/{parent=*/*}/feeds\xda\x41\x06parent\x12\x82\x01\n\nUpdateFeed\x12(.google.cloud.asset.v1.UpdateFeedRequest\x1a\x1b.google.cloud.asset.v1.Feed"-\x82\xd3\xe4\x93\x02 2\x1b/v1/{feed.name=*/*/feeds/*}:\x01*\xda\x41\x04\x66\x65\x65\x64\x12u\n\nDeleteFeed\x12(.google.cloud.asset.v1.DeleteFeedRequest\x1a\x16.google.protobuf.Empty"%\x82\xd3\xe4\x93\x02\x18*\x16/v1/{name=*/*/feeds/*}\xda\x41\x04name\x1aM\xca\x41\x19\x63loudasset.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\x9c\x01\n\x19\x63om.google.cloud.asset.v1B\x11\x41ssetServiceProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' ), dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, @@ -82,8 +82,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=1418, - serialized_end=1526, + serialized_start=2399, + serialized_end=2507, ) _sym_db.RegisterEnumDescriptor(_CONTENTTYPE) @@ -399,6 +399,298 @@ ) +_CREATEFEEDREQUEST = _descriptor.Descriptor( + name="CreateFeedRequest", + full_name="google.cloud.asset.v1.CreateFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="feed_id", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="feed", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1095, + serialized_end=1205, +) + + +_GETFEEDREQUEST = _descriptor.Descriptor( + name="GetFeedRequest", + full_name="google.cloud.asset.v1.GetFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1.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=_b( + "\340A\002\372A \n\036cloudasset.googleapis.com/Feed" + ), + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1207, + serialized_end=1277, +) + + +_LISTFEEDSREQUEST = _descriptor.Descriptor( + name="ListFeedsRequest", + full_name="google.cloud.asset.v1.ListFeedsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1279, + serialized_end=1318, +) + + +_LISTFEEDSRESPONSE = _descriptor.Descriptor( + name="ListFeedsResponse", + full_name="google.cloud.asset.v1.ListFeedsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="feeds", + full_name="google.cloud.asset.v1.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=1320, + serialized_end=1383, +) + + +_UPDATEFEEDREQUEST = _descriptor.Descriptor( + name="UpdateFeedRequest", + full_name="google.cloud.asset.v1.UpdateFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="feed", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="update_mask", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1385, + serialized_end=1506, +) + + +_DELETEFEEDREQUEST = _descriptor.Descriptor( + name="DeleteFeedRequest", + full_name="google.cloud.asset.v1.DeleteFeedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.asset.v1.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=_b( + "\340A\002\372A \n\036cloudasset.googleapis.com/Feed" + ), + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1508, + serialized_end=1581, +) + + _OUTPUTCONFIG = _descriptor.Descriptor( name="OutputConfig", full_name="google.cloud.asset.v1.OutputConfig", @@ -415,25 +707,173 @@ cpp_type=10, label=1, has_default_value=False, - default_value=None, + 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.v1.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.v1.OutputConfig.destination", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1584, + serialized_end=1755, +) + + +_GCSDESTINATION = _descriptor.Descriptor( + name="GcsDestination", + full_name="google.cloud.asset.v1.GcsDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="uri", + full_name="google.cloud.asset.v1.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.v1.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.v1.GcsDestination.object_uri", + index=0, + containing_type=None, + fields=[], + ) + ], + serialized_start=1757, + serialized_end=1824, +) + + +_BIGQUERYDESTINATION = _descriptor.Descriptor( + name="BigQueryDestination", + full_name="google.cloud.asset.v1.BigQueryDestination", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="dataset", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="table", + full_name="google.cloud.asset.v1.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, + serialized_options=_b("\340A\002"), file=DESCRIPTOR, ), _descriptor.FieldDescriptor( - name="bigquery_destination", - full_name="google.cloud.asset.v1.OutputConfig.bigquery_destination", - index=1, - number=2, - type=11, - cpp_type=10, + name="force", + full_name="google.cloud.asset.v1.BigQueryDestination.force", + index=2, + number=3, + type=8, + cpp_type=7, label=1, has_default_value=False, - default_value=None, + default_value=False, message_type=None, enum_type=None, containing_type=None, @@ -450,30 +890,22 @@ is_extendable=False, syntax="proto3", extension_ranges=[], - oneofs=[ - _descriptor.OneofDescriptor( - name="destination", - full_name="google.cloud.asset.v1.OutputConfig.destination", - index=0, - containing_type=None, - fields=[], - ) - ], - serialized_start=1096, - serialized_end=1267, + oneofs=[], + serialized_start=1826, + serialized_end=1904, ) -_GCSDESTINATION = _descriptor.Descriptor( - name="GcsDestination", - full_name="google.cloud.asset.v1.GcsDestination", +_PUBSUBDESTINATION = _descriptor.Descriptor( + name="PubsubDestination", + full_name="google.cloud.asset.v1.PubsubDestination", filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name="uri", - full_name="google.cloud.asset.v1.GcsDestination.uri", + name="topic", + full_name="google.cloud.asset.v1.PubsubDestination.topic", index=0, number=1, type=9, @@ -488,17 +920,38 @@ 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=1906, + serialized_end=1940, +) + + +_FEEDOUTPUTCONFIG = _descriptor.Descriptor( + name="FeedOutputConfig", + full_name="google.cloud.asset.v1.FeedOutputConfig", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ _descriptor.FieldDescriptor( - name="uri_prefix", - full_name="google.cloud.asset.v1.GcsDestination.uri_prefix", - index=1, - number=2, - type=9, - cpp_type=9, + name="pubsub_destination", + full_name="google.cloud.asset.v1.FeedOutputConfig.pubsub_destination", + index=0, + number=1, + type=11, + cpp_type=10, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=None, message_type=None, enum_type=None, containing_type=None, @@ -506,7 +959,7 @@ extension_scope=None, serialized_options=None, file=DESCRIPTOR, - ), + ) ], extensions=[], nested_types=[], @@ -517,28 +970,28 @@ extension_ranges=[], oneofs=[ _descriptor.OneofDescriptor( - name="object_uri", - full_name="google.cloud.asset.v1.GcsDestination.object_uri", + name="destination", + full_name="google.cloud.asset.v1.FeedOutputConfig.destination", index=0, containing_type=None, fields=[], ) ], - serialized_start=1269, - serialized_end=1336, + serialized_start=1942, + serialized_end=2047, ) -_BIGQUERYDESTINATION = _descriptor.Descriptor( - name="BigQueryDestination", - full_name="google.cloud.asset.v1.BigQueryDestination", +_FEED = _descriptor.Descriptor( + name="Feed", + full_name="google.cloud.asset.v1.Feed", filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( - name="dataset", - full_name="google.cloud.asset.v1.BigQueryDestination.dataset", + name="name", + full_name="google.cloud.asset.v1.Feed.name", index=0, number=1, type=9, @@ -555,33 +1008,51 @@ file=DESCRIPTOR, ), _descriptor.FieldDescriptor( - name="table", - full_name="google.cloud.asset.v1.BigQueryDestination.table", + name="asset_names", + full_name="google.cloud.asset.v1.Feed.asset_names", index=1, number=2, type=9, cpp_type=9, - label=1, + label=3, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\002"), + serialized_options=None, file=DESCRIPTOR, ), _descriptor.FieldDescriptor( - name="force", - full_name="google.cloud.asset.v1.BigQueryDestination.force", + name="asset_types", + full_name="google.cloud.asset.v1.Feed.asset_types", index=2, number=3, - type=8, - cpp_type=7, + 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.v1.Feed.content_type", + index=3, + number=4, + type=14, + cpp_type=8, label=1, has_default_value=False, - default_value=False, + default_value=0, message_type=None, enum_type=None, containing_type=None, @@ -590,17 +1061,37 @@ serialized_options=None, file=DESCRIPTOR, ), + _descriptor.FieldDescriptor( + name="feed_output_config", + full_name="google.cloud.asset.v1.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=_b("\340A\002"), + file=DESCRIPTOR, + ), ], extensions=[], nested_types=[], enum_types=[], - serialized_options=None, + serialized_options=_b( + "\352A\215\001\n\036cloudasset.googleapis.com/Feed\022\037projects/{project}/feeds/{feed}\022\035folders/{folder}/feeds/{feed}\022)organizations/{organization}/feeds/{feed} \001" + ), is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1338, - serialized_end=1416, + serialized_start=2050, + serialized_end=2397, ) _EXPORTASSETSREQUEST.fields_by_name[ @@ -619,6 +1110,12 @@ _BATCHGETASSETSHISTORYRESPONSE.fields_by_name[ "assets" ].message_type = google_dot_cloud_dot_asset__v1_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( @@ -645,6 +1142,15 @@ _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[ @@ -653,9 +1159,18 @@ 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) @@ -784,6 +1299,141 @@ ) _sym_db.RegisterMessage(BatchGetAssetsHistoryResponse) +CreateFeedRequest = _reflection.GeneratedProtocolMessageType( + "CreateFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_CREATEFEEDREQUEST, + __module__="google.cloud.asset_v1.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: + Required. 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.v1.CreateFeedRequest) + ), +) +_sym_db.RegisterMessage(CreateFeedRequest) + +GetFeedRequest = _reflection.GeneratedProtocolMessageType( + "GetFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_GETFEEDREQUEST, + __module__="google.cloud.asset_v1.proto.asset_service_pb2", + __doc__="""Get asset feed request. + + + Attributes: + name: + Required. 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.v1.GetFeedRequest) + ), +) +_sym_db.RegisterMessage(GetFeedRequest) + +ListFeedsRequest = _reflection.GeneratedProtocolMessageType( + "ListFeedsRequest", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFEEDSREQUEST, + __module__="google.cloud.asset_v1.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.v1.ListFeedsRequest) + ), +) +_sym_db.RegisterMessage(ListFeedsRequest) + +ListFeedsResponse = _reflection.GeneratedProtocolMessageType( + "ListFeedsResponse", + (_message.Message,), + dict( + DESCRIPTOR=_LISTFEEDSRESPONSE, + __module__="google.cloud.asset_v1.proto.asset_service_pb2", + __doc__=""" + Attributes: + feeds: + A list of feeds. + """, + # @@protoc_insertion_point(class_scope:google.cloud.asset.v1.ListFeedsResponse) + ), +) +_sym_db.RegisterMessage(ListFeedsResponse) + +UpdateFeedRequest = _reflection.GeneratedProtocolMessageType( + "UpdateFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_UPDATEFEEDREQUEST, + __module__="google.cloud.asset_v1.proto.asset_service_pb2", + __doc__="""Update asset feed request. + + + Attributes: + feed: + Required. 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: + Required. 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.v1.UpdateFeedRequest) + ), +) +_sym_db.RegisterMessage(UpdateFeedRequest) + +DeleteFeedRequest = _reflection.GeneratedProtocolMessageType( + "DeleteFeedRequest", + (_message.Message,), + dict( + DESCRIPTOR=_DELETEFEEDREQUEST, + __module__="google.cloud.asset_v1.proto.asset_service_pb2", + __doc__=""" + Attributes: + name: + Required. 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.v1.DeleteFeedRequest) + ), +) +_sym_db.RegisterMessage(DeleteFeedRequest) + OutputConfig = _reflection.GeneratedProtocolMessageType( "OutputConfig", (_message.Message,), @@ -873,6 +1523,97 @@ ) _sym_db.RegisterMessage(BigQueryDestination) +PubsubDestination = _reflection.GeneratedProtocolMessageType( + "PubsubDestination", + (_message.Message,), + dict( + DESCRIPTOR=_PUBSUBDESTINATION, + __module__="google.cloud.asset_v1.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.v1.PubsubDestination) + ), +) +_sym_db.RegisterMessage(PubsubDestination) + +FeedOutputConfig = _reflection.GeneratedProtocolMessageType( + "FeedOutputConfig", + (_message.Message,), + dict( + DESCRIPTOR=_FEEDOUTPUTCONFIG, + __module__="google.cloud.asset_v1.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.v1.FeedOutputConfig) + ), +) +_sym_db.RegisterMessage(FeedOutputConfig) + +Feed = _reflection.GeneratedProtocolMessageType( + "Feed", + (_message.Message,), + dict( + DESCRIPTOR=_FEED, + __module__="google.cloud.asset_v1.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.v1.Feed) + ), +) +_sym_db.RegisterMessage(Feed) + DESCRIPTOR._options = None _EXPORTASSETSREQUEST.fields_by_name["parent"]._options = None @@ -880,8 +1621,19 @@ _BATCHGETASSETSHISTORYREQUEST.fields_by_name["parent"]._options = None _BATCHGETASSETSHISTORYREQUEST.fields_by_name["content_type"]._options = None _BATCHGETASSETSHISTORYREQUEST.fields_by_name["read_time_window"]._options = None +_CREATEFEEDREQUEST.fields_by_name["parent"]._options = None +_CREATEFEEDREQUEST.fields_by_name["feed_id"]._options = None +_CREATEFEEDREQUEST.fields_by_name["feed"]._options = None +_GETFEEDREQUEST.fields_by_name["name"]._options = None +_LISTFEEDSREQUEST.fields_by_name["parent"]._options = None +_UPDATEFEEDREQUEST.fields_by_name["feed"]._options = None +_UPDATEFEEDREQUEST.fields_by_name["update_mask"]._options = None +_DELETEFEEDREQUEST.fields_by_name["name"]._options = None _BIGQUERYDESTINATION.fields_by_name["dataset"]._options = None _BIGQUERYDESTINATION.fields_by_name["table"]._options = None +_FEED.fields_by_name["name"]._options = None +_FEED.fields_by_name["feed_output_config"]._options = None +_FEED._options = None _ASSETSERVICE = _descriptor.ServiceDescriptor( name="AssetService", @@ -891,8 +1643,8 @@ serialized_options=_b( "\312A\031cloudasset.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" ), - serialized_start=1529, - serialized_end=2028, + serialized_start=2510, + serialized_end=3646, methods=[ _descriptor.MethodDescriptor( name="ExportAssets", @@ -916,6 +1668,61 @@ "\202\323\344\223\002(\022&/v1/{parent=*/*}:batchGetAssetsHistory" ), ), + _descriptor.MethodDescriptor( + name="CreateFeed", + full_name="google.cloud.asset.v1.AssetService.CreateFeed", + index=2, + containing_service=None, + input_type=_CREATEFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + '\202\323\344\223\002\033"\026/v1/{parent=*/*}/feeds:\001*\332A\006parent' + ), + ), + _descriptor.MethodDescriptor( + name="GetFeed", + full_name="google.cloud.asset.v1.AssetService.GetFeed", + index=3, + containing_service=None, + input_type=_GETFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + "\202\323\344\223\002\030\022\026/v1/{name=*/*/feeds/*}\332A\004name" + ), + ), + _descriptor.MethodDescriptor( + name="ListFeeds", + full_name="google.cloud.asset.v1.AssetService.ListFeeds", + index=4, + containing_service=None, + input_type=_LISTFEEDSREQUEST, + output_type=_LISTFEEDSRESPONSE, + serialized_options=_b( + "\202\323\344\223\002\030\022\026/v1/{parent=*/*}/feeds\332A\006parent" + ), + ), + _descriptor.MethodDescriptor( + name="UpdateFeed", + full_name="google.cloud.asset.v1.AssetService.UpdateFeed", + index=5, + containing_service=None, + input_type=_UPDATEFEEDREQUEST, + output_type=_FEED, + serialized_options=_b( + "\202\323\344\223\002 2\033/v1/{feed.name=*/*/feeds/*}:\001*\332A\004feed" + ), + ), + _descriptor.MethodDescriptor( + name="DeleteFeed", + full_name="google.cloud.asset.v1.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\030*\026/v1/{name=*/*/feeds/*}\332A\004name" + ), + ), ], ) _sym_db.RegisterServiceDescriptor(_ASSETSERVICE) diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py index 3795a401928c..1b0b5385379c 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py @@ -7,6 +7,7 @@ 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): @@ -29,6 +30,31 @@ def __init__(self, channel): request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.SerializeToString, response_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.FromString, ) + self.CreateFeed = channel.unary_unary( + "/google.cloud.asset.v1.AssetService/CreateFeed", + request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.GetFeed = channel.unary_unary( + "/google.cloud.asset.v1.AssetService/GetFeed", + request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.GetFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.ListFeeds = channel.unary_unary( + "/google.cloud.asset.v1.AssetService/ListFeeds", + request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.FromString, + ) + self.UpdateFeed = channel.unary_unary( + "/google.cloud.asset.v1.AssetService/UpdateFeed", + request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + ) + self.DeleteFeed = channel.unary_unary( + "/google.cloud.asset.v1.AssetService/DeleteFeed", + request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.DeleteFeedRequest.SerializeToString, + response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, + ) class AssetServiceServicer(object): @@ -58,6 +84,42 @@ def BatchGetAssetsHistory(self, request, context): 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 = { @@ -71,6 +133,31 @@ def add_AssetServiceServicer_to_server(servicer, server): request_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.FromString, response_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.SerializeToString, ), + "CreateFeed": grpc.unary_unary_rpc_method_handler( + servicer.CreateFeed, + request_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "GetFeed": grpc.unary_unary_rpc_method_handler( + servicer.GetFeed, + request_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.GetFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "ListFeeds": grpc.unary_unary_rpc_method_handler( + servicer.ListFeeds, + request_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.SerializeToString, + ), + "UpdateFeed": grpc.unary_unary_rpc_method_handler( + servicer.UpdateFeed, + request_deserializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.FromString, + response_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.SerializeToString, + ), + "DeleteFeed": grpc.unary_unary_rpc_method_handler( + servicer.DeleteFeed, + request_deserializer=google_dot_cloud_dot_asset__v1_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.v1.AssetService", rpc_method_handlers diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets.proto b/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets.proto index e689b761822c..6a5c8cb8cb2c 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets.proto +++ b/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets.proto @@ -17,12 +17,12 @@ syntax = "proto3"; package google.cloud.asset.v1; -import "google/api/annotations.proto"; import "google/api/resource.proto"; import "google/iam/v1/policy.proto"; import "google/protobuf/any.proto"; import "google/protobuf/struct.proto"; import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; option cc_enable_arenas = true; option csharp_namespace = "Google.Cloud.Asset.V1"; @@ -79,6 +79,14 @@ message Asset { // 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; + + // 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 ends at 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 = 10; } // Representation of a cloud resource. diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets_pb2.py b/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets_pb2.py index 0b37f61584ae..60f1340fa02f 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets_pb2.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/proto/assets_pb2.py @@ -15,12 +15,12 @@ _sym_db = _symbol_database.Default() -from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 from google.api import resource_pb2 as google_dot_api_dot_resource__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 +from google.api import annotations_pb2 as google_dot_api_dot_annotations__pb2 DESCRIPTOR = _descriptor.FileDescriptor( @@ -31,15 +31,15 @@ "\n\031com.google.cloud.asset.v1B\nAssetProtoP\001Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\370\001\001\252\002\025Google.Cloud.Asset.V1\312\002\025Google\\Cloud\\Asset\\V1" ), serialized_pb=_b( - '\n(google/cloud/asset_v1/proto/assets.proto\x12\x15google.cloud.asset.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x19google/api/resource.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x80\x01\n\rTemporalAsset\x12\x31\n\x06window\x18\x01 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindow\x12\x0f\n\x07\x64\x65leted\x18\x02 \x01(\x08\x12+\n\x05\x61sset\x18\x03 \x01(\x0b\x32\x1c.google.cloud.asset.v1.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"\xb0\x01\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nasset_type\x18\x02 \x01(\t\x12\x31\n\x08resource\x18\x03 \x01(\x0b\x32\x1f.google.cloud.asset.v1.Resource\x12)\n\niam_policy\x18\x04 \x01(\x0b\x32\x15.google.iam.v1.Policy:\'\xea\x41$\n\x1f\x63loudasset.googleapis.com/Asset\x12\x01*"\xa0\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.StructB\x98\x01\n\x19\x63om.google.cloud.asset.v1B\nAssetProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xf8\x01\x01\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' + '\n(google/cloud/asset_v1/proto/assets.proto\x12\x15google.cloud.asset.v1\x1a\x19google/api/resource.proto\x1a\x1agoogle/iam/v1/policy.proto\x1a\x19google/protobuf/any.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1cgoogle/api/annotations.proto"\x80\x01\n\rTemporalAsset\x12\x31\n\x06window\x18\x01 \x01(\x0b\x32!.google.cloud.asset.v1.TimeWindow\x12\x0f\n\x07\x64\x65leted\x18\x02 \x01(\x08\x12+\n\x05\x61sset\x18\x03 \x01(\x0b\x32\x1c.google.cloud.asset.v1.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"\xc3\x01\n\x05\x41sset\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x12\n\nasset_type\x18\x02 \x01(\t\x12\x31\n\x08resource\x18\x03 \x01(\x0b\x32\x1f.google.cloud.asset.v1.Resource\x12)\n\niam_policy\x18\x04 \x01(\x0b\x32\x15.google.iam.v1.Policy\x12\x11\n\tancestors\x18\n \x03(\t:\'\xea\x41$\n\x1f\x63loudasset.googleapis.com/Asset\x12\x01*"\xa0\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.StructB\x98\x01\n\x19\x63om.google.cloud.asset.v1B\nAssetProtoP\x01Z:google.golang.org/genproto/googleapis/cloud/asset/v1;asset\xf8\x01\x01\xaa\x02\x15Google.Cloud.Asset.V1\xca\x02\x15Google\\Cloud\\Asset\\V1b\x06proto3' ), dependencies=[ - google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_resource__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, + google_dot_api_dot_annotations__pb2.DESCRIPTOR, ], ) @@ -255,6 +255,24 @@ serialized_options=None, file=DESCRIPTOR, ), + _descriptor.FieldDescriptor( + name="ancestors", + full_name="google.cloud.asset.v1.Asset.ancestors", + index=4, + number=10, + 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=[], @@ -265,7 +283,7 @@ extension_ranges=[], oneofs=[], serialized_start=482, - serialized_end=658, + serialized_end=677, ) @@ -393,8 +411,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=661, - serialized_end=821, + serialized_start=680, + serialized_end=840, ) _TEMPORALASSET.fields_by_name["window"].message_type = _TIMEWINDOW @@ -489,6 +507,13 @@ 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. + 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 ends at + 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.v1.Asset) ), diff --git a/packages/google-cloud-asset/google/cloud/asset_v1/types.py b/packages/google-cloud-asset/google/cloud/asset_v1/types.py index 6dc0ded7c413..0689ba285ec3 100644 --- a/packages/google-cloud-asset/google/cloud/asset_v1/types.py +++ b/packages/google-cloud-asset/google/cloud/asset_v1/types.py @@ -25,6 +25,8 @@ 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 @@ -35,6 +37,8 @@ policy_pb2, operations_pb2, any_pb2, + empty_pb2, + field_mask_pb2, struct_pb2, timestamp_pb2, status_pb2, diff --git a/packages/google-cloud-asset/synth.metadata b/packages/google-cloud-asset/synth.metadata index 4c5e9ceeaa19..c1fc512abda1 100644 --- a/packages/google-cloud-asset/synth.metadata +++ b/packages/google-cloud-asset/synth.metadata @@ -1,5 +1,5 @@ { - "updateTime": "2019-11-19T13:12:01.626148Z", + "updateTime": "2019-12-07T13:11:51.552507Z", "sources": [ { "generator": { @@ -12,8 +12,8 @@ "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "d8dd7fe8d5304f7bd1c52207703d7f27d5328c5a", - "internalRef": "281088257" + "sha": "a4adac3a12aca6e3a792c9c35ee850435fe7cf7e", + "internalRef": "284277770" } }, { diff --git a/packages/google-cloud-asset/synth.py b/packages/google-cloud-asset/synth.py index 9f4498bdbb58..d3175bcacdae 100644 --- a/packages/google-cloud-asset/synth.py +++ b/packages/google-cloud-asset/synth.py @@ -80,6 +80,14 @@ _FIXED_ASSET_DOCSTRING, ) +# Fix docstrings with no summary line +s.replace( + "google/cloud/**/proto/*_pb2.py", + r'''__doc__\s*=\s*"""Attributes:''', + '''__doc__ = """ + Attributes:''', +) + # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- diff --git a/packages/google-cloud-asset/tests/unit/gapic/v1/test_asset_service_client_v1.py b/packages/google-cloud-asset/tests/unit/gapic/v1/test_asset_service_client_v1.py index 0afe1cf92033..4f4b981d7415 100644 --- a/packages/google-cloud-asset/tests/unit/gapic/v1/test_asset_service_client_v1.py +++ b/packages/google-cloud-asset/tests/unit/gapic/v1/test_asset_service_client_v1.py @@ -26,6 +26,8 @@ from google.cloud.asset_v1.proto import asset_service_pb2 from google.cloud.asset_v1.proto import assets_pb2 from google.longrunning import operations_pb2 +from google.protobuf import empty_pb2 +from google.protobuf import field_mask_pb2 class MultiCallableStub(object): @@ -165,3 +167,195 @@ def test_batch_get_assets_history_exception(self): with pytest.raises(CustomException): client.batch_get_assets_history(parent, content_type, read_time_window) + + 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_v1.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_v1.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_v1.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_v1.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_v1.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_v1.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_v1.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_v1.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_v1.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_v1.AssetServiceClient() + + # Setup request + name = client.feed_path("[PROJECT]", "[FEED]") + + with pytest.raises(CustomException): + client.delete_feed(name)