Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions google/cloud/recommender/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from google.cloud.recommender_v1.types.recommendation import Recommendation
from google.cloud.recommender_v1.types.recommendation import RecommendationContent
from google.cloud.recommender_v1.types.recommendation import RecommendationStateInfo
from google.cloud.recommender_v1.types.recommendation import SecurityProjection
from google.cloud.recommender_v1.types.recommendation import ValueMatcher
from google.cloud.recommender_v1.types.recommender_service import GetInsightRequest
from google.cloud.recommender_v1.types.recommender_service import (
Expand Down Expand Up @@ -66,6 +67,7 @@
"Recommendation",
"RecommendationContent",
"RecommendationStateInfo",
"SecurityProjection",
"ValueMatcher",
"GetInsightRequest",
"GetRecommendationRequest",
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/recommender_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from .types.recommendation import Recommendation
from .types.recommendation import RecommendationContent
from .types.recommendation import RecommendationStateInfo
from .types.recommendation import SecurityProjection
from .types.recommendation import ValueMatcher
from .types.recommender_service import GetInsightRequest
from .types.recommender_service import GetRecommendationRequest
Expand Down Expand Up @@ -60,5 +61,6 @@
"RecommendationContent",
"RecommendationStateInfo",
"RecommenderClient",
"SecurityProjection",
"ValueMatcher",
)
52 changes: 41 additions & 11 deletions google/cloud/recommender_v1/services/recommender/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ async def list_insights(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListInsightsAsyncPager:
r"""Lists insights for a Cloud project. Requires the
r"""Lists insights for the specified Cloud Resource. Requires the
recommender.*.list IAM permission for the specified insight
type.

Expand All @@ -237,14 +237,20 @@ async def list_insights(
Required. The container resource on which to execute the
request. Acceptable formats:

1.
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

"projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
- ``projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

LOCATION here refers to GCP Locations:
https://cloud.google.com/about/locations/
INSIGHT_TYPE_ID refers to supported insight types:
https://cloud.google.com/recommender/docs/insights/insight-types.)
https://cloud.google.com/recommender/docs/insights/insight-types.

This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -508,8 +514,9 @@ async def list_recommendations(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListRecommendationsAsyncPager:
r"""Lists recommendations for a Cloud project. Requires the
recommender.*.list IAM permission for the specified recommender.
r"""Lists recommendations for the specified Cloud Resource. Requires
the recommender.*.list IAM permission for the specified
recommender.

Args:
request (Union[google.cloud.recommender_v1.types.ListRecommendationsRequest, dict]):
Expand All @@ -519,9 +526,15 @@ async def list_recommendations(
Required. The container resource on which to execute the
request. Acceptable formats:

1.
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

"projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

LOCATION here refers to GCP Locations:
https://cloud.google.com/about/locations/ RECOMMENDER_ID
Expand All @@ -533,9 +546,26 @@ async def list_recommendations(
should not be set.
filter (:class:`str`):
Filter expression to restrict the recommendations
returned. Supported filter fields: state_info.state Eg:
\`state_info.state:"DISMISSED" or
state_info.state:"FAILED"
returned. Supported filter fields:

- ``state_info.state``

- ``recommenderSubtype``

- ``priority``

Examples:

- ``stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED``

- ``recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE``

- ``priority = P1 OR priority = P2``

- ``stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)``

(These expressions are based on the filter language
described at https://google.aip.dev/160)

This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
52 changes: 41 additions & 11 deletions google/cloud/recommender_v1/services/recommender/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def list_insights(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListInsightsPager:
r"""Lists insights for a Cloud project. Requires the
r"""Lists insights for the specified Cloud Resource. Requires the
recommender.*.list IAM permission for the specified insight
type.

Expand All @@ -486,14 +486,20 @@ def list_insights(
Required. The container resource on which to execute the
request. Acceptable formats:

1.
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

"projects/[PROJECT_NUMBER]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]",
- ``projects/[PROJECT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``folders/[FOLDER_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/insightTypes/[INSIGHT_TYPE_ID]``

LOCATION here refers to GCP Locations:
https://cloud.google.com/about/locations/
INSIGHT_TYPE_ID refers to supported insight types:
https://cloud.google.com/recommender/docs/insights/insight-types.)
https://cloud.google.com/recommender/docs/insights/insight-types.

This corresponds to the ``parent`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down Expand Up @@ -736,8 +742,9 @@ def list_recommendations(
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> pagers.ListRecommendationsPager:
r"""Lists recommendations for a Cloud project. Requires the
recommender.*.list IAM permission for the specified recommender.
r"""Lists recommendations for the specified Cloud Resource. Requires
the recommender.*.list IAM permission for the specified
recommender.

Args:
request (Union[google.cloud.recommender_v1.types.ListRecommendationsRequest, dict]):
Expand All @@ -747,9 +754,15 @@ def list_recommendations(
Required. The container resource on which to execute the
request. Acceptable formats:

1.
- ``projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

"projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]",
- ``billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``folders/[FOLDER_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

- ``organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]``

LOCATION here refers to GCP Locations:
https://cloud.google.com/about/locations/ RECOMMENDER_ID
Expand All @@ -761,9 +774,26 @@ def list_recommendations(
should not be set.
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"
returned. Supported filter fields:

- ``state_info.state``

- ``recommenderSubtype``

- ``priority``

Examples:

- ``stateInfo.state = ACTIVE OR stateInfo.state = DISMISSED``

- ``recommenderSubtype = REMOVE_ROLE OR recommenderSubtype = REPLACE_ROLE``

- ``priority = P1 OR priority = P2``

- ``stateInfo.state = ACTIVE AND (priority = P1 OR priority = P2)``

(These expressions are based on the filter language
described at https://google.aip.dev/160)

This corresponds to the ``filter`` field
on the ``request`` instance; if ``request`` is provided, this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def list_insights(
]:
r"""Return a callable for the list insights method over gRPC.

Lists insights for a Cloud project. Requires the
Lists insights for the specified Cloud Resource. Requires the
recommender.*.list IAM permission for the specified insight
type.

Expand Down Expand Up @@ -331,8 +331,9 @@ def list_recommendations(
]:
r"""Return a callable for the list recommendations method over gRPC.

Lists recommendations for a Cloud project. Requires the
recommender.*.list IAM permission for the specified recommender.
Lists recommendations for the specified Cloud Resource. Requires
the recommender.*.list IAM permission for the specified
recommender.

Returns:
Callable[[~.ListRecommendationsRequest],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def list_insights(
]:
r"""Return a callable for the list insights method over gRPC.

Lists insights for a Cloud project. Requires the
Lists insights for the specified Cloud Resource. Requires the
recommender.*.list IAM permission for the specified insight
type.

Expand Down Expand Up @@ -335,8 +335,9 @@ def list_recommendations(
]:
r"""Return a callable for the list recommendations method over gRPC.

Lists recommendations for a Cloud project. Requires the
recommender.*.list IAM permission for the specified recommender.
Lists recommendations for the specified Cloud Resource. Requires
the recommender.*.list IAM permission for the specified
recommender.

Returns:
Callable[[~.ListRecommendationsRequest],
Expand Down
2 changes: 2 additions & 0 deletions google/cloud/recommender_v1/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
Recommendation,
RecommendationContent,
RecommendationStateInfo,
SecurityProjection,
ValueMatcher,
)
from .recommender_service import (
Expand All @@ -50,6 +51,7 @@
"Recommendation",
"RecommendationContent",
"RecommendationStateInfo",
"SecurityProjection",
"ValueMatcher",
"GetInsightRequest",
"GetRecommendationRequest",
Expand Down
11 changes: 11 additions & 0 deletions google/cloud/recommender_v1/types/insight.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ class Insight(proto.Message):
Information state and metadata.
category (google.cloud.recommender_v1.types.Insight.Category):
Category being targeted by the insight.
severity (google.cloud.recommender_v1.types.Insight.Severity):
Insight's severity.
etag (str):
Fingerprint of the Insight. Provides
optimistic locking when updating states.
Expand All @@ -71,6 +73,14 @@ class Category(proto.Enum):
PERFORMANCE = 3
MANAGEABILITY = 4

class Severity(proto.Enum):
r"""Insight severity levels."""
SEVERITY_UNSPECIFIED = 0
LOW = 1
MEDIUM = 2
HIGH = 3
CRITICAL = 4

class RecommendationReference(proto.Message):
r"""Reference to an associated recommendation.

Expand All @@ -95,6 +105,7 @@ class RecommendationReference(proto.Message):
)
state_info = proto.Field(proto.MESSAGE, number=6, message="InsightStateInfo",)
category = proto.Field(proto.ENUM, number=7, enum=Category,)
severity = proto.Field(proto.ENUM, number=15, enum=Severity,)
etag = proto.Field(proto.STRING, number=11,)
associated_recommendations = proto.RepeatedField(
proto.MESSAGE, number=8, message=RecommendationReference,
Expand Down
Loading