As of January 1, 2020 this library no longer supports Python 2 on the latest released version. Library versions released prior to that date will continue to be available. For more information please visit Python 2 support on Google Cloud.

Recommender

class google.cloud.recommender_v1beta1.services.recommender.RecommenderAsyncClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport, typing.Callable[[...], google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport]]] = 'grpc_asyncio', client_options: typing.Optional[google.api_core.client_options.ClientOptions] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

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.

Instantiates the recommender async client.

Parameters
  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

  • transport (Optional[Union[str,RecommenderTransport,Callable[..., RecommenderTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport to use. If a Callable is given, it will be called with the same set of initialization arguments as used in the RecommenderTransport constructor. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • 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 None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTlsChannelError – If mutual TLS transport creation failed for any reason.

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

static common_billing_account_path(billing_account: str) str

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str

Returns a fully-qualified location string.

static common_organization_path(organization: str) str

Returns a fully-qualified organization string.

static common_project_path(project: str) str

Returns a fully-qualified project string.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderAsyncClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderAsyncClient

classmethod from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderAsyncClient

async get_insight(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetInsightRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight.Insight[source]

Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_get_insight():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetInsightRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_insight(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.GetInsightRequest, dict]]) – The request object. Request to the GetInsight method.

  • name (str) – Required. Name of the insight. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An insight along with the information used to derive the insight. The insight may have associated recommendations as well.

Return type

google.cloud.recommender_v1beta1.types.Insight

async get_insight_type_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetInsightTypeConfigRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig[source]

Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_get_insight_type_config():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetInsightTypeConfigRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_insight_type_config(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.GetInsightTypeConfigRequest, dict]]) – The request object. Request for the GetInsightTypeConfig` method.

  • name (str) –

    Required. Name of the InsightTypeConfig to get.

    Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    • projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    • organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Configuration for an InsightType.

Return type

google.cloud.recommender_v1beta1.types.InsightTypeConfig

classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameters

client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Returns

returns the API endpoint and the

client cert source to use.

Return type

Tuple[str, Callable[[], Tuple[bytes, bytes]]]

Raises

google.auth.exceptions.MutualTLSChannelError – If any errors happen.

async get_recommendation(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetRecommendationRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_get_recommendation():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetRecommendationRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_recommendation(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.GetRecommendationRequest, dict]]) – The request object. Request to the GetRecommendation method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

async get_recommender_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetRecommenderConfigRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig[source]

Gets the requested Recommender Config. There is only one instance of the config for each Recommender.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_get_recommender_config():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetRecommenderConfigRequest(
        name="name_value",
    )

    # Make the request
    response = await client.get_recommender_config(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.GetRecommenderConfigRequest, dict]]) – The request object. Request for the GetRecommenderConfig` method.

  • name (str) –

    Required. Name of the Recommendation Config to get.

    Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    • projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    • organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Configuration for a Recommender.

Return type

google.cloud.recommender_v1beta1.types.RecommenderConfig

classmethod get_transport_class(label: Optional[str] = None) Type[google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport]

Returns an appropriate transport class.

Parameters

label – The name of the desired transport. If none is provided, then the first transport in the registry is used.

Returns

The transport class to use.

static insight_path(project: str, location: str, insight_type: str, insight: str) str

Returns a fully-qualified insight string.

static insight_type_config_path(project: str, location: str, insight_type: str) str

Returns a fully-qualified insight_type_config string.

static insight_type_path(project: str, location: str, insight_type: str) str

Returns a fully-qualified insight_type string.

async list_insight_types(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesAsyncPager[source]

Lists available InsightTypes. No IAM permissions are required.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_insight_types():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListInsightTypesRequest(
    )

    # Make the request
    page_result = client.list_insight_types(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.ListInsightTypesRequest, dict]]) – The request object. Request for the ListInsightTypes method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for the ListInsightTypes method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesAsyncPager

async list_insights(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsAsyncPager[source]

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

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_insights():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListInsightsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_insights(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.ListInsightsRequest, dict]]) – The request object. Request for the ListInsights method.

  • parent (str) –

    Required. The container resource on which to execute the request. Acceptable formats:

    • 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.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response to the ListInsights method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsAsyncPager

async list_recommendations(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsAsyncPager[source]

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

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_recommendations():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListRecommendationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_recommendations(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.ListRecommendationsRequest, dict]]) – The request object. Request for the ListRecommendations method.

  • parent (str) –

    Required. The container resource on which to execute the request. Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]

    • projects/[PROJECT_ID]/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 refers to supported recommenders: https://cloud.google.com/recommender/docs/recommenders.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) –

    Filter expression to restrict the recommendations 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 should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response to the ListRecommendations method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsAsyncPager

