From b8f198ecb1d36afa16d9054653ebbb811e7dbd91 Mon Sep 17 00:00:00 2001 From: yoshi-automation Date: Fri, 13 Mar 2020 05:17:59 -0700 Subject: [PATCH 1/2] [CHANGE ME] Re-generated to pick up changes in the API or client library generator. --- google/__init__.py | 2 +- google/cloud/__init__.py | 2 +- google/cloud/recommender.py | 2 +- google/cloud/recommender_v1/__init__.py | 2 +- google/cloud/recommender_v1/gapic/enums.py | 10 +- .../gapic/recommender_client.py | 147 ++-- .../gapic/recommender_client_config.py | 14 - .../transports/recommender_grpc_transport.py | 84 +- .../proto/recommendation_pb2.py | 71 +- .../proto/recommendation_pb2_grpc.py | 2 +- .../proto/recommender_service_pb2.py | 122 +-- .../proto/recommender_service_pb2_grpc.py | 2 +- google/cloud/recommender_v1/types.py | 2 +- google/cloud/recommender_v1beta1/__init__.py | 2 +- .../cloud/recommender_v1beta1/gapic/enums.py | 81 +- .../gapic/recommender_client.py | 718 ++++++++++++++++-- .../gapic/recommender_client_config.py | 29 +- .../transports/recommender_grpc_transport.py | 383 +++++++++- .../recommender_v1beta1/proto/insight_pb2.py | 595 +++++++++++++++ .../proto/insight_pb2_grpc.py | 17 + .../proto/recommendation_pb2.py | 203 +++-- .../proto/recommendation_pb2_grpc.py | 2 +- .../proto/recommender_service_pb2.py | 664 +++++++++++++--- .../proto/recommender_service_pb2_grpc.py | 63 +- google/cloud/recommender_v1beta1/types.py | 5 +- noxfile.py | 3 +- synth.metadata | 34 +- .../gapic/v1/test_recommender_client_v1.py | 2 +- .../test_recommender_client_v1beta1.py | 152 +++- 29 files changed, 2840 insertions(+), 575 deletions(-) create mode 100644 google/cloud/recommender_v1beta1/proto/insight_pb2.py create mode 100644 google/cloud/recommender_v1beta1/proto/insight_pb2_grpc.py diff --git a/google/__init__.py b/google/__init__.py index 8fcc60e..9a1b64a 100644 --- a/google/__init__.py +++ b/google/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/__init__.py b/google/cloud/__init__.py index 8fcc60e..9a1b64a 100644 --- a/google/cloud/__init__.py +++ b/google/cloud/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender.py b/google/cloud/recommender.py index a54d504..7bf5c92 100644 --- a/google/cloud/recommender.py +++ b/google/cloud/recommender.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1/__init__.py b/google/cloud/recommender_v1/__init__.py index af2ac67..1de5743 100644 --- a/google/cloud/recommender_v1/__init__.py +++ b/google/cloud/recommender_v1/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1/gapic/enums.py b/google/cloud/recommender_v1/gapic/enums.py index 20e2869..0a577ef 100644 --- a/google/cloud/recommender_v1/gapic/enums.py +++ b/google/cloud/recommender_v1/gapic/enums.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,10 +21,10 @@ class NullValue(enum.IntEnum): """ - ``NullValue`` is a singleton enumeration to represent the null value - for the ``Value`` type union. - - The JSON representation for ``NullValue`` is JSON ``null``. + Optional. If present, retrieves the next batch of results from the + preceding call to this method. ``page_token`` must be the value of + ``next_page_token`` from the previous response. The values of other + method parameters must be identical to those in the previous call. Attributes: NULL_VALUE (int): Null value. diff --git a/google/cloud/recommender_v1/gapic/recommender_client.py b/google/cloud/recommender_v1/gapic/recommender_client.py index a8e30e8..b1e4fc8 100644 --- a/google/cloud/recommender_v1/gapic/recommender_client.py +++ b/google/cloud/recommender_v1/gapic/recommender_client.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -81,12 +81,7 @@ def from_service_account_file(cls, filename, *args, **kwargs): @classmethod def recommendation_path(cls, project, location, recommender, recommendation): - """DEPRECATED. Return a fully-qualified recommendation string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified recommendation string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}", project=project, @@ -97,12 +92,7 @@ def recommendation_path(cls, project, location, recommender, recommendation): @classmethod def recommender_path(cls, project, location, recommender): - """DEPRECATED. Return a fully-qualified recommender string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified recommender string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/recommenders/{recommender}", project=project, @@ -233,8 +223,9 @@ def list_recommendations( metadata=None, ): """ - Lists recommendations for a Cloud project. Requires the - recommender.*.list IAM permission for the specified recommender. + Denotes a field as required. This indicates that the field **must** + be provided as part of the request, and failure to do so will cause an + error (usually ``INVALID_ARGUMENT``). Example: >>> from google.cloud import recommender_v1 @@ -258,23 +249,26 @@ def list_recommendations( ... pass Args: - parent (str): Required. The container resource on which to execute the request. - Acceptable formats: - - 1. - - "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", - - LOCATION here refers to GCP Locations: - https://cloud.google.com/about/locations/ + parent (str): Set of filters to apply if ``path`` refers to array elements or + nested array elements in order to narrow down to a single unique element + that is being tested/modified. This is intended to be an exact match per + filter. To perform advanced matching, use path_value_matchers. + + - Example: { "/versions/*/name" : "it-123" + "/versions/*/targetSize/percent": 20 } + - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/condition" + : null } + - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/members/*" + : ["x@google.com", "y@google.com"] } When both path_filters and + path_value_matchers are set, an implicit AND must be performed. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. - filter_ (str): Filter expression to restrict the recommendations returned. - Supported filter fields: state_info.state Eg: - \`state_info.state:"DISMISSED" or state_info.state:"FAILED" + filter_ (str): ``ListValue`` is a wrapper around a repeated field of values. + + The JSON representation for ``ListValue`` is JSON array. 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. @@ -347,8 +341,45 @@ def get_recommendation( metadata=None, ): """ - Gets the requested recommendation. Requires the recommender.*.get - IAM permission for the specified recommender. + If this SourceCodeInfo represents a complete declaration, these are + any comments appearing before and after the declaration which appear to + be attached to the declaration. + + A series of line comments appearing on consecutive lines, with no other + tokens appearing on those lines, will be treated as a single comment. + + leading_detached_comments will keep paragraphs of comments that appear + before (but not connected to) the current element. Each paragraph, + separated by empty lines, will be one comment element in the repeated + field. + + Only the comment content is provided; comment markers (e.g. //) are + stripped out. For block comments, leading whitespace and an asterisk + will be stripped from the beginning of each line other than the first. + Newlines are included in the output. + + Examples: + + optional int32 foo = 1; // Comment attached to foo. // Comment attached + to bar. optional int32 bar = 2; + + optional string baz = 3; // Comment attached to baz. // Another line + attached to baz. + + // Comment attached to qux. // // Another line attached to qux. optional + double qux = 4; + + // Detached comment for corge. This is not leading or trailing comments + // to qux or corge because there are blank lines separating it from // + both. + + // Detached comment for corge paragraph 2. + + optional string corge = 5; /\* Block comment attached \* to corge. + Leading asterisks \* will be removed. */ /* Block comment attached to \* + grault. \*/ optional int32 grault = 6; + + // ignored detached comments. Example: >>> from google.cloud import recommender_v1 @@ -419,16 +450,8 @@ def mark_recommendation_claimed( metadata=None, ): """ - Mark the Recommendation State as Claimed. Users can use this method - to indicate to the Recommender API that they are starting to apply the - recommendation themselves. This stops the recommendation content from - being updated. - - MarkRecommendationClaimed can be applied to recommendations in CLAIMED, - SUCCEEDED, FAILED, or ACTIVE state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Can be set for action 'test' for advanced matching for the value of + 'path' field. Either this or ``value`` will be set for 'test' operation. Example: >>> from google.cloud import recommender_v1 @@ -445,10 +468,7 @@ def mark_recommendation_claimed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): Request for the ``MarkRecommendationSucceeded`` Method. 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. @@ -511,16 +531,10 @@ def mark_recommendation_succeeded( metadata=None, ): """ - Mark the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. - - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Denotes a field as output only. This indicates that the field is + provided in responses, but including the field in a request does nothing + (the server *must* ignore it and *must not* throw an error as a result + of the field's presence). Example: >>> from google.cloud import recommender_v1 @@ -537,10 +551,12 @@ def mark_recommendation_succeeded( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): Number of nano (10^-9) units of the amount. The value must be + between -999,999,999 and +999,999,999 inclusive. If ``units`` is + positive, ``nanos`` must be positive or zero. If ``units`` is zero, + ``nanos`` can be positive, zero, or negative. If ``units`` is negative, + ``nanos`` must be negative or zero. For example $-1.75 is represented as + ``units``\ =-1 and ``nanos``\ =-750,000,000. 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. @@ -603,12 +619,12 @@ def mark_recommendation_failed( metadata=None, ): """ - Mark the Recommendation State as Failed. Users can use this method - to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation failed. This stops the - recommendation content from being updated. + Mark the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. - MarkRecommendationFailed can be applied to recommendations in ACTIVE, + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state. Requires the recommender.*.update IAM permission for the specified @@ -629,10 +645,9 @@ def mark_recommendation_failed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): Signed seconds of the span of time. Must be from -315,576,000,000 to + +315,576,000,000 inclusive. Note: these bounds are computed from: 60 + sec/min \* 60 min/hr \* 24 hr/day \* 365.25 days/year \* 10000 years 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. diff --git a/google/cloud/recommender_v1/gapic/recommender_client_config.py b/google/cloud/recommender_v1/gapic/recommender_client_config.py index 3b74190..7526288 100644 --- a/google/cloud/recommender_v1/gapic/recommender_client_config.py +++ b/google/cloud/recommender_v1/gapic/recommender_client_config.py @@ -1,17 +1,3 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - config = { "interfaces": { "google.cloud.recommender.v1.Recommender": { diff --git a/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py b/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py index 40e1897..0a3a923 100644 --- a/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py +++ b/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -111,8 +111,9 @@ def channel(self): def list_recommendations(self): """Return the gRPC stub for :meth:`RecommenderClient.list_recommendations`. - Lists recommendations for a Cloud project. Requires the - recommender.*.list IAM permission for the specified recommender. + Denotes a field as required. This indicates that the field **must** + be provided as part of the request, and failure to do so will cause an + error (usually ``INVALID_ARGUMENT``). Returns: Callable: A callable which accepts the appropriate @@ -125,8 +126,45 @@ def list_recommendations(self): def get_recommendation(self): """Return the gRPC stub for :meth:`RecommenderClient.get_recommendation`. - Gets the requested recommendation. Requires the recommender.*.get - IAM permission for the specified recommender. + If this SourceCodeInfo represents a complete declaration, these are + any comments appearing before and after the declaration which appear to + be attached to the declaration. + + A series of line comments appearing on consecutive lines, with no other + tokens appearing on those lines, will be treated as a single comment. + + leading_detached_comments will keep paragraphs of comments that appear + before (but not connected to) the current element. Each paragraph, + separated by empty lines, will be one comment element in the repeated + field. + + Only the comment content is provided; comment markers (e.g. //) are + stripped out. For block comments, leading whitespace and an asterisk + will be stripped from the beginning of each line other than the first. + Newlines are included in the output. + + Examples: + + optional int32 foo = 1; // Comment attached to foo. // Comment attached + to bar. optional int32 bar = 2; + + optional string baz = 3; // Comment attached to baz. // Another line + attached to baz. + + // Comment attached to qux. // // Another line attached to qux. optional + double qux = 4; + + // Detached comment for corge. This is not leading or trailing comments + // to qux or corge because there are blank lines separating it from // + both. + + // Detached comment for corge paragraph 2. + + optional string corge = 5; /\* Block comment attached \* to corge. + Leading asterisks \* will be removed. */ /* Block comment attached to \* + grault. \*/ optional int32 grault = 6; + + // ignored detached comments. Returns: Callable: A callable which accepts the appropriate @@ -139,16 +177,8 @@ def get_recommendation(self): def mark_recommendation_claimed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_claimed`. - Mark the Recommendation State as Claimed. Users can use this method - to indicate to the Recommender API that they are starting to apply the - recommendation themselves. This stops the recommendation content from - being updated. - - MarkRecommendationClaimed can be applied to recommendations in CLAIMED, - SUCCEEDED, FAILED, or ACTIVE state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Can be set for action 'test' for advanced matching for the value of + 'path' field. Either this or ``value`` will be set for 'test' operation. Returns: Callable: A callable which accepts the appropriate @@ -161,16 +191,10 @@ def mark_recommendation_claimed(self): def mark_recommendation_succeeded(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_succeeded`. - Mark the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. - - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Denotes a field as output only. This indicates that the field is + provided in responses, but including the field in a request does nothing + (the server *must* ignore it and *must not* throw an error as a result + of the field's presence). Returns: Callable: A callable which accepts the appropriate @@ -183,12 +207,12 @@ def mark_recommendation_succeeded(self): def mark_recommendation_failed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_failed`. - Mark the Recommendation State as Failed. Users can use this method - to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation failed. This stops the - recommendation content from being updated. + Mark the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. - MarkRecommendationFailed can be applied to recommendations in ACTIVE, + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state. Requires the recommender.*.update IAM permission for the specified diff --git a/google/cloud/recommender_v1/proto/recommendation_pb2.py b/google/cloud/recommender_v1/proto/recommendation_pb2.py index 38f19f8..306cdfb 100644 --- a/google/cloud/recommender_v1/proto/recommendation_pb2.py +++ b/google/cloud/recommender_v1/proto/recommendation_pb2.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/recommender_v1/proto/recommendation.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -40,12 +23,8 @@ name="google/cloud/recommender_v1/proto/recommendation.proto", package="google.cloud.recommender.v1", syntax="proto3", - serialized_options=_b( - "\n\037com.google.cloud.recommender.v1P\001ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\242\002\004CREC\252\002\033Google.Cloud.Recommender.V1\352Al\n&recommender.googleapis.com/Recommender\022Bprojects/{project}/locations/{location}/recommenders/{recommender}" - ), - serialized_pb=_b( - '\n6google/cloud/recommender_v1/proto/recommendation.proto\x12\x1bgoogle.cloud.recommender.v1\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/money.proto"\xb8\x04\n\x0eRecommendation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1b\n\x13recommender_subtype\x18\x0c \x01(\t\x12\x35\n\x11last_refresh_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12;\n\x0eprimary_impact\x18\x05 \x01(\x0b\x32#.google.cloud.recommender.v1.Impact\x12>\n\x11\x61\x64\x64itional_impact\x18\x06 \x03(\x0b\x32#.google.cloud.recommender.v1.Impact\x12\x43\n\x07\x63ontent\x18\x07 \x01(\x0b\x32\x32.google.cloud.recommender.v1.RecommendationContent\x12H\n\nstate_info\x18\n \x01(\x0b\x32\x34.google.cloud.recommender.v1.RecommendationStateInfo\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t:\x94\x01\xea\x41\x90\x01\n)recommender.googleapis.com/Recommendation\x12\x63projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}"^\n\x15RecommendationContent\x12\x45\n\x10operation_groups\x18\x02 \x03(\x0b\x32+.google.cloud.recommender.v1.OperationGroup"L\n\x0eOperationGroup\x12:\n\noperations\x18\x01 \x03(\x0b\x32&.google.cloud.recommender.v1.Operation"\xd7\x04\n\tOperation\x12\x0e\n\x06\x61\x63tion\x18\x01 \x01(\t\x12\x15\n\rresource_type\x18\x02 \x01(\t\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x17\n\x0fsource_resource\x18\x05 \x01(\t\x12\x13\n\x0bsource_path\x18\x06 \x01(\t\x12\'\n\x05value\x18\x07 \x01(\x0b\x32\x16.google.protobuf.ValueH\x00\x12\x42\n\rvalue_matcher\x18\n \x01(\x0b\x32).google.cloud.recommender.v1.ValueMatcherH\x00\x12M\n\x0cpath_filters\x18\x08 \x03(\x0b\x32\x37.google.cloud.recommender.v1.Operation.PathFiltersEntry\x12Z\n\x13path_value_matchers\x18\x0b \x03(\x0b\x32=.google.cloud.recommender.v1.Operation.PathValueMatchersEntry\x1aJ\n\x10PathFiltersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a\x63\n\x16PathValueMatchersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).google.cloud.recommender.v1.ValueMatcher:\x02\x38\x01\x42\x0c\n\npath_value":\n\x0cValueMatcher\x12\x19\n\x0fmatches_pattern\x18\x01 \x01(\tH\x00\x42\x0f\n\rmatch_variant"_\n\x0e\x43ostProjection\x12 \n\x04\x63ost\x18\x01 \x01(\x0b\x32\x12.google.type.Money\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x80\x02\n\x06Impact\x12>\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32,.google.cloud.recommender.v1.Impact.Category\x12\x46\n\x0f\x63ost_projection\x18\x64 \x01(\x0b\x32+.google.cloud.recommender.v1.CostProjectionH\x00"`\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x08\n\x04\x43OST\x10\x01\x12\x0c\n\x08SECURITY\x10\x02\x12\x0f\n\x0bPERFORMANCE\x10\x03\x12\x11\n\rMANAGEABILITY\x10\x04\x42\x0c\n\nprojection"\xde\x02\n\x17RecommendationStateInfo\x12I\n\x05state\x18\x01 \x01(\x0e\x32:.google.cloud.recommender.v1.RecommendationStateInfo.State\x12_\n\x0estate_metadata\x18\x02 \x03(\x0b\x32G.google.cloud.recommender.v1.RecommendationStateInfo.StateMetadataEntry\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"a\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0b\n\x07\x43LAIMED\x10\x06\x12\r\n\tSUCCEEDED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\r\n\tDISMISSED\x10\x05\x42\xff\x01\n\x1f\x63om.google.cloud.recommender.v1P\x01ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\xa2\x02\x04\x43REC\xaa\x02\x1bGoogle.Cloud.Recommender.V1\xea\x41l\n&recommender.googleapis.com/Recommender\x12\x42projects/{project}/locations/{location}/recommenders/{recommender}b\x06proto3' - ), + serialized_options=b"\n\037com.google.cloud.recommender.v1P\001ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\242\002\004CREC\252\002\033Google.Cloud.Recommender.V1\352Al\n&recommender.googleapis.com/Recommender\022Bprojects/{project}/locations/{location}/recommenders/{recommender}", + serialized_pb=b'\n6google/cloud/recommender_v1/proto/recommendation.proto\x12\x1bgoogle.cloud.recommender.v1\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/money.proto"\xb8\x04\n\x0eRecommendation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1b\n\x13recommender_subtype\x18\x0c \x01(\t\x12\x35\n\x11last_refresh_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12;\n\x0eprimary_impact\x18\x05 \x01(\x0b\x32#.google.cloud.recommender.v1.Impact\x12>\n\x11\x61\x64\x64itional_impact\x18\x06 \x03(\x0b\x32#.google.cloud.recommender.v1.Impact\x12\x43\n\x07\x63ontent\x18\x07 \x01(\x0b\x32\x32.google.cloud.recommender.v1.RecommendationContent\x12H\n\nstate_info\x18\n \x01(\x0b\x32\x34.google.cloud.recommender.v1.RecommendationStateInfo\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t:\x94\x01\xea\x41\x90\x01\n)recommender.googleapis.com/Recommendation\x12\x63projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}"^\n\x15RecommendationContent\x12\x45\n\x10operation_groups\x18\x02 \x03(\x0b\x32+.google.cloud.recommender.v1.OperationGroup"L\n\x0eOperationGroup\x12:\n\noperations\x18\x01 \x03(\x0b\x32&.google.cloud.recommender.v1.Operation"\xd7\x04\n\tOperation\x12\x0e\n\x06\x61\x63tion\x18\x01 \x01(\t\x12\x15\n\rresource_type\x18\x02 \x01(\t\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x17\n\x0fsource_resource\x18\x05 \x01(\t\x12\x13\n\x0bsource_path\x18\x06 \x01(\t\x12\'\n\x05value\x18\x07 \x01(\x0b\x32\x16.google.protobuf.ValueH\x00\x12\x42\n\rvalue_matcher\x18\n \x01(\x0b\x32).google.cloud.recommender.v1.ValueMatcherH\x00\x12M\n\x0cpath_filters\x18\x08 \x03(\x0b\x32\x37.google.cloud.recommender.v1.Operation.PathFiltersEntry\x12Z\n\x13path_value_matchers\x18\x0b \x03(\x0b\x32=.google.cloud.recommender.v1.Operation.PathValueMatchersEntry\x1aJ\n\x10PathFiltersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1a\x63\n\x16PathValueMatchersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x38\n\x05value\x18\x02 \x01(\x0b\x32).google.cloud.recommender.v1.ValueMatcher:\x02\x38\x01\x42\x0c\n\npath_value":\n\x0cValueMatcher\x12\x19\n\x0fmatches_pattern\x18\x01 \x01(\tH\x00\x42\x0f\n\rmatch_variant"_\n\x0e\x43ostProjection\x12 \n\x04\x63ost\x18\x01 \x01(\x0b\x32\x12.google.type.Money\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x80\x02\n\x06Impact\x12>\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32,.google.cloud.recommender.v1.Impact.Category\x12\x46\n\x0f\x63ost_projection\x18\x64 \x01(\x0b\x32+.google.cloud.recommender.v1.CostProjectionH\x00"`\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x08\n\x04\x43OST\x10\x01\x12\x0c\n\x08SECURITY\x10\x02\x12\x0f\n\x0bPERFORMANCE\x10\x03\x12\x11\n\rMANAGEABILITY\x10\x04\x42\x0c\n\nprojection"\xde\x02\n\x17RecommendationStateInfo\x12I\n\x05state\x18\x01 \x01(\x0e\x32:.google.cloud.recommender.v1.RecommendationStateInfo.State\x12_\n\x0estate_metadata\x18\x02 \x03(\x0b\x32G.google.cloud.recommender.v1.RecommendationStateInfo.StateMetadataEntry\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"a\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0b\n\x07\x43LAIMED\x10\x06\x12\r\n\tSUCCEEDED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\r\n\tDISMISSED\x10\x05\x42\xff\x01\n\x1f\x63om.google.cloud.recommender.v1P\x01ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\xa2\x02\x04\x43REC\xaa\x02\x1bGoogle.Cloud.Recommender.V1\xea\x41l\n&recommender.googleapis.com/Recommender\x12\x42projects/{project}/locations/{location}/recommenders/{recommender}b\x06proto3', dependencies=[ google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, @@ -142,7 +121,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -160,7 +139,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -178,7 +157,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -286,7 +265,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -299,9 +278,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b( - "\352A\220\001\n)recommender.googleapis.com/Recommendation\022cprojects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}" - ), + serialized_options=b"\352A\220\001\n)recommender.googleapis.com/Recommendation\022cprojects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -405,7 +382,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -436,7 +413,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -461,7 +438,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -492,7 +469,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -517,7 +494,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -535,7 +512,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -553,7 +530,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -571,7 +548,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -589,7 +566,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -607,7 +584,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -726,7 +703,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -895,7 +872,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -913,7 +890,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -926,7 +903,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -1251,7 +1228,8 @@ support value matching beyond exact match. To perform exact match, use path_filters. When both path_filters and path_value_matchers are set, an implicit AND must be - performed. + performed. .. [1] a-z0-9 .. [2] a-z0-9 .. [3] + a-z0-9 """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.Operation) }, @@ -1266,7 +1244,8 @@ { "DESCRIPTOR": _VALUEMATCHER, "__module__": "google.cloud.recommender_v1.proto.recommendation_pb2", - "__doc__": """Contains various matching options for values for a GCP resource field. + "__doc__": """Contains various matching options for values for a GCP + resource field. Attributes: diff --git a/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py b/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py index b662812..7343170 100644 --- a/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py +++ b/google/cloud/recommender_v1/proto/recommendation_pb2_grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1/proto/recommender_service_pb2.py b/google/cloud/recommender_v1/proto/recommender_service_pb2.py index cfe9715..6743905 100644 --- a/google/cloud/recommender_v1/proto/recommender_service_pb2.py +++ b/google/cloud/recommender_v1/proto/recommender_service_pb2.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/recommender_v1/proto/recommender_service.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -42,12 +25,8 @@ name="google/cloud/recommender_v1/proto/recommender_service.proto", package="google.cloud.recommender.v1", syntax="proto3", - serialized_options=_b( - "\n\037com.google.cloud.recommender.v1B\020RecommenderProtoP\001ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\242\002\004CREC\252\002\033Google.Cloud.Recommender.V1" - ), - serialized_pb=_b( - '\n;google/cloud/recommender_v1/proto/recommender_service.proto\x12\x1bgoogle.cloud.recommender.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x36google/cloud/recommender_v1/proto/recommendation.proto"\x9d\x01\n\x1aListRecommendationsRequest\x12>\n\x06parent\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&recommender.googleapis.com/Recommender\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t"|\n\x1bListRecommendationsResponse\x12\x44\n\x0frecommendations\x18\x01 \x03(\x0b\x32+.google.cloud.recommender.v1.Recommendation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"[\n\x18GetRecommendationRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation"\x96\x02\n MarkRecommendationClaimedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12h\n\x0estate_metadata\x18\x02 \x03(\x0b\x32P.google.cloud.recommender.v1.MarkRecommendationClaimedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x9a\x02\n"MarkRecommendationSucceededRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12j\n\x0estate_metadata\x18\x02 \x03(\x0b\x32R.google.cloud.recommender.v1.MarkRecommendationSucceededRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x94\x02\n\x1fMarkRecommendationFailedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12g\n\x0estate_metadata\x18\x02 \x03(\x0b\x32O.google.cloud.recommender.v1.MarkRecommendationFailedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\x9d\n\n\x0bRecommender\x12\xed\x01\n\x13ListRecommendations\x12\x37.google.cloud.recommender.v1.ListRecommendationsRequest\x1a\x38.google.cloud.recommender.v1.ListRecommendationsResponse"c\x82\xd3\xe4\x93\x02\x44\x12\x42/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations\xda\x41\x06parent\xda\x41\rparent,filter\x12\xca\x01\n\x11GetRecommendation\x12\x35.google.cloud.recommender.v1.GetRecommendationRequest\x1a+.google.cloud.recommender.v1.Recommendation"Q\x82\xd3\xe4\x93\x02\x44\x12\x42/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\xda\x41\x04name\x12\xfd\x01\n\x19MarkRecommendationClaimed\x12=.google.cloud.recommender.v1.MarkRecommendationClaimedRequest\x1a+.google.cloud.recommender.v1.Recommendation"t\x82\xd3\xe4\x93\x02S"N/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\x01*\xda\x41\x18name,state_metadata,etag\x12\x83\x02\n\x1bMarkRecommendationSucceeded\x12?.google.cloud.recommender.v1.MarkRecommendationSucceededRequest\x1a+.google.cloud.recommender.v1.Recommendation"v\x82\xd3\xe4\x93\x02U"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\x01*\xda\x41\x18name,state_metadata,etag\x12\xfa\x01\n\x18MarkRecommendationFailed\x12<.google.cloud.recommender.v1.MarkRecommendationFailedRequest\x1a+.google.cloud.recommender.v1.Recommendation"s\x82\xd3\xe4\x93\x02R"M/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\x01*\xda\x41\x18name,state_metadata,etag\x1aN\xca\x41\x1arecommender.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xa2\x01\n\x1f\x63om.google.cloud.recommender.v1B\x10RecommenderProtoP\x01ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\xa2\x02\x04\x43REC\xaa\x02\x1bGoogle.Cloud.Recommender.V1b\x06proto3' - ), + serialized_options=b"\n\037com.google.cloud.recommender.v1B\020RecommenderProtoP\001ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\242\002\004CREC\252\002\033Google.Cloud.Recommender.V1", + serialized_pb=b'\n;google/cloud/recommender_v1/proto/recommender_service.proto\x12\x1bgoogle.cloud.recommender.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x36google/cloud/recommender_v1/proto/recommendation.proto"\x9d\x01\n\x1aListRecommendationsRequest\x12>\n\x06parent\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&recommender.googleapis.com/Recommender\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t"|\n\x1bListRecommendationsResponse\x12\x44\n\x0frecommendations\x18\x01 \x03(\x0b\x32+.google.cloud.recommender.v1.Recommendation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"[\n\x18GetRecommendationRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation"\x96\x02\n MarkRecommendationClaimedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12h\n\x0estate_metadata\x18\x02 \x03(\x0b\x32P.google.cloud.recommender.v1.MarkRecommendationClaimedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x9a\x02\n"MarkRecommendationSucceededRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12j\n\x0estate_metadata\x18\x02 \x03(\x0b\x32R.google.cloud.recommender.v1.MarkRecommendationSucceededRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x94\x02\n\x1fMarkRecommendationFailedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12g\n\x0estate_metadata\x18\x02 \x03(\x0b\x32O.google.cloud.recommender.v1.MarkRecommendationFailedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\x9d\n\n\x0bRecommender\x12\xed\x01\n\x13ListRecommendations\x12\x37.google.cloud.recommender.v1.ListRecommendationsRequest\x1a\x38.google.cloud.recommender.v1.ListRecommendationsResponse"c\x82\xd3\xe4\x93\x02\x44\x12\x42/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations\xda\x41\x06parent\xda\x41\rparent,filter\x12\xca\x01\n\x11GetRecommendation\x12\x35.google.cloud.recommender.v1.GetRecommendationRequest\x1a+.google.cloud.recommender.v1.Recommendation"Q\x82\xd3\xe4\x93\x02\x44\x12\x42/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\xda\x41\x04name\x12\xfd\x01\n\x19MarkRecommendationClaimed\x12=.google.cloud.recommender.v1.MarkRecommendationClaimedRequest\x1a+.google.cloud.recommender.v1.Recommendation"t\x82\xd3\xe4\x93\x02S"N/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\x01*\xda\x41\x18name,state_metadata,etag\x12\x83\x02\n\x1bMarkRecommendationSucceeded\x12?.google.cloud.recommender.v1.MarkRecommendationSucceededRequest\x1a+.google.cloud.recommender.v1.Recommendation"v\x82\xd3\xe4\x93\x02U"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\x01*\xda\x41\x18name,state_metadata,etag\x12\xfa\x01\n\x18MarkRecommendationFailed\x12<.google.cloud.recommender.v1.MarkRecommendationFailedRequest\x1a+.google.cloud.recommender.v1.Recommendation"s\x82\xd3\xe4\x93\x02R"M/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\x01*\xda\x41\x18name,state_metadata,etag\x1aN\xca\x41\x1arecommender.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xa2\x01\n\x1f\x63om.google.cloud.recommender.v1B\x10RecommenderProtoP\x01ZFgoogle.golang.org/genproto/googleapis/cloud/recommender/v1;recommender\xa2\x02\x04\x43REC\xaa\x02\x1bGoogle.Cloud.Recommender.V1b\x06proto3', dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_client__pb2.DESCRIPTOR, @@ -74,15 +53,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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&recommender.googleapis.com/Recommender" - ), + serialized_options=b"\340A\002\372A(\n&recommender.googleapis.com/Recommender", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -100,7 +77,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\001"), + serialized_options=b"\340A\001", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -112,13 +89,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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\001"), + serialized_options=b"\340A\001", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -130,7 +107,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -187,7 +164,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -226,15 +203,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ) ], @@ -267,7 +242,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -285,7 +260,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -298,7 +273,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -323,15 +298,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -361,13 +334,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -400,7 +373,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -418,7 +391,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -431,7 +404,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -456,15 +429,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -494,13 +465,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -533,7 +504,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -551,7 +522,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -564,7 +535,7 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], @@ -589,15 +560,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -627,13 +596,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -829,8 +798,7 @@ ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides - optimistic locking. .. [1] a-z0-9 .. [2] a-z0-9 .. - [3] a-z0-9 + optimistic locking. """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.MarkRecommendationSucceededRequest) }, @@ -895,9 +863,7 @@ full_name="google.cloud.recommender.v1.Recommender", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\032recommender.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" - ), + serialized_options=b"\312A\032recommender.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform", serialized_start=1488, serialized_end=2797, methods=[ @@ -908,9 +874,7 @@ containing_service=None, input_type=_LISTRECOMMENDATIONSREQUEST, output_type=_LISTRECOMMENDATIONSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002D\022B/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations\332A\006parent\332A\rparent,filter" - ), + serialized_options=b"\202\323\344\223\002D\022B/v1/{parent=projects/*/locations/*/recommenders/*}/recommendations\332A\006parent\332A\rparent,filter", ), _descriptor.MethodDescriptor( name="GetRecommendation", @@ -919,9 +883,7 @@ containing_service=None, input_type=_GETRECOMMENDATIONREQUEST, output_type=google_dot_cloud_dot_recommender__v1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - "\202\323\344\223\002D\022B/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\332A\004name" - ), + serialized_options=b"\202\323\344\223\002D\022B/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\332A\004name", ), _descriptor.MethodDescriptor( name="MarkRecommendationClaimed", @@ -930,9 +892,7 @@ containing_service=None, input_type=_MARKRECOMMENDATIONCLAIMEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002S"N/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002S"N/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\001*\332A\030name,state_metadata,etag', ), _descriptor.MethodDescriptor( name="MarkRecommendationSucceeded", @@ -941,9 +901,7 @@ containing_service=None, input_type=_MARKRECOMMENDATIONSUCCEEDEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002U"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002U"P/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\001*\332A\030name,state_metadata,etag', ), _descriptor.MethodDescriptor( name="MarkRecommendationFailed", @@ -952,9 +910,7 @@ containing_service=None, input_type=_MARKRECOMMENDATIONFAILEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002R"M/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002R"M/v1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\001*\332A\030name,state_metadata,etag', ), ], ) diff --git a/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py b/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py index 486a25a..617b0cb 100644 --- a/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py +++ b/google/cloud/recommender_v1/proto/recommender_service_pb2_grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1/types.py b/google/cloud/recommender_v1/types.py index 96dccdf..f5d243e 100644 --- a/google/cloud/recommender_v1/types.py +++ b/google/cloud/recommender_v1/types.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1beta1/__init__.py b/google/cloud/recommender_v1beta1/__init__.py index 330d111..51dbe34 100644 --- a/google/cloud/recommender_v1beta1/__init__.py +++ b/google/cloud/recommender_v1beta1/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1beta1/gapic/enums.py b/google/cloud/recommender_v1beta1/gapic/enums.py index f2eaf84..1cff3c1 100644 --- a/google/cloud/recommender_v1beta1/gapic/enums.py +++ b/google/cloud/recommender_v1beta1/gapic/enums.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -21,10 +21,39 @@ class NullValue(enum.IntEnum): """ - ``NullValue`` is a singleton enumeration to represent the null value - for the ``Value`` type union. + A definition of a client library method signature. - The JSON representation for ``NullValue`` is JSON ``null``. + In client libraries, each proto RPC corresponds to one or more methods + which the end user is able to call, and calls the underlying RPC. + Normally, this method receives a single argument (a struct or instance + corresponding to the RPC request object). Defining this field will add + one or more overloads providing flattened or simpler method signatures + in some languages. + + The fields on the method signature are provided as a comma-separated + string. + + For example, the proto RPC and annotation: + + rpc CreateSubscription(CreateSubscriptionRequest) returns (Subscription) + { option (google.api.method_signature) = "name,topic"; } + + Would add the following Java overload (in addition to the method + accepting the request object): + + public final Subscription createSubscription(String name, String topic) + + The following backwards-compatibility guidelines apply: + + - Adding this annotation to an unannotated method is backwards + compatible. + - Adding this annotation to a method which already has existing method + signature annotations is backwards compatible if and only if the new + method signature annotation is last in the sequence. + - Modifying or removing an existing method signature annotation is a + breaking change. + - Re-ordering existing method signature annotations is a breaking + change. Attributes: NULL_VALUE (int): Null value. @@ -53,6 +82,50 @@ class Category(enum.IntEnum): MANAGEABILITY = 4 +class Insight(object): + class Category(enum.IntEnum): + """ + Insight category. + + Attributes: + CATEGORY_UNSPECIFIED (int): Unspecified category. + COST (int): The insight is related to cost. + SECURITY (int): The insight is related to security. + PERFORMANCE (int): The insight is related to performance. + MANAGEABILITY (int): This insight is related to manageability. + """ + + CATEGORY_UNSPECIFIED = 0 + COST = 1 + SECURITY = 2 + PERFORMANCE = 3 + MANAGEABILITY = 4 + + +class InsightStateInfo(object): + class State(enum.IntEnum): + """ + Represents insight state. + + Attributes: + STATE_UNSPECIFIED (int): Unspecified state. + ACTIVE (int): Insight is active. Content for ACTIVE insights can be updated by Google. + ACTIVE insights can be marked DISMISSED OR ACCEPTED. + ACCEPTED (int): Some action has been taken based on this insight. Insights become + accepted when a recommendation derived from the insight has been marked + CLAIMED, SUCCEEDED, or FAILED. ACTIVE insights can also be marked + ACCEPTED explicitly. Content for ACCEPTED insights is immutable. ACCEPTED + insights can only be marked ACCEPTED (which may update state metadata). + DISMISSED (int): Insight is dismissed. Content for DISMISSED insights can be updated by + Google. DISMISSED insights can be marked as ACTIVE. + """ + + STATE_UNSPECIFIED = 0 + ACTIVE = 1 + ACCEPTED = 2 + DISMISSED = 3 + + class RecommendationStateInfo(object): class State(enum.IntEnum): """ diff --git a/google/cloud/recommender_v1beta1/gapic/recommender_client.py b/google/cloud/recommender_v1beta1/gapic/recommender_client.py index fb3e014..c31d728 100644 --- a/google/cloud/recommender_v1beta1/gapic/recommender_client.py +++ b/google/cloud/recommender_v1beta1/gapic/recommender_client.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ from google.cloud.recommender_v1beta1.gapic import enums from google.cloud.recommender_v1beta1.gapic import recommender_client_config from google.cloud.recommender_v1beta1.gapic.transports import recommender_grpc_transport +from google.cloud.recommender_v1beta1.proto import insight_pb2 from google.cloud.recommender_v1beta1.proto import recommendation_pb2 from google.cloud.recommender_v1beta1.proto import recommender_service_pb2 from google.cloud.recommender_v1beta1.proto import recommender_service_pb2_grpc @@ -80,13 +81,29 @@ def from_service_account_file(cls, filename, *args, **kwargs): from_service_account_json = from_service_account_file @classmethod - def recommendation_path(cls, project, location, recommender, recommendation): - """DEPRECATED. Return a fully-qualified recommendation string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, + def insight_path(cls, project, location, insight_type, insight): + """Return a fully-qualified insight string.""" + return google.api_core.path_template.expand( + "projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}", + project=project, + location=location, + insight_type=insight_type, + insight=insight, + ) + + @classmethod + def insight_type_path(cls, project, location, insight_type): + """Return a fully-qualified insight_type string.""" + return google.api_core.path_template.expand( + "projects/{project}/locations/{location}/insightTypes/{insight_type}", + project=project, + location=location, + insight_type=insight_type, ) + + @classmethod + def recommendation_path(cls, project, location, recommender, recommendation): + """Return a fully-qualified recommendation string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}", project=project, @@ -97,12 +114,7 @@ def recommendation_path(cls, project, location, recommender, recommendation): @classmethod def recommender_path(cls, project, location, recommender): - """DEPRECATED. Return a fully-qualified recommender string.""" - warnings.warn( - "Resource name helper functions are deprecated.", - PendingDeprecationWarning, - stacklevel=1, - ) + """Return a fully-qualified recommender string.""" return google.api_core.path_template.expand( "projects/{project}/locations/{location}/recommenders/{recommender}", project=project, @@ -223,6 +235,575 @@ def __init__( self._inner_api_calls = {} # Service calls + def list_insights( + self, + parent, + page_size=None, + filter_=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + # gRPC Transcoding + + gRPC Transcoding is a feature for mapping between a gRPC method and one + or more HTTP REST endpoints. It allows developers to build a single API + service that supports both gRPC APIs and REST APIs. Many systems, + including `Google APIs `__, + `Cloud Endpoints `__, `gRPC + Gateway `__, and + `Envoy `__ proxy support this + feature and use it for large scale production services. + + ``HttpRule`` defines the schema of the gRPC/REST mapping. The mapping + specifies how different portions of the gRPC request message are mapped + to the URL path, URL query parameters, and HTTP request body. It also + controls how the gRPC response message is mapped to the HTTP response + body. ``HttpRule`` is typically specified as an ``google.api.http`` + annotation on the gRPC method. + + Each mapping specifies a URL path template and an HTTP method. The path + template may refer to one or more fields in the gRPC request message, as + long as each field is a non-repeated field with a primitive + (non-message) type. The path template controls how fields of the request + message are mapped to the URL path. + + Example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get: "/v1/{name=messages/*}" + }; + } + } + message GetMessageRequest { + string name = 1; // Mapped to URL path. + } + message Message { + string text = 1; // The resource content. + } + + This enables an HTTP REST to gRPC mapping as below: + + HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| + ``GetMessage(name: "messages/123456")`` + + Any fields in the request message which are not bound by the path + template automatically become HTTP query parameters if there is no HTTP + request body. For example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get:"/v1/messages/{message_id}" + }; + } + } + message GetMessageRequest { + message SubMessage { + string subfield = 1; + } + string message_id = 1; // Mapped to URL path. + int64 revision = 2; // Mapped to URL query parameter `revision`. + SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + } + + This enables a HTTP JSON to RPC mapping as below: + + HTTP \| gRPC -----|----- + ``GET /v1/messages/123456?revision=2&sub.subfield=foo`` \| + ``GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`` + + Note that fields which are mapped to URL query parameters must have a + primitive type or a repeated primitive type or a non-repeated message + type. In the case of a repeated type, the parameter can be repeated in + the URL as ``...?param=A¶m=B``. In the case of a message type, each + field of the message is mapped to a separate parameter, such as + ``...?foo.a=A&foo.b=B&foo.c=C``. + + For HTTP methods that allow a request body, the ``body`` field specifies + the mapping. Consider a REST update method on the message resource + collection: + + :: + + service Messaging { + rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + option (google.api.http) = { + patch: "/v1/messages/{message_id}" + body: "message" + }; + } + } + message UpdateMessageRequest { + string message_id = 1; // mapped to the URL + Message message = 2; // mapped to the body + } + + The following HTTP JSON to RPC mapping is enabled, where the + representation of the JSON in the request body is determined by protos + JSON encoding: + + HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` + \| ``UpdateMessage(message_id: "123456" message { text: "Hi!" })`` + + The special name ``*`` can be used in the body mapping to define that + every field not bound by the path template should be mapped to the + request body. This enables the following alternative definition of the + update method: + + :: + + service Messaging { + rpc UpdateMessage(Message) returns (Message) { + option (google.api.http) = { + patch: "/v1/messages/{message_id}" + body: "*" + }; + } + } + message Message { + string message_id = 1; + string text = 2; + } + + The following HTTP JSON to RPC mapping is enabled: + + HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` + \| ``UpdateMessage(message_id: "123456" text: "Hi!")`` + + Note that when using ``*`` in the body mapping, it is not possible to + have HTTP parameters, as all fields not bound by the path end in the + body. This makes this option more rarely used in practice when defining + REST APIs. The common usage of ``*`` is in custom methods which don't + use the URL at all for transferring data. + + It is possible to define multiple HTTP methods for one RPC by using the + ``additional_bindings`` option. Example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get: "/v1/messages/{message_id}" + additional_bindings { + get: "/v1/users/{user_id}/messages/{message_id}" + } + }; + } + } + message GetMessageRequest { + string message_id = 1; + string user_id = 2; + } + + This enables the following two alternative HTTP JSON to RPC mappings: + + HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| + ``GetMessage(message_id: "123456")`` + ``GET /v1/users/me/messages/123456`` \| + ``GetMessage(user_id: "me" message_id: "123456")`` + + ## Rules for HTTP mapping + + 1. Leaf request fields (recursive expansion nested messages in the + request message) are classified into three categories: + + - Fields referred by the path template. They are passed via the URL + path. + - Fields referred by the ``HttpRule.body``. They are passed via the + HTTP request body. + - All other fields are passed via the URL query parameters, and the + parameter name is the field path in the request message. A + repeated field can be represented as multiple query parameters + under the same name. + + 2. If ``HttpRule.body`` is "*", there is no URL query parameter, all + fields are passed via URL path and HTTP request body. + 3. If ``HttpRule.body`` is omitted, there is no HTTP request body, all + fields are passed via URL path and URL query parameters. + + Path template syntax + ~~~~~~~~~~~~~~~~~~~~ + + :: + + Template = "/" Segments [ Verb ] ; + Segments = Segment { "/" Segment } ; + Segment = "*" | "**" | LITERAL | Variable ; + Variable = "{" FieldPath [ "=" Segments ] "}" ; + FieldPath = IDENT { "." IDENT } ; + Verb = ":" LITERAL ; + + The syntax ``*`` matches a single URL path segment. The syntax ``**`` + matches zero or more URL path segments, which must be the last part of + the URL path except the ``Verb``. + + The syntax ``Variable`` matches part of the URL path as specified by its + template. A variable template must not contain other variables. If a + variable matches a single path segment, its template may be omitted, + e.g. ``{var}`` is equivalent to ``{var=*}``. + + The syntax ``LITERAL`` matches literal text in the URL path. If the + ``LITERAL`` contains any reserved character, such characters should be + percent-encoded before the matching. + + If a variable contains exactly one path segment, such as ``"{var}"`` or + ``"{var=*}"``, when such a variable is expanded into a URL path on the + client side, all characters except ``[-_.~0-9a-zA-Z]`` are + percent-encoded. The server side does the reverse decoding. Such + variables show up in the `Discovery + Document `__ + as ``{var}``. + + If a variable contains multiple path segments, such as ``"{var=foo/*}"`` + or ``"{var=**}"``, when such a variable is expanded into a URL path on + the client side, all characters except ``[-_.~/0-9a-zA-Z]`` are + percent-encoded. The server side does the reverse decoding, except "%2F" + and "%2f" are left unchanged. Such variables show up in the `Discovery + Document `__ + as ``{+var}``. + + ## Using gRPC API Service Configuration + + gRPC API Service Configuration (service config) is a configuration + language for configuring a gRPC service to become a user-facing product. + The service config is simply the YAML representation of the + ``google.api.Service`` proto message. + + As an alternative to annotating your proto file, you can configure gRPC + transcoding in your service config YAML files. You do this by specifying + a ``HttpRule`` that maps the gRPC method to a REST endpoint, achieving + the same effect as the proto annotation. This can be particularly useful + if you have a proto that is reused in multiple services. Note that any + transcoding specified in the service config will override any matching + transcoding configuration in the proto. + + Example: + + :: + + http: + rules: + # Selects a gRPC method and applies HttpRule to it. + - selector: example.v1.Messaging.GetMessage + get: /v1/messages/{message_id}/{sub.subfield} + + ## Special notes + + When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + proto to JSON conversion must follow the `proto3 + specification `__. + + While the single segment variable follows the semantics of `RFC + 6570 `__ Section 3.2.2 Simple + String Expansion, the multi segment variable **does not** follow RFC + 6570 Section 3.2.3 Reserved Expansion. The reason is that the Reserved + Expansion does not expand special characters like ``?`` and ``#``, which + would lead to invalid URLs. As the result, gRPC Transcoding uses a + custom encoding for multi segment variables. + + The path variables **must not** refer to any repeated or mapped field, + because client libraries are not capable of handling such variable + expansion. + + The path variables **must not** capture the leading "/" character. The + reason is that the most common use case "{var}" does not capture the + leading "/" character. For consistency, all path variables must share + the same behavior. + + Repeated message fields must not be mapped to URL query parameters, + because no client library can support such complicated mapping. + + If an API needs to use a JSON array for request or response body, it can + map the request or response body to a repeated field. However, some gRPC + Transcoding implementations may not support this feature. + + Example: + >>> from google.cloud import recommender_v1beta1 + >>> + >>> client = recommender_v1beta1.RecommenderClient() + >>> + >>> parent = client.insight_type_path('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]') + >>> + >>> # Iterate over all results + >>> for element in client.list_insights(parent): + ... # process element + ... pass + >>> + >>> + >>> # Alternatively: + >>> + >>> # Iterate over results one page at a time + >>> for page in client.list_insights(parent).pages: + ... for element in page: + ... # process element + ... pass + + Args: + parent (str): Denotes a field as required. This indicates that the field **must** + be provided as part of the request, and failure to do so will cause an + error (usually ``INVALID_ARGUMENT``). + page_size (int): The maximum number of resources contained in the + underlying API response. If page streaming is performed per- + resource, this parameter does not affect the return value. If page + streaming is performed per-page, this determines the maximum number + of resources in a page. + filter_ (str): Can be set for action 'test' for advanced matching for the value of + 'path' field. Either this or ``value`` will be set for 'test' operation. + 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.api_core.page_iterator.PageIterator` instance. + An iterable of :class:`~google.cloud.recommender_v1beta1.types.Insight` instances. + You can also iterate over the pages of the response + using its `pages` property. + + 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_insights" not in self._inner_api_calls: + self._inner_api_calls[ + "list_insights" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.list_insights, + default_retry=self._method_configs["ListInsights"].retry, + default_timeout=self._method_configs["ListInsights"].timeout, + client_info=self._client_info, + ) + + request = recommender_service_pb2.ListInsightsRequest( + parent=parent, page_size=page_size, filter=filter_ + ) + 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) + + iterator = google.api_core.page_iterator.GRPCIterator( + client=None, + method=functools.partial( + self._inner_api_calls["list_insights"], + retry=retry, + timeout=timeout, + metadata=metadata, + ), + request=request, + items_field="insights", + request_token_field="page_token", + response_token_field="next_page_token", + ) + return iterator + + def get_insight( + self, + name, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Optional. If present, retrieves the next batch of results from the + preceding call to this method. ``page_token`` must be the value of + ``next_page_token`` from the previous response. The values of other + method parameters must be identical to those in the previous call. + + Example: + >>> from google.cloud import recommender_v1beta1 + >>> + >>> client = recommender_v1beta1.RecommenderClient() + >>> + >>> name = client.insight_path('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]') + >>> + >>> response = client.get_insight(name) + + Args: + name (str): Required. Name of the insight. + 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.recommender_v1beta1.types.Insight` 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_insight" not in self._inner_api_calls: + self._inner_api_calls[ + "get_insight" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.get_insight, + default_retry=self._method_configs["GetInsight"].retry, + default_timeout=self._method_configs["GetInsight"].timeout, + client_info=self._client_info, + ) + + request = recommender_service_pb2.GetInsightRequest(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_insight"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + + def mark_insight_accepted( + self, + name, + etag, + state_metadata=None, + retry=google.api_core.gapic_v1.method.DEFAULT, + timeout=google.api_core.gapic_v1.method.DEFAULT, + metadata=None, + ): + """ + Selects a method to which this rule applies. + + Refer to ``selector`` for syntax details. + + Example: + >>> from google.cloud import recommender_v1beta1 + >>> + >>> client = recommender_v1beta1.RecommenderClient() + >>> + >>> name = client.insight_path('[PROJECT]', '[LOCATION]', '[INSIGHT_TYPE]', '[INSIGHT]') + >>> + >>> # TODO: Initialize `etag`: + >>> etag = '' + >>> + >>> response = client.mark_insight_accepted(name, etag) + + Args: + name (str): Required. Name of the insight. + etag (str): Required. Fingerprint of the Insight. Provides optimistic locking. + state_metadata (dict[str -> str]): Protocol Buffers - Google's data interchange format Copyright 2008 + Google Inc. All rights reserved. + https://developers.google.com/protocol-buffers/ + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + + :: + + * Redistributions of source code must retain the above copyright + + notice, this list of conditions and the following disclaimer. \* + Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. \* + Neither the name of Google Inc. nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS + IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + 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.recommender_v1beta1.types.Insight` 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 "mark_insight_accepted" not in self._inner_api_calls: + self._inner_api_calls[ + "mark_insight_accepted" + ] = google.api_core.gapic_v1.method.wrap_method( + self.transport.mark_insight_accepted, + default_retry=self._method_configs["MarkInsightAccepted"].retry, + default_timeout=self._method_configs["MarkInsightAccepted"].timeout, + client_info=self._client_info, + ) + + request = recommender_service_pb2.MarkInsightAcceptedRequest( + name=name, etag=etag, state_metadata=state_metadata + ) + 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["mark_insight_accepted"]( + request, retry=retry, timeout=timeout, metadata=metadata + ) + def list_recommendations( self, parent, @@ -233,8 +814,9 @@ def list_recommendations( metadata=None, ): """ - Lists recommendations for a Cloud project. Requires the - recommender.*.list IAM permission for the specified recommender. + Can be set with action 'copy' or 'move' to indicate the source field + within resource or source_resource, ignored if provided for other + operation types. Example: >>> from google.cloud import recommender_v1beta1 @@ -258,23 +840,26 @@ def list_recommendations( ... pass Args: - parent (str): Required. The container resource on which to execute the request. - Acceptable formats: - - 1. - - "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", - - LOCATION here refers to GCP Locations: - https://cloud.google.com/about/locations/ + parent (str): Set of filters to apply if ``path`` refers to array elements or + nested array elements in order to narrow down to a single unique element + that is being tested/modified. This is intended to be an exact match per + filter. To perform advanced matching, use path_value_matchers. + + - Example: { "/versions/*/name" : "it-123" + "/versions/*/targetSize/percent": 20 } + - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/condition" + : null } + - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/members/*" + : ["x@google.com", "y@google.com"] } When both path_filters and + path_value_matchers are set, an implicit AND must be performed. page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. - filter_ (str): Filter expression to restrict the recommendations returned. - Supported filter fields: state_info.state Eg: - \`state_info.state:"DISMISSED" or state_info.state:"FAILED" + filter_ (str): ``ListValue`` is a wrapper around a repeated field of values. + + The JSON representation for ``ListValue`` is JSON array. 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. @@ -347,8 +932,17 @@ def get_recommendation( metadata=None, ): """ - Gets the requested recommendation. Requires the recommender.*.get - IAM permission for the specified recommender. + The resource type that the annotated field references. + + Example: + + :: + + message Subscription { + string topic = 2 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + } Example: >>> from google.cloud import recommender_v1beta1 @@ -419,17 +1013,8 @@ def mark_recommendation_claimed( metadata=None, ): """ - Marks the Recommendation State as Claimed. Users can use this method - to indicate to the Recommender API that they are starting to apply the - recommendation themselves. This stops the recommendation content from - being updated. Associated insights are frozen and placed in the ACCEPTED - state. - - MarkRecommendationClaimed can be applied to recommendations in CLAIMED - or ACTIVE state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Optional. Filter expression to restrict the insights returned. + Supported filter fields: state Eg: \`state:"DISMISSED" or state:"ACTIVE" Example: >>> from google.cloud import recommender_v1beta1 @@ -446,10 +1031,8 @@ def mark_recommendation_claimed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): Recommendation resource name, e.g. + projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_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. @@ -512,17 +1095,10 @@ def mark_recommendation_succeeded( metadata=None, ): """ - Marks the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. Associated insights are - frozen and placed in the ACCEPTED state. - - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Value for the ``path`` field. Will be set for + actions:'add'/'replace'. Maybe set for action: 'test'. Either this or + ``value_matcher`` will be set for 'test' operation. An exact match must + be performed. Example: >>> from google.cloud import recommender_v1beta1 @@ -539,10 +1115,17 @@ def mark_recommendation_succeeded( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): The jstype option determines the JavaScript type used for values of + the field. The option is permitted only for 64 bit integral and fixed + types (int64, uint64, sint64, fixed64, sfixed64). A field with jstype + JS_STRING is represented as JavaScript string, which avoids loss of + precision that can happen when a large value is converted to a floating + point JavaScript. Specifying JS_NUMBER for the jstype causes the + generated JavaScript code to use the JavaScript "number" type. The + behavior of the default option JS_NORMAL is implementation dependent. + + This option is an enum to permit additional types to be added, e.g. + goog.math.Integer. 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. @@ -605,17 +1188,7 @@ def mark_recommendation_failed( metadata=None, ): """ - Marks the Recommendation State as Failed. Users can use this method - to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation failed. This stops the - recommendation content from being updated. Associated insights are - frozen and placed in the ACCEPTED state. - - MarkRecommendationFailed can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Request for the ``MarkRecommendationFailed`` Method. Example: >>> from google.cloud import recommender_v1beta1 @@ -632,10 +1205,7 @@ def mark_recommendation_failed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing - ``state_metadata``. Keys must match the regex - ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex - ``/^[a-zA-Z0-9_./-]{0,255}$/``. + state_metadata (dict[str -> str]): The set of insights for the ``parent`` resource. 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. diff --git a/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py b/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py index d16dd81..011d9eb 100644 --- a/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py +++ b/google/cloud/recommender_v1beta1/gapic/recommender_client_config.py @@ -1,17 +1,3 @@ -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - config = { "interfaces": { "google.cloud.recommender.v1beta1.Recommender": { @@ -31,6 +17,21 @@ } }, "methods": { + "ListInsights": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "GetInsight": { + "timeout_millis": 60000, + "retry_codes_name": "idempotent", + "retry_params_name": "default", + }, + "MarkInsightAccepted": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default", + }, "ListRecommendations": { "timeout_millis": 60000, "retry_codes_name": "idempotent", diff --git a/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py b/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py index a0628a2..d763734 100644 --- a/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py +++ b/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -107,12 +107,336 @@ def channel(self): """ return self._channel + @property + def list_insights(self): + """Return the gRPC stub for :meth:`RecommenderClient.list_insights`. + + # gRPC Transcoding + + gRPC Transcoding is a feature for mapping between a gRPC method and one + or more HTTP REST endpoints. It allows developers to build a single API + service that supports both gRPC APIs and REST APIs. Many systems, + including `Google APIs `__, + `Cloud Endpoints `__, `gRPC + Gateway `__, and + `Envoy `__ proxy support this + feature and use it for large scale production services. + + ``HttpRule`` defines the schema of the gRPC/REST mapping. The mapping + specifies how different portions of the gRPC request message are mapped + to the URL path, URL query parameters, and HTTP request body. It also + controls how the gRPC response message is mapped to the HTTP response + body. ``HttpRule`` is typically specified as an ``google.api.http`` + annotation on the gRPC method. + + Each mapping specifies a URL path template and an HTTP method. The path + template may refer to one or more fields in the gRPC request message, as + long as each field is a non-repeated field with a primitive + (non-message) type. The path template controls how fields of the request + message are mapped to the URL path. + + Example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get: "/v1/{name=messages/*}" + }; + } + } + message GetMessageRequest { + string name = 1; // Mapped to URL path. + } + message Message { + string text = 1; // The resource content. + } + + This enables an HTTP REST to gRPC mapping as below: + + HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| + ``GetMessage(name: "messages/123456")`` + + Any fields in the request message which are not bound by the path + template automatically become HTTP query parameters if there is no HTTP + request body. For example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get:"/v1/messages/{message_id}" + }; + } + } + message GetMessageRequest { + message SubMessage { + string subfield = 1; + } + string message_id = 1; // Mapped to URL path. + int64 revision = 2; // Mapped to URL query parameter `revision`. + SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + } + + This enables a HTTP JSON to RPC mapping as below: + + HTTP \| gRPC -----|----- + ``GET /v1/messages/123456?revision=2&sub.subfield=foo`` \| + ``GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`` + + Note that fields which are mapped to URL query parameters must have a + primitive type or a repeated primitive type or a non-repeated message + type. In the case of a repeated type, the parameter can be repeated in + the URL as ``...?param=A¶m=B``. In the case of a message type, each + field of the message is mapped to a separate parameter, such as + ``...?foo.a=A&foo.b=B&foo.c=C``. + + For HTTP methods that allow a request body, the ``body`` field specifies + the mapping. Consider a REST update method on the message resource + collection: + + :: + + service Messaging { + rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + option (google.api.http) = { + patch: "/v1/messages/{message_id}" + body: "message" + }; + } + } + message UpdateMessageRequest { + string message_id = 1; // mapped to the URL + Message message = 2; // mapped to the body + } + + The following HTTP JSON to RPC mapping is enabled, where the + representation of the JSON in the request body is determined by protos + JSON encoding: + + HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` + \| ``UpdateMessage(message_id: "123456" message { text: "Hi!" })`` + + The special name ``*`` can be used in the body mapping to define that + every field not bound by the path template should be mapped to the + request body. This enables the following alternative definition of the + update method: + + :: + + service Messaging { + rpc UpdateMessage(Message) returns (Message) { + option (google.api.http) = { + patch: "/v1/messages/{message_id}" + body: "*" + }; + } + } + message Message { + string message_id = 1; + string text = 2; + } + + The following HTTP JSON to RPC mapping is enabled: + + HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` + \| ``UpdateMessage(message_id: "123456" text: "Hi!")`` + + Note that when using ``*`` in the body mapping, it is not possible to + have HTTP parameters, as all fields not bound by the path end in the + body. This makes this option more rarely used in practice when defining + REST APIs. The common usage of ``*`` is in custom methods which don't + use the URL at all for transferring data. + + It is possible to define multiple HTTP methods for one RPC by using the + ``additional_bindings`` option. Example: + + :: + + service Messaging { + rpc GetMessage(GetMessageRequest) returns (Message) { + option (google.api.http) = { + get: "/v1/messages/{message_id}" + additional_bindings { + get: "/v1/users/{user_id}/messages/{message_id}" + } + }; + } + } + message GetMessageRequest { + string message_id = 1; + string user_id = 2; + } + + This enables the following two alternative HTTP JSON to RPC mappings: + + HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| + ``GetMessage(message_id: "123456")`` + ``GET /v1/users/me/messages/123456`` \| + ``GetMessage(user_id: "me" message_id: "123456")`` + + ## Rules for HTTP mapping + + 1. Leaf request fields (recursive expansion nested messages in the + request message) are classified into three categories: + + - Fields referred by the path template. They are passed via the URL + path. + - Fields referred by the ``HttpRule.body``. They are passed via the + HTTP request body. + - All other fields are passed via the URL query parameters, and the + parameter name is the field path in the request message. A + repeated field can be represented as multiple query parameters + under the same name. + + 2. If ``HttpRule.body`` is "*", there is no URL query parameter, all + fields are passed via URL path and HTTP request body. + 3. If ``HttpRule.body`` is omitted, there is no HTTP request body, all + fields are passed via URL path and URL query parameters. + + Path template syntax + ~~~~~~~~~~~~~~~~~~~~ + + :: + + Template = "/" Segments [ Verb ] ; + Segments = Segment { "/" Segment } ; + Segment = "*" | "**" | LITERAL | Variable ; + Variable = "{" FieldPath [ "=" Segments ] "}" ; + FieldPath = IDENT { "." IDENT } ; + Verb = ":" LITERAL ; + + The syntax ``*`` matches a single URL path segment. The syntax ``**`` + matches zero or more URL path segments, which must be the last part of + the URL path except the ``Verb``. + + The syntax ``Variable`` matches part of the URL path as specified by its + template. A variable template must not contain other variables. If a + variable matches a single path segment, its template may be omitted, + e.g. ``{var}`` is equivalent to ``{var=*}``. + + The syntax ``LITERAL`` matches literal text in the URL path. If the + ``LITERAL`` contains any reserved character, such characters should be + percent-encoded before the matching. + + If a variable contains exactly one path segment, such as ``"{var}"`` or + ``"{var=*}"``, when such a variable is expanded into a URL path on the + client side, all characters except ``[-_.~0-9a-zA-Z]`` are + percent-encoded. The server side does the reverse decoding. Such + variables show up in the `Discovery + Document `__ + as ``{var}``. + + If a variable contains multiple path segments, such as ``"{var=foo/*}"`` + or ``"{var=**}"``, when such a variable is expanded into a URL path on + the client side, all characters except ``[-_.~/0-9a-zA-Z]`` are + percent-encoded. The server side does the reverse decoding, except "%2F" + and "%2f" are left unchanged. Such variables show up in the `Discovery + Document `__ + as ``{+var}``. + + ## Using gRPC API Service Configuration + + gRPC API Service Configuration (service config) is a configuration + language for configuring a gRPC service to become a user-facing product. + The service config is simply the YAML representation of the + ``google.api.Service`` proto message. + + As an alternative to annotating your proto file, you can configure gRPC + transcoding in your service config YAML files. You do this by specifying + a ``HttpRule`` that maps the gRPC method to a REST endpoint, achieving + the same effect as the proto annotation. This can be particularly useful + if you have a proto that is reused in multiple services. Note that any + transcoding specified in the service config will override any matching + transcoding configuration in the proto. + + Example: + + :: + + http: + rules: + # Selects a gRPC method and applies HttpRule to it. + - selector: example.v1.Messaging.GetMessage + get: /v1/messages/{message_id}/{sub.subfield} + + ## Special notes + + When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + proto to JSON conversion must follow the `proto3 + specification `__. + + While the single segment variable follows the semantics of `RFC + 6570 `__ Section 3.2.2 Simple + String Expansion, the multi segment variable **does not** follow RFC + 6570 Section 3.2.3 Reserved Expansion. The reason is that the Reserved + Expansion does not expand special characters like ``?`` and ``#``, which + would lead to invalid URLs. As the result, gRPC Transcoding uses a + custom encoding for multi segment variables. + + The path variables **must not** refer to any repeated or mapped field, + because client libraries are not capable of handling such variable + expansion. + + The path variables **must not** capture the leading "/" character. The + reason is that the most common use case "{var}" does not capture the + leading "/" character. For consistency, all path variables must share + the same behavior. + + Repeated message fields must not be mapped to URL query parameters, + because no client library can support such complicated mapping. + + If an API needs to use a JSON array for request or response body, it can + map the request or response body to a repeated field. However, some gRPC + Transcoding implementations may not support this feature. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["recommender_stub"].ListInsights + + @property + def get_insight(self): + """Return the gRPC stub for :meth:`RecommenderClient.get_insight`. + + Optional. If present, retrieves the next batch of results from the + preceding call to this method. ``page_token`` must be the value of + ``next_page_token`` from the previous response. The values of other + method parameters must be identical to those in the previous call. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["recommender_stub"].GetInsight + + @property + def mark_insight_accepted(self): + """Return the gRPC stub for :meth:`RecommenderClient.mark_insight_accepted`. + + Selects a method to which this rule applies. + + Refer to ``selector`` for syntax details. + + Returns: + Callable: A callable which accepts the appropriate + deserialized request object and returns a + deserialized response object. + """ + return self._stubs["recommender_stub"].MarkInsightAccepted + @property def list_recommendations(self): """Return the gRPC stub for :meth:`RecommenderClient.list_recommendations`. - Lists recommendations for a Cloud project. Requires the - recommender.*.list IAM permission for the specified recommender. + Can be set with action 'copy' or 'move' to indicate the source field + within resource or source_resource, ignored if provided for other + operation types. Returns: Callable: A callable which accepts the appropriate @@ -125,8 +449,17 @@ def list_recommendations(self): def get_recommendation(self): """Return the gRPC stub for :meth:`RecommenderClient.get_recommendation`. - Gets the requested recommendation. Requires the recommender.*.get - IAM permission for the specified recommender. + The resource type that the annotated field references. + + Example: + + :: + + message Subscription { + string topic = 2 [(google.api.resource_reference) = { + type: "pubsub.googleapis.com/Topic" + }]; + } Returns: Callable: A callable which accepts the appropriate @@ -139,17 +472,8 @@ def get_recommendation(self): def mark_recommendation_claimed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_claimed`. - Marks the Recommendation State as Claimed. Users can use this method - to indicate to the Recommender API that they are starting to apply the - recommendation themselves. This stops the recommendation content from - being updated. Associated insights are frozen and placed in the ACCEPTED - state. - - MarkRecommendationClaimed can be applied to recommendations in CLAIMED - or ACTIVE state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Optional. Filter expression to restrict the insights returned. + Supported filter fields: state Eg: \`state:"DISMISSED" or state:"ACTIVE" Returns: Callable: A callable which accepts the appropriate @@ -162,17 +486,10 @@ def mark_recommendation_claimed(self): def mark_recommendation_succeeded(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_succeeded`. - Marks the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. Associated insights are - frozen and placed in the ACCEPTED state. - - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Value for the ``path`` field. Will be set for + actions:'add'/'replace'. Maybe set for action: 'test'. Either this or + ``value_matcher`` will be set for 'test' operation. An exact match must + be performed. Returns: Callable: A callable which accepts the appropriate @@ -185,17 +502,7 @@ def mark_recommendation_succeeded(self): def mark_recommendation_failed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_failed`. - Marks the Recommendation State as Failed. Users can use this method - to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation failed. This stops the - recommendation content from being updated. Associated insights are - frozen and placed in the ACCEPTED state. - - MarkRecommendationFailed can be applied to recommendations in ACTIVE, - CLAIMED, SUCCEEDED, or FAILED state. - - Requires the recommender.*.update IAM permission for the specified - recommender. + Request for the ``MarkRecommendationFailed`` Method. Returns: Callable: A callable which accepts the appropriate diff --git a/google/cloud/recommender_v1beta1/proto/insight_pb2.py b/google/cloud/recommender_v1beta1/proto/insight_pb2.py new file mode 100644 index 0000000..049d50f --- /dev/null +++ b/google/cloud/recommender_v1beta1/proto/insight_pb2.py @@ -0,0 +1,595 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: google/cloud/recommender_v1beta1/proto/insight.proto + +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 +from google.protobuf import duration_pb2 as google_dot_protobuf_dot_duration__pb2 +from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2 +from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="google/cloud/recommender_v1beta1/proto/insight.proto", + package="google.cloud.recommender.v1beta1", + syntax="proto3", + serialized_options=b"\n$com.google.cloud.recommender.v1beta1P\001ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\242\002\004CREC\252\002 Google.Cloud.Recommender.V1Beta1\352Am\n&recommender.googleapis.com/InsightType\022Cprojects/{project}/locations/{location}/insightTypes/{insight_type}", + serialized_pb=b'\n4google/cloud/recommender_v1beta1/proto/insight.proto\x12 google.cloud.recommender.v1beta1\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto"\x90\x06\n\x07Insight\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x18\n\x10target_resources\x18\t \x03(\t\x12\x17\n\x0finsight_subtype\x18\n \x01(\t\x12(\n\x07\x63ontent\x18\x03 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x35\n\x11last_refresh_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x35\n\x12observation_period\x18\x05 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x46\n\nstate_info\x18\x06 \x01(\x0b\x32\x32.google.cloud.recommender.v1beta1.InsightStateInfo\x12\x44\n\x08\x63\x61tegory\x18\x07 \x01(\x0e\x32\x32.google.cloud.recommender.v1beta1.Insight.Category\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t\x12\x65\n\x1a\x61ssociated_recommendations\x18\x08 \x03(\x0b\x32\x41.google.cloud.recommender.v1beta1.Insight.RecommendationReference\x1a\x31\n\x17RecommendationReference\x12\x16\n\x0erecommendation\x18\x01 \x01(\t"`\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x08\n\x04\x43OST\x10\x01\x12\x0c\n\x08SECURITY\x10\x02\x12\x0f\n\x0bPERFORMANCE\x10\x03\x12\x11\n\rMANAGEABILITY\x10\x04:\x7f\xea\x41|\n"recommender.googleapis.com/Insight\x12Vprojects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}"\xb9\x02\n\x10InsightStateInfo\x12G\n\x05state\x18\x01 \x01(\x0e\x32\x38.google.cloud.recommender.v1beta1.InsightStateInfo.State\x12]\n\x0estate_metadata\x18\x02 \x03(\x0b\x32\x45.google.cloud.recommender.v1beta1.InsightStateInfo.StateMetadataEntry\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"G\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0c\n\x08\x41\x43\x43\x45PTED\x10\x02\x12\r\n\tDISMISSED\x10\x03\x42\x8f\x02\n$com.google.cloud.recommender.v1beta1P\x01ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\xa2\x02\x04\x43REC\xaa\x02 Google.Cloud.Recommender.V1Beta1\xea\x41m\n&recommender.googleapis.com/InsightType\x12\x43projects/{project}/locations/{location}/insightTypes/{insight_type}b\x06proto3', + dependencies=[ + google_dot_api_dot_resource__pb2.DESCRIPTOR, + google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, + google_dot_protobuf_dot_struct__pb2.DESCRIPTOR, + google_dot_protobuf_dot_timestamp__pb2.DESCRIPTOR, + ], +) + + +_INSIGHT_CATEGORY = _descriptor.EnumDescriptor( + name="Category", + full_name="google.cloud.recommender.v1beta1.Insight.Category", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="CATEGORY_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="COST", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="SECURITY", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="PERFORMANCE", index=3, number=3, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="MANAGEABILITY", index=4, number=4, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=772, + serialized_end=868, +) +_sym_db.RegisterEnumDescriptor(_INSIGHT_CATEGORY) + +_INSIGHTSTATEINFO_STATE = _descriptor.EnumDescriptor( + name="State", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.State", + filename=None, + file=DESCRIPTOR, + values=[ + _descriptor.EnumValueDescriptor( + name="STATE_UNSPECIFIED", + index=0, + number=0, + serialized_options=None, + type=None, + ), + _descriptor.EnumValueDescriptor( + name="ACTIVE", index=1, number=1, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="ACCEPTED", index=2, number=2, serialized_options=None, type=None + ), + _descriptor.EnumValueDescriptor( + name="DISMISSED", index=3, number=3, serialized_options=None, type=None + ), + ], + containing_type=None, + serialized_options=None, + serialized_start=1242, + serialized_end=1313, +) +_sym_db.RegisterEnumDescriptor(_INSIGHTSTATEINFO_STATE) + + +_INSIGHT_RECOMMENDATIONREFERENCE = _descriptor.Descriptor( + name="RecommendationReference", + full_name="google.cloud.recommender.v1beta1.Insight.RecommendationReference", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="recommendation", + full_name="google.cloud.recommender.v1beta1.Insight.RecommendationReference.recommendation", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=721, + serialized_end=770, +) + +_INSIGHT = _descriptor.Descriptor( + name="Insight", + full_name="google.cloud.recommender.v1beta1.Insight", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.recommender.v1beta1.Insight.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="description", + full_name="google.cloud.recommender.v1beta1.Insight.description", + index=1, + number=2, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="target_resources", + full_name="google.cloud.recommender.v1beta1.Insight.target_resources", + index=2, + number=9, + 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="insight_subtype", + full_name="google.cloud.recommender.v1beta1.Insight.insight_subtype", + index=3, + number=10, + 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="content", + full_name="google.cloud.recommender.v1beta1.Insight.content", + index=4, + number=3, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="last_refresh_time", + full_name="google.cloud.recommender.v1beta1.Insight.last_refresh_time", + index=5, + number=4, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="observation_period", + full_name="google.cloud.recommender.v1beta1.Insight.observation_period", + index=6, + number=5, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state_info", + full_name="google.cloud.recommender.v1beta1.Insight.state_info", + index=7, + number=6, + type=11, + cpp_type=10, + label=1, + has_default_value=False, + default_value=None, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="category", + full_name="google.cloud.recommender.v1beta1.Insight.category", + index=8, + number=7, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="etag", + full_name="google.cloud.recommender.v1beta1.Insight.etag", + index=9, + number=11, + 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="associated_recommendations", + full_name="google.cloud.recommender.v1beta1.Insight.associated_recommendations", + index=10, + number=8, + 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=[_INSIGHT_RECOMMENDATIONREFERENCE], + enum_types=[_INSIGHT_CATEGORY], + serialized_options=b'\352A|\n"recommender.googleapis.com/Insight\022Vprojects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}', + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=213, + serialized_end=997, +) + + +_INSIGHTSTATEINFO_STATEMETADATAENTRY = _descriptor.Descriptor( + name="StateMetadataEntry", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.StateMetadataEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.StateMetadataEntry.key", + 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="value", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.StateMetadataEntry.value", + 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=b"8\001", + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1188, + serialized_end=1240, +) + +_INSIGHTSTATEINFO = _descriptor.Descriptor( + name="InsightStateInfo", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="state", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.state", + index=0, + number=1, + type=14, + cpp_type=8, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state_metadata", + full_name="google.cloud.recommender.v1beta1.InsightStateInfo.state_metadata", + index=1, + number=2, + 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=[_INSIGHTSTATEINFO_STATEMETADATAENTRY], + enum_types=[_INSIGHTSTATEINFO_STATE], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=1000, + serialized_end=1313, +) + +_INSIGHT_RECOMMENDATIONREFERENCE.containing_type = _INSIGHT +_INSIGHT.fields_by_name[ + "content" +].message_type = google_dot_protobuf_dot_struct__pb2._STRUCT +_INSIGHT.fields_by_name[ + "last_refresh_time" +].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP +_INSIGHT.fields_by_name[ + "observation_period" +].message_type = google_dot_protobuf_dot_duration__pb2._DURATION +_INSIGHT.fields_by_name["state_info"].message_type = _INSIGHTSTATEINFO +_INSIGHT.fields_by_name["category"].enum_type = _INSIGHT_CATEGORY +_INSIGHT.fields_by_name[ + "associated_recommendations" +].message_type = _INSIGHT_RECOMMENDATIONREFERENCE +_INSIGHT_CATEGORY.containing_type = _INSIGHT +_INSIGHTSTATEINFO_STATEMETADATAENTRY.containing_type = _INSIGHTSTATEINFO +_INSIGHTSTATEINFO.fields_by_name["state"].enum_type = _INSIGHTSTATEINFO_STATE +_INSIGHTSTATEINFO.fields_by_name[ + "state_metadata" +].message_type = _INSIGHTSTATEINFO_STATEMETADATAENTRY +_INSIGHTSTATEINFO_STATE.containing_type = _INSIGHTSTATEINFO +DESCRIPTOR.message_types_by_name["Insight"] = _INSIGHT +DESCRIPTOR.message_types_by_name["InsightStateInfo"] = _INSIGHTSTATEINFO +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +Insight = _reflection.GeneratedProtocolMessageType( + "Insight", + (_message.Message,), + { + "RecommendationReference": _reflection.GeneratedProtocolMessageType( + "RecommendationReference", + (_message.Message,), + { + "DESCRIPTOR": _INSIGHT_RECOMMENDATIONREFERENCE, + "__module__": "google.cloud.recommender_v1beta1.proto.insight_pb2", + "__doc__": """Reference to an associated recommendation. + + + Attributes: + recommendation: + Recommendation resource name, e.g. projects/[PROJECT_NUMBER]/l + ocations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendati + ons/[RECOMMENDATION_ID] + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Insight.RecommendationReference) + }, + ), + "DESCRIPTOR": _INSIGHT, + "__module__": "google.cloud.recommender_v1beta1.proto.insight_pb2", + "__doc__": """An insight along with the information used to derive the + insight. The insight may have associated recomendations as well. + + + Attributes: + name: + Name of the insight. + description: + Free-form human readable summary in English. The maximum + length is 500 characters. + target_resources: + Fully qualified resource names that this insight is targeting. + insight_subtype: + Insight subtype. Insight content schema will be stable for a + given subtype. + content: + A struct of custom fields to explain the insight. Example: + “grantedPermissionsCount”: “1000” + last_refresh_time: + Timestamp of the latest data used to generate the insight. + observation_period: + Observation period that led to the insight. The source data + used to generate the insight ends at last_refresh_time and + begins at (last_refresh_time - observation_period). + state_info: + Information state and metadata. + category: + Category being targeted by the insight. + etag: + Fingerprint of the Insight. Provides optimistic locking when + updating states. + associated_recommendations: + Recommendations derived from this insight. + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Insight) + }, +) +_sym_db.RegisterMessage(Insight) +_sym_db.RegisterMessage(Insight.RecommendationReference) + +InsightStateInfo = _reflection.GeneratedProtocolMessageType( + "InsightStateInfo", + (_message.Message,), + { + "StateMetadataEntry": _reflection.GeneratedProtocolMessageType( + "StateMetadataEntry", + (_message.Message,), + { + "DESCRIPTOR": _INSIGHTSTATEINFO_STATEMETADATAENTRY, + "__module__": "google.cloud.recommender_v1beta1.proto.insight_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.InsightStateInfo.StateMetadataEntry) + }, + ), + "DESCRIPTOR": _INSIGHTSTATEINFO, + "__module__": "google.cloud.recommender_v1beta1.proto.insight_pb2", + "__doc__": """Information related to insight state. + + + Attributes: + state: + Insight state. + state_metadata: + A map of metadata for the state, provided by user or + automations systems. .. [1] a-z0-9 .. [2] a-z0-9 .. + [3] a-z0-9 + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.InsightStateInfo) + }, +) +_sym_db.RegisterMessage(InsightStateInfo) +_sym_db.RegisterMessage(InsightStateInfo.StateMetadataEntry) + + +DESCRIPTOR._options = None +_INSIGHT._options = None +_INSIGHTSTATEINFO_STATEMETADATAENTRY._options = None +# @@protoc_insertion_point(module_scope) diff --git a/google/cloud/recommender_v1beta1/proto/insight_pb2_grpc.py b/google/cloud/recommender_v1beta1/proto/insight_pb2_grpc.py new file mode 100644 index 0000000..7343170 --- /dev/null +++ b/google/cloud/recommender_v1beta1/proto/insight_pb2_grpc.py @@ -0,0 +1,17 @@ +# Copyright 2019 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! + +import grpc diff --git a/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py b/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py index 8262f8e..3f9c9a1 100644 --- a/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py +++ b/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/recommender_v1beta1/proto/recommendation.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -40,12 +23,8 @@ name="google/cloud/recommender_v1beta1/proto/recommendation.proto", package="google.cloud.recommender.v1beta1", syntax="proto3", - serialized_options=_b( - "\n$com.google.cloud.recommender.v1beta1P\001ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\242\002\004CREC\252\002 Google.Cloud.Recommender.V1Beta1\352Al\n&recommender.googleapis.com/Recommender\022Bprojects/{project}/locations/{location}/recommenders/{recommender}" - ), - serialized_pb=_b( - '\n;google/cloud/recommender_v1beta1/proto/recommendation.proto\x12 google.cloud.recommender.v1beta1\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/money.proto"\xcc\x04\n\x0eRecommendation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1b\n\x13recommender_subtype\x18\x0c \x01(\t\x12\x35\n\x11last_refresh_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\x0eprimary_impact\x18\x05 \x01(\x0b\x32(.google.cloud.recommender.v1beta1.Impact\x12\x43\n\x11\x61\x64\x64itional_impact\x18\x06 \x03(\x0b\x32(.google.cloud.recommender.v1beta1.Impact\x12H\n\x07\x63ontent\x18\x07 \x01(\x0b\x32\x37.google.cloud.recommender.v1beta1.RecommendationContent\x12M\n\nstate_info\x18\n \x01(\x0b\x32\x39.google.cloud.recommender.v1beta1.RecommendationStateInfo\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t:\x94\x01\xea\x41\x90\x01\n)recommender.googleapis.com/Recommendation\x12\x63projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}"c\n\x15RecommendationContent\x12J\n\x10operation_groups\x18\x02 \x03(\x0b\x32\x30.google.cloud.recommender.v1beta1.OperationGroup"Q\n\x0eOperationGroup\x12?\n\noperations\x18\x01 \x03(\x0b\x32+.google.cloud.recommender.v1beta1.Operation"\xeb\x04\n\tOperation\x12\x0e\n\x06\x61\x63tion\x18\x01 \x01(\t\x12\x15\n\rresource_type\x18\x02 \x01(\t\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x17\n\x0fsource_resource\x18\x05 \x01(\t\x12\x13\n\x0bsource_path\x18\x06 \x01(\t\x12\'\n\x05value\x18\x07 \x01(\x0b\x32\x16.google.protobuf.ValueH\x00\x12G\n\rvalue_matcher\x18\n \x01(\x0b\x32..google.cloud.recommender.v1beta1.ValueMatcherH\x00\x12R\n\x0cpath_filters\x18\x08 \x03(\x0b\x32<.google.cloud.recommender.v1beta1.Operation.PathFiltersEntry\x12_\n\x13path_value_matchers\x18\x0b \x03(\x0b\x32\x42.google.cloud.recommender.v1beta1.Operation.PathValueMatchersEntry\x1aJ\n\x10PathFiltersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1ah\n\x16PathValueMatchersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12=\n\x05value\x18\x02 \x01(\x0b\x32..google.cloud.recommender.v1beta1.ValueMatcher:\x02\x38\x01\x42\x0c\n\npath_value":\n\x0cValueMatcher\x12\x19\n\x0fmatches_pattern\x18\x01 \x01(\tH\x00\x42\x0f\n\rmatch_variant"_\n\x0e\x43ostProjection\x12 \n\x04\x63ost\x18\x01 \x01(\x0b\x32\x12.google.type.Money\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x8a\x02\n\x06Impact\x12\x43\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32\x31.google.cloud.recommender.v1beta1.Impact.Category\x12K\n\x0f\x63ost_projection\x18\x64 \x01(\x0b\x32\x30.google.cloud.recommender.v1beta1.CostProjectionH\x00"`\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x08\n\x04\x43OST\x10\x01\x12\x0c\n\x08SECURITY\x10\x02\x12\x0f\n\x0bPERFORMANCE\x10\x03\x12\x11\n\rMANAGEABILITY\x10\x04\x42\x0c\n\nprojection"\xe8\x02\n\x17RecommendationStateInfo\x12N\n\x05state\x18\x01 \x01(\x0e\x32?.google.cloud.recommender.v1beta1.RecommendationStateInfo.State\x12\x64\n\x0estate_metadata\x18\x02 \x03(\x0b\x32L.google.cloud.recommender.v1beta1.RecommendationStateInfo.StateMetadataEntry\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"a\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0b\n\x07\x43LAIMED\x10\x06\x12\r\n\tSUCCEEDED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\r\n\tDISMISSED\x10\x05\x42\x8e\x02\n$com.google.cloud.recommender.v1beta1P\x01ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\xa2\x02\x04\x43REC\xaa\x02 Google.Cloud.Recommender.V1Beta1\xea\x41l\n&recommender.googleapis.com/Recommender\x12\x42projects/{project}/locations/{location}/recommenders/{recommender}b\x06proto3' - ), + serialized_options=b"\n$com.google.cloud.recommender.v1beta1P\001ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\242\002\004CREC\252\002 Google.Cloud.Recommender.V1Beta1\352Al\n&recommender.googleapis.com/Recommender\022Bprojects/{project}/locations/{location}/recommenders/{recommender}", + serialized_pb=b'\n;google/cloud/recommender_v1beta1/proto/recommendation.proto\x12 google.cloud.recommender.v1beta1\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x17google/type/money.proto"\xd1\x05\n\x0eRecommendation\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x1b\n\x13recommender_subtype\x18\x0c \x01(\t\x12\x35\n\x11last_refresh_time\x18\x04 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\x0eprimary_impact\x18\x05 \x01(\x0b\x32(.google.cloud.recommender.v1beta1.Impact\x12\x43\n\x11\x61\x64\x64itional_impact\x18\x06 \x03(\x0b\x32(.google.cloud.recommender.v1beta1.Impact\x12H\n\x07\x63ontent\x18\x07 \x01(\x0b\x32\x37.google.cloud.recommender.v1beta1.RecommendationContent\x12M\n\nstate_info\x18\n \x01(\x0b\x32\x39.google.cloud.recommender.v1beta1.RecommendationStateInfo\x12\x0c\n\x04\x65tag\x18\x0b \x01(\t\x12^\n\x13\x61ssociated_insights\x18\x0e \x03(\x0b\x32\x41.google.cloud.recommender.v1beta1.Recommendation.InsightReference\x1a#\n\x10InsightReference\x12\x0f\n\x07insight\x18\x01 \x01(\t:\x94\x01\xea\x41\x90\x01\n)recommender.googleapis.com/Recommendation\x12\x63projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}"c\n\x15RecommendationContent\x12J\n\x10operation_groups\x18\x02 \x03(\x0b\x32\x30.google.cloud.recommender.v1beta1.OperationGroup"Q\n\x0eOperationGroup\x12?\n\noperations\x18\x01 \x03(\x0b\x32+.google.cloud.recommender.v1beta1.Operation"\xeb\x04\n\tOperation\x12\x0e\n\x06\x61\x63tion\x18\x01 \x01(\t\x12\x15\n\rresource_type\x18\x02 \x01(\t\x12\x10\n\x08resource\x18\x03 \x01(\t\x12\x0c\n\x04path\x18\x04 \x01(\t\x12\x17\n\x0fsource_resource\x18\x05 \x01(\t\x12\x13\n\x0bsource_path\x18\x06 \x01(\t\x12\'\n\x05value\x18\x07 \x01(\x0b\x32\x16.google.protobuf.ValueH\x00\x12G\n\rvalue_matcher\x18\n \x01(\x0b\x32..google.cloud.recommender.v1beta1.ValueMatcherH\x00\x12R\n\x0cpath_filters\x18\x08 \x03(\x0b\x32<.google.cloud.recommender.v1beta1.Operation.PathFiltersEntry\x12_\n\x13path_value_matchers\x18\x0b \x03(\x0b\x32\x42.google.cloud.recommender.v1beta1.Operation.PathValueMatchersEntry\x1aJ\n\x10PathFiltersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12%\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.Value:\x02\x38\x01\x1ah\n\x16PathValueMatchersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12=\n\x05value\x18\x02 \x01(\x0b\x32..google.cloud.recommender.v1beta1.ValueMatcher:\x02\x38\x01\x42\x0c\n\npath_value":\n\x0cValueMatcher\x12\x19\n\x0fmatches_pattern\x18\x01 \x01(\tH\x00\x42\x0f\n\rmatch_variant"_\n\x0e\x43ostProjection\x12 \n\x04\x63ost\x18\x01 \x01(\x0b\x32\x12.google.type.Money\x12+\n\x08\x64uration\x18\x02 \x01(\x0b\x32\x19.google.protobuf.Duration"\x8a\x02\n\x06Impact\x12\x43\n\x08\x63\x61tegory\x18\x01 \x01(\x0e\x32\x31.google.cloud.recommender.v1beta1.Impact.Category\x12K\n\x0f\x63ost_projection\x18\x64 \x01(\x0b\x32\x30.google.cloud.recommender.v1beta1.CostProjectionH\x00"`\n\x08\x43\x61tegory\x12\x18\n\x14\x43\x41TEGORY_UNSPECIFIED\x10\x00\x12\x08\n\x04\x43OST\x10\x01\x12\x0c\n\x08SECURITY\x10\x02\x12\x0f\n\x0bPERFORMANCE\x10\x03\x12\x11\n\rMANAGEABILITY\x10\x04\x42\x0c\n\nprojection"\xe8\x02\n\x17RecommendationStateInfo\x12N\n\x05state\x18\x01 \x01(\x0e\x32?.google.cloud.recommender.v1beta1.RecommendationStateInfo.State\x12\x64\n\x0estate_metadata\x18\x02 \x03(\x0b\x32L.google.cloud.recommender.v1beta1.RecommendationStateInfo.StateMetadataEntry\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"a\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\n\n\x06\x41\x43TIVE\x10\x01\x12\x0b\n\x07\x43LAIMED\x10\x06\x12\r\n\tSUCCEEDED\x10\x03\x12\n\n\x06\x46\x41ILED\x10\x04\x12\r\n\tDISMISSED\x10\x05\x42\x8e\x02\n$com.google.cloud.recommender.v1beta1P\x01ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\xa2\x02\x04\x43REC\xaa\x02 Google.Cloud.Recommender.V1Beta1\xea\x41l\n&recommender.googleapis.com/Recommender\x12\x42projects/{project}/locations/{location}/recommenders/{recommender}b\x06proto3', dependencies=[ google_dot_api_dot_resource__pb2.DESCRIPTOR, google_dot_protobuf_dot_duration__pb2.DESCRIPTOR, @@ -84,8 +63,8 @@ ], containing_type=None, serialized_options=None, - serialized_start=1955, - serialized_end=2051, + serialized_start=2088, + serialized_end=2184, ) _sym_db.RegisterEnumDescriptor(_IMPACT_CATEGORY) @@ -120,12 +99,50 @@ ], containing_type=None, serialized_options=None, - serialized_start=2331, - serialized_end=2428, + serialized_start=2464, + serialized_end=2561, ) _sym_db.RegisterEnumDescriptor(_RECOMMENDATIONSTATEINFO_STATE) +_RECOMMENDATION_INSIGHTREFERENCE = _descriptor.Descriptor( + name="InsightReference", + full_name="google.cloud.recommender.v1beta1.Recommendation.InsightReference", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="insight", + full_name="google.cloud.recommender.v1beta1.Recommendation.InsightReference.insight", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=780, + serialized_end=815, +) + _RECOMMENDATION = _descriptor.Descriptor( name="Recommendation", full_name="google.cloud.recommender.v1beta1.Recommendation", @@ -142,7 +159,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -160,7 +177,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -178,7 +195,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -286,7 +303,25 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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="associated_insights", + full_name="google.cloud.recommender.v1beta1.Recommendation.associated_insights", + index=9, + number=14, + type=11, + cpp_type=10, + label=3, + has_default_value=False, + default_value=[], message_type=None, enum_type=None, containing_type=None, @@ -297,17 +332,15 @@ ), ], extensions=[], - nested_types=[], + nested_types=[_RECOMMENDATION_INSIGHTREFERENCE], enum_types=[], - serialized_options=_b( - "\352A\220\001\n)recommender.googleapis.com/Recommendation\022cprojects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}" - ), + serialized_options=b"\352A\220\001\n)recommender.googleapis.com/Recommendation\022cprojects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], serialized_start=245, - serialized_end=833, + serialized_end=966, ) @@ -345,8 +378,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=835, - serialized_end=934, + serialized_start=968, + serialized_end=1067, ) @@ -384,8 +417,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=936, - serialized_end=1017, + serialized_start=1069, + serialized_end=1150, ) @@ -405,7 +438,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -436,13 +469,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1445, - serialized_end=1519, + serialized_start=1578, + serialized_end=1652, ) _OPERATION_PATHVALUEMATCHERSENTRY = _descriptor.Descriptor( @@ -461,7 +494,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -492,13 +525,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1521, - serialized_end=1625, + serialized_start=1654, + serialized_end=1758, ) _OPERATION = _descriptor.Descriptor( @@ -517,7 +550,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -535,7 +568,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -553,7 +586,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -571,7 +604,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -589,7 +622,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -607,7 +640,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -705,8 +738,8 @@ fields=[], ) ], - serialized_start=1020, - serialized_end=1639, + serialized_start=1153, + serialized_end=1772, ) @@ -726,7 +759,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -752,8 +785,8 @@ fields=[], ) ], - serialized_start=1641, - serialized_end=1699, + serialized_start=1774, + serialized_end=1832, ) @@ -809,8 +842,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1701, - serialized_end=1796, + serialized_start=1834, + serialized_end=1929, ) @@ -874,8 +907,8 @@ fields=[], ) ], - serialized_start=1799, - serialized_end=2065, + serialized_start=1932, + serialized_end=2198, ) @@ -895,7 +928,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -913,7 +946,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -926,13 +959,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2277, - serialized_end=2329, + serialized_start=2410, + serialized_end=2462, ) _RECOMMENDATIONSTATEINFO = _descriptor.Descriptor( @@ -987,10 +1020,11 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=2068, - serialized_end=2428, + serialized_start=2201, + serialized_end=2561, ) +_RECOMMENDATION_INSIGHTREFERENCE.containing_type = _RECOMMENDATION _RECOMMENDATION.fields_by_name[ "last_refresh_time" ].message_type = google_dot_protobuf_dot_timestamp__pb2._TIMESTAMP @@ -998,6 +1032,9 @@ _RECOMMENDATION.fields_by_name["additional_impact"].message_type = _IMPACT _RECOMMENDATION.fields_by_name["content"].message_type = _RECOMMENDATIONCONTENT _RECOMMENDATION.fields_by_name["state_info"].message_type = _RECOMMENDATIONSTATEINFO +_RECOMMENDATION.fields_by_name[ + "associated_insights" +].message_type = _RECOMMENDATION_INSIGHTREFERENCE _RECOMMENDATIONCONTENT.fields_by_name["operation_groups"].message_type = _OPERATIONGROUP _OPERATIONGROUP.fields_by_name["operations"].message_type = _OPERATION _OPERATION_PATHFILTERSENTRY.fields_by_name[ @@ -1069,10 +1106,29 @@ "Recommendation", (_message.Message,), { + "InsightReference": _reflection.GeneratedProtocolMessageType( + "InsightReference", + (_message.Message,), + { + "DESCRIPTOR": _RECOMMENDATION_INSIGHTREFERENCE, + "__module__": "google.cloud.recommender_v1beta1.proto.recommendation_pb2", + "__doc__": """Reference to an associated insight. + + + Attributes: + insight: + Insight resource name, e.g. projects/[PROJECT_NUMBER]/location + s/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ + ID] + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Recommendation.InsightReference) + }, + ), "DESCRIPTOR": _RECOMMENDATION, "__module__": "google.cloud.recommender_v1beta1.proto.recommendation_pb2", - "__doc__": """A recommendation along with a suggested action. E.g., a rightsizing - recommendation for an underutilized VM, IAM role recommendations, etc + "__doc__": """A recommendation along with a suggested action. E.g., a + rightsizing recommendation for an underutilized VM, IAM role + recommendations, etc Attributes: @@ -1109,11 +1165,14 @@ etag: Fingerprint of the Recommendation. Provides optimistic locking when updating states. + associated_insights: + Insights that led to this recommendation. """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Recommendation) }, ) _sym_db.RegisterMessage(Recommendation) +_sym_db.RegisterMessage(Recommendation.InsightReference) RecommendationContent = _reflection.GeneratedProtocolMessageType( "RecommendationContent", diff --git a/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py b/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py index b662812..7343170 100644 --- a/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py +++ b/google/cloud/recommender_v1beta1/proto/recommendation_pb2_grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py index 9bebc60..1b50e1e 100644 --- a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py +++ b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py @@ -1,24 +1,7 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/recommender_v1beta1/proto/recommender_service.proto -import sys - -_b = sys.version_info[0] < 3 and (lambda x: x) or (lambda x: x.encode("latin1")) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection @@ -33,6 +16,9 @@ from google.api import client_pb2 as google_dot_api_dot_client__pb2 from google.api import field_behavior_pb2 as google_dot_api_dot_field__behavior__pb2 from google.api import resource_pb2 as google_dot_api_dot_resource__pb2 +from google.cloud.recommender_v1beta1.proto import ( + insight_pb2 as google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2, +) from google.cloud.recommender_v1beta1.proto import ( recommendation_pb2 as google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2, ) @@ -42,22 +28,339 @@ name="google/cloud/recommender_v1beta1/proto/recommender_service.proto", package="google.cloud.recommender.v1beta1", syntax="proto3", - serialized_options=_b( - "\n$com.google.cloud.recommender.v1beta1B\020RecommenderProtoP\001ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\242\002\004CREC\252\002 Google.Cloud.Recommender.V1Beta1" - ), - serialized_pb=_b( - '\n@google/cloud/recommender_v1beta1/proto/recommender_service.proto\x12 google.cloud.recommender.v1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a;google/cloud/recommender_v1beta1/proto/recommendation.proto"\x9d\x01\n\x1aListRecommendationsRequest\x12>\n\x06parent\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&recommender.googleapis.com/Recommender\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t"\x81\x01\n\x1bListRecommendationsResponse\x12I\n\x0frecommendations\x18\x01 \x03(\x0b\x32\x30.google.cloud.recommender.v1beta1.Recommendation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"[\n\x18GetRecommendationRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation"\x9b\x02\n MarkRecommendationClaimedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12m\n\x0estate_metadata\x18\x02 \x03(\x0b\x32U.google.cloud.recommender.v1beta1.MarkRecommendationClaimedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x9f\x02\n"MarkRecommendationSucceededRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12o\n\x0estate_metadata\x18\x02 \x03(\x0b\x32W.google.cloud.recommender.v1beta1.MarkRecommendationSucceededRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x99\x02\n\x1fMarkRecommendationFailedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12l\n\x0estate_metadata\x18\x02 \x03(\x0b\x32T.google.cloud.recommender.v1beta1.MarkRecommendationFailedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\xdf\n\n\x0bRecommender\x12\xf3\x01\n\x13ListRecommendations\x12<.google.cloud.recommender.v1beta1.ListRecommendationsRequest\x1a=.google.cloud.recommender.v1beta1.ListRecommendationsResponse"_\x82\xd3\xe4\x93\x02I\x12G/v1beta1/{parent=projects/*/locations/*/recommenders/*}/recommendations\xda\x41\rparent,filter\x12\xd9\x01\n\x11GetRecommendation\x12:.google.cloud.recommender.v1beta1.GetRecommendationRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"V\x82\xd3\xe4\x93\x02I\x12G/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\xda\x41\x04name\x12\x8c\x02\n\x19MarkRecommendationClaimed\x12\x42.google.cloud.recommender.v1beta1.MarkRecommendationClaimedRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"y\x82\xd3\xe4\x93\x02X"S/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\x01*\xda\x41\x18name,state_metadata,etag\x12\x92\x02\n\x1bMarkRecommendationSucceeded\x12\x44.google.cloud.recommender.v1beta1.MarkRecommendationSucceededRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"{\x82\xd3\xe4\x93\x02Z"U/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\x01*\xda\x41\x18name,state_metadata,etag\x12\x89\x02\n\x18MarkRecommendationFailed\x12\x41.google.cloud.recommender.v1beta1.MarkRecommendationFailedRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"x\x82\xd3\xe4\x93\x02W"R/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\x01*\xda\x41\x18name,state_metadata,etag\x1aN\xca\x41\x1arecommender.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb1\x01\n$com.google.cloud.recommender.v1beta1B\x10RecommenderProtoP\x01ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\xa2\x02\x04\x43REC\xaa\x02 Google.Cloud.Recommender.V1Beta1b\x06proto3' - ), + serialized_options=b"\n$com.google.cloud.recommender.v1beta1B\020RecommenderProtoP\001ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\242\002\004CREC\252\002 Google.Cloud.Recommender.V1Beta1", + serialized_pb=b'\n@google/cloud/recommender_v1beta1/proto/recommender_service.proto\x12 google.cloud.recommender.v1beta1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x34google/cloud/recommender_v1beta1/proto/insight.proto\x1a;google/cloud/recommender_v1beta1/proto/recommendation.proto"\x9b\x01\n\x13ListInsightsRequest\x12>\n\x06parent\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&recommender.googleapis.com/InsightType\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x13\n\x06\x66ilter\x18\x04 \x01(\tB\x03\xe0\x41\x01"l\n\x14ListInsightsResponse\x12;\n\x08insights\x18\x01 \x03(\x0b\x32).google.cloud.recommender.v1beta1.Insight\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"M\n\x11GetInsightRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"recommender.googleapis.com/Insight"\x8d\x02\n\x1aMarkInsightAcceptedRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n"recommender.googleapis.com/Insight\x12l\n\x0estate_metadata\x18\x02 \x03(\x0b\x32O.google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.StateMetadataEntryB\x03\xe0\x41\x01\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x9d\x01\n\x1aListRecommendationsRequest\x12>\n\x06parent\x18\x01 \x01(\tB.\xe0\x41\x02\xfa\x41(\n&recommender.googleapis.com/Recommender\x12\x16\n\tpage_size\x18\x02 \x01(\x05\x42\x03\xe0\x41\x01\x12\x17\n\npage_token\x18\x03 \x01(\tB\x03\xe0\x41\x01\x12\x0e\n\x06\x66ilter\x18\x05 \x01(\t"\x81\x01\n\x1bListRecommendationsResponse\x12I\n\x0frecommendations\x18\x01 \x03(\x0b\x32\x30.google.cloud.recommender.v1beta1.Recommendation\x12\x17\n\x0fnext_page_token\x18\x02 \x01(\t"[\n\x18GetRecommendationRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation"\x9b\x02\n MarkRecommendationClaimedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12m\n\x0estate_metadata\x18\x02 \x03(\x0b\x32U.google.cloud.recommender.v1beta1.MarkRecommendationClaimedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x9f\x02\n"MarkRecommendationSucceededRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12o\n\x0estate_metadata\x18\x02 \x03(\x0b\x32W.google.cloud.recommender.v1beta1.MarkRecommendationSucceededRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01"\x99\x02\n\x1fMarkRecommendationFailedRequest\x12?\n\x04name\x18\x01 \x01(\tB1\xe0\x41\x02\xfa\x41+\n)recommender.googleapis.com/Recommendation\x12l\n\x0estate_metadata\x18\x02 \x03(\x0b\x32T.google.cloud.recommender.v1beta1.MarkRecommendationFailedRequest.StateMetadataEntry\x12\x11\n\x04\x65tag\x18\x03 \x01(\tB\x03\xe0\x41\x02\x1a\x34\n\x12StateMetadataEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\x32\xe8\x0f\n\x0bRecommender\x12\xd0\x01\n\x0cListInsights\x12\x35.google.cloud.recommender.v1beta1.ListInsightsRequest\x1a\x36.google.cloud.recommender.v1beta1.ListInsightsResponse"Q\x82\xd3\xe4\x93\x02\x42\x12@/v1beta1/{parent=projects/*/locations/*/insightTypes/*}/insights\xda\x41\x06parent\x12\xbd\x01\n\nGetInsight\x12\x33.google.cloud.recommender.v1beta1.GetInsightRequest\x1a).google.cloud.recommender.v1beta1.Insight"O\x82\xd3\xe4\x93\x02\x42\x12@/v1beta1/{name=projects/*/locations/*/insightTypes/*/insights/*}\xda\x41\x04name\x12\xf3\x01\n\x13MarkInsightAccepted\x12<.google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest\x1a).google.cloud.recommender.v1beta1.Insight"s\x82\xd3\xe4\x93\x02R"M/v1beta1/{name=projects/*/locations/*/insightTypes/*/insights/*}:markAccepted:\x01*\xda\x41\x18name,state_metadata,etag\x12\xf3\x01\n\x13ListRecommendations\x12<.google.cloud.recommender.v1beta1.ListRecommendationsRequest\x1a=.google.cloud.recommender.v1beta1.ListRecommendationsResponse"_\x82\xd3\xe4\x93\x02I\x12G/v1beta1/{parent=projects/*/locations/*/recommenders/*}/recommendations\xda\x41\rparent,filter\x12\xd9\x01\n\x11GetRecommendation\x12:.google.cloud.recommender.v1beta1.GetRecommendationRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"V\x82\xd3\xe4\x93\x02I\x12G/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\xda\x41\x04name\x12\x8c\x02\n\x19MarkRecommendationClaimed\x12\x42.google.cloud.recommender.v1beta1.MarkRecommendationClaimedRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"y\x82\xd3\xe4\x93\x02X"S/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\x01*\xda\x41\x18name,state_metadata,etag\x12\x92\x02\n\x1bMarkRecommendationSucceeded\x12\x44.google.cloud.recommender.v1beta1.MarkRecommendationSucceededRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"{\x82\xd3\xe4\x93\x02Z"U/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\x01*\xda\x41\x18name,state_metadata,etag\x12\x89\x02\n\x18MarkRecommendationFailed\x12\x41.google.cloud.recommender.v1beta1.MarkRecommendationFailedRequest\x1a\x30.google.cloud.recommender.v1beta1.Recommendation"x\x82\xd3\xe4\x93\x02W"R/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\x01*\xda\x41\x18name,state_metadata,etag\x1aN\xca\x41\x1arecommender.googleapis.com\xd2\x41.https://www.googleapis.com/auth/cloud-platformB\xb1\x01\n$com.google.cloud.recommender.v1beta1B\x10RecommenderProtoP\x01ZKgoogle.golang.org/genproto/googleapis/cloud/recommender/v1beta1;recommender\xa2\x02\x04\x43REC\xaa\x02 Google.Cloud.Recommender.V1Beta1b\x06proto3', dependencies=[ google_dot_api_dot_annotations__pb2.DESCRIPTOR, google_dot_api_dot_client__pb2.DESCRIPTOR, google_dot_api_dot_field__behavior__pb2.DESCRIPTOR, google_dot_api_dot_resource__pb2.DESCRIPTOR, + google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2.DESCRIPTOR, google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2.DESCRIPTOR, ], ) +_LISTINSIGHTSREQUEST = _descriptor.Descriptor( + name="ListInsightsRequest", + full_name="google.cloud.recommender.v1beta1.ListInsightsRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="parent", + full_name="google.cloud.recommender.v1beta1.ListInsightsRequest.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\372A(\n&recommender.googleapis.com/InsightType", + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_size", + full_name="google.cloud.recommender.v1beta1.ListInsightsRequest.page_size", + index=1, + number=2, + type=5, + cpp_type=1, + label=1, + has_default_value=False, + default_value=0, + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\340A\001", + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="page_token", + full_name="google.cloud.recommender.v1beta1.ListInsightsRequest.page_token", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\340A\001", + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="filter", + full_name="google.cloud.recommender.v1beta1.ListInsightsRequest.filter", + index=3, + number=4, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\340A\001", + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=333, + serialized_end=488, +) + + +_LISTINSIGHTSRESPONSE = _descriptor.Descriptor( + name="ListInsightsResponse", + full_name="google.cloud.recommender.v1beta1.ListInsightsResponse", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="insights", + full_name="google.cloud.recommender.v1beta1.ListInsightsResponse.insights", + 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, + ), + _descriptor.FieldDescriptor( + name="next_page_token", + full_name="google.cloud.recommender.v1beta1.ListInsightsResponse.next_page_token", + 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=[], + serialized_start=490, + serialized_end=598, +) + + +_GETINSIGHTREQUEST = _descriptor.Descriptor( + name="GetInsightRequest", + full_name="google.cloud.recommender.v1beta1.GetInsightRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.recommender.v1beta1.GetInsightRequest.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"recommender.googleapis.com/Insight', + file=DESCRIPTOR, + ) + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=600, + serialized_end=677, +) + + +_MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY = _descriptor.Descriptor( + name="StateMetadataEntry", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.StateMetadataEntry", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="key", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.StateMetadataEntry.key", + 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="value", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.StateMetadataEntry.value", + 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=b"8\001", + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=897, + serialized_end=949, +) + +_MARKINSIGHTACCEPTEDREQUEST = _descriptor.Descriptor( + name="MarkInsightAcceptedRequest", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest", + filename=None, + file=DESCRIPTOR, + containing_type=None, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.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"recommender.googleapis.com/Insight', + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="state_metadata", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.state_metadata", + index=1, + number=2, + 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=b"\340A\001", + file=DESCRIPTOR, + ), + _descriptor.FieldDescriptor( + name="etag", + full_name="google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.etag", + index=2, + number=3, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=b"\340A\002", + file=DESCRIPTOR, + ), + ], + extensions=[], + nested_types=[_MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=680, + serialized_end=949, +) + + _LISTRECOMMENDATIONSREQUEST = _descriptor.Descriptor( name="ListRecommendationsRequest", full_name="google.cloud.recommender.v1beta1.ListRecommendationsRequest", @@ -74,15 +377,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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&recommender.googleapis.com/Recommender" - ), + serialized_options=b"\340A\002\372A(\n&recommender.googleapis.com/Recommender", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -100,7 +401,7 @@ containing_type=None, is_extension=False, extension_scope=None, - serialized_options=_b("\340A\001"), + serialized_options=b"\340A\001", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -112,13 +413,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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\001"), + serialized_options=b"\340A\001", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -130,7 +431,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -148,8 +449,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=279, - serialized_end=436, + serialized_start=952, + serialized_end=1109, ) @@ -187,7 +488,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -205,8 +506,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=439, - serialized_end=568, + serialized_start=1112, + serialized_end=1241, ) @@ -226,15 +527,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ) ], @@ -246,8 +545,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=570, - serialized_end=661, + serialized_start=1243, + serialized_end=1334, ) @@ -267,7 +566,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -285,7 +584,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -298,13 +597,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=895, - serialized_end=947, + serialized_start=897, + serialized_end=949, ) _MARKRECOMMENDATIONCLAIMEDREQUEST = _descriptor.Descriptor( @@ -323,15 +622,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -361,13 +658,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -379,8 +676,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=664, - serialized_end=947, + serialized_start=1337, + serialized_end=1620, ) @@ -400,7 +697,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -418,7 +715,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -431,13 +728,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=895, - serialized_end=947, + serialized_start=897, + serialized_end=949, ) _MARKRECOMMENDATIONSUCCEEDEDREQUEST = _descriptor.Descriptor( @@ -456,15 +753,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -494,13 +789,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -512,8 +807,8 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=950, - serialized_end=1237, + serialized_start=1623, + serialized_end=1910, ) @@ -533,7 +828,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -551,7 +846,7 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + default_value=b"".decode("utf-8"), message_type=None, enum_type=None, containing_type=None, @@ -564,13 +859,13 @@ extensions=[], nested_types=[], enum_types=[], - serialized_options=_b("8\001"), + serialized_options=b"8\001", is_extendable=False, syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=895, - serialized_end=947, + serialized_start=897, + serialized_end=949, ) _MARKRECOMMENDATIONFAILEDREQUEST = _descriptor.Descriptor( @@ -589,15 +884,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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)recommender.googleapis.com/Recommendation" - ), + serialized_options=b"\340A\002\372A+\n)recommender.googleapis.com/Recommendation", file=DESCRIPTOR, ), _descriptor.FieldDescriptor( @@ -627,13 +920,13 @@ cpp_type=9, label=1, has_default_value=False, - default_value=_b("").decode("utf-8"), + 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"), + serialized_options=b"\340A\002", file=DESCRIPTOR, ), ], @@ -645,10 +938,21 @@ syntax="proto3", extension_ranges=[], oneofs=[], - serialized_start=1240, - serialized_end=1521, + serialized_start=1913, + serialized_end=2194, ) +_LISTINSIGHTSRESPONSE.fields_by_name[ + "insights" +].message_type = ( + google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2._INSIGHT +) +_MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY.containing_type = ( + _MARKINSIGHTACCEPTEDREQUEST +) +_MARKINSIGHTACCEPTEDREQUEST.fields_by_name[ + "state_metadata" +].message_type = _MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY _LISTRECOMMENDATIONSRESPONSE.fields_by_name[ "recommendations" ].message_type = ( @@ -672,6 +976,12 @@ _MARKRECOMMENDATIONFAILEDREQUEST.fields_by_name[ "state_metadata" ].message_type = _MARKRECOMMENDATIONFAILEDREQUEST_STATEMETADATAENTRY +DESCRIPTOR.message_types_by_name["ListInsightsRequest"] = _LISTINSIGHTSREQUEST +DESCRIPTOR.message_types_by_name["ListInsightsResponse"] = _LISTINSIGHTSRESPONSE +DESCRIPTOR.message_types_by_name["GetInsightRequest"] = _GETINSIGHTREQUEST +DESCRIPTOR.message_types_by_name[ + "MarkInsightAcceptedRequest" +] = _MARKINSIGHTACCEPTEDREQUEST DESCRIPTOR.message_types_by_name[ "ListRecommendationsRequest" ] = _LISTRECOMMENDATIONSREQUEST @@ -690,6 +1000,115 @@ ] = _MARKRECOMMENDATIONFAILEDREQUEST _sym_db.RegisterFileDescriptor(DESCRIPTOR) +ListInsightsRequest = _reflection.GeneratedProtocolMessageType( + "ListInsightsRequest", + (_message.Message,), + { + "DESCRIPTOR": _LISTINSIGHTSREQUEST, + "__module__": "google.cloud.recommender_v1beta1.proto.recommender_service_pb2", + "__doc__": """Request for the ``ListInsights`` method. + + + Attributes: + parent: + Required. The container resource on which to execute the + request. Acceptable formats: 1. “projects/[PROJECT_NUMBER]/lo + cations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]”, LOCATION + here refers to GCP Locations: + https://cloud.google.com/about/locations/ + page_size: + Optional. The maximum number of results to return from this + request. Non-positive values are ignored. If not specified, + the server will determine the number of results to return. + page_token: + Optional. If present, retrieves the next batch of results from + the preceding call to this method. ``page_token`` must be the + value of ``next_page_token`` from the previous response. The + values of other method parameters must be identical to those + in the previous call. + filter: + Optional. Filter expression to restrict the insights returned. + Supported filter fields: state Eg: \`state:“DISMISSED” or + state:“ACTIVE” + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.ListInsightsRequest) + }, +) +_sym_db.RegisterMessage(ListInsightsRequest) + +ListInsightsResponse = _reflection.GeneratedProtocolMessageType( + "ListInsightsResponse", + (_message.Message,), + { + "DESCRIPTOR": _LISTINSIGHTSRESPONSE, + "__module__": "google.cloud.recommender_v1beta1.proto.recommender_service_pb2", + "__doc__": """Response to the ``ListInsights`` method. + + + Attributes: + insights: + The set of insights for the ``parent`` resource. + next_page_token: + A token that can be used to request the next page of results. + This field is empty if there are no additional results. + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.ListInsightsResponse) + }, +) +_sym_db.RegisterMessage(ListInsightsResponse) + +GetInsightRequest = _reflection.GeneratedProtocolMessageType( + "GetInsightRequest", + (_message.Message,), + { + "DESCRIPTOR": _GETINSIGHTREQUEST, + "__module__": "google.cloud.recommender_v1beta1.proto.recommender_service_pb2", + "__doc__": """Request to the ``GetInsight`` method. + + + Attributes: + name: + Required. Name of the insight. + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.GetInsightRequest) + }, +) +_sym_db.RegisterMessage(GetInsightRequest) + +MarkInsightAcceptedRequest = _reflection.GeneratedProtocolMessageType( + "MarkInsightAcceptedRequest", + (_message.Message,), + { + "StateMetadataEntry": _reflection.GeneratedProtocolMessageType( + "StateMetadataEntry", + (_message.Message,), + { + "DESCRIPTOR": _MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY, + "__module__": "google.cloud.recommender_v1beta1.proto.recommender_service_pb2" + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest.StateMetadataEntry) + }, + ), + "DESCRIPTOR": _MARKINSIGHTACCEPTEDREQUEST, + "__module__": "google.cloud.recommender_v1beta1.proto.recommender_service_pb2", + "__doc__": """Request for the ``MarkInsightAccepted`` method. + + + Attributes: + name: + Required. Name of the insight. + state_metadata: + Optional. State properties user wish to include with this + state. Full replace of the current state_metadata. + etag: + Required. Fingerprint of the Insight. Provides optimistic + locking. + """, + # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.MarkInsightAcceptedRequest) + }, +) +_sym_db.RegisterMessage(MarkInsightAcceptedRequest) +_sym_db.RegisterMessage(MarkInsightAcceptedRequest.StateMetadataEntry) + ListRecommendationsRequest = _reflection.GeneratedProtocolMessageType( "ListRecommendationsRequest", (_message.Message,), @@ -789,7 +1208,7 @@ state_metadata: State properties to include with this state. Overwrites any existing ``state_metadata``. Keys must match the regex ``/ - [2]_[a-z0-9_.-]{0,62}/``. Values must match the regex + [1]_[a-z0-9_.-]{0,62}/``. Values must match the regex ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides @@ -825,12 +1244,11 @@ state_metadata: State properties to include with this state. Overwrites any existing ``state_metadata``. Keys must match the regex ``/ - [3]_[a-z0-9_.-]{0,62}/``. Values must match the regex + [2]_[a-z0-9_.-]{0,62}/``. Values must match the regex ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides - optimistic locking. .. [1] a-z0-9 .. [2] a-z0-9 .. - [3] a-z0-9 + optimistic locking. """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.MarkRecommendationSucceededRequest) }, @@ -862,7 +1280,7 @@ state_metadata: State properties to include with this state. Overwrites any existing ``state_metadata``. Keys must match the regex ``/ - [1]_[a-z0-9_.-]{0,62}/``. Values must match the regex + [3]_[a-z0-9_.-]{0,62}/``. Values must match the regex ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides @@ -876,6 +1294,15 @@ DESCRIPTOR._options = None +_LISTINSIGHTSREQUEST.fields_by_name["parent"]._options = None +_LISTINSIGHTSREQUEST.fields_by_name["page_size"]._options = None +_LISTINSIGHTSREQUEST.fields_by_name["page_token"]._options = None +_LISTINSIGHTSREQUEST.fields_by_name["filter"]._options = None +_GETINSIGHTREQUEST.fields_by_name["name"]._options = None +_MARKINSIGHTACCEPTEDREQUEST_STATEMETADATAENTRY._options = None +_MARKINSIGHTACCEPTEDREQUEST.fields_by_name["name"]._options = None +_MARKINSIGHTACCEPTEDREQUEST.fields_by_name["state_metadata"]._options = None +_MARKINSIGHTACCEPTEDREQUEST.fields_by_name["etag"]._options = None _LISTRECOMMENDATIONSREQUEST.fields_by_name["parent"]._options = None _LISTRECOMMENDATIONSREQUEST.fields_by_name["page_size"]._options = None _LISTRECOMMENDATIONSREQUEST.fields_by_name["page_token"]._options = None @@ -895,66 +1322,81 @@ full_name="google.cloud.recommender.v1beta1.Recommender", file=DESCRIPTOR, index=0, - serialized_options=_b( - "\312A\032recommender.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform" - ), - serialized_start=1524, - serialized_end=2899, + serialized_options=b"\312A\032recommender.googleapis.com\322A.https://www.googleapis.com/auth/cloud-platform", + serialized_start=2197, + serialized_end=4221, methods=[ + _descriptor.MethodDescriptor( + name="ListInsights", + full_name="google.cloud.recommender.v1beta1.Recommender.ListInsights", + index=0, + containing_service=None, + input_type=_LISTINSIGHTSREQUEST, + output_type=_LISTINSIGHTSRESPONSE, + serialized_options=b"\202\323\344\223\002B\022@/v1beta1/{parent=projects/*/locations/*/insightTypes/*}/insights\332A\006parent", + ), + _descriptor.MethodDescriptor( + name="GetInsight", + full_name="google.cloud.recommender.v1beta1.Recommender.GetInsight", + index=1, + containing_service=None, + input_type=_GETINSIGHTREQUEST, + output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2._INSIGHT, + serialized_options=b"\202\323\344\223\002B\022@/v1beta1/{name=projects/*/locations/*/insightTypes/*/insights/*}\332A\004name", + ), + _descriptor.MethodDescriptor( + name="MarkInsightAccepted", + full_name="google.cloud.recommender.v1beta1.Recommender.MarkInsightAccepted", + index=2, + containing_service=None, + input_type=_MARKINSIGHTACCEPTEDREQUEST, + output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2._INSIGHT, + serialized_options=b'\202\323\344\223\002R"M/v1beta1/{name=projects/*/locations/*/insightTypes/*/insights/*}:markAccepted:\001*\332A\030name,state_metadata,etag', + ), _descriptor.MethodDescriptor( name="ListRecommendations", full_name="google.cloud.recommender.v1beta1.Recommender.ListRecommendations", - index=0, + index=3, containing_service=None, input_type=_LISTRECOMMENDATIONSREQUEST, output_type=_LISTRECOMMENDATIONSRESPONSE, - serialized_options=_b( - "\202\323\344\223\002I\022G/v1beta1/{parent=projects/*/locations/*/recommenders/*}/recommendations\332A\rparent,filter" - ), + serialized_options=b"\202\323\344\223\002I\022G/v1beta1/{parent=projects/*/locations/*/recommenders/*}/recommendations\332A\rparent,filter", ), _descriptor.MethodDescriptor( name="GetRecommendation", full_name="google.cloud.recommender.v1beta1.Recommender.GetRecommendation", - index=1, + index=4, containing_service=None, input_type=_GETRECOMMENDATIONREQUEST, output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - "\202\323\344\223\002I\022G/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\332A\004name" - ), + serialized_options=b"\202\323\344\223\002I\022G/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}\332A\004name", ), _descriptor.MethodDescriptor( name="MarkRecommendationClaimed", full_name="google.cloud.recommender.v1beta1.Recommender.MarkRecommendationClaimed", - index=2, + index=5, containing_service=None, input_type=_MARKRECOMMENDATIONCLAIMEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002X"S/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002X"S/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markClaimed:\001*\332A\030name,state_metadata,etag', ), _descriptor.MethodDescriptor( name="MarkRecommendationSucceeded", full_name="google.cloud.recommender.v1beta1.Recommender.MarkRecommendationSucceeded", - index=3, + index=6, containing_service=None, input_type=_MARKRECOMMENDATIONSUCCEEDEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002Z"U/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002Z"U/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markSucceeded:\001*\332A\030name,state_metadata,etag', ), _descriptor.MethodDescriptor( name="MarkRecommendationFailed", full_name="google.cloud.recommender.v1beta1.Recommender.MarkRecommendationFailed", - index=4, + index=7, containing_service=None, input_type=_MARKRECOMMENDATIONFAILEDREQUEST, output_type=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2._RECOMMENDATION, - serialized_options=_b( - '\202\323\344\223\002W"R/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\001*\332A\030name,state_metadata,etag' - ), + serialized_options=b'\202\323\344\223\002W"R/v1beta1/{name=projects/*/locations/*/recommenders/*/recommendations/*}:markFailed:\001*\332A\030name,state_metadata,etag', ), ], ) diff --git a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py index 6b72361..733edaf 100644 --- a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py +++ b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2_grpc.py @@ -1,4 +1,4 @@ -# Copyright 2020 Google LLC +# Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,6 +16,9 @@ import grpc +from google.cloud.recommender_v1beta1.proto import ( + insight_pb2 as google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2, +) from google.cloud.recommender_v1beta1.proto import ( recommendation_pb2 as google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommendation__pb2, ) @@ -37,6 +40,21 @@ def __init__(self, channel): Args: channel: A grpc.Channel. """ + self.ListInsights = channel.unary_unary( + "/google.cloud.recommender.v1beta1.Recommender/ListInsights", + request_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListInsightsRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListInsightsResponse.FromString, + ) + self.GetInsight = channel.unary_unary( + "/google.cloud.recommender.v1beta1.Recommender/GetInsight", + request_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.GetInsightRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2.Insight.FromString, + ) + self.MarkInsightAccepted = channel.unary_unary( + "/google.cloud.recommender.v1beta1.Recommender/MarkInsightAccepted", + request_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.MarkInsightAcceptedRequest.SerializeToString, + response_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2.Insight.FromString, + ) self.ListRecommendations = channel.unary_unary( "/google.cloud.recommender.v1beta1.Recommender/ListRecommendations", request_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListRecommendationsRequest.SerializeToString, @@ -71,6 +89,34 @@ class RecommenderServicer(object): based on analysis of user resources, configuration and monitoring metrics. """ + def ListInsights(self, request, context): + """Lists insights for a Cloud project. Requires the recommender.*.list IAM + permission for the specified insight type. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def GetInsight(self, request, context): + """Gets the requested insight. Requires the recommender.*.get IAM permission + for the specified insight type. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + + def MarkInsightAccepted(self, request, context): + """Marks the Insight State as Accepted. Users can use this method to + indicate to the Recommender API that they have applied some action based + on the insight. This stops the insight content from being updated. + + MarkInsightAccepted can be applied to insights in ACTIVE state. Requires + the recommender.*.update IAM permission for the specified insight. + """ + context.set_code(grpc.StatusCode.UNIMPLEMENTED) + context.set_details("Method not implemented!") + raise NotImplementedError("Method not implemented!") + def ListRecommendations(self, request, context): """Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender. @@ -140,6 +186,21 @@ def MarkRecommendationFailed(self, request, context): def add_RecommenderServicer_to_server(servicer, server): rpc_method_handlers = { + "ListInsights": grpc.unary_unary_rpc_method_handler( + servicer.ListInsights, + request_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListInsightsRequest.FromString, + response_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListInsightsResponse.SerializeToString, + ), + "GetInsight": grpc.unary_unary_rpc_method_handler( + servicer.GetInsight, + request_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.GetInsightRequest.FromString, + response_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2.Insight.SerializeToString, + ), + "MarkInsightAccepted": grpc.unary_unary_rpc_method_handler( + servicer.MarkInsightAccepted, + request_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.MarkInsightAcceptedRequest.FromString, + response_serializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_insight__pb2.Insight.SerializeToString, + ), "ListRecommendations": grpc.unary_unary_rpc_method_handler( servicer.ListRecommendations, request_deserializer=google_dot_cloud_dot_recommender__v1beta1_dot_proto_dot_recommender__service__pb2.ListRecommendationsRequest.FromString, diff --git a/google/cloud/recommender_v1beta1/types.py b/google/cloud/recommender_v1beta1/types.py index 205bae4..3a85b6f 100644 --- a/google/cloud/recommender_v1beta1/types.py +++ b/google/cloud/recommender_v1beta1/types.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ from google.api_core.protobuf_helpers import get_messages +from google.cloud.recommender_v1beta1.proto import insight_pb2 from google.cloud.recommender_v1beta1.proto import recommendation_pb2 from google.cloud.recommender_v1beta1.proto import recommender_service_pb2 from google.protobuf import duration_pb2 @@ -30,7 +31,7 @@ _shared_modules = [duration_pb2, struct_pb2, timestamp_pb2, money_pb2] -_local_modules = [recommendation_pb2, recommender_service_pb2] +_local_modules = [insight_pb2, recommendation_pb2, recommender_service_pb2] names = [] diff --git a/noxfile.py b/noxfile.py index 8ac2d4b..00d00a4 100644 --- a/noxfile.py +++ b/noxfile.py @@ -42,7 +42,7 @@ def lint(session): session.run("flake8", "google", "tests") -@nox.session(python="3") +@nox.session(python="3.6") def blacken(session): """Run black. @@ -72,6 +72,7 @@ def default(session): session.run( "py.test", "--quiet", + "--cov=google.cloud.recommender", "--cov=google.cloud", "--cov=tests.unit", "--cov-append", diff --git a/synth.metadata b/synth.metadata index 02ad1dc..2ccb875 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,11 +1,39 @@ { - "updateTime": "2020-02-05T00:09:38.363168Z", + "updateTime": "2020-03-13T12:17:59.665819Z", "sources": [ + { + "git": { + "name": "googleapis", + "remote": "https://github.com/googleapis/googleapis.git", + "sha": "7d569be2928dbd72b4e261bf9e468f23afd2b950", + "internalRef": "300718800" + } + }, { "template": { - "name": "python_split_library", + "name": "python_library", "origin": "synthtool.gcp", - "version": "2019.10.17" + "version": "2020.2.4" + } + } + ], + "destinations": [ + { + "client": { + "source": "googleapis", + "apiName": "recommender", + "apiVersion": "v1beta1", + "language": "python", + "generator": "bazel" + } + }, + { + "client": { + "source": "googleapis", + "apiName": "recommender", + "apiVersion": "v1", + "language": "python", + "generator": "bazel" } } ] diff --git a/tests/unit/gapic/v1/test_recommender_client_v1.py b/tests/unit/gapic/v1/test_recommender_client_v1.py index 2822743..617fb6d 100644 --- a/tests/unit/gapic/v1/test_recommender_client_v1.py +++ b/tests/unit/gapic/v1/test_recommender_client_v1.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py b/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py index dafe315..8c84608 100644 --- a/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py +++ b/tests/unit/gapic/v1beta1/test_recommender_client_v1beta1.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # -# Copyright 2019 Google LLC +# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import pytest from google.cloud import recommender_v1beta1 +from google.cloud.recommender_v1beta1.proto import insight_pb2 from google.cloud.recommender_v1beta1.proto import recommendation_pb2 from google.cloud.recommender_v1beta1.proto import recommender_service_pb2 @@ -61,6 +62,155 @@ class CustomException(Exception): class TestRecommenderClient(object): + def test_list_insights(self): + # Setup Expected Response + next_page_token = "" + insights_element = {} + insights = [insights_element] + expected_response = {"next_page_token": next_page_token, "insights": insights} + expected_response = recommender_service_pb2.ListInsightsResponse( + **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 = recommender_v1beta1.RecommenderClient() + + # Setup Request + parent = client.insight_type_path("[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") + + paged_list_response = client.list_insights(parent) + resources = list(paged_list_response) + assert len(resources) == 1 + + assert expected_response.insights[0] == resources[0] + + assert len(channel.requests) == 1 + expected_request = recommender_service_pb2.ListInsightsRequest(parent=parent) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_list_insights_exception(self): + 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 = recommender_v1beta1.RecommenderClient() + + # Setup request + parent = client.insight_type_path("[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]") + + paged_list_response = client.list_insights(parent) + with pytest.raises(CustomException): + list(paged_list_response) + + def test_get_insight(self): + # Setup Expected Response + name_2 = "name2-1052831874" + description = "description-1724546052" + insight_subtype = "insightSubtype-1491142701" + etag = "etag3123477" + expected_response = { + "name": name_2, + "description": description, + "insight_subtype": insight_subtype, + "etag": etag, + } + expected_response = insight_pb2.Insight(**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 = recommender_v1beta1.RecommenderClient() + + # Setup Request + name = client.insight_path( + "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]" + ) + + response = client.get_insight(name) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = recommender_service_pb2.GetInsightRequest(name=name) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_get_insight_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 = recommender_v1beta1.RecommenderClient() + + # Setup request + name = client.insight_path( + "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]" + ) + + with pytest.raises(CustomException): + client.get_insight(name) + + def test_mark_insight_accepted(self): + # Setup Expected Response + name_2 = "name2-1052831874" + description = "description-1724546052" + insight_subtype = "insightSubtype-1491142701" + etag_2 = "etag2-1293302904" + expected_response = { + "name": name_2, + "description": description, + "insight_subtype": insight_subtype, + "etag": etag_2, + } + expected_response = insight_pb2.Insight(**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 = recommender_v1beta1.RecommenderClient() + + # Setup Request + name = client.insight_path( + "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]" + ) + etag = "etag3123477" + + response = client.mark_insight_accepted(name, etag) + assert expected_response == response + + assert len(channel.requests) == 1 + expected_request = recommender_service_pb2.MarkInsightAcceptedRequest( + name=name, etag=etag + ) + actual_request = channel.requests[0][1] + assert expected_request == actual_request + + def test_mark_insight_accepted_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 = recommender_v1beta1.RecommenderClient() + + # Setup request + name = client.insight_path( + "[PROJECT]", "[LOCATION]", "[INSIGHT_TYPE]", "[INSIGHT]" + ) + etag = "etag3123477" + + with pytest.raises(CustomException): + client.mark_insight_accepted(name, etag) + def test_list_recommendations(self): # Setup Expected Response next_page_token = "" From e171676888924e2efc5970eaf4aca479a0888389 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Sat, 14 Mar 2020 00:28:31 +0000 Subject: [PATCH 2/2] chore: regen --- google/cloud/recommender_v1/gapic/enums.py | 8 +- .../gapic/recommender_client.py | 131 ++--- .../transports/recommender_grpc_transport.py | 82 ++-- .../proto/recommendation_pb2.py | 6 +- .../proto/recommender_service_pb2.py | 3 +- .../cloud/recommender_v1beta1/gapic/enums.py | 35 +- .../gapic/recommender_client.py | 455 ++++-------------- .../transports/recommender_grpc_transport.py | 353 ++------------ .../recommender_v1beta1/proto/insight_pb2.py | 3 +- .../proto/recommendation_pb2.py | 4 +- .../proto/recommender_service_pb2.py | 7 +- synth.metadata | 13 +- synth.py | 10 + 13 files changed, 248 insertions(+), 862 deletions(-) diff --git a/google/cloud/recommender_v1/gapic/enums.py b/google/cloud/recommender_v1/gapic/enums.py index 0a577ef..a4c452d 100644 --- a/google/cloud/recommender_v1/gapic/enums.py +++ b/google/cloud/recommender_v1/gapic/enums.py @@ -21,10 +21,10 @@ class NullValue(enum.IntEnum): """ - Optional. If present, retrieves the next batch of results from the - preceding call to this method. ``page_token`` must be the value of - ``next_page_token`` from the previous response. The values of other - method parameters must be identical to those in the previous call. + ``NullValue`` is a singleton enumeration to represent the null value + for the ``Value`` type union. + + The JSON representation for ``NullValue`` is JSON ``null``. Attributes: NULL_VALUE (int): Null value. diff --git a/google/cloud/recommender_v1/gapic/recommender_client.py b/google/cloud/recommender_v1/gapic/recommender_client.py index b1e4fc8..308aaaa 100644 --- a/google/cloud/recommender_v1/gapic/recommender_client.py +++ b/google/cloud/recommender_v1/gapic/recommender_client.py @@ -223,9 +223,8 @@ def list_recommendations( metadata=None, ): """ - Denotes a field as required. This indicates that the field **must** - be provided as part of the request, and failure to do so will cause an - error (usually ``INVALID_ARGUMENT``). + Lists recommendations for a Cloud project. Requires the + recommender.*.list IAM permission for the specified recommender. Example: >>> from google.cloud import recommender_v1 @@ -249,26 +248,23 @@ def list_recommendations( ... pass Args: - parent (str): Set of filters to apply if ``path`` refers to array elements or - nested array elements in order to narrow down to a single unique element - that is being tested/modified. This is intended to be an exact match per - filter. To perform advanced matching, use path_value_matchers. - - - Example: { "/versions/*/name" : "it-123" - "/versions/*/targetSize/percent": 20 } - - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/condition" - : null } - - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/members/*" - : ["x@google.com", "y@google.com"] } When both path_filters and - path_value_matchers are set, an implicit AND must be performed. + parent (str): Required. The container resource on which to execute the request. + Acceptable formats: + + 1. + + "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", + + LOCATION here refers to GCP Locations: + https://cloud.google.com/about/locations/ page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. - filter_ (str): ``ListValue`` is a wrapper around a repeated field of values. - - The JSON representation for ``ListValue`` is JSON array. + filter_ (str): Filter expression to restrict the recommendations returned. + Supported filter fields: state_info.state Eg: + \`state_info.state:"DISMISSED" or state_info.state:"FAILED" 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. @@ -341,45 +337,8 @@ def get_recommendation( metadata=None, ): """ - If this SourceCodeInfo represents a complete declaration, these are - any comments appearing before and after the declaration which appear to - be attached to the declaration. - - A series of line comments appearing on consecutive lines, with no other - tokens appearing on those lines, will be treated as a single comment. - - leading_detached_comments will keep paragraphs of comments that appear - before (but not connected to) the current element. Each paragraph, - separated by empty lines, will be one comment element in the repeated - field. - - Only the comment content is provided; comment markers (e.g. //) are - stripped out. For block comments, leading whitespace and an asterisk - will be stripped from the beginning of each line other than the first. - Newlines are included in the output. - - Examples: - - optional int32 foo = 1; // Comment attached to foo. // Comment attached - to bar. optional int32 bar = 2; - - optional string baz = 3; // Comment attached to baz. // Another line - attached to baz. - - // Comment attached to qux. // // Another line attached to qux. optional - double qux = 4; - - // Detached comment for corge. This is not leading or trailing comments - // to qux or corge because there are blank lines separating it from // - both. - - // Detached comment for corge paragraph 2. - - optional string corge = 5; /\* Block comment attached \* to corge. - Leading asterisks \* will be removed. */ /* Block comment attached to \* - grault. \*/ optional int32 grault = 6; - - // ignored detached comments. + Gets the requested recommendation. Requires the recommender.*.get + IAM permission for the specified recommender. Example: >>> from google.cloud import recommender_v1 @@ -450,8 +409,16 @@ def mark_recommendation_claimed( metadata=None, ): """ - Can be set for action 'test' for advanced matching for the value of - 'path' field. Either this or ``value`` will be set for 'test' operation. + Mark the Recommendation State as Claimed. Users can use this method + to indicate to the Recommender API that they are starting to apply the + recommendation themselves. This stops the recommendation content from + being updated. + + MarkRecommendationClaimed can be applied to recommendations in CLAIMED, + SUCCEEDED, FAILED, or ACTIVE state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Example: >>> from google.cloud import recommender_v1 @@ -468,7 +435,10 @@ def mark_recommendation_claimed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): Request for the ``MarkRecommendationSucceeded`` Method. + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. @@ -531,10 +501,16 @@ def mark_recommendation_succeeded( metadata=None, ): """ - Denotes a field as output only. This indicates that the field is - provided in responses, but including the field in a request does nothing - (the server *must* ignore it and *must not* throw an error as a result - of the field's presence). + Mark the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. + + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Example: >>> from google.cloud import recommender_v1 @@ -551,12 +527,10 @@ def mark_recommendation_succeeded( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): Number of nano (10^-9) units of the amount. The value must be - between -999,999,999 and +999,999,999 inclusive. If ``units`` is - positive, ``nanos`` must be positive or zero. If ``units`` is zero, - ``nanos`` can be positive, zero, or negative. If ``units`` is negative, - ``nanos`` must be negative or zero. For example $-1.75 is represented as - ``units``\ =-1 and ``nanos``\ =-750,000,000. + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. @@ -619,12 +593,12 @@ def mark_recommendation_failed( metadata=None, ): """ - Mark the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. + Mark the Recommendation State as Failed. Users can use this method + to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation failed. This stops the + recommendation content from being updated. - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state. Requires the recommender.*.update IAM permission for the specified @@ -645,9 +619,10 @@ def mark_recommendation_failed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): Signed seconds of the span of time. Must be from -315,576,000,000 to - +315,576,000,000 inclusive. Note: these bounds are computed from: 60 - sec/min \* 60 min/hr \* 24 hr/day \* 365.25 days/year \* 10000 years + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. diff --git a/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py b/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py index 0a3a923..b08c238 100644 --- a/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py +++ b/google/cloud/recommender_v1/gapic/transports/recommender_grpc_transport.py @@ -111,9 +111,8 @@ def channel(self): def list_recommendations(self): """Return the gRPC stub for :meth:`RecommenderClient.list_recommendations`. - Denotes a field as required. This indicates that the field **must** - be provided as part of the request, and failure to do so will cause an - error (usually ``INVALID_ARGUMENT``). + Lists recommendations for a Cloud project. Requires the + recommender.*.list IAM permission for the specified recommender. Returns: Callable: A callable which accepts the appropriate @@ -126,45 +125,8 @@ def list_recommendations(self): def get_recommendation(self): """Return the gRPC stub for :meth:`RecommenderClient.get_recommendation`. - If this SourceCodeInfo represents a complete declaration, these are - any comments appearing before and after the declaration which appear to - be attached to the declaration. - - A series of line comments appearing on consecutive lines, with no other - tokens appearing on those lines, will be treated as a single comment. - - leading_detached_comments will keep paragraphs of comments that appear - before (but not connected to) the current element. Each paragraph, - separated by empty lines, will be one comment element in the repeated - field. - - Only the comment content is provided; comment markers (e.g. //) are - stripped out. For block comments, leading whitespace and an asterisk - will be stripped from the beginning of each line other than the first. - Newlines are included in the output. - - Examples: - - optional int32 foo = 1; // Comment attached to foo. // Comment attached - to bar. optional int32 bar = 2; - - optional string baz = 3; // Comment attached to baz. // Another line - attached to baz. - - // Comment attached to qux. // // Another line attached to qux. optional - double qux = 4; - - // Detached comment for corge. This is not leading or trailing comments - // to qux or corge because there are blank lines separating it from // - both. - - // Detached comment for corge paragraph 2. - - optional string corge = 5; /\* Block comment attached \* to corge. - Leading asterisks \* will be removed. */ /* Block comment attached to \* - grault. \*/ optional int32 grault = 6; - - // ignored detached comments. + Gets the requested recommendation. Requires the recommender.*.get + IAM permission for the specified recommender. Returns: Callable: A callable which accepts the appropriate @@ -177,8 +139,16 @@ def get_recommendation(self): def mark_recommendation_claimed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_claimed`. - Can be set for action 'test' for advanced matching for the value of - 'path' field. Either this or ``value`` will be set for 'test' operation. + Mark the Recommendation State as Claimed. Users can use this method + to indicate to the Recommender API that they are starting to apply the + recommendation themselves. This stops the recommendation content from + being updated. + + MarkRecommendationClaimed can be applied to recommendations in CLAIMED, + SUCCEEDED, FAILED, or ACTIVE state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Returns: Callable: A callable which accepts the appropriate @@ -191,10 +161,16 @@ def mark_recommendation_claimed(self): def mark_recommendation_succeeded(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_succeeded`. - Denotes a field as output only. This indicates that the field is - provided in responses, but including the field in a request does nothing - (the server *must* ignore it and *must not* throw an error as a result - of the field's presence). + Mark the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. + + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Returns: Callable: A callable which accepts the appropriate @@ -207,12 +183,12 @@ def mark_recommendation_succeeded(self): def mark_recommendation_failed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_failed`. - Mark the Recommendation State as Succeeded. Users can use this - method to indicate to the Recommender API that they have applied the - recommendation themselves, and the operation was successful. This stops - the recommendation content from being updated. + Mark the Recommendation State as Failed. Users can use this method + to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation failed. This stops the + recommendation content from being updated. - MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + MarkRecommendationFailed can be applied to recommendations in ACTIVE, CLAIMED, SUCCEEDED, or FAILED state. Requires the recommender.*.update IAM permission for the specified diff --git a/google/cloud/recommender_v1/proto/recommendation_pb2.py b/google/cloud/recommender_v1/proto/recommendation_pb2.py index 306cdfb..b5f9bee 100644 --- a/google/cloud/recommender_v1/proto/recommendation_pb2.py +++ b/google/cloud/recommender_v1/proto/recommendation_pb2.py @@ -1228,8 +1228,7 @@ support value matching beyond exact match. To perform exact match, use path_filters. When both path_filters and path_value_matchers are set, an implicit AND must be - performed. .. [1] a-z0-9 .. [2] a-z0-9 .. [3] - a-z0-9 + performed. """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.Operation) }, @@ -1244,8 +1243,7 @@ { "DESCRIPTOR": _VALUEMATCHER, "__module__": "google.cloud.recommender_v1.proto.recommendation_pb2", - "__doc__": """Contains various matching options for values for a GCP - resource field. + "__doc__": """Contains various matching options for values for a GCP resource field. Attributes: diff --git a/google/cloud/recommender_v1/proto/recommender_service_pb2.py b/google/cloud/recommender_v1/proto/recommender_service_pb2.py index 6743905..d518bd7 100644 --- a/google/cloud/recommender_v1/proto/recommender_service_pb2.py +++ b/google/cloud/recommender_v1/proto/recommender_service_pb2.py @@ -798,7 +798,8 @@ ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides - optimistic locking. + optimistic locking. .. [1] a-z0-9 .. [2] a-z0-9 .. + [3] a-z0-9 """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1.MarkRecommendationSucceededRequest) }, diff --git a/google/cloud/recommender_v1beta1/gapic/enums.py b/google/cloud/recommender_v1beta1/gapic/enums.py index 1cff3c1..a794132 100644 --- a/google/cloud/recommender_v1beta1/gapic/enums.py +++ b/google/cloud/recommender_v1beta1/gapic/enums.py @@ -21,39 +21,10 @@ class NullValue(enum.IntEnum): """ - A definition of a client library method signature. + ``NullValue`` is a singleton enumeration to represent the null value + for the ``Value`` type union. - In client libraries, each proto RPC corresponds to one or more methods - which the end user is able to call, and calls the underlying RPC. - Normally, this method receives a single argument (a struct or instance - corresponding to the RPC request object). Defining this field will add - one or more overloads providing flattened or simpler method signatures - in some languages. - - The fields on the method signature are provided as a comma-separated - string. - - For example, the proto RPC and annotation: - - rpc CreateSubscription(CreateSubscriptionRequest) returns (Subscription) - { option (google.api.method_signature) = "name,topic"; } - - Would add the following Java overload (in addition to the method - accepting the request object): - - public final Subscription createSubscription(String name, String topic) - - The following backwards-compatibility guidelines apply: - - - Adding this annotation to an unannotated method is backwards - compatible. - - Adding this annotation to a method which already has existing method - signature annotations is backwards compatible if and only if the new - method signature annotation is last in the sequence. - - Modifying or removing an existing method signature annotation is a - breaking change. - - Re-ordering existing method signature annotations is a breaking - change. + The JSON representation for ``NullValue`` is JSON ``null``. Attributes: NULL_VALUE (int): Null value. diff --git a/google/cloud/recommender_v1beta1/gapic/recommender_client.py b/google/cloud/recommender_v1beta1/gapic/recommender_client.py index c31d728..e437b03 100644 --- a/google/cloud/recommender_v1beta1/gapic/recommender_client.py +++ b/google/cloud/recommender_v1beta1/gapic/recommender_client.py @@ -245,286 +245,8 @@ def list_insights( metadata=None, ): """ - # gRPC Transcoding - - gRPC Transcoding is a feature for mapping between a gRPC method and one - or more HTTP REST endpoints. It allows developers to build a single API - service that supports both gRPC APIs and REST APIs. Many systems, - including `Google APIs `__, - `Cloud Endpoints `__, `gRPC - Gateway `__, and - `Envoy `__ proxy support this - feature and use it for large scale production services. - - ``HttpRule`` defines the schema of the gRPC/REST mapping. The mapping - specifies how different portions of the gRPC request message are mapped - to the URL path, URL query parameters, and HTTP request body. It also - controls how the gRPC response message is mapped to the HTTP response - body. ``HttpRule`` is typically specified as an ``google.api.http`` - annotation on the gRPC method. - - Each mapping specifies a URL path template and an HTTP method. The path - template may refer to one or more fields in the gRPC request message, as - long as each field is a non-repeated field with a primitive - (non-message) type. The path template controls how fields of the request - message are mapped to the URL path. - - Example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get: "/v1/{name=messages/*}" - }; - } - } - message GetMessageRequest { - string name = 1; // Mapped to URL path. - } - message Message { - string text = 1; // The resource content. - } - - This enables an HTTP REST to gRPC mapping as below: - - HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| - ``GetMessage(name: "messages/123456")`` - - Any fields in the request message which are not bound by the path - template automatically become HTTP query parameters if there is no HTTP - request body. For example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get:"/v1/messages/{message_id}" - }; - } - } - message GetMessageRequest { - message SubMessage { - string subfield = 1; - } - string message_id = 1; // Mapped to URL path. - int64 revision = 2; // Mapped to URL query parameter `revision`. - SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. - } - - This enables a HTTP JSON to RPC mapping as below: - - HTTP \| gRPC -----|----- - ``GET /v1/messages/123456?revision=2&sub.subfield=foo`` \| - ``GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`` - - Note that fields which are mapped to URL query parameters must have a - primitive type or a repeated primitive type or a non-repeated message - type. In the case of a repeated type, the parameter can be repeated in - the URL as ``...?param=A¶m=B``. In the case of a message type, each - field of the message is mapped to a separate parameter, such as - ``...?foo.a=A&foo.b=B&foo.c=C``. - - For HTTP methods that allow a request body, the ``body`` field specifies - the mapping. Consider a REST update method on the message resource - collection: - - :: - - service Messaging { - rpc UpdateMessage(UpdateMessageRequest) returns (Message) { - option (google.api.http) = { - patch: "/v1/messages/{message_id}" - body: "message" - }; - } - } - message UpdateMessageRequest { - string message_id = 1; // mapped to the URL - Message message = 2; // mapped to the body - } - - The following HTTP JSON to RPC mapping is enabled, where the - representation of the JSON in the request body is determined by protos - JSON encoding: - - HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` - \| ``UpdateMessage(message_id: "123456" message { text: "Hi!" })`` - - The special name ``*`` can be used in the body mapping to define that - every field not bound by the path template should be mapped to the - request body. This enables the following alternative definition of the - update method: - - :: - - service Messaging { - rpc UpdateMessage(Message) returns (Message) { - option (google.api.http) = { - patch: "/v1/messages/{message_id}" - body: "*" - }; - } - } - message Message { - string message_id = 1; - string text = 2; - } - - The following HTTP JSON to RPC mapping is enabled: - - HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` - \| ``UpdateMessage(message_id: "123456" text: "Hi!")`` - - Note that when using ``*`` in the body mapping, it is not possible to - have HTTP parameters, as all fields not bound by the path end in the - body. This makes this option more rarely used in practice when defining - REST APIs. The common usage of ``*`` is in custom methods which don't - use the URL at all for transferring data. - - It is possible to define multiple HTTP methods for one RPC by using the - ``additional_bindings`` option. Example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get: "/v1/messages/{message_id}" - additional_bindings { - get: "/v1/users/{user_id}/messages/{message_id}" - } - }; - } - } - message GetMessageRequest { - string message_id = 1; - string user_id = 2; - } - - This enables the following two alternative HTTP JSON to RPC mappings: - - HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| - ``GetMessage(message_id: "123456")`` - ``GET /v1/users/me/messages/123456`` \| - ``GetMessage(user_id: "me" message_id: "123456")`` - - ## Rules for HTTP mapping - - 1. Leaf request fields (recursive expansion nested messages in the - request message) are classified into three categories: - - - Fields referred by the path template. They are passed via the URL - path. - - Fields referred by the ``HttpRule.body``. They are passed via the - HTTP request body. - - All other fields are passed via the URL query parameters, and the - parameter name is the field path in the request message. A - repeated field can be represented as multiple query parameters - under the same name. - - 2. If ``HttpRule.body`` is "*", there is no URL query parameter, all - fields are passed via URL path and HTTP request body. - 3. If ``HttpRule.body`` is omitted, there is no HTTP request body, all - fields are passed via URL path and URL query parameters. - - Path template syntax - ~~~~~~~~~~~~~~~~~~~~ - - :: - - Template = "/" Segments [ Verb ] ; - Segments = Segment { "/" Segment } ; - Segment = "*" | "**" | LITERAL | Variable ; - Variable = "{" FieldPath [ "=" Segments ] "}" ; - FieldPath = IDENT { "." IDENT } ; - Verb = ":" LITERAL ; - - The syntax ``*`` matches a single URL path segment. The syntax ``**`` - matches zero or more URL path segments, which must be the last part of - the URL path except the ``Verb``. - - The syntax ``Variable`` matches part of the URL path as specified by its - template. A variable template must not contain other variables. If a - variable matches a single path segment, its template may be omitted, - e.g. ``{var}`` is equivalent to ``{var=*}``. - - The syntax ``LITERAL`` matches literal text in the URL path. If the - ``LITERAL`` contains any reserved character, such characters should be - percent-encoded before the matching. - - If a variable contains exactly one path segment, such as ``"{var}"`` or - ``"{var=*}"``, when such a variable is expanded into a URL path on the - client side, all characters except ``[-_.~0-9a-zA-Z]`` are - percent-encoded. The server side does the reverse decoding. Such - variables show up in the `Discovery - Document `__ - as ``{var}``. - - If a variable contains multiple path segments, such as ``"{var=foo/*}"`` - or ``"{var=**}"``, when such a variable is expanded into a URL path on - the client side, all characters except ``[-_.~/0-9a-zA-Z]`` are - percent-encoded. The server side does the reverse decoding, except "%2F" - and "%2f" are left unchanged. Such variables show up in the `Discovery - Document `__ - as ``{+var}``. - - ## Using gRPC API Service Configuration - - gRPC API Service Configuration (service config) is a configuration - language for configuring a gRPC service to become a user-facing product. - The service config is simply the YAML representation of the - ``google.api.Service`` proto message. - - As an alternative to annotating your proto file, you can configure gRPC - transcoding in your service config YAML files. You do this by specifying - a ``HttpRule`` that maps the gRPC method to a REST endpoint, achieving - the same effect as the proto annotation. This can be particularly useful - if you have a proto that is reused in multiple services. Note that any - transcoding specified in the service config will override any matching - transcoding configuration in the proto. - - Example: - - :: - - http: - rules: - # Selects a gRPC method and applies HttpRule to it. - - selector: example.v1.Messaging.GetMessage - get: /v1/messages/{message_id}/{sub.subfield} - - ## Special notes - - When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the - proto to JSON conversion must follow the `proto3 - specification `__. - - While the single segment variable follows the semantics of `RFC - 6570 `__ Section 3.2.2 Simple - String Expansion, the multi segment variable **does not** follow RFC - 6570 Section 3.2.3 Reserved Expansion. The reason is that the Reserved - Expansion does not expand special characters like ``?`` and ``#``, which - would lead to invalid URLs. As the result, gRPC Transcoding uses a - custom encoding for multi segment variables. - - The path variables **must not** refer to any repeated or mapped field, - because client libraries are not capable of handling such variable - expansion. - - The path variables **must not** capture the leading "/" character. The - reason is that the most common use case "{var}" does not capture the - leading "/" character. For consistency, all path variables must share - the same behavior. - - Repeated message fields must not be mapped to URL query parameters, - because no client library can support such complicated mapping. - - If an API needs to use a JSON array for request or response body, it can - map the request or response body to a repeated field. However, some gRPC - Transcoding implementations may not support this feature. + Lists insights for a Cloud project. Requires the recommender.*.list + IAM permission for the specified insight type. Example: >>> from google.cloud import recommender_v1beta1 @@ -548,16 +270,22 @@ def list_insights( ... pass Args: - parent (str): Denotes a field as required. This indicates that the field **must** - be provided as part of the request, and failure to do so will cause an - error (usually ``INVALID_ARGUMENT``). + parent (str): Required. The container resource on which to execute the request. + Acceptable formats: + + 1. + + "projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]", + + LOCATION here refers to GCP Locations: + https://cloud.google.com/about/locations/ page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. - filter_ (str): Can be set for action 'test' for advanced matching for the value of - 'path' field. Either this or ``value`` will be set for 'test' operation. + filter_ (str): Optional. Filter expression to restrict the insights returned. + Supported filter fields: state Eg: \`state:"DISMISSED" or state:"ACTIVE" 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. @@ -630,10 +358,8 @@ def get_insight( metadata=None, ): """ - Optional. If present, retrieves the next batch of results from the - preceding call to this method. ``page_token`` must be the value of - ``next_page_token`` from the previous response. The values of other - method parameters must be identical to those in the previous call. + Gets the requested insight. Requires the recommender.*.get IAM + permission for the specified insight type. Example: >>> from google.cloud import recommender_v1beta1 @@ -704,9 +430,12 @@ def mark_insight_accepted( metadata=None, ): """ - Selects a method to which this rule applies. + Marks the Insight State as Accepted. Users can use this method to + indicate to the Recommender API that they have applied some action based + on the insight. This stops the insight content from being updated. - Refer to ``selector`` for syntax details. + MarkInsightAccepted can be applied to insights in ACTIVE state. Requires + the recommender.*.update IAM permission for the specified insight. Example: >>> from google.cloud import recommender_v1beta1 @@ -723,37 +452,8 @@ def mark_insight_accepted( Args: name (str): Required. Name of the insight. etag (str): Required. Fingerprint of the Insight. Provides optimistic locking. - state_metadata (dict[str -> str]): Protocol Buffers - Google's data interchange format Copyright 2008 - Google Inc. All rights reserved. - https://developers.google.com/protocol-buffers/ - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - :: - - * Redistributions of source code must retain the above copyright - - notice, this list of conditions and the following disclaimer. \* - Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. \* - Neither the name of Google Inc. nor the names of its contributors may be - used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + state_metadata (dict[str -> str]): Optional. State properties user wish to include with this state. + Full replace of the current state_metadata. 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. @@ -814,9 +514,8 @@ def list_recommendations( metadata=None, ): """ - Can be set with action 'copy' or 'move' to indicate the source field - within resource or source_resource, ignored if provided for other - operation types. + Lists recommendations for a Cloud project. Requires the + recommender.*.list IAM permission for the specified recommender. Example: >>> from google.cloud import recommender_v1beta1 @@ -840,26 +539,23 @@ def list_recommendations( ... pass Args: - parent (str): Set of filters to apply if ``path`` refers to array elements or - nested array elements in order to narrow down to a single unique element - that is being tested/modified. This is intended to be an exact match per - filter. To perform advanced matching, use path_value_matchers. - - - Example: { "/versions/*/name" : "it-123" - "/versions/*/targetSize/percent": 20 } - - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/condition" - : null } - - Example: { "/bindings/*/role": "roles/admin" "/bindings/*/members/*" - : ["x@google.com", "y@google.com"] } When both path_filters and - path_value_matchers are set, an implicit AND must be performed. + parent (str): Required. The container resource on which to execute the request. + Acceptable formats: + + 1. + + "projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]", + + LOCATION here refers to GCP Locations: + https://cloud.google.com/about/locations/ page_size (int): The maximum number of resources contained in the underlying API response. If page streaming is performed per- resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page. - filter_ (str): ``ListValue`` is a wrapper around a repeated field of values. - - The JSON representation for ``ListValue`` is JSON array. + filter_ (str): Filter expression to restrict the recommendations returned. + Supported filter fields: state_info.state Eg: + \`state_info.state:"DISMISSED" or state_info.state:"FAILED" 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. @@ -932,17 +628,8 @@ def get_recommendation( metadata=None, ): """ - The resource type that the annotated field references. - - Example: - - :: - - message Subscription { - string topic = 2 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - } + Gets the requested recommendation. Requires the recommender.*.get + IAM permission for the specified recommender. Example: >>> from google.cloud import recommender_v1beta1 @@ -1013,8 +700,17 @@ def mark_recommendation_claimed( metadata=None, ): """ - Optional. Filter expression to restrict the insights returned. - Supported filter fields: state Eg: \`state:"DISMISSED" or state:"ACTIVE" + Marks the Recommendation State as Claimed. Users can use this method + to indicate to the Recommender API that they are starting to apply the + recommendation themselves. This stops the recommendation content from + being updated. Associated insights are frozen and placed in the ACCEPTED + state. + + MarkRecommendationClaimed can be applied to recommendations in CLAIMED + or ACTIVE state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Example: >>> from google.cloud import recommender_v1beta1 @@ -1031,8 +727,10 @@ def mark_recommendation_claimed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): Recommendation resource name, e.g. - projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/recommendations/[RECOMMENDATION_ID] + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. @@ -1095,10 +793,17 @@ def mark_recommendation_succeeded( metadata=None, ): """ - Value for the ``path`` field. Will be set for - actions:'add'/'replace'. Maybe set for action: 'test'. Either this or - ``value_matcher`` will be set for 'test' operation. An exact match must - be performed. + Marks the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. Associated insights are + frozen and placed in the ACCEPTED state. + + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Example: >>> from google.cloud import recommender_v1beta1 @@ -1115,17 +820,10 @@ def mark_recommendation_succeeded( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): The jstype option determines the JavaScript type used for values of - the field. The option is permitted only for 64 bit integral and fixed - types (int64, uint64, sint64, fixed64, sfixed64). A field with jstype - JS_STRING is represented as JavaScript string, which avoids loss of - precision that can happen when a large value is converted to a floating - point JavaScript. Specifying JS_NUMBER for the jstype causes the - generated JavaScript code to use the JavaScript "number" type. The - behavior of the default option JS_NORMAL is implementation dependent. - - This option is an enum to permit additional types to be added, e.g. - goog.math.Integer. + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. @@ -1188,7 +886,17 @@ def mark_recommendation_failed( metadata=None, ): """ - Request for the ``MarkRecommendationFailed`` Method. + Marks the Recommendation State as Failed. Users can use this method + to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation failed. This stops the + recommendation content from being updated. Associated insights are + frozen and placed in the ACCEPTED state. + + MarkRecommendationFailed can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Example: >>> from google.cloud import recommender_v1beta1 @@ -1205,7 +913,10 @@ def mark_recommendation_failed( Args: name (str): Required. Name of the recommendation. etag (str): Required. Fingerprint of the Recommendation. Provides optimistic locking. - state_metadata (dict[str -> str]): The set of insights for the ``parent`` resource. + state_metadata (dict[str -> str]): State properties to include with this state. Overwrites any existing + ``state_metadata``. Keys must match the regex + ``/^[a-z0-9][a-z0-9_.-]{0,62}$/``. Values must match the regex + ``/^[a-zA-Z0-9_./-]{0,255}$/``. 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. diff --git a/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py b/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py index d763734..fd2d573 100644 --- a/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py +++ b/google/cloud/recommender_v1beta1/gapic/transports/recommender_grpc_transport.py @@ -111,286 +111,8 @@ def channel(self): def list_insights(self): """Return the gRPC stub for :meth:`RecommenderClient.list_insights`. - # gRPC Transcoding - - gRPC Transcoding is a feature for mapping between a gRPC method and one - or more HTTP REST endpoints. It allows developers to build a single API - service that supports both gRPC APIs and REST APIs. Many systems, - including `Google APIs `__, - `Cloud Endpoints `__, `gRPC - Gateway `__, and - `Envoy `__ proxy support this - feature and use it for large scale production services. - - ``HttpRule`` defines the schema of the gRPC/REST mapping. The mapping - specifies how different portions of the gRPC request message are mapped - to the URL path, URL query parameters, and HTTP request body. It also - controls how the gRPC response message is mapped to the HTTP response - body. ``HttpRule`` is typically specified as an ``google.api.http`` - annotation on the gRPC method. - - Each mapping specifies a URL path template and an HTTP method. The path - template may refer to one or more fields in the gRPC request message, as - long as each field is a non-repeated field with a primitive - (non-message) type. The path template controls how fields of the request - message are mapped to the URL path. - - Example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get: "/v1/{name=messages/*}" - }; - } - } - message GetMessageRequest { - string name = 1; // Mapped to URL path. - } - message Message { - string text = 1; // The resource content. - } - - This enables an HTTP REST to gRPC mapping as below: - - HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| - ``GetMessage(name: "messages/123456")`` - - Any fields in the request message which are not bound by the path - template automatically become HTTP query parameters if there is no HTTP - request body. For example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get:"/v1/messages/{message_id}" - }; - } - } - message GetMessageRequest { - message SubMessage { - string subfield = 1; - } - string message_id = 1; // Mapped to URL path. - int64 revision = 2; // Mapped to URL query parameter `revision`. - SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. - } - - This enables a HTTP JSON to RPC mapping as below: - - HTTP \| gRPC -----|----- - ``GET /v1/messages/123456?revision=2&sub.subfield=foo`` \| - ``GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`` - - Note that fields which are mapped to URL query parameters must have a - primitive type or a repeated primitive type or a non-repeated message - type. In the case of a repeated type, the parameter can be repeated in - the URL as ``...?param=A¶m=B``. In the case of a message type, each - field of the message is mapped to a separate parameter, such as - ``...?foo.a=A&foo.b=B&foo.c=C``. - - For HTTP methods that allow a request body, the ``body`` field specifies - the mapping. Consider a REST update method on the message resource - collection: - - :: - - service Messaging { - rpc UpdateMessage(UpdateMessageRequest) returns (Message) { - option (google.api.http) = { - patch: "/v1/messages/{message_id}" - body: "message" - }; - } - } - message UpdateMessageRequest { - string message_id = 1; // mapped to the URL - Message message = 2; // mapped to the body - } - - The following HTTP JSON to RPC mapping is enabled, where the - representation of the JSON in the request body is determined by protos - JSON encoding: - - HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` - \| ``UpdateMessage(message_id: "123456" message { text: "Hi!" })`` - - The special name ``*`` can be used in the body mapping to define that - every field not bound by the path template should be mapped to the - request body. This enables the following alternative definition of the - update method: - - :: - - service Messaging { - rpc UpdateMessage(Message) returns (Message) { - option (google.api.http) = { - patch: "/v1/messages/{message_id}" - body: "*" - }; - } - } - message Message { - string message_id = 1; - string text = 2; - } - - The following HTTP JSON to RPC mapping is enabled: - - HTTP \| gRPC -----|----- ``PATCH /v1/messages/123456 { "text": "Hi!" }`` - \| ``UpdateMessage(message_id: "123456" text: "Hi!")`` - - Note that when using ``*`` in the body mapping, it is not possible to - have HTTP parameters, as all fields not bound by the path end in the - body. This makes this option more rarely used in practice when defining - REST APIs. The common usage of ``*`` is in custom methods which don't - use the URL at all for transferring data. - - It is possible to define multiple HTTP methods for one RPC by using the - ``additional_bindings`` option. Example: - - :: - - service Messaging { - rpc GetMessage(GetMessageRequest) returns (Message) { - option (google.api.http) = { - get: "/v1/messages/{message_id}" - additional_bindings { - get: "/v1/users/{user_id}/messages/{message_id}" - } - }; - } - } - message GetMessageRequest { - string message_id = 1; - string user_id = 2; - } - - This enables the following two alternative HTTP JSON to RPC mappings: - - HTTP \| gRPC -----|----- ``GET /v1/messages/123456`` \| - ``GetMessage(message_id: "123456")`` - ``GET /v1/users/me/messages/123456`` \| - ``GetMessage(user_id: "me" message_id: "123456")`` - - ## Rules for HTTP mapping - - 1. Leaf request fields (recursive expansion nested messages in the - request message) are classified into three categories: - - - Fields referred by the path template. They are passed via the URL - path. - - Fields referred by the ``HttpRule.body``. They are passed via the - HTTP request body. - - All other fields are passed via the URL query parameters, and the - parameter name is the field path in the request message. A - repeated field can be represented as multiple query parameters - under the same name. - - 2. If ``HttpRule.body`` is "*", there is no URL query parameter, all - fields are passed via URL path and HTTP request body. - 3. If ``HttpRule.body`` is omitted, there is no HTTP request body, all - fields are passed via URL path and URL query parameters. - - Path template syntax - ~~~~~~~~~~~~~~~~~~~~ - - :: - - Template = "/" Segments [ Verb ] ; - Segments = Segment { "/" Segment } ; - Segment = "*" | "**" | LITERAL | Variable ; - Variable = "{" FieldPath [ "=" Segments ] "}" ; - FieldPath = IDENT { "." IDENT } ; - Verb = ":" LITERAL ; - - The syntax ``*`` matches a single URL path segment. The syntax ``**`` - matches zero or more URL path segments, which must be the last part of - the URL path except the ``Verb``. - - The syntax ``Variable`` matches part of the URL path as specified by its - template. A variable template must not contain other variables. If a - variable matches a single path segment, its template may be omitted, - e.g. ``{var}`` is equivalent to ``{var=*}``. - - The syntax ``LITERAL`` matches literal text in the URL path. If the - ``LITERAL`` contains any reserved character, such characters should be - percent-encoded before the matching. - - If a variable contains exactly one path segment, such as ``"{var}"`` or - ``"{var=*}"``, when such a variable is expanded into a URL path on the - client side, all characters except ``[-_.~0-9a-zA-Z]`` are - percent-encoded. The server side does the reverse decoding. Such - variables show up in the `Discovery - Document `__ - as ``{var}``. - - If a variable contains multiple path segments, such as ``"{var=foo/*}"`` - or ``"{var=**}"``, when such a variable is expanded into a URL path on - the client side, all characters except ``[-_.~/0-9a-zA-Z]`` are - percent-encoded. The server side does the reverse decoding, except "%2F" - and "%2f" are left unchanged. Such variables show up in the `Discovery - Document `__ - as ``{+var}``. - - ## Using gRPC API Service Configuration - - gRPC API Service Configuration (service config) is a configuration - language for configuring a gRPC service to become a user-facing product. - The service config is simply the YAML representation of the - ``google.api.Service`` proto message. - - As an alternative to annotating your proto file, you can configure gRPC - transcoding in your service config YAML files. You do this by specifying - a ``HttpRule`` that maps the gRPC method to a REST endpoint, achieving - the same effect as the proto annotation. This can be particularly useful - if you have a proto that is reused in multiple services. Note that any - transcoding specified in the service config will override any matching - transcoding configuration in the proto. - - Example: - - :: - - http: - rules: - # Selects a gRPC method and applies HttpRule to it. - - selector: example.v1.Messaging.GetMessage - get: /v1/messages/{message_id}/{sub.subfield} - - ## Special notes - - When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the - proto to JSON conversion must follow the `proto3 - specification `__. - - While the single segment variable follows the semantics of `RFC - 6570 `__ Section 3.2.2 Simple - String Expansion, the multi segment variable **does not** follow RFC - 6570 Section 3.2.3 Reserved Expansion. The reason is that the Reserved - Expansion does not expand special characters like ``?`` and ``#``, which - would lead to invalid URLs. As the result, gRPC Transcoding uses a - custom encoding for multi segment variables. - - The path variables **must not** refer to any repeated or mapped field, - because client libraries are not capable of handling such variable - expansion. - - The path variables **must not** capture the leading "/" character. The - reason is that the most common use case "{var}" does not capture the - leading "/" character. For consistency, all path variables must share - the same behavior. - - Repeated message fields must not be mapped to URL query parameters, - because no client library can support such complicated mapping. - - If an API needs to use a JSON array for request or response body, it can - map the request or response body to a repeated field. However, some gRPC - Transcoding implementations may not support this feature. + Lists insights for a Cloud project. Requires the recommender.*.list + IAM permission for the specified insight type. Returns: Callable: A callable which accepts the appropriate @@ -403,10 +125,8 @@ def list_insights(self): def get_insight(self): """Return the gRPC stub for :meth:`RecommenderClient.get_insight`. - Optional. If present, retrieves the next batch of results from the - preceding call to this method. ``page_token`` must be the value of - ``next_page_token`` from the previous response. The values of other - method parameters must be identical to those in the previous call. + Gets the requested insight. Requires the recommender.*.get IAM + permission for the specified insight type. Returns: Callable: A callable which accepts the appropriate @@ -419,9 +139,12 @@ def get_insight(self): def mark_insight_accepted(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_insight_accepted`. - Selects a method to which this rule applies. + Marks the Insight State as Accepted. Users can use this method to + indicate to the Recommender API that they have applied some action based + on the insight. This stops the insight content from being updated. - Refer to ``selector`` for syntax details. + MarkInsightAccepted can be applied to insights in ACTIVE state. Requires + the recommender.*.update IAM permission for the specified insight. Returns: Callable: A callable which accepts the appropriate @@ -434,9 +157,8 @@ def mark_insight_accepted(self): def list_recommendations(self): """Return the gRPC stub for :meth:`RecommenderClient.list_recommendations`. - Can be set with action 'copy' or 'move' to indicate the source field - within resource or source_resource, ignored if provided for other - operation types. + Lists recommendations for a Cloud project. Requires the + recommender.*.list IAM permission for the specified recommender. Returns: Callable: A callable which accepts the appropriate @@ -449,17 +171,8 @@ def list_recommendations(self): def get_recommendation(self): """Return the gRPC stub for :meth:`RecommenderClient.get_recommendation`. - The resource type that the annotated field references. - - Example: - - :: - - message Subscription { - string topic = 2 [(google.api.resource_reference) = { - type: "pubsub.googleapis.com/Topic" - }]; - } + Gets the requested recommendation. Requires the recommender.*.get + IAM permission for the specified recommender. Returns: Callable: A callable which accepts the appropriate @@ -472,8 +185,17 @@ def get_recommendation(self): def mark_recommendation_claimed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_claimed`. - Optional. Filter expression to restrict the insights returned. - Supported filter fields: state Eg: \`state:"DISMISSED" or state:"ACTIVE" + Marks the Recommendation State as Claimed. Users can use this method + to indicate to the Recommender API that they are starting to apply the + recommendation themselves. This stops the recommendation content from + being updated. Associated insights are frozen and placed in the ACCEPTED + state. + + MarkRecommendationClaimed can be applied to recommendations in CLAIMED + or ACTIVE state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Returns: Callable: A callable which accepts the appropriate @@ -486,10 +208,17 @@ def mark_recommendation_claimed(self): def mark_recommendation_succeeded(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_succeeded`. - Value for the ``path`` field. Will be set for - actions:'add'/'replace'. Maybe set for action: 'test'. Either this or - ``value_matcher`` will be set for 'test' operation. An exact match must - be performed. + Marks the Recommendation State as Succeeded. Users can use this + method to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation was successful. This stops + the recommendation content from being updated. Associated insights are + frozen and placed in the ACCEPTED state. + + MarkRecommendationSucceeded can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Returns: Callable: A callable which accepts the appropriate @@ -502,7 +231,17 @@ def mark_recommendation_succeeded(self): def mark_recommendation_failed(self): """Return the gRPC stub for :meth:`RecommenderClient.mark_recommendation_failed`. - Request for the ``MarkRecommendationFailed`` Method. + Marks the Recommendation State as Failed. Users can use this method + to indicate to the Recommender API that they have applied the + recommendation themselves, and the operation failed. This stops the + recommendation content from being updated. Associated insights are + frozen and placed in the ACCEPTED state. + + MarkRecommendationFailed can be applied to recommendations in ACTIVE, + CLAIMED, SUCCEEDED, or FAILED state. + + Requires the recommender.*.update IAM permission for the specified + recommender. Returns: Callable: A callable which accepts the appropriate diff --git a/google/cloud/recommender_v1beta1/proto/insight_pb2.py b/google/cloud/recommender_v1beta1/proto/insight_pb2.py index 049d50f..6f51f39 100644 --- a/google/cloud/recommender_v1beta1/proto/insight_pb2.py +++ b/google/cloud/recommender_v1beta1/proto/insight_pb2.py @@ -579,8 +579,7 @@ Insight state. state_metadata: A map of metadata for the state, provided by user or - automations systems. .. [1] a-z0-9 .. [2] a-z0-9 .. - [3] a-z0-9 + automations systems. """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.InsightStateInfo) }, diff --git a/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py b/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py index 3f9c9a1..0954a7e 100644 --- a/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py +++ b/google/cloud/recommender_v1beta1/proto/recommendation_pb2.py @@ -1117,9 +1117,7 @@ Attributes: insight: - Insight resource name, e.g. projects/[PROJECT_NUMBER]/location - s/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ - ID] + Insight resource name, e.g. ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID]`` """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.Recommendation.InsightReference) }, diff --git a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py index 1b50e1e..ac9a5a0 100644 --- a/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py +++ b/google/cloud/recommender_v1beta1/proto/recommender_service_pb2.py @@ -1208,11 +1208,12 @@ state_metadata: State properties to include with this state. Overwrites any existing ``state_metadata``. Keys must match the regex ``/ - [1]_[a-z0-9_.-]{0,62}/``. Values must match the regex + [3]_[a-z0-9_.-]{0,62}/``. Values must match the regex ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides - optimistic locking. + optimistic locking. .. [1] a-z0-9 .. [2] a-z0-9 .. + [3] a-z0-9 """, # @@protoc_insertion_point(class_scope:google.cloud.recommender.v1beta1.MarkRecommendationClaimedRequest) }, @@ -1280,7 +1281,7 @@ state_metadata: State properties to include with this state. Overwrites any existing ``state_metadata``. Keys must match the regex ``/ - [3]_[a-z0-9_.-]{0,62}/``. Values must match the regex + [1]_[a-z0-9_.-]{0,62}/``. Values must match the regex ``/^[a-zA-Z0-9_./-]{0,255}/``. etag: Required. Fingerprint of the Recommendation. Provides diff --git a/synth.metadata b/synth.metadata index 2ccb875..01e407a 100644 --- a/synth.metadata +++ b/synth.metadata @@ -1,12 +1,19 @@ { - "updateTime": "2020-03-13T12:17:59.665819Z", + "updateTime": "2020-03-14T00:25:36.917796Z", "sources": [ + { + "git": { + "name": ".", + "remote": "git@github.com:googleapis/python-recommender.git", + "sha": "b8f198ecb1d36afa16d9054653ebbb811e7dbd91" + } + }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "7d569be2928dbd72b4e261bf9e468f23afd2b950", - "internalRef": "300718800" + "sha": "8386761d09819b665b6a6e1e6d6ff884bc8ff781", + "internalRef": "300843960" } }, { diff --git a/synth.py b/synth.py index 7790539..2cf1995 100644 --- a/synth.py +++ b/synth.py @@ -47,6 +47,16 @@ flags=re.MULTILINE | re.DOTALL, ) +# Fix multiline path +s.replace( + "google/**/recommendation_pb2.py", + """projects/\[PROJECT_NUMBER\]/location + s/\[LOCATION\]/insightTypes/\[INSIGHT\_TYPE\_ID\]/insights/\[INSIGHT_ + ID\]""", + """``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]/insights/[INSIGHT_ID]``""" +) + + python.fix_pb2_headers() python.fix_pb2_grpc_headers()