# Google Cloud Network Connectivity V1 Client - Class PscConnection (2.5.3)

2.5.3 (latest) 2.5.2 2.4.0 2.3.0 2.2.2 2.1.2 2.0.2 1.5.5 1.4.2 1.3.0 1.2.0 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud Network Connectivity V1 Client class PscConnection.

Information about a specific Private Service Connect connection.

Generated from protobuf message `google.cloud.networkconnectivity.v1.ServiceConnectionPolicy.PscConnection`

## Namespace

Google \\ Cloud \\ NetworkConnectivity \\ V1 \\ ServiceConnectionPolicy

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ state` | `int` State of the PSC Connection |
| `↳ consumer_forwarding_rule` | `string` The resource reference of the PSC Forwarding Rule within the consumer VPC. |
| `↳ consumer_address` | `string` The resource reference of the consumer address. |
| `↳ error_type` | `int` The error type indicates whether the error is consumer facing, producer facing or system internal. |
| `↳ error` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` The most recent error during operating this connection. Deprecated, please use error_info instead. |
| `↳ gce_operation` | `string` The last Compute Engine operation to setup PSC connection. |
| `↳ consumer_target_project` | `string` The project where the PSC connection is created. |
| `↳ psc_connection_id` | `string` The PSC connection id of the PSC forwarding rule. |
| `↳ error_info` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.ErrorInfo.html` Output only. The error info for the latest error during operating this connection. |
| `↳ selected_subnetwork` | `string` Output only. The URI of the subnetwork selected to allocate IP address for this connection. |
| `↳ producer_instance_id` | `string` Immutable. Deprecated. Use producer_instance_metadata instead. An immutable identifier for the producer instance. |
| `↳ producer_instance_metadata` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Immutable. An immutable map for the producer instance metadata. |
| `↳ service_class` | `string` Output only. \[Output only\] The service class associated with this PSC Connection. The value is derived from the SCPolicy and matches the service class name provided by the customer. |
| `↳ ip_version` | `int` The requested IP version for the PSC connection. |

### getState

State of the PSC Connection

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-network-connectivity/latest/V1.ServiceConnectionPolicy.State). |

### setState

State of the PSC Connection

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

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

### getConsumerForwardingRule

The resource reference of the PSC Forwarding Rule within the consumer
VPC.

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

### setConsumerForwardingRule

The resource reference of the PSC Forwarding Rule within the consumer
VPC.

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

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

### getConsumerAddress

The resource reference of the consumer address.

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

### setConsumerAddress

The resource reference of the consumer address.

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

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

### getErrorType

The error type indicates whether the error is consumer facing, producer
facing or system internal.

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

### setErrorType

The error type indicates whether the error is consumer facing, producer
facing or system internal.

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

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

### getError

The most recent error during operating this connection.

Deprecated, please use error_info instead.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html|null` |   |

### hasError

### clearError

### setError

The most recent error during operating this connection.

Deprecated, please use error_info instead.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.Status.html` |

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

### getGceOperation

The last Compute Engine operation to setup PSC connection.

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

### setGceOperation

The last Compute Engine operation to setup PSC connection.

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

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

### getConsumerTargetProject

The project where the PSC connection is created.

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

### setConsumerTargetProject

The project where the PSC connection is created.

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

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

### getPscConnectionId

The PSC connection id of the PSC forwarding rule.

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

### setPscConnectionId

The PSC connection id of the PSC forwarding rule.

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

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

### getErrorInfo

Output only. The error info for the latest error during operating this
connection.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.ErrorInfo.html|null` |   |

### hasErrorInfo

### clearErrorInfo

### setErrorInfo

Output only. The error info for the latest error during operating this
connection.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/common-protos/latest/Rpc.ErrorInfo.html` |

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

### getSelectedSubnetwork

Output only. The URI of the subnetwork selected to allocate IP address
for this connection.

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

### setSelectedSubnetwork

Output only. The URI of the subnetwork selected to allocate IP address
for this connection.

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

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

### getProducerInstanceId

Immutable. Deprecated. Use producer_instance_metadata instead.

An immutable identifier for the producer instance.

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

### setProducerInstanceId

Immutable. Deprecated. Use producer_instance_metadata instead.

An immutable identifier for the producer instance.

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

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

### getProducerInstanceMetadata

Immutable. An immutable map for the producer instance metadata.

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

### setProducerInstanceMetadata

Immutable. An immutable map for the producer instance metadata.

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

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

### getServiceClass

Output only. \[Output only\] The service class associated with this PSC
Connection. The value is derived from the SCPolicy and matches the
service class name provided by the customer.

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

### setServiceClass

Output only. \[Output only\] The service class associated with this PSC
Connection. The value is derived from the SCPolicy and matches the
service class name provided by the customer.

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

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

### getIpVersion

The requested IP version for the PSC connection.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` |   |

### hasIpVersion

### clearIpVersion

### setIpVersion

The requested IP version for the PSC connection.

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

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