From 58f5d58eba2f37af2a0161793fd61019a236cad3 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Wed, 24 Jun 2020 19:30:06 -0700 Subject: [PATCH] fix: update default retry configs (#51) * fix: migrate asset/v1 to grpc_service_config PiperOrigin-RevId: 317872667 Source-Author: Google APIs Source-Date: Tue Jun 23 08:43:32 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e8385a4863e19248b71dd1cbe0df5ff51c7a3c3e Source-Link: https://github.com/googleapis/googleapis/commit/e8385a4863e19248b71dd1cbe0df5ff51c7a3c3e * chore: update grpc to v1.30.0 PiperOrigin-RevId: 317949519 Source-Author: Google APIs Source-Date: Tue Jun 23 15:22:22 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: 7157f9552747421572cf1ab3aec1105c05ebd4f9 Source-Link: https://github.com/googleapis/googleapis/commit/7157f9552747421572cf1ab3aec1105c05ebd4f9 --- .../asset_v1/gapic/asset_service_client.py | 140 ++++---- .../gapic/asset_service_client_config.py | 89 +++-- .../asset_service_grpc_transport.py | 26 +- .../cloud/asset_v1/proto/asset_service_pb2.py | 2 +- .../asset_v1/proto/asset_service_pb2_grpc.py | 324 ++++++++++++++++-- google/cloud/asset_v1/proto/assets_pb2.py | 2 +- .../cloud/asset_v1/proto/assets_pb2_grpc.py | 1 + .../asset_v1beta1/proto/asset_service_pb2.py | 2 +- .../proto/asset_service_pb2_grpc.py | 95 ++++- .../cloud/asset_v1beta1/proto/assets_pb2.py | 2 +- .../asset_v1beta1/proto/assets_pb2_grpc.py | 1 + .../proto/asset_service_pb2.py | 2 +- .../proto/asset_service_pb2_grpc.py | 95 ++++- .../cloud/asset_v1p1beta1/proto/assets_pb2.py | 2 +- .../asset_v1p1beta1/proto/assets_pb2_grpc.py | 1 + .../proto/asset_service_pb2.py | 2 +- .../proto/asset_service_pb2_grpc.py | 164 ++++++++- .../cloud/asset_v1p2beta1/proto/assets_pb2.py | 2 +- .../asset_v1p2beta1/proto/assets_pb2_grpc.py | 1 + .../proto/asset_service_pb2.py | 2 +- .../proto/asset_service_pb2_grpc.py | 83 ++++- .../cloud/asset_v1p4beta1/proto/assets_pb2.py | 2 +- .../asset_v1p4beta1/proto/assets_pb2_grpc.py | 1 + synth.metadata | 6 +- synth.py | 2 +- .../gapic/v1/test_asset_service_client_v1.py | 62 ++-- 26 files changed, 860 insertions(+), 251 deletions(-) diff --git a/google/cloud/asset_v1/gapic/asset_service_client.py b/google/cloud/asset_v1/gapic/asset_service_client.py index fb3aae32..912e8d87 100644 --- a/google/cloud/asset_v1/gapic/asset_service_client.py +++ b/google/cloud/asset_v1/gapic/asset_service_client.py @@ -205,76 +205,6 @@ def __init__( self._inner_api_calls = {} # Service calls - 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() - >>> - >>> # TODO: Initialize `name`: - >>> name = '' - >>> - >>> 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 - ) - def export_assets( self, parent, @@ -837,6 +767,76 @@ def 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() + >>> + >>> # TODO: Initialize `name`: + >>> name = '' + >>> + >>> 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 + ) + def search_all_resources( self, scope, diff --git a/google/cloud/asset_v1/gapic/asset_service_client_config.py b/google/cloud/asset_v1/gapic/asset_service_client_config.py index 75e1bf34..6f43e402 100644 --- a/google/cloud/asset_v1/gapic/asset_service_client_config.py +++ b/google/cloud/asset_v1/gapic/asset_service_client_config.py @@ -2,65 +2,94 @@ "interfaces": { "google.cloud.asset.v1.AssetService": { "retry_codes": { - "idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], - "non_idempotent": [], + "retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "no_retry_codes": [], + "retry_policy_2_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"], + "no_retry_1_codes": [], }, "retry_params": { - "default": { + "retry_policy_1_params": { "initial_retry_delay_millis": 100, "retry_delay_multiplier": 1.3, "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, + "initial_rpc_timeout_millis": 60000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, - "total_timeout_millis": 600000, - } + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000, + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 15000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 15000, + "total_timeout_millis": 15000, + }, + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0, + }, + "no_retry_1_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 60000, + }, }, "methods": { - "DeleteFeed": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", - }, "ExportAssets": { "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params", }, "BatchGetAssetsHistory": { "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "CreateFeed": { "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params", }, "GetFeed": { "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "ListFeeds": { "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", }, "UpdateFeed": { "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default", + "retry_codes_name": "no_retry_1_codes", + "retry_params_name": "no_retry_1_params", }, - "SearchAllResources": { + "DeleteFeed": { "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params", + }, + "SearchAllResources": { + "timeout_millis": 15000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params", }, "SearchAllIamPolicies": { - "timeout_millis": 60000, - "retry_codes_name": "idempotent", - "retry_params_name": "default", + "timeout_millis": 15000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params", }, }, } diff --git a/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py b/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py index 6b1df304..d7d957d1 100644 --- a/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py +++ b/google/cloud/asset_v1/gapic/transports/asset_service_grpc_transport.py @@ -115,19 +115,6 @@ def channel(self): """ return self._channel - @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 - @property def export_assets(self): """Return the gRPC stub for :meth:`AssetServiceClient.export_assets`. @@ -221,6 +208,19 @@ def update_feed(self): """ 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 + @property def search_all_resources(self): """Return the gRPC stub for :meth:`AssetServiceClient.search_all_resources`. diff --git a/google/cloud/asset_v1/proto/asset_service_pb2.py b/google/cloud/asset_v1/proto/asset_service_pb2.py index 801f940e..e1c5c209 100644 --- a/google/cloud/asset_v1/proto/asset_service_pb2.py +++ b/google/cloud/asset_v1/proto/asset_service_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1/proto/asset_service.proto - +"""Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message diff --git a/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py b/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py index 609b87a1..78708cc0 100644 --- a/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py +++ b/google/cloud/asset_v1/proto/asset_service_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.asset_v1.proto import ( @@ -12,14 +13,14 @@ class AssetServiceStub(object): """Asset service definition. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.ExportAssets = channel.unary_unary( "/google.cloud.asset.v1.AssetService/ExportAssets", request_serializer=google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.SerializeToString, @@ -69,90 +70,90 @@ def __init__(self, channel): class AssetServiceServicer(object): """Asset service definition. - """ + """ def ExportAssets(self, request, context): """Exports assets with time and resource types to a given Cloud Storage - location/BigQuery table. For Cloud Storage location destinations, the - output format is newline-delimited JSON. Each line represents a - [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON - format; for BigQuery table destinations, the output table stores the fields - in asset proto as columns. This API implements the - [google.longrunning.Operation][google.longrunning.Operation] API , which - allows you to keep track of the export. We recommend intervals of at least - 2 seconds with exponential retry to poll the export operation result. For - regular-size resource parent, the export operation usually finishes within - 5 minutes. - """ + location/BigQuery table. For Cloud Storage location destinations, the + output format is newline-delimited JSON. Each line represents a + [google.cloud.asset.v1.Asset][google.cloud.asset.v1.Asset] in the JSON + format; for BigQuery table destinations, the output table stores the fields + in asset proto as columns. This API implements the + [google.longrunning.Operation][google.longrunning.Operation] API , which + allows you to keep track of the export. We recommend intervals of at least + 2 seconds with exponential retry to poll the export operation result. For + regular-size resource parent, the export operation usually finishes within + 5 minutes. + """ 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 IAM_POLICY content, this API outputs history when the asset and its - attached IAM POLICY both exist. This can create gaps in the output history. - Otherwise, this API outputs history with asset in both non-delete or - deleted status. - If a specified asset does not exist, this API returns an INVALID_ARGUMENT - error. - """ + For IAM_POLICY content, this API outputs history when the asset and its + attached IAM POLICY both exist. This can create gaps in the output history. + Otherwise, this API outputs history with asset in both non-delete or + deleted status. + If a specified asset does not exist, this API returns an INVALID_ARGUMENT + error. + """ 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. - """ + 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 SearchAllResources(self, request, context): """Searches all the resources within the given accessible scope (e.g., a - project, a folder or an organization). Callers should have - cloud.assets.SearchAllResources permission upon the requested scope, - otherwise the request will be rejected. - """ + project, a folder or an organization). Callers should have + cloud.assets.SearchAllResources permission upon the requested scope, + otherwise the request will be rejected. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def SearchAllIamPolicies(self, request, context): """Searches all the IAM policies within the given accessible scope (e.g., a - project, a folder or an organization). Callers should have - cloud.assets.SearchAllIamPolicies permission upon the requested scope, - otherwise the request will be rejected. - """ + project, a folder or an organization). Callers should have + cloud.assets.SearchAllIamPolicies permission upon the requested scope, + otherwise the request will be rejected. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -210,3 +211,252 @@ def add_AssetServiceServicer_to_server(servicer, server): "google.cloud.asset.v1.AssetService", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class AssetService(object): + """Asset service definition. + """ + + @staticmethod + def ExportAssets( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/ExportAssets", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.SerializeToString, + google_dot_longrunning_dot_operations__pb2.Operation.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def BatchGetAssetsHistory( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/BatchGetAssetsHistory", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def CreateFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/CreateFeed", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def GetFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/GetFeed", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.GetFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def ListFeeds( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/ListFeeds", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def UpdateFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/UpdateFeed", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def DeleteFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/DeleteFeed", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.DeleteFeedRequest.SerializeToString, + google_dot_protobuf_dot_empty__pb2.Empty.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def SearchAllResources( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/SearchAllResources", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.SearchAllResourcesRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.SearchAllResourcesResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def SearchAllIamPolicies( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1.AssetService/SearchAllIamPolicies", + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.SearchAllIamPoliciesRequest.SerializeToString, + google_dot_cloud_dot_asset__v1_dot_proto_dot_asset__service__pb2.SearchAllIamPoliciesResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/google/cloud/asset_v1/proto/assets_pb2.py b/google/cloud/asset_v1/proto/assets_pb2.py index a1f1a803..893a7349 100644 --- a/google/cloud/asset_v1/proto/assets_pb2.py +++ b/google/cloud/asset_v1/proto/assets_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1/proto/assets.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1/proto/assets_pb2_grpc.py b/google/cloud/asset_v1/proto/assets_pb2_grpc.py index 07cb78fe..8a939394 100644 --- a/google/cloud/asset_v1/proto/assets_pb2_grpc.py +++ b/google/cloud/asset_v1/proto/assets_pb2_grpc.py @@ -1,2 +1,3 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/google/cloud/asset_v1beta1/proto/asset_service_pb2.py b/google/cloud/asset_v1beta1/proto/asset_service_pb2.py index e7edfaff..fa374525 100644 --- a/google/cloud/asset_v1beta1/proto/asset_service_pb2.py +++ b/google/cloud/asset_v1beta1/proto/asset_service_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1beta1/proto/asset_service.proto - +"""Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message diff --git a/google/cloud/asset_v1beta1/proto/asset_service_pb2_grpc.py b/google/cloud/asset_v1beta1/proto/asset_service_pb2_grpc.py index 24a26e0c..1038401b 100644 --- a/google/cloud/asset_v1beta1/proto/asset_service_pb2_grpc.py +++ b/google/cloud/asset_v1beta1/proto/asset_service_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.asset_v1beta1.proto import ( @@ -11,14 +12,14 @@ class AssetServiceStub(object): """Asset service definition. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.ExportAssets = channel.unary_unary( "/google.cloud.asset.v1beta1.AssetService/ExportAssets", request_serializer=google_dot_cloud_dot_asset__v1beta1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.SerializeToString, @@ -33,28 +34,28 @@ def __init__(self, channel): 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. - """ + 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. - If a specified asset does not exist, this API returns an INVALID_ARGUMENT - error. - """ + For RESOURCE content, this API outputs history with asset in both + non-delete or deleted status. + For IAM_POLICY content, this API outputs history when the asset and its + attached IAM POLICY both exist. This can create gaps in the output history. + If a specified asset does not exist, this API returns an INVALID_ARGUMENT + error. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -77,3 +78,63 @@ def add_AssetServiceServicer_to_server(servicer, server): "google.cloud.asset.v1beta1.AssetService", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class AssetService(object): + """Asset service definition. + """ + + @staticmethod + def ExportAssets( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1beta1.AssetService/ExportAssets", + google_dot_cloud_dot_asset__v1beta1_dot_proto_dot_asset__service__pb2.ExportAssetsRequest.SerializeToString, + google_dot_longrunning_dot_operations__pb2.Operation.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def BatchGetAssetsHistory( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1beta1.AssetService/BatchGetAssetsHistory", + google_dot_cloud_dot_asset__v1beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryRequest.SerializeToString, + google_dot_cloud_dot_asset__v1beta1_dot_proto_dot_asset__service__pb2.BatchGetAssetsHistoryResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/google/cloud/asset_v1beta1/proto/assets_pb2.py b/google/cloud/asset_v1beta1/proto/assets_pb2.py index 15b45640..781eeca1 100644 --- a/google/cloud/asset_v1beta1/proto/assets_pb2.py +++ b/google/cloud/asset_v1beta1/proto/assets_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1beta1/proto/assets.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1beta1/proto/assets_pb2_grpc.py b/google/cloud/asset_v1beta1/proto/assets_pb2_grpc.py index 07cb78fe..8a939394 100644 --- a/google/cloud/asset_v1beta1/proto/assets_pb2_grpc.py +++ b/google/cloud/asset_v1beta1/proto/assets_pb2_grpc.py @@ -1,2 +1,3 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/google/cloud/asset_v1p1beta1/proto/asset_service_pb2.py b/google/cloud/asset_v1p1beta1/proto/asset_service_pb2.py index 8d9ce3f3..22dc8014 100644 --- a/google/cloud/asset_v1p1beta1/proto/asset_service_pb2.py +++ b/google/cloud/asset_v1p1beta1/proto/asset_service_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p1beta1/proto/asset_service.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1p1beta1/proto/asset_service_pb2_grpc.py b/google/cloud/asset_v1p1beta1/proto/asset_service_pb2_grpc.py index 034b538b..42767655 100644 --- a/google/cloud/asset_v1p1beta1/proto/asset_service_pb2_grpc.py +++ b/google/cloud/asset_v1p1beta1/proto/asset_service_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.asset_v1p1beta1.proto import ( @@ -8,14 +9,14 @@ class AssetServiceStub(object): """Asset service definition. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.SearchAllResources = channel.unary_unary( "/google.cloud.asset.v1p1beta1.AssetService/SearchAllResources", request_serializer=google_dot_cloud_dot_asset__v1p1beta1_dot_proto_dot_asset__service__pb2.SearchAllResourcesRequest.SerializeToString, @@ -30,28 +31,28 @@ def __init__(self, channel): class AssetServiceServicer(object): """Asset service definition. - """ + """ def SearchAllResources(self, request, context): """Searches all the resources under a given accessible CRM scope - (project/folder/organization). This RPC gives callers - especially admins the ability to search all the resources under a scope, - even if they don't have .get permission of all the resources. Callers - should have cloud.assets.SearchAllResources permission on the requested - scope, otherwise it will be rejected. - """ + (project/folder/organization). This RPC gives callers + especially admins the ability to search all the resources under a scope, + even if they don't have .get permission of all the resources. Callers + should have cloud.assets.SearchAllResources permission on the requested + scope, otherwise it will be rejected. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def SearchAllIamPolicies(self, request, context): """Searches all the IAM policies under a given accessible CRM scope - (project/folder/organization). This RPC gives callers - especially admins the ability to search all the IAM policies under a scope, - even if they don't have .getIamPolicy permission of all the IAM policies. - Callers should have cloud.assets.SearchAllIamPolicies permission on the - requested scope, otherwise it will be rejected. - """ + (project/folder/organization). This RPC gives callers + especially admins the ability to search all the IAM policies under a scope, + even if they don't have .getIamPolicy permission of all the IAM policies. + Callers should have cloud.assets.SearchAllIamPolicies permission on the + requested scope, otherwise it will be rejected. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -74,3 +75,63 @@ def add_AssetServiceServicer_to_server(servicer, server): "google.cloud.asset.v1p1beta1.AssetService", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class AssetService(object): + """Asset service definition. + """ + + @staticmethod + def SearchAllResources( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p1beta1.AssetService/SearchAllResources", + google_dot_cloud_dot_asset__v1p1beta1_dot_proto_dot_asset__service__pb2.SearchAllResourcesRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p1beta1_dot_proto_dot_asset__service__pb2.SearchAllResourcesResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def SearchAllIamPolicies( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p1beta1.AssetService/SearchAllIamPolicies", + google_dot_cloud_dot_asset__v1p1beta1_dot_proto_dot_asset__service__pb2.SearchAllIamPoliciesRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p1beta1_dot_proto_dot_asset__service__pb2.SearchAllIamPoliciesResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/google/cloud/asset_v1p1beta1/proto/assets_pb2.py b/google/cloud/asset_v1p1beta1/proto/assets_pb2.py index f85e6e9a..8186024e 100644 --- a/google/cloud/asset_v1p1beta1/proto/assets_pb2.py +++ b/google/cloud/asset_v1p1beta1/proto/assets_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p1beta1/proto/assets.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1p1beta1/proto/assets_pb2_grpc.py b/google/cloud/asset_v1p1beta1/proto/assets_pb2_grpc.py index 07cb78fe..8a939394 100644 --- a/google/cloud/asset_v1p1beta1/proto/assets_pb2_grpc.py +++ b/google/cloud/asset_v1p1beta1/proto/assets_pb2_grpc.py @@ -1,2 +1,3 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py b/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py index 1af5d9b3..7c5005fa 100644 --- a/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py +++ b/google/cloud/asset_v1p2beta1/proto/asset_service_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p2beta1/proto/asset_service.proto - +"""Generated protocol buffer code.""" from google.protobuf.internal import enum_type_wrapper from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message diff --git a/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py b/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py index 04493683..7c558f97 100644 --- a/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py +++ b/google/cloud/asset_v1p2beta1/proto/asset_service_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.asset_v1p2beta1.proto import ( @@ -9,14 +10,14 @@ class AssetServiceStub(object): """Asset service definition. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ 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, @@ -46,40 +47,40 @@ def __init__(self, channel): class AssetServiceServicer(object): """Asset service definition. - """ + """ def CreateFeed(self, request, context): """Creates a feed in a parent project/folder/organization to listen to its - asset updates. - """ + 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!") @@ -117,3 +118,144 @@ def add_AssetServiceServicer_to_server(servicer, server): "google.cloud.asset.v1p2beta1.AssetService", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class AssetService(object): + """Asset service definition. + """ + + @staticmethod + def CreateFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p2beta1.AssetService/CreateFeed", + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.CreateFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def GetFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p2beta1.AssetService/GetFeed", + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.GetFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def ListFeeds( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p2beta1.AssetService/ListFeeds", + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.ListFeedsResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def UpdateFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p2beta1.AssetService/UpdateFeed", + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.UpdateFeedRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.Feed.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def DeleteFeed( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p2beta1.AssetService/DeleteFeed", + google_dot_cloud_dot_asset__v1p2beta1_dot_proto_dot_asset__service__pb2.DeleteFeedRequest.SerializeToString, + google_dot_protobuf_dot_empty__pb2.Empty.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/google/cloud/asset_v1p2beta1/proto/assets_pb2.py b/google/cloud/asset_v1p2beta1/proto/assets_pb2.py index 97dd40c5..f1b713c5 100644 --- a/google/cloud/asset_v1p2beta1/proto/assets_pb2.py +++ b/google/cloud/asset_v1p2beta1/proto/assets_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p2beta1/proto/assets.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py b/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py index 07cb78fe..8a939394 100644 --- a/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py +++ b/google/cloud/asset_v1p2beta1/proto/assets_pb2_grpc.py @@ -1,2 +1,3 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/google/cloud/asset_v1p4beta1/proto/asset_service_pb2.py b/google/cloud/asset_v1p4beta1/proto/asset_service_pb2.py index 3e489833..487cc4b6 100644 --- a/google/cloud/asset_v1p4beta1/proto/asset_service_pb2.py +++ b/google/cloud/asset_v1p4beta1/proto/asset_service_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p4beta1/proto/asset_service.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1p4beta1/proto/asset_service_pb2_grpc.py b/google/cloud/asset_v1p4beta1/proto/asset_service_pb2_grpc.py index 887357ac..d193ce9a 100644 --- a/google/cloud/asset_v1p4beta1/proto/asset_service_pb2_grpc.py +++ b/google/cloud/asset_v1p4beta1/proto/asset_service_pb2_grpc.py @@ -1,4 +1,5 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc from google.cloud.asset_v1p4beta1.proto import ( @@ -11,14 +12,14 @@ class AssetServiceStub(object): """Asset service definition. - """ + """ def __init__(self, channel): """Constructor. - Args: - channel: A grpc.Channel. - """ + Args: + channel: A grpc.Channel. + """ self.AnalyzeIamPolicy = channel.unary_unary( "/google.cloud.asset.v1p4beta1.AssetService/AnalyzeIamPolicy", request_serializer=google_dot_cloud_dot_asset__v1p4beta1_dot_proto_dot_asset__service__pb2.AnalyzeIamPolicyRequest.SerializeToString, @@ -33,22 +34,22 @@ def __init__(self, channel): class AssetServiceServicer(object): """Asset service definition. - """ + """ def AnalyzeIamPolicy(self, request, context): """Analyzes IAM policies based on the specified request. Returns - a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request. - """ + a list of [IamPolicyAnalysisResult][google.cloud.asset.v1p4beta1.IamPolicyAnalysisResult] matching the request. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") def ExportIamPolicyAnalysis(self, request, context): """Exports IAM policy analysis based on the specified request. This API - implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep - track of the export. The metadata contains the request to help callers to - map responses to requests. - """ + implements the [google.longrunning.Operation][google.longrunning.Operation] API allowing you to keep + track of the export. The metadata contains the request to help callers to + map responses to requests. + """ context.set_code(grpc.StatusCode.UNIMPLEMENTED) context.set_details("Method not implemented!") raise NotImplementedError("Method not implemented!") @@ -71,3 +72,63 @@ def add_AssetServiceServicer_to_server(servicer, server): "google.cloud.asset.v1p4beta1.AssetService", rpc_method_handlers ) server.add_generic_rpc_handlers((generic_handler,)) + + +# This class is part of an EXPERIMENTAL API. +class AssetService(object): + """Asset service definition. + """ + + @staticmethod + def AnalyzeIamPolicy( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p4beta1.AssetService/AnalyzeIamPolicy", + google_dot_cloud_dot_asset__v1p4beta1_dot_proto_dot_asset__service__pb2.AnalyzeIamPolicyRequest.SerializeToString, + google_dot_cloud_dot_asset__v1p4beta1_dot_proto_dot_asset__service__pb2.AnalyzeIamPolicyResponse.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) + + @staticmethod + def ExportIamPolicyAnalysis( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): + return grpc.experimental.unary_unary( + request, + target, + "/google.cloud.asset.v1p4beta1.AssetService/ExportIamPolicyAnalysis", + google_dot_cloud_dot_asset__v1p4beta1_dot_proto_dot_asset__service__pb2.ExportIamPolicyAnalysisRequest.SerializeToString, + google_dot_longrunning_dot_operations__pb2.Operation.FromString, + options, + channel_credentials, + call_credentials, + compression, + wait_for_ready, + timeout, + metadata, + ) diff --git a/google/cloud/asset_v1p4beta1/proto/assets_pb2.py b/google/cloud/asset_v1p4beta1/proto/assets_pb2.py index 227c6fe8..9ecd9b81 100644 --- a/google/cloud/asset_v1p4beta1/proto/assets_pb2.py +++ b/google/cloud/asset_v1p4beta1/proto/assets_pb2.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/asset_v1p4beta1/proto/assets.proto - +"""Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection diff --git a/google/cloud/asset_v1p4beta1/proto/assets_pb2_grpc.py b/google/cloud/asset_v1p4beta1/proto/assets_pb2_grpc.py index 07cb78fe..8a939394 100644 --- a/google/cloud/asset_v1p4beta1/proto/assets_pb2_grpc.py +++ b/google/cloud/asset_v1p4beta1/proto/assets_pb2_grpc.py @@ -1,2 +1,3 @@ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! +"""Client and server classes corresponding to protobuf-defined services.""" import grpc diff --git a/synth.metadata b/synth.metadata index 6bb8186e..41f13089 100644 --- a/synth.metadata +++ b/synth.metadata @@ -4,15 +4,15 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-asset.git", - "sha": "f0e299275662a3a1825698069258753d9a37100e" + "sha": "e089e865904c755e5a395934cbcefa02ea09fd10" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "3dcb344dd2a03043708b3ba40c4df141a3d5b06b", - "internalRef": "316789767" + "sha": "b882b8e6bfcd708042ff00f7adc67ce750817dd0", + "internalRef": "318028816" } }, { diff --git a/synth.py b/synth.py index 457079a2..413aec92 100644 --- a/synth.py +++ b/synth.py @@ -175,6 +175,6 @@ def project_path(cls, project): s.move(templated_files) # TODO(busunkim): Use latest sphinx after microgenerator transition -s.replace("noxfile.py", '"sphinx"', '"sphinx<3.0.0"') +s.replace("noxfile.py", "'sphinx'", '"sphinx<3.0.0"') s.shell.run(["nox", "-s", "blacken"], hide_output=False) diff --git a/tests/unit/gapic/v1/test_asset_service_client_v1.py b/tests/unit/gapic/v1/test_asset_service_client_v1.py index fd69408a..3902d2a6 100644 --- a/tests/unit/gapic/v1/test_asset_service_client_v1.py +++ b/tests/unit/gapic/v1/test_asset_service_client_v1.py @@ -66,37 +66,6 @@ class CustomException(Exception): class TestAssetServiceClient(object): - 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 = "name3373707" - - 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 = "name3373707" - - with pytest.raises(CustomException): - client.delete_feed(name) - def test_export_assets(self): # Setup Expected Response expected_response = {} @@ -351,6 +320,37 @@ def test_update_feed_exception(self): 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 = "name3373707" + + 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 = "name3373707" + + with pytest.raises(CustomException): + client.delete_feed(name) + def test_search_all_resources(self): # Setup Expected Response next_page_token = ""