Recommender V1 Client - Class RecommenderClient (1.8.2)

Reference documentation and code samples for the Recommender V1 Client class RecommenderClient.

Service Description: 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.

This class is currently experimental and may be subject to changes.

Namespace

Google \ Cloud \ Recommender \ V1 \ Client

Methods

__construct

Constructor.

Parameters
NameDescription
options array

Optional. Options for configuring the service API wrapper.

↳ apiEndpoint string

The address of the API remote host. May optionally include the port, formatted as "

↳ credentials string|array|FetchAuthTokenInterface|CredentialsWrapper

The credentials to be used by the client to authorize API calls. This option accepts either a path to a credentials file, or a decoded credentials file as a PHP array. Advanced usage: In addition, this option can also accept a pre-constructed Google\Auth\FetchAuthTokenInterface object or Google\ApiCore\CredentialsWrapper object. Note that when one of these objects are provided, any settings in $credentialsConfig will be ignored.

↳ credentialsConfig array

Options used to configure credentials, including auth token caching, for the client. For a full list of supporting configuration options, see Google\ApiCore\CredentialsWrapper::build() .

↳ disableRetries bool

Determines whether or not retries defined by the client configuration should be disabled. Defaults to false.

↳ clientConfig string|array

Client method configuration, including retry settings. This option can be either a path to a JSON file, or a PHP array containing the decoded JSON data. By default this settings points to the default client config file, which is provided in the resources folder.

↳ transport string|TransportInterface

The transport used for executing network requests. May be either the string rest or grpc. Defaults to grpc if gRPC support is detected on the system. Advanced usage: Additionally, it is possible to pass in an already instantiated Google\ApiCore\Transport\TransportInterface object. Note that when this object is provided, any settings in $transportConfig, and any $apiEndpoint setting, will be ignored.

↳ transportConfig array

Configuration options that will be used to construct the transport. Options for each supported transport type should be passed in a key for that transport. For example: $transportConfig = [ 'grpc' => [...], 'rest' => [...], ]; See the Google\ApiCore\Transport\GrpcTransport::build() and Google\ApiCore\Transport\RestTransport::build() methods for the supported options.

↳ clientCertSource callable

A callable which returns the client cert as a string. This can be used to provide a certificate and private key to the transport layer for mTLS.

getInsight

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::getInsightAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetInsightRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Insight

getInsightTypeConfig

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::getInsightTypeConfigAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetInsightTypeConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\InsightTypeConfig

getRecommendation

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::getRecommendationAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetRecommendationRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Recommendation

getRecommenderConfig

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::getRecommenderConfigAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetRecommenderConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\RecommenderConfig

listInsights

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::listInsightsAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\ListInsightsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse

listRecommendations

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::listRecommendationsAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\ListRecommendationsRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\ApiCore\PagedListResponse

markInsightAccepted

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.

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::markInsightAcceptedAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkInsightAcceptedRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Insight

markRecommendationClaimed

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, SUCCEEDED, FAILED, or ACTIVE state.

Requires the recommender.*.update IAM permission for the specified recommender.

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::markRecommendationClaimedAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationClaimedRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Recommendation

markRecommendationFailed

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.

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::markRecommendationFailedAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationFailedRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Recommendation

markRecommendationSucceeded

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.

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::markRecommendationSucceededAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationSucceededRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\Recommendation

updateInsightTypeConfig

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::updateInsightTypeConfigAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\UpdateInsightTypeConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\InsightTypeConfig

updateRecommenderConfig

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

The async variant is Google\Cloud\Recommender\V1\Client\BaseClient\self::updateRecommenderConfigAsync() .

Parameters
NameDescription
request Google\Cloud\Recommender\V1\UpdateRecommenderConfigRequest

A request to house fields associated with the call.

callOptions array

Optional.

↳ retrySettings RetrySettings|array

Retry settings to use for this call. Can be a Google\ApiCore\RetrySettings object, or an associative array of retry settings parameters. See the documentation on Google\ApiCore\RetrySettings for example usage.

Returns
TypeDescription
Google\Cloud\Recommender\V1\RecommenderConfig

getInsightAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetInsightRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getInsightTypeConfigAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetInsightTypeConfigRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getRecommendationAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetRecommendationRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

getRecommenderConfigAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\GetRecommenderConfigRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listInsightsAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\ListInsightsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

listRecommendationsAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\ListRecommendationsRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

markInsightAcceptedAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkInsightAcceptedRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

markRecommendationClaimedAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationClaimedRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

markRecommendationFailedAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationFailedRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

markRecommendationSucceededAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\MarkRecommendationSucceededRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateInsightTypeConfigAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\UpdateInsightTypeConfigRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

updateRecommenderConfigAsync

