RecommenderClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Provides insights and recommendations for cloud customers for various categories like performance optimization, cost savings, reliability, feature discovery, etc. Insights and recommendations are generated automatically based on analysis of user resources, configuration and monitoring metrics.
Inheritance
builtins.object > google.cloud.recommender_v1beta1.gapic.recommender_client.RecommenderClient > RecommenderClientMethods
RecommenderClient
RecommenderClient(
transport=None,
channel=None,
credentials=None,
client_config=None,
client_info=None,
client_options=None,
)
Constructor.
Name | Description |
channel |
grpc.Channel
DEPRECATED. A |
credentials |
google.auth.credentials.Credentials
The authorization credentials to attach to requests. These credentials identify this application to the service. If none are specified, the client will attempt to ascertain the credentials from the environment. This argument is mutually exclusive with providing a transport instance to |
client_config |
dict
DEPRECATED. A dictionary of call options for each method. If not specified, the default configuration is used. |
client_info |
google.api_core.gapic_v1.client_info.ClientInfo
The client info used to send a user-agent string along with API requests. If |
client_options |
Union[dict, google.api_core.client_options.ClientOptions]
Client options used to set user options on the client. API Endpoint should be set through client_options. |
from_service_account_file
from_service_account_file(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
RecommenderClient | The constructed client. |
from_service_account_json
from_service_account_json(filename, *args, **kwargs)
Creates an instance of this client using the provided credentials file.
Name | Description |
filename |
str
The path to the service account private key json file. |
Type | Description |
RecommenderClient | The constructed client. |
get_recommendation
get_recommendation(name, retry=<object object>, timeout=<object object>, metadata=None)
Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.
.. rubric:: Example
from google.cloud import recommender_v1beta1
client = recommender_v1beta1.RecommenderClient()
name = client.recommendation_path('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]')
response = client.get_recommendation(name)
Name | Description |
name |
str
Required. Name of the recommendation. |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
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. |
list_recommendations
list_recommendations(parent, page_size=None, filter_=None, retry=<object object>, timeout=<object object>, metadata=None)
Lists recommendations for a Cloud project. Requires the recommender.*.list IAM permission for the specified recommender.
.. rubric:: Example
from google.cloud import recommender_v1beta1
client = recommender_v1beta1.RecommenderClient()
parent = client.recommender_path('[PROJECT]', '[LOCATION]', '[RECOMMENDER]')
Iterate over all results
for element in client.list_recommendations(parent): ... # process element ... pass
Alternatively:
Iterate over results one page at a time
for page in client.list_recommendations(parent).pages: ... for element in page: ... # process element ... pass
Name | Description |
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
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 |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
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. |
mark_recommendation_claimed
mark_recommendation_claimed(name, etag, state_metadata=None, retry=<object object>, timeout=<object object>, 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.
.. rubric:: Example
from google.cloud import recommender_v1beta1
client = recommender_v1beta1.RecommenderClient()
name = client.recommendation_path('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]')
TODO: Initialize
etag
:etag = ''
response = client.mark_recommendation_claimed(name, etag)
Name | Description |
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
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. |
mark_recommendation_failed
mark_recommendation_failed(name, etag, state_metadata=None, retry=<object object>, timeout=<object object>, 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.
.. rubric:: Example
from google.cloud import recommender_v1beta1
client = recommender_v1beta1.RecommenderClient()
name = client.recommendation_path('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]')
TODO: Initialize
etag
:etag = ''
response = client.mark_recommendation_failed(name, etag)
Name | Description |
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
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. |
mark_recommendation_succeeded
mark_recommendation_succeeded(name, etag, state_metadata=None, retry=<object object>, timeout=<object object>, 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.
.. rubric:: Example
from google.cloud import recommender_v1beta1
client = recommender_v1beta1.RecommenderClient()
name = client.recommendation_path('[PROJECT]', '[LOCATION]', '[RECOMMENDER]', '[RECOMMENDATION]')
TODO: Initialize
etag
:etag = ''
response = client.mark_recommendation_succeeded(name, etag)
Name | Description |
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 |
retry |
Optional[google.api_core.retry.Retry]
A retry object used to retry requests. If |
timeout |
Optional[float]
The amount of time, in seconds, to wait for the request to complete. Note that if |
metadata |
Optional[Sequence[Tuple[str, str]]]
Additional metadata that is provided to the method. |
Type | Description |
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. |
recommendation_path
recommendation_path(project, location, recommender, recommendation)
DEPRECATED. Return a fully-qualified recommendation string.
recommender_path
recommender_path(project, location, recommender)
DEPRECATED. Return a fully-qualified recommender string.