# Recommender V1 Client - Class Recommendation (2.2.0)

2.2.0 (latest) 2.1.3 2.0.5 1.11.5 1.10.0 1.9.1 1.8.2 1.7.8 Reference documentation and code samples for the Recommender V1 Client class Recommendation.

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

Generated from protobuf message `google.cloud.recommender.v1.Recommendation`

## Namespace

Google \\ Cloud \\ Recommender \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Identifier. Name of recommendation. |
| `↳ description` | `string` Free-form human readable summary in English. The maximum length is 500 characters. |
| `↳ recommender_subtype` | `string` Contains an identifier for a subtype of recommendations produced for the same recommender. Subtype is a function of content and impact, meaning a new subtype might be added when significant changes to `content` or `primary_impact.category` are introduced. See the Recommenders section to see a list of subtypes for a given Recommender. Examples: For recommender = "google.iam.policy.Recommender", recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE" |
| `↳ last_refresh_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Last time this recommendation was refreshed by the system that created it in the first place. |
| `↳ primary_impact` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact` The primary impact that this recommendation can have while trying to optimize for one category. |
| `↳ additional_impact` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact>` Optional set of additional impact that this recommendation may have when trying to optimize for the primary category. These may be positive or negative. |
| `↳ priority` | `int` Recommendation's priority. |
| `↳ content` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationContent` Content of the recommendation describing recommended changes to resources. |
| `↳ state_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationStateInfo` Information for state. Contains state and metadata. |
| `↳ etag` | `string` Fingerprint of the Recommendation. Provides optimistic locking when updating states. |
| `↳ associated_insights` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Recommendation.InsightReference>` Insights that led to this recommendation. |
| `↳ xor_group_id` | `string` Corresponds to a mutually exclusive group ID within a recommender. A non-empty ID indicates that the recommendation belongs to a mutually exclusive group. This means that only one recommendation within the group is suggested to be applied. |
| `↳ target_resources` | `string[]` Fully qualified resource names that this recommendation is targeting. |

### getName

Identifier. Name of recommendation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Identifier. Name of recommendation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDescription

Free-form human readable summary in English. The maximum length is 500
characters.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setDescription

Free-form human readable summary in English. The maximum length is 500
characters.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRecommenderSubtype

Contains an identifier for a subtype of recommendations produced for the
same recommender. Subtype is a function of content and impact, meaning a
new subtype might be added when significant changes to `content` or
`primary_impact.category` are introduced. See the Recommenders section
to see a list of subtypes for a given Recommender.

Examples:
For recommender = "google.iam.policy.Recommender",
recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE"

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setRecommenderSubtype

Contains an identifier for a subtype of recommendations produced for the
same recommender. Subtype is a function of content and impact, meaning a
new subtype might be added when significant changes to `content` or
`primary_impact.category` are introduced. See the Recommenders section
to see a list of subtypes for a given Recommender.

Examples:
For recommender = "google.iam.policy.Recommender",
recommender_subtype can be one of "REMOVE_ROLE"/"REPLACE_ROLE"

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getLastRefreshTime

Last time this recommendation was refreshed by the system that created it
in the first place.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasLastRefreshTime

### clearLastRefreshTime

### setLastRefreshTime

Last time this recommendation was refreshed by the system that created it
in the first place.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPrimaryImpact

The primary impact that this recommendation can have while trying to
optimize for one category.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact|null` |   |

### hasPrimaryImpact

### clearPrimaryImpact

### setPrimaryImpact

The primary impact that this recommendation can have while trying to
optimize for one category.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAdditionalImpact

Optional set of additional impact that this recommendation may have when
trying to optimize for the primary category. These may be positive
or negative.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact>` |   |

### setAdditionalImpact

Optional set of additional impact that this recommendation may have when
trying to optimize for the primary category. These may be positive
or negative.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Impact>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPriority

Recommendation's priority.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [Priority](https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Recommendation.Priority). |

### setPriority

Recommendation's priority.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [Priority](https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Recommendation.Priority). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getContent

Content of the recommendation describing recommended changes to resources.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationContent|null` |   |

### hasContent

### clearContent

### setContent

Content of the recommendation describing recommended changes to resources.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationContent` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getStateInfo

Information for state. Contains state and metadata.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationStateInfo|null` |   |

### hasStateInfo

### clearStateInfo

### setStateInfo

Information for state. Contains state and metadata.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.RecommendationStateInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getEtag

Fingerprint of the Recommendation. Provides optimistic locking when
updating states.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setEtag

Fingerprint of the Recommendation. Provides optimistic locking when
updating states.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAssociatedInsights

Insights that led to this recommendation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Recommendation.InsightReference>` |   |

### setAssociatedInsights

Insights that led to this recommendation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Recommendation.InsightReference>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getXorGroupId

Corresponds to a mutually exclusive group ID within a recommender.

A non-empty ID indicates that the recommendation belongs to a mutually
exclusive group. This means that only one recommendation within the group
is suggested to be applied.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setXorGroupId

Corresponds to a mutually exclusive group ID within a recommender.

A non-empty ID indicates that the recommendation belongs to a mutually
exclusive group. This means that only one recommendation within the group
is suggested to be applied.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getTargetResources

Fully qualified resource names that this recommendation is targeting.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setTargetResources

Fully qualified resource names that this recommendation is targeting.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |