# Data Loss Prevention V2 Client - Class Connection (2.13.0)

2.13.0 (latest) 2.12.0 2.11.0 2.10.0 2.9.2 2.8.1 2.7.0 2.6.1 2.4.1 2.3.0 2.2.3 2.1.0 2.0.0 1.19.0 1.18.0 1.17.0 1.16.0 1.15.1 1.14.0 1.13.2 1.12.0 1.11.0 1.10.2 1.9.0 1.8.6 Reference documentation and code samples for the Data Loss Prevention V2 Client class Connection.

A data connection to allow the DLP API to profile data in locations that
require additional configuration.

Generated from protobuf message `google.privacy.dlp.v2.Connection`

## Namespace

Google \\ Cloud \\ Dlp \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ name` | `string` Output only. Name of the connection: `projects/{project}/locations/{location}/connections/{name}`. |
| `↳ state` | `int` Required. The connection's state in its lifecycle. |
| `↳ errors` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.Error>` Output only. Set if status == ERROR, to provide additional details. Will store the last 10 errors sorted with the most recent first. |
| `↳ cloud_sql` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.CloudSqlProperties` Connect to a Cloud SQL instance. |

### getName

Output only. Name of the connection:
`projects/{project}/locations/{location}/connections/{name}`.

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

### setName

Output only. Name of the connection:
`projects/{project}/locations/{location}/connections/{name}`.

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

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

### getState

Required. The connection's state in its lifecycle.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ConnectionState](https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.ConnectionState). |

### setState

Required. The connection's state in its lifecycle.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ConnectionState](https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.ConnectionState). |

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

### getErrors

Output only. Set if status == ERROR, to provide additional details. Will
store the last 10 errors sorted with the most recent first.

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

### setErrors

Output only. Set if status == ERROR, to provide additional details. Will
store the last 10 errors sorted with the most recent first.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.Error>` |

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

### getCloudSql

Connect to a Cloud SQL instance.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.CloudSqlProperties|null` |   |

### hasCloudSql

### setCloudSql

Connect to a Cloud SQL instance.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-dlp/latest/V2.CloudSqlProperties` |

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

### getProperties

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