Parameters
NameDescription
request Google\Cloud\Recommender\V1\UpdateRecommenderConfigRequest
optionalArgs = [] array
Returns
TypeDescription
GuzzleHttp\Promise\PromiseInterface

static::billingAccountLocationInsightTypeName

Formats a string containing the fully-qualified path to represent a billing_account_location_insight_type resource.

Parameters
NameDescription
billingAccount string
location string
insightType string
Returns
TypeDescription
stringThe formatted billing_account_location_insight_type resource.

static::billingAccountLocationInsightTypeInsightName

Formats a string containing the fully-qualified path to represent a billing_account_location_insight_type_insight resource.

Parameters
NameDescription
billingAccount string
location string
insightType string
insight string
Returns
TypeDescription
stringThe formatted billing_account_location_insight_type_insight resource.

static::billingAccountLocationRecommenderName

Formats a string containing the fully-qualified path to represent a billing_account_location_recommender resource.

Parameters
NameDescription
billingAccount string
location string
recommender string
Returns
TypeDescription
stringThe formatted billing_account_location_recommender resource.

static::billingAccountLocationRecommenderRecommendationName

Formats a string containing the fully-qualified path to represent a billing_account_location_recommender_recommendation resource.

Parameters
NameDescription
billingAccount string
location string
recommender string
recommendation string
Returns
TypeDescription
stringThe formatted billing_account_location_recommender_recommendation resource.

static::folderLocationInsightTypeName

Formats a string containing the fully-qualified path to represent a folder_location_insight_type resource.

Parameters
NameDescription
folder string
location string
insightType string
Returns
TypeDescription
stringThe formatted folder_location_insight_type resource.

static::folderLocationInsightTypeInsightName

Formats a string containing the fully-qualified path to represent a folder_location_insight_type_insight resource.

Parameters
NameDescription
folder string
location string
insightType string
insight string
Returns
TypeDescription
stringThe formatted folder_location_insight_type_insight resource.

static::folderLocationRecommenderName

Formats a string containing the fully-qualified path to represent a folder_location_recommender resource.

Parameters
NameDescription
folder string
location string
recommender string
Returns
TypeDescription
stringThe formatted folder_location_recommender resource.

static::folderLocationRecommenderRecommendationName

Formats a string containing the fully-qualified path to represent a folder_location_recommender_recommendation resource.

Parameters
NameDescription
folder string
location string
recommender string
recommendation string
Returns
TypeDescription
stringThe formatted folder_location_recommender_recommendation resource.

static::insightName

Formats a string containing the fully-qualified path to represent a insight resource.

Parameters
NameDescription
project string
location string
insightType string
insight string
Returns
TypeDescription
stringThe formatted insight resource.

static::insightTypeName

Formats a string containing the fully-qualified path to represent a insight_type resource.

Parameters
NameDescription
project string
location string
insightType string
Returns
TypeDescription
stringThe formatted insight_type resource.

static::insightTypeConfigName

Formats a string containing the fully-qualified path to represent a insight_type_config resource.

Parameters
NameDescription
project string
location string
insightType string
Returns
TypeDescription
stringThe formatted insight_type_config resource.

static::organizationLocationInsightTypeName

Formats a string containing the fully-qualified path to represent a organization_location_insight_type resource.

Parameters
NameDescription
organization string
location string
insightType string
Returns
TypeDescription
stringThe formatted organization_location_insight_type resource.

static::organizationLocationInsightTypeConfigName

Formats a string containing the fully-qualified path to represent a organization_location_insight_type_config resource.

Parameters
NameDescription
organization string
location string
insightType string
Returns
TypeDescription
stringThe formatted organization_location_insight_type_config resource.

static::organizationLocationInsightTypeInsightName

Formats a string containing the fully-qualified path to represent a organization_location_insight_type_insight resource.

Parameters
NameDescription
organization string
location string
insightType string
insight string
Returns
TypeDescription
stringThe formatted organization_location_insight_type_insight resource.

static::organizationLocationRecommenderName

Formats a string containing the fully-qualified path to represent a organization_location_recommender resource.

Parameters
NameDescription
organization string
location string
recommender string
Returns
TypeDescription
stringThe formatted organization_location_recommender resource.

static::organizationLocationRecommenderConfigName

Formats a string containing the fully-qualified path to represent a organization_location_recommender_config resource.

Parameters
NameDescription
organization string
location string
recommender string
Returns
TypeDescription
stringThe formatted organization_location_recommender_config resource.

static::organizationLocationRecommenderRecommendationName

Formats a string containing the fully-qualified path to represent a organization_location_recommender_recommendation resource.

Parameters
NameDescription
organization string
location string
recommender string
recommendation string
Returns
TypeDescription
stringThe formatted organization_location_recommender_recommendation resource.

static::projectLocationInsightTypeName

Formats a string containing the fully-qualified path to represent a project_location_insight_type resource.

Parameters
NameDescription
project string
location string
insightType string
Returns
TypeDescription
stringThe formatted project_location_insight_type resource.

static::projectLocationInsightTypeConfigName

Formats a string containing the fully-qualified path to represent a project_location_insight_type_config resource.

Parameters
NameDescription
project string
location string
insightType string
Returns
TypeDescription
stringThe formatted project_location_insight_type_config resource.

static::projectLocationInsightTypeInsightName

Formats a string containing the fully-qualified path to represent a project_location_insight_type_insight resource.

Parameters
NameDescription
project string
location string
insightType string
insight string
Returns
TypeDescription
stringThe formatted project_location_insight_type_insight resource.

static::projectLocationRecommenderName

Formats a string containing the fully-qualified path to represent a project_location_recommender resource.

Parameters
NameDescription
project string
location string
recommender string
Returns
TypeDescription
stringThe formatted project_location_recommender resource.

static::projectLocationRecommenderConfigName

Formats a string containing the fully-qualified path to represent a project_location_recommender_config resource.

Parameters
NameDescription
project string
location string
recommender string
Returns
TypeDescription
stringThe formatted project_location_recommender_config resource.

static::projectLocationRecommenderRecommendationName

Formats a string containing the fully-qualified path to represent a project_location_recommender_recommendation resource.

Parameters
NameDescription
project string
location string
recommender string
recommendation string
Returns
TypeDescription
stringThe formatted project_location_recommender_recommendation resource.

static::recommendationName

Formats a string containing the fully-qualified path to represent a recommendation resource.

Parameters
NameDescription
project string
location string
recommender string
recommendation string
Returns
TypeDescription
stringThe formatted recommendation resource.

static::recommenderName

Formats a string containing the fully-qualified path to represent a recommender resource.

Parameters
NameDescription
project string
location string
recommender string
Returns
TypeDescription
stringThe formatted recommender resource.

static::recommenderConfigName

Formats a string containing the fully-qualified path to represent a recommender_config resource.

Parameters
NameDescription
project string
location string
recommender string
Returns
TypeDescription
stringThe formatted recommender_config resource.

static::parseName

Parses a formatted name string and returns an associative array of the components in the name.

The following name formats are supported: Template: Pattern

  • billingAccountLocationInsightType: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}
  • billingAccountLocationInsightTypeInsight: billingAccounts/{billing_account}/locations/{location}/insightTypes/{insight_type}/insights/{insight}
  • billingAccountLocationRecommender: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}
  • billingAccountLocationRecommenderRecommendation: billingAccounts/{billing_account}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}
  • folderLocationInsightType: folders/{folder}/locations/{location}/insightTypes/{insight_type}
  • folderLocationInsightTypeInsight: folders/{folder}/locations/{location}/insightTypes/{insight_type}/insights/{insight}
  • folderLocationRecommender: folders/{folder}/locations/{location}/recommenders/{recommender}
  • folderLocationRecommenderRecommendation: folders/{folder}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}
  • insight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}
  • insightType: projects/{project}/locations/{location}/insightTypes/{insight_type}
  • insightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config
  • organizationLocationInsightType: organizations/{organization}/locations/{location}/insightTypes/{insight_type}
  • organizationLocationInsightTypeConfig: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/config
  • organizationLocationInsightTypeInsight: organizations/{organization}/locations/{location}/insightTypes/{insight_type}/insights/{insight}
  • organizationLocationRecommender: organizations/{organization}/locations/{location}/recommenders/{recommender}
  • organizationLocationRecommenderConfig: organizations/{organization}/locations/{location}/recommenders/{recommender}/config
  • organizationLocationRecommenderRecommendation: organizations/{organization}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}
  • projectLocationInsightType: projects/{project}/locations/{location}/insightTypes/{insight_type}
  • projectLocationInsightTypeConfig: projects/{project}/locations/{location}/insightTypes/{insight_type}/config
  • projectLocationInsightTypeInsight: projects/{project}/locations/{location}/insightTypes/{insight_type}/insights/{insight}
  • projectLocationRecommender: projects/{project}/locations/{location}/recommenders/{recommender}
  • projectLocationRecommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config
  • projectLocationRecommenderRecommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}
  • recommendation: projects/{project}/locations/{location}/recommenders/{recommender}/recommendations/{recommendation}
  • recommender: projects/{project}/locations/{location}/recommenders/{recommender}
  • recommenderConfig: projects/{project}/locations/{location}/recommenders/{recommender}/config

The optional $template argument can be supplied to specify a particular pattern, and must match one of the templates listed above. If no $template argument is provided, or if the $template argument does not match one of the templates listed, then parseName will check each of the supported templates, and return the first match.

Parameters
NameDescription
formattedName string

The formatted name string

template string

Optional name of template to match

Returns
TypeDescription
arrayAn associative array from name component IDs to component values.