Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 7c578fe

Browse files
feat(v1): add recommendation priority / insight severity (#165)
- [ ] Regenerate this pull request now. Incorporate above new features, as well as update .bazel files. PiperOrigin-RevId: 424391246 Source-Link: googleapis/googleapis@2060f89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7bd16df69dbf75915ff8f96698510c90061161af Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2JkMTZkZjY5ZGJmNzU5MTVmZjhmOTY2OTg1MTBjOTAwNjExNjFhZiJ9 feat(v1): add recommendation xor_group_id feat(v1): add recommendation security projection
1 parent f108fb9 commit 7c578fe

File tree

11 files changed

+256
-39
lines changed

11 files changed

+256
-39
lines changed

google/cloud/recommender/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from google.cloud.recommender_v1.types.recommendation import Recommendation
2929
from google.cloud.recommender_v1.types.recommendation import RecommendationContent
3030
from google.cloud.recommender_v1.types.recommendation import RecommendationStateInfo
31+
from google.cloud.recommender_v1.types.recommendation import SecurityProjection
3132
from google.cloud.recommender_v1.types.recommendation import ValueMatcher
3233
from google.cloud.recommender_v1.types.recommender_service import GetInsightRequest
3334
from google.cloud.recommender_v1.types.recommender_service import (
@@ -66,6 +67,7 @@
6667
"Recommendation",
6768
"RecommendationContent",
6869
"RecommendationStateInfo",
70+
"SecurityProjection",
6971
"ValueMatcher",
7072
"GetInsightRequest",
7173
"GetRecommendationRequest",

google/cloud/recommender_v1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from .types.recommendation import Recommendation
2727
from .types.recommendation import RecommendationContent
2828
from .types.recommendation import RecommendationStateInfo
29+
from .types.recommendation import SecurityProjection
2930
from .types.recommendation import ValueMatcher
3031
from .types.recommender_service import GetInsightRequest
3132
from .types.recommender_service import GetRecommendationRequest
@@ -60,5 +61,6 @@
6061
"RecommendationContent",
6162
"RecommendationStateInfo",
6263
"RecommenderClient",
64+
"SecurityProjection",
6365
"ValueMatcher",
6466
)

google/cloud/recommender_v1/services/recommender/async_client.py

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ async def list_insights(
225225
timeout: float = None,
226226
metadata: Sequence[Tuple[str, str]] = (),
227227
) -> pagers.ListInsightsAsyncPager:
228-
r"""Lists insights for a Cloud project. Requires the
228+
r"""Lists insights for the specified Cloud Resource. Requires the
229229
recommender.*.list IAM permission for the specified insight
230230
type.
231231
@@ -237,14 +237,20 @@ async def list_insights(
237237
Required. The container resource on which to execute the
238238
request. Acceptable formats:
239239
240-
1.
240+
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
241241
242-
"projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
242+
- ``projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
243+
244+
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
245+
246+
- ``folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
247+
248+
- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
243249
244250
LOCATION here refers to GCP Locations:
245251
https://cloud.google.com/about/locations/
246252
INSIGHT_TYPE_ID refers to supported insight types:
247-
https://cloud.google.com/recommender/docs/insights/insight-types.)
253+
https://cloud.google.com/recommender/docs/insights/insight-types.
248254
249255
This corresponds to the ``parent`` field
250256
on the ``request`` instance; if ``request`` is provided, this
@@ -508,8 +514,9 @@ async def list_recommendations(
508514
timeout: float = None,
509515
metadata: Sequence[Tuple[str, str]] = (),
510516
) -> pagers.ListRecommendationsAsyncPager:
511-
r"""Lists recommendations for a Cloud project. Requires the
512-
recommender.*.list IAM permission for the specified recommender.
517+
r"""Lists recommendations for the specified Cloud Resource. Requires
518+
the recommender.*.list IAM permission for the specified
519+
recommender.
513520
514521
Args:
515522
request (Union[google.cloud.recommender_v1.types.ListRecommendationsRequest, dict]):
@@ -519,9 +526,15 @@ async def list_recommendations(
519526
Required. The container resource on which to execute the
520527
request. Acceptable formats:
521528
522-
1.
529+
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
530+
531+
- ``projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
523532
524-
"projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
533+
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
534+
535+
- ``folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
536+
537+
- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
525538
526539
LOCATION here refers to GCP Locations:
527540
https://cloud.google.com/about/locations/ RECOMMENDER_ID
@@ -533,9 +546,26 @@ async def list_recommendations(
533546
should not be set.
534547
filter (:class:`str`):
535548
Filter expression to restrict the recommendations
536-
returned. Supported filter fields: state_info.state Eg:
537-
\`state_info.state:"DISMISSED" or
538-
state_info.state:"FAILED"
549+
returned. Supported filter fields:
550+
551+
- ``state_info.state``
552+
553+
- ``recommenderSubtype``
554+
555+
- ``priority``
556+
557+
Examples:
558+
559+
- ``stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED``
560+
561+
- ``recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE``
562+
563+
- ``priority = P1 OR priority = P2``
564+
565+
- ``stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)``
566+
567+
(These expressions are based on the filter language
568+
described at https://google.aip.dev/160)
539569
540570
This corresponds to the ``filter`` field
541571
on the ``request`` instance; if ``request`` is provided, this

google/cloud/recommender_v1/services/recommender/client.py

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def list_insights(
474474
timeout: float = None,
475475
metadata: Sequence[Tuple[str, str]] = (),
476476
) -> pagers.ListInsightsPager:
477-
r"""Lists insights for a Cloud project. Requires the
477+
r"""Lists insights for the specified Cloud Resource. Requires the
478478
recommender.*.list IAM permission for the specified insight
479479
type.
480480
@@ -486,14 +486,20 @@ def list_insights(
486486
Required. The container resource on which to execute the
487487
request. Acceptable formats:
488488
489-
1.
489+
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
490490
491-
"projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
491+
- ``projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
492+
493+
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
494+
495+
- ``folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
496+
497+
- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``
492498
493499
LOCATION here refers to GCP Locations:
494500
https://cloud.google.com/about/locations/
495501
INSIGHT_TYPE_ID refers to supported insight types:
496-
https://cloud.google.com/recommender/docs/insights/insight-types.)
502+
https://cloud.google.com/recommender/docs/insights/insight-types.
497503
498504
This corresponds to the ``parent`` field
499505
on the ``request`` instance; if ``request`` is provided, this
@@ -736,8 +742,9 @@ def list_recommendations(
736742
timeout: float = None,
737743
metadata: Sequence[Tuple[str, str]] = (),
738744
) -> pagers.ListRecommendationsPager:
739-
r"""Lists recommendations for a Cloud project. Requires the
740-
recommender.*.list IAM permission for the specified recommender.
745+
r"""Lists recommendations for the specified Cloud Resource. Requires
746+
the recommender.*.list IAM permission for the specified
747+
recommender.
741748
742749
Args:
743750
request (Union[google.cloud.recommender_v1.types.ListRecommendationsRequest, dict]):
@@ -747,9 +754,15 @@ def list_recommendations(
747754
Required. The container resource on which to execute the
748755
request. Acceptable formats:
749756
750-
1.
757+
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
758+
759+
- ``projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
751760
752-
"projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
761+
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
762+
763+
- ``folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
764+
765+
- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``
753766
754767
LOCATION here refers to GCP Locations:
755768
https://cloud.google.com/about/locations/ RECOMMENDER_ID
@@ -761,9 +774,26 @@ def list_recommendations(
761774
should not be set.
762775
filter (str):
763776
Filter expression to restrict the recommendations
764-
returned. Supported filter fields: state_info.state Eg:
765-
\`state_info.state:"DISMISSED" or
766-
state_info.state:"FAILED"
777+
returned. Supported filter fields:
778+
779+
- ``state_info.state``
780+
781+
- ``recommenderSubtype``
782+
783+
- ``priority``
784+
785+
Examples:
786+
787+
- ``stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED``
788+
789+
- ``recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE``
790+
791+
- ``priority = P1 OR priority = P2``
792+
793+
- ``stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)``
794+
795+
(These expressions are based on the filter language
796+
described at https://google.aip.dev/160)
767797
768798
This corresponds to the ``filter`` field
769799
on the ``request`` instance; if ``request`` is provided, this

google/cloud/recommender_v1/services/recommender/transports/grpc.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def list_insights(
240240
]:
241241
r"""Return a callable for the list insights method over gRPC.
242242
243-
Lists insights for a Cloud project. Requires the
243+
Lists insights for the specified Cloud Resource. Requires the
244244
recommender.*.list IAM permission for the specified insight
245245
type.
246246
@@ -331,8 +331,9 @@ def list_recommendations(
331331
]:
332332
r"""Return a callable for the list recommendations method over gRPC.
333333
334-
Lists recommendations for a Cloud project. Requires the
335-
recommender.*.list IAM permission for the specified recommender.
334+
Lists recommendations for the specified Cloud Resource. Requires
335+
the recommender.*.list IAM permission for the specified
336+
recommender.
336337
337338
Returns:
338339
Callable[[~.ListRecommendationsRequest],

google/cloud/recommender_v1/services/recommender/transports/grpc_asyncio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def list_insights(
242242
]:
243243
r"""Return a callable for the list insights method over gRPC.
244244
245-
Lists insights for a Cloud project. Requires the
245+
Lists insights for the specified Cloud Resource. Requires the
246246
recommender.*.list IAM permission for the specified insight
247247
type.
248248
@@ -335,8 +335,9 @@ def list_recommendations(
335335
]:
336336
r"""Return a callable for the list recommendations method over gRPC.
337337
338-
Lists recommendations for a Cloud project. Requires the
339-
recommender.*.list IAM permission for the specified recommender.
338+
Lists recommendations for the specified Cloud Resource. Requires
339+
the recommender.*.list IAM permission for the specified
340+
recommender.
340341
341342
Returns:
342343
Callable[[~.ListRecommendationsRequest],

google/cloud/recommender_v1/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
Recommendation,
2626
RecommendationContent,
2727
RecommendationStateInfo,
28+
SecurityProjection,
2829
ValueMatcher,
2930
)
3031
from .recommender_service import (
@@ -50,6 +51,7 @@
5051
"Recommendation",
5152
"RecommendationContent",
5253
"RecommendationStateInfo",
54+
"SecurityProjection",
5355
"ValueMatcher",
5456
"GetInsightRequest",
5557
"GetRecommendationRequest",

google/cloud/recommender_v1/types/insight.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ class Insight(proto.Message):
5656
Information state and metadata.
5757
category (google.cloud.recommender_v1.types.Insight.Category):
5858
Category being targeted by the insight.
59+
severity (google.cloud.recommender_v1.types.Insight.Severity):
60+
Insight's severity.
5961
etag (str):
6062
Fingerprint of the Insight. Provides
6163
optimistic locking when updating states.
@@ -71,6 +73,14 @@ class Category(proto.Enum):
7173
PERFORMANCE = 3
7274
MANAGEABILITY = 4
7375

76+
class Severity(proto.Enum):
77+
r"""Insight severity levels."""
78+
SEVERITY_UNSPECIFIED = 0
79+
LOW = 1
80+
MEDIUM = 2
81+
HIGH = 3
82+
CRITICAL = 4
83+
7484
class RecommendationReference(proto.Message):
7585
r"""Reference to an associated recommendation.
7686
@@ -95,6 +105,7 @@ class RecommendationReference(proto.Message):
95105
)
96106
state_info = proto.Field(proto.MESSAGE, number=6, message="InsightStateInfo",)
97107
category = proto.Field(proto.ENUM, number=7, enum=Category,)
108+
severity = proto.Field(proto.ENUM, number=15, enum=Severity,)
98109
etag = proto.Field(proto.STRING, number=11,)
99110
associated_recommendations = proto.RepeatedField(
100111
proto.MESSAGE, number=8, message=RecommendationReference,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy