# Recommender V1 Client - Class Insight (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 Insight.

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

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

## 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 the insight. |
| `↳ description` | `string` Free-form human readable summary in English. The maximum length is 500 characters. |
| `↳ target_resources` | `string[]` Fully qualified resource names that this insight is targeting. |
| `↳ insight_subtype` | `string` Insight subtype. Insight content schema will be stable for a given subtype. |
| `↳ content` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Struct` A struct of custom fields to explain the insight. Example: "grantedPermissionsCount": "1000" |
| `↳ last_refresh_time` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` Timestamp of the latest data used to generate the insight. |
| `↳ observation_period` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Duration` Observation period that led to the insight. The source data used to generate the insight ends at last_refresh_time and begins at (last_refresh_time - observation_period). |
| `↳ state_info` | `https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.InsightStateInfo` Information state and metadata. |
| `↳ category` | `int` Category being targeted by the insight. |
| `↳ severity` | `int` Insight's severity. |
| `↳ etag` | `string` Fingerprint of the Insight. Provides optimistic locking when updating states. |
| `↳ associated_recommendations` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-recommender/latest/V1.Insight.RecommendationReference>` Recommendations derived from this insight. |

### getName

Identifier. Name of the insight.

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

### setName

Identifier. Name of the insight.

| **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` |   |

### getTargetResources

Fully qualified resource names that this insight is targeting.

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

### setTargetResources

Fully qualified resource names that this insight is targeting.

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

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

### getInsightSubtype

Insight subtype. Insight content schema will be stable for a given subtype.

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

### setInsightSubtype

Insight subtype. Insight content schema will be stable for a given subtype.

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

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

### getContent

A struct of custom fields to explain the insight.

Example: "grantedPermissionsCount": "1000"

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

### hasContent

### clearContent

### setContent

A struct of custom fields to explain the insight.

Example: "grantedPermissionsCount": "1000"

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

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

### getLastRefreshTime

Timestamp of the latest data used to generate the insight.

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

### hasLastRefreshTime

### clearLastRefreshTime

### setLastRefreshTime

Timestamp of the latest data used to generate the insight.

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

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

### getObservationPeriod

Observation period that led to the insight. The source data used to
generate the insight ends at last_refresh_time and begins at
(last_refresh_time - observation_period).

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

### hasObservationPeriod

### clearObservationPeriod

### setObservationPeriod

Observation period that led to the insight. The source data used to
generate the insight ends at last_refresh_time and begins at
(last_refresh_time - observation_period).

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

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

### getStateInfo

Information state and metadata.

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

### hasStateInfo

### clearStateInfo

### setStateInfo

Information state and metadata.

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

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

### getCategory

Category being targeted by the insight.

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

### setCategory

Category being targeted by the insight.

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

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

### getSeverity

Insight's severity.

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

### setSeverity

Insight's severity.

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

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

### getEtag

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

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

### setEtag

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

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

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

### getAssociatedRecommendations

Recommendations derived from this insight.

| **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.Insight.RecommendationReference>` |   |

### setAssociatedRecommendations

Recommendations derived from this insight.

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

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