async list_recommenders(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersAsyncPager[source]

Lists all available Recommenders. No IAM permissions are required.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_list_recommenders():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListRecommendersRequest(
    )

    # Make the request
    page_result = client.list_recommenders(request=request)

    # Handle the response
    async for response in page_result:
        print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.ListRecommendersRequest, dict]]) – The request object. Request for the ListRecommender method.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response for the ListRecommender method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersAsyncPager

async mark_insight_accepted(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkInsightAcceptedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight.Insight[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_mark_insight_accepted():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkInsightAcceptedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = await client.mark_insight_accepted(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.MarkInsightAcceptedRequest, dict]]) – The request object. Request for the MarkInsightAccepted method.

  • name (str) – Required. Name of the insight. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[str, str]) –

    Optional. State properties user wish to include with this state. Full replace of the current state_metadata.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Insight. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An insight along with the information used to derive the insight. The insight may have associated recommendations as well.

Return type

google.cloud.recommender_v1beta1.types.Insight

async mark_recommendation_claimed(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationClaimedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_mark_recommendation_claimed():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationClaimedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = await client.mark_recommendation_claimed(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.MarkRecommendationClaimedRequest, dict]]) – The request object. Request for the MarkRecommendationClaimed Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

async mark_recommendation_failed(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationFailedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_mark_recommendation_failed():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationFailedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = await client.mark_recommendation_failed(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.MarkRecommendationFailedRequest, dict]]) – The request object. Request for the MarkRecommendationFailed Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

async mark_recommendation_succeeded(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationSucceededRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_mark_recommendation_succeeded():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationSucceededRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = await client.mark_recommendation_succeeded(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Optional[Union[google.cloud.recommender_v1beta1.types.MarkRecommendationSucceededRequest, dict]]) – The request object. Request for the MarkRecommendationSucceeded Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry_async.AsyncRetry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

static parse_common_billing_account_path(path: str) Dict[str, str]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str]

Parse a project path into its component segments.

static parse_insight_path(path: str) Dict[str, str]

Parses a insight path into its component segments.

static parse_insight_type_config_path(path: str) Dict[str, str]

Parses a insight_type_config path into its component segments.

static parse_insight_type_path(path: str) Dict[str, str]

Parses a insight_type path into its component segments.

static parse_recommendation_path(path: str) Dict[str, str]

Parses a recommendation path into its component segments.

static parse_recommender_config_path(path: str) Dict[str, str]

Parses a recommender_config path into its component segments.

static parse_recommender_path(path: str) Dict[str, str]

Parses a recommender path into its component segments.

static recommendation_path(project: str, location: str, recommender: str, recommendation: str) str

Returns a fully-qualified recommendation string.

static recommender_config_path(project: str, location: str, recommender: str) str

Returns a fully-qualified recommender_config string.

static recommender_path(project: str, location: str, recommender: str) str

Returns a fully-qualified recommender string.

property transport: google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport

Returns the transport used by the client instance.

Returns

The transport used by the client instance.

Return type

RecommenderTransport

property universe_domain: str

Return the universe domain used by the client instance.

Returns

The universe domain used

by the client instance.

Return type

str

async update_insight_type_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.UpdateInsightTypeConfigRequest, dict]] = None, *, insight_type_config: Optional[google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig[source]

Updates an InsightTypeConfig change. This will create a new revision of the config.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_update_insight_type_config():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.UpdateInsightTypeConfigRequest(
    )

    # Make the request
    response = await client.update_insight_type_config(request=request)

    # Handle the response
    print(response)
Parameters
Returns

Configuration for an InsightType.

Return type

google.cloud.recommender_v1beta1.types.InsightTypeConfig

async update_recommender_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.UpdateRecommenderConfigRequest, dict]] = None, *, recommender_config: Optional[google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig[source]

Updates a Recommender Config. This will create a new revision of the config.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

async def sample_update_recommender_config():
    # Create a client
    client = recommender_v1beta1.RecommenderAsyncClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.UpdateRecommenderConfigRequest(
    )

    # Make the request
    response = await client.update_recommender_config(request=request)

    # Handle the response
    print(response)
Parameters
Returns

Configuration for a Recommender.

Return type

google.cloud.recommender_v1beta1.types.RecommenderConfig

class google.cloud.recommender_v1beta1.services.recommender.RecommenderClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport, typing.Callable[[...], google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport]]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)[source]

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.

Instantiates the recommender client.

Parameters
  • credentials (Optional[google.auth.credentials.Credentials]) – The authorization credentials to attach to requests. These credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment.

  • transport (Optional[Union[str,RecommenderTransport,Callable[..., RecommenderTransport]]]) – The transport to use, or a Callable that constructs and returns a new transport. If a Callable is given, it will be called with the same set of initialization arguments as used in the RecommenderTransport constructor. If set to None, a transport is chosen automatically.

  • client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]) –

    Custom options for the client.

    1. The api_endpoint property can be used to override the default endpoint provided by the client when transport is not explicitly provided. Only if this property is not set and transport was not explicitly provided, the endpoint is determined by the GOOGLE_API_USE_MTLS_ENDPOINT environment variable, which have one of the following values: “always” (always use the default mTLS endpoint), “never” (always use the default regular endpoint) and “auto” (auto-switch to the default mTLS endpoint if client certificate is present; this is the default value).

    2. If the GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “true”, then the client_cert_source property can be used to provide a client certificate for mTLS transport. If not provided, the default SSL client certificate will be used if present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is “false” or not set, no client certificate will be used.

    3. The universe_domain property can be used to override the default “googleapis.com” universe. Note that the api_endpoint property still takes precedence; and universe_domain is currently not supported for mTLS.

  • 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 None, then default info will be used. Generally, you only need to set this if you’re developing your own client library.

Raises

google.auth.exceptions.MutualTLSChannelError – If mutual TLS transport creation failed for any reason.

__exit__(type, value, traceback)[source]

Releases underlying transport’s resources.

Warning

ONLY use as a context manager if the transport is NOT shared with other clients! Exiting the with block will CLOSE the transport and may cause errors in other clients!

property api_endpoint

Return the API endpoint used by the client instance.

Returns

The API endpoint used by the client instance.

Return type

str

static common_billing_account_path(billing_account: str) str[source]

Returns a fully-qualified billing_account string.

static common_folder_path(folder: str) str[source]

Returns a fully-qualified folder string.

static common_location_path(project: str, location: str) str[source]

Returns a fully-qualified location string.

static common_organization_path(organization: str) str[source]

Returns a fully-qualified organization string.

static common_project_path(project: str) str[source]

Returns a fully-qualified project string.

classmethod from_service_account_file(filename: str, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderClient

classmethod from_service_account_info(info: dict, *args, **kwargs)[source]
Creates an instance of this client using the provided credentials

info.

Parameters
  • info (dict) – The service account private key info.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderClient

classmethod from_service_account_json(filename: str, *args, **kwargs)
Creates an instance of this client using the provided credentials

file.

Parameters
  • filename (str) – The path to the service account private key json file.

  • args – Additional arguments to pass to the constructor.

  • kwargs – Additional arguments to pass to the constructor.

Returns

The constructed client.

Return type

RecommenderClient

get_insight(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetInsightRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight.Insight[source]

Gets the requested insight. Requires the recommender.*.get IAM permission for the specified insight type.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_get_insight():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetInsightRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_insight(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.GetInsightRequest, dict]) – The request object. Request to the GetInsight method.

  • name (str) – Required. Name of the insight. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An insight along with the information used to derive the insight. The insight may have associated recommendations as well.

Return type

google.cloud.recommender_v1beta1.types.Insight

get_insight_type_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetInsightTypeConfigRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig[source]

Gets the requested InsightTypeConfig. There is only one instance of the config for each InsightType.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_get_insight_type_config():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetInsightTypeConfigRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_insight_type_config(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.GetInsightTypeConfigRequest, dict]) – The request object. Request for the GetInsightTypeConfig` method.

  • name (str) –

    Required. Name of the InsightTypeConfig to get.

    Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    • projects/[PROJECT_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    • organizations/[ORGANIZATION_ID]/locations/global/recommenders/[INSIGHT_TYPE_ID]/config

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Configuration for an InsightType.

Return type

google.cloud.recommender_v1beta1.types.InsightTypeConfig

classmethod get_mtls_endpoint_and_cert_source(client_options: Optional[google.api_core.client_options.ClientOptions] = None)[source]

Deprecated. Return the API endpoint and client cert source for mutual TLS.

The client cert source is determined in the following order: (1) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is not “true”, the client cert source is None. (2) if client_options.client_cert_source is provided, use the provided one; if the default client cert source exists, use the default one; otherwise the client cert source is None.

The API endpoint is determined in the following order: (1) if client_options.api_endpoint if provided, use the provided one. (2) if GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable is “always”, use the default mTLS endpoint; if the environment variable is “never”, use the default API endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise use the default API endpoint.

More details can be found at https://google.aip.dev/auth/4114.

Parameters

client_options (google.api_core.client_options.ClientOptions) – Custom options for the client. Only the api_endpoint and client_cert_source properties may be used in this method.

Returns

returns the API endpoint and the

client cert source to use.

Return type

Tuple[str, Callable[[], Tuple[bytes, bytes]]]

Raises

google.auth.exceptions.MutualTLSChannelError – If any errors happen.

get_recommendation(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetRecommendationRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

Gets the requested recommendation. Requires the recommender.*.get IAM permission for the specified recommender.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_get_recommendation():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetRecommendationRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_recommendation(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.GetRecommendationRequest, dict]) – The request object. Request to the GetRecommendation method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

get_recommender_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.GetRecommenderConfigRequest, dict]] = None, *, name: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig[source]

Gets the requested Recommender Config. There is only one instance of the config for each Recommender.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_get_recommender_config():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.GetRecommenderConfigRequest(
        name="name_value",
    )

    # Make the request
    response = client.get_recommender_config(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.GetRecommenderConfigRequest, dict]) – The request object. Request for the GetRecommenderConfig` method.

  • name (str) –

    Required. Name of the Recommendation Config to get.

    Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    • projects/[PROJECT_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    • organizations/[ORGANIZATION_ID]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]/config

    This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Configuration for a Recommender.

Return type

google.cloud.recommender_v1beta1.types.RecommenderConfig

static insight_path(project: str, location: str, insight_type: str, insight: str) str[source]

Returns a fully-qualified insight string.

static insight_type_config_path(project: str, location: str, insight_type: str) str[source]

Returns a fully-qualified insight_type_config string.

static insight_type_path(project: str, location: str, insight_type: str) str[source]

Returns a fully-qualified insight_type string.

list_insight_types(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesPager[source]

Lists available InsightTypes. No IAM permissions are required.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_list_insight_types():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListInsightTypesRequest(
    )

    # Make the request
    page_result = client.list_insight_types(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
Returns

Response for the ListInsightTypes method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesPager

list_insights(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsRequest, dict]] = None, *, parent: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsPager[source]

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

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_list_insights():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListInsightsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_insights(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.ListInsightsRequest, dict]) – The request object. Request for the ListInsights method.

  • parent (str) –

    Required. The container resource on which to execute the request. Acceptable formats:

    • 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.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response to the ListInsights method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsPager

list_recommendations(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsRequest, dict]] = None, *, parent: Optional[str] = None, filter: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsPager[source]

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

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_list_recommendations():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListRecommendationsRequest(
        parent="parent_value",
    )

    # Make the request
    page_result = client.list_recommendations(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.ListRecommendationsRequest, dict]) – The request object. Request for the ListRecommendations method.

  • parent (str) –

    Required. The container resource on which to execute the request. Acceptable formats:

    • projects/[PROJECT_NUMBER]/locations/[LOCATION]/recommenders/[RECOMMENDER_ID]

    • projects/[PROJECT_ID]/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 refers to supported recommenders: https://cloud.google.com/recommender/docs/recommenders.

    This corresponds to the parent field on the request instance; if request is provided, this should not be set.

  • filter (str) –

    Filter expression to restrict the recommendations 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 should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

Response to the ListRecommendations method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsPager

list_recommenders(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersRequest, dict]] = None, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersPager[source]

Lists all available Recommenders. No IAM permissions are required.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_list_recommenders():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.ListRecommendersRequest(
    )

    # Make the request
    page_result = client.list_recommenders(request=request)

    # Handle the response
    for response in page_result:
        print(response)
Parameters
Returns

Response for the ListRecommender method.

Iterating over this object will yield results and resolve additional pages automatically.

Return type

google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersPager

mark_insight_accepted(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkInsightAcceptedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight.Insight[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_mark_insight_accepted():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkInsightAcceptedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = client.mark_insight_accepted(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.MarkInsightAcceptedRequest, dict]) – The request object. Request for the MarkInsightAccepted method.

  • name (str) – Required. Name of the insight. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[str, str]) –

    Optional. State properties user wish to include with this state. Full replace of the current state_metadata.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Insight. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

An insight along with the information used to derive the insight. The insight may have associated recommendations as well.

Return type

google.cloud.recommender_v1beta1.types.Insight

mark_recommendation_claimed(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationClaimedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_mark_recommendation_claimed():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationClaimedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = client.mark_recommendation_claimed(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.MarkRecommendationClaimedRequest, dict]) – The request object. Request for the MarkRecommendationClaimed Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

mark_recommendation_failed(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationFailedRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_mark_recommendation_failed():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationFailedRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = client.mark_recommendation_failed(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.MarkRecommendationFailedRequest, dict]) – The request object. Request for the MarkRecommendationFailed Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

mark_recommendation_succeeded(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.MarkRecommendationSucceededRequest, dict]] = None, *, name: Optional[str] = None, state_metadata: Optional[MutableMapping[str, str]] = None, etag: Optional[str] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommendation.Recommendation[source]

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.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_mark_recommendation_succeeded():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.MarkRecommendationSucceededRequest(
        name="name_value",
        etag="etag_value",
    )

    # Make the request
    response = client.mark_recommendation_succeeded(request=request)

    # Handle the response
    print(response)
Parameters
  • request (Union[google.cloud.recommender_v1beta1.types.MarkRecommendationSucceededRequest, dict]) – The request object. Request for the MarkRecommendationSucceeded Method.

  • name (str) – Required. Name of the recommendation. This corresponds to the name field on the request instance; if request is provided, this should not be set.

  • state_metadata (MutableMapping[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}$/.

    This corresponds to the state_metadata field on the request instance; if request is provided, this should not be set.

  • etag (str) –

    Required. Fingerprint of the Recommendation. Provides optimistic locking.

    This corresponds to the etag field on the request instance; if request is provided, this should not be set.

  • retry (google.api_core.retry.Retry) – Designation of what errors, if any, should be retried.

  • timeout (float) – The timeout for this request.

  • metadata (Sequence[Tuple[str, str]]) – Strings which should be sent along with the request as metadata.

Returns

A recommendation along with a suggested action. E.g., a rightsizing recommendation for an underutilized VM, IAM role recommendations, etc

Return type

google.cloud.recommender_v1beta1.types.Recommendation

static parse_common_billing_account_path(path: str) Dict[str, str][source]

Parse a billing_account path into its component segments.

static parse_common_folder_path(path: str) Dict[str, str][source]

Parse a folder path into its component segments.

static parse_common_location_path(path: str) Dict[str, str][source]

Parse a location path into its component segments.

static parse_common_organization_path(path: str) Dict[str, str][source]

Parse a organization path into its component segments.

static parse_common_project_path(path: str) Dict[str, str][source]

Parse a project path into its component segments.

static parse_insight_path(path: str) Dict[str, str][source]

Parses a insight path into its component segments.

static parse_insight_type_config_path(path: str) Dict[str, str][source]

Parses a insight_type_config path into its component segments.

static parse_insight_type_path(path: str) Dict[str, str][source]

Parses a insight_type path into its component segments.

static parse_recommendation_path(path: str) Dict[str, str][source]

Parses a recommendation path into its component segments.

static parse_recommender_config_path(path: str) Dict[str, str][source]

Parses a recommender_config path into its component segments.

static parse_recommender_path(path: str) Dict[str, str][source]

Parses a recommender path into its component segments.

static recommendation_path(project: str, location: str, recommender: str, recommendation: str) str[source]

Returns a fully-qualified recommendation string.

static recommender_config_path(project: str, location: str, recommender: str) str[source]

Returns a fully-qualified recommender_config string.

static recommender_path(project: str, location: str, recommender: str) str[source]

Returns a fully-qualified recommender string.

property transport: google.cloud.recommender_v1beta1.services.recommender.transports.base.RecommenderTransport

Returns the transport used by the client instance.

Returns

The transport used by the client

instance.

Return type

RecommenderTransport

property universe_domain: str

Return the universe domain used by the client instance.

Returns

The universe domain used by the client instance.

Return type

str

update_insight_type_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.UpdateInsightTypeConfigRequest, dict]] = None, *, insight_type_config: Optional[google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.insight_type_config.InsightTypeConfig[source]

Updates an InsightTypeConfig change. This will create a new revision of the config.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_update_insight_type_config():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.UpdateInsightTypeConfigRequest(
    )

    # Make the request
    response = client.update_insight_type_config(request=request)

    # Handle the response
    print(response)
Parameters
Returns

Configuration for an InsightType.

Return type

google.cloud.recommender_v1beta1.types.InsightTypeConfig

update_recommender_config(request: Optional[Union[google.cloud.recommender_v1beta1.types.recommender_service.UpdateRecommenderConfigRequest, dict]] = None, *, recommender_config: Optional[google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig] = None, update_mask: Optional[google.protobuf.field_mask_pb2.FieldMask] = None, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ()) google.cloud.recommender_v1beta1.types.recommender_config.RecommenderConfig[source]

Updates a Recommender Config. This will create a new revision of the config.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import recommender_v1beta1

def sample_update_recommender_config():
    # Create a client
    client = recommender_v1beta1.RecommenderClient()

    # Initialize request argument(s)
    request = recommender_v1beta1.UpdateRecommenderConfigRequest(
    )

    # Make the request
    response = client.update_recommender_config(request=request)

    # Handle the response
    print(response)
Parameters
Returns

Configuration for a Recommender.

Return type

google.cloud.recommender_v1beta1.types.RecommenderConfig

class google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesAsyncPager(method: Callable[[...], Awaitable[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesResponse]], request: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_insight_types requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListInsightTypesResponse object, and provides an __aiter__ method to iterate through its insight_types field.

If there are more pages, the __aiter__ method will make additional ListInsightTypes requests and continue to iterate through the insight_types field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListInsightTypesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightTypesPager(method: Callable[[...], google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesResponse], request: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightTypesResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_insight_types requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListInsightTypesResponse object, and provides an __iter__ method to iterate through its insight_types field.

If there are more pages, the __iter__ method will make additional ListInsightTypes requests and continue to iterate through the insight_types field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListInsightTypesResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsAsyncPager(method: Callable[[...], Awaitable[google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsResponse]], request: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_insights requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListInsightsResponse object, and provides an __aiter__ method to iterate through its insights field.

If there are more pages, the __aiter__ method will make additional ListInsights requests and continue to iterate through the insights field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListInsightsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListInsightsPager(method: Callable[[...], google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsResponse], request: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListInsightsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_insights requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListInsightsResponse object, and provides an __iter__ method to iterate through its insights field.

If there are more pages, the __iter__ method will make additional ListInsights requests and continue to iterate through the insights field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListInsightsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsAsyncPager(method: Callable[[...], Awaitable[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsResponse]], request: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_recommendations requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListRecommendationsResponse object, and provides an __aiter__ method to iterate through its recommendations field.

If there are more pages, the __aiter__ method will make additional ListRecommendations requests and continue to iterate through the recommendations field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListRecommendationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendationsPager(method: Callable[[...], google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsResponse], request: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendationsResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_recommendations requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListRecommendationsResponse object, and provides an __iter__ method to iterate through its recommendations field.

If there are more pages, the __iter__ method will make additional ListRecommendations requests and continue to iterate through the recommendations field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListRecommendationsResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersAsyncPager(method: Callable[[...], Awaitable[google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersResponse]], request: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary_async.AsyncRetry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_recommenders requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListRecommendersResponse object, and provides an __aiter__ method to iterate through its recommenders field.

If there are more pages, the __aiter__ method will make additional ListRecommenders requests and continue to iterate through the recommenders field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListRecommendersResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiates the pager.

Parameters
class google.cloud.recommender_v1beta1.services.recommender.pagers.ListRecommendersPager(method: Callable[[...], google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersResponse], request: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersRequest, response: google.cloud.recommender_v1beta1.types.recommender_service.ListRecommendersResponse, *, retry: Optional[Union[google.api_core.retry.retry_unary.Retry, google.api_core.gapic_v1.method._MethodDefault]] = _MethodDefault._DEFAULT_VALUE, timeout: Union[float, object] = _MethodDefault._DEFAULT_VALUE, metadata: Sequence[Tuple[str, str]] = ())[source]

A pager for iterating through list_recommenders requests.

This class thinly wraps an initial google.cloud.recommender_v1beta1.types.ListRecommendersResponse object, and provides an __iter__ method to iterate through its recommenders field.

If there are more pages, the __iter__ method will make additional ListRecommenders requests and continue to iterate through the recommenders field on the corresponding responses.

All the usual google.cloud.recommender_v1beta1.types.ListRecommendersResponse attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup.

Instantiate the pager.

Parameters