# Compute V1 Client - Class NetworkPeering (2.10.0)

2.10.0 (latest) 2.9.0 2.8.0 2.7.0 2.6.0 2.5.0 2.4.0 2.3.0 2.2.0 2.1.1 2.0.0 1.36.0 1.35.0 1.34.0 1.33.0 1.32.0 1.31.0 1.30.0 1.29.0 1.28.0 1.27.0 1.26.0 1.25.0 1.24.0 1.23.0 1.22.1 1.21.0 1.20.0 1.19.0 1.18.1 1.17.0 1.16.2 1.14.0 1.13.0 1.12.1 1.11.1 1.10.1 1.9.1 1.8.3 1.7.1 1.6.1 1.5.0 Reference documentation and code samples for the Compute V1 Client class NetworkPeering.

A network peering attached to a network resource. The message includes the
peering name, peer network, peering state, and a flag indicating whether
Google Compute Engine should automatically create routes for the peering.

Generated from protobuf message `google.cloud.compute.v1.NetworkPeering`

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ auto_create_routes` | `bool` This field will be deprecated soon. Use theexchange_subnet_routes field instead. Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state isACTIVE. |
| `↳ connection_status` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.NetworkPeeringConnectionStatus` Output only. \[Output Only\] The effective state of the peering connection as a whole. |
| `↳ exchange_subnet_routes` | `bool` Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state isACTIVE. |
| `↳ export_custom_routes` | `bool` Whether to export the custom routes to peer network. The default value is false. |
| `↳ export_subnet_routes_with_public_ip` | `bool` Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported.IPv4 special-use ranges are always exported to peers and are not controlled by this field. |
| `↳ import_custom_routes` | `bool` Whether to import the custom routes from peer network. The default value is false. |
| `↳ import_subnet_routes_with_public_ip` | `bool` Whether subnet routes with public IP range are imported. The default value is false.IPv4 special-use ranges are always imported from peers and are not controlled by this field. |
| `↳ name` | `string` Name of this peering. Provided by the client when the peering is created. The name must comply withRFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash. |
| `↳ network` | `string` The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network. |
| `↳ peer_mtu` | `int` Output only. \[Output Only\] Maximum Transmission Unit in bytes of the peer network. |
| `↳ stack_type` | `string` Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY. Check the StackType enum for the list of possible values. |
| `↳ state` | `string` Output only. \[Output Only\] State for the peering. Check the State enum for the list of possible values. |
| `↳ state_details` | `string` Output only. \[Output Only\] Details about the current state of the peering. |
| `↳ update_strategy` | `string` The update strategy determines the semantics for updates and deletes to the peering connection configuration. Check the UpdateStrategy enum for the list of possible values. |

### getAutoCreateRoutes

This field will be deprecated soon. Use theexchange_subnet_routes field instead.

Indicates whether full mesh connectivity is created and managed
automatically between peered networks. Currently this field should always
be true since Google Compute Engine will automatically create and manage
subnetwork routes between two networks when peering state isACTIVE.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasAutoCreateRoutes

### clearAutoCreateRoutes

### setAutoCreateRoutes

This field will be deprecated soon. Use theexchange_subnet_routes field instead.

Indicates whether full mesh connectivity is created and managed
automatically between peered networks. Currently this field should always
be true since Google Compute Engine will automatically create and manage
subnetwork routes between two networks when peering state isACTIVE.

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

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

### getConnectionStatus

Output only. \[Output Only\] The effective state of the peering connection
as a whole.

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

### hasConnectionStatus

### clearConnectionStatus

### setConnectionStatus

Output only. \[Output Only\] The effective state of the peering connection
as a whole.

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

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

### getExchangeSubnetRoutes

Indicates whether full mesh connectivity is created and managed
automatically between peered networks. Currently this field should always
be true since Google Compute Engine will automatically create and manage
subnetwork routes between two networks when peering state isACTIVE.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasExchangeSubnetRoutes

### clearExchangeSubnetRoutes

### setExchangeSubnetRoutes

Indicates whether full mesh connectivity is created and managed
automatically between peered networks. Currently this field should always
be true since Google Compute Engine will automatically create and manage
subnetwork routes between two networks when peering state isACTIVE.

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

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

### getExportCustomRoutes

Whether to export the custom routes to peer network. The default value is
false.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasExportCustomRoutes

### clearExportCustomRoutes

### setExportCustomRoutes

Whether to export the custom routes to peer network. The default value is
false.

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

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

### getExportSubnetRoutesWithPublicIp

Whether subnet routes with public IP range are exported. The default value
is true, all subnet routes are exported.IPv4
special-use ranges are always
exported to peers and are not controlled by this field.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasExportSubnetRoutesWithPublicIp

### clearExportSubnetRoutesWithPublicIp

### setExportSubnetRoutesWithPublicIp

Whether subnet routes with public IP range are exported. The default value
is true, all subnet routes are exported.IPv4
special-use ranges are always
exported to peers and are not controlled by this field.

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

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

### getImportCustomRoutes

Whether to import the custom routes from peer network. The default value is
false.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasImportCustomRoutes

### clearImportCustomRoutes

### setImportCustomRoutes

Whether to import the custom routes from peer network. The default value is
false.

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

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

### getImportSubnetRoutesWithPublicIp

Whether subnet routes with public IP range are imported. The default value
is false.IPv4
special-use ranges are always
imported from peers and are not controlled by this field.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `bool` |   |

### hasImportSubnetRoutesWithPublicIp

### clearImportSubnetRoutesWithPublicIp

### setImportSubnetRoutesWithPublicIp

Whether subnet routes with public IP range are imported. The default value
is false.IPv4
special-use ranges are always
imported from peers and are not controlled by this field.

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

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

### getName

Name of this peering. Provided by the client when the peering is created.

The name must comply withRFC1035.
Specifically, the name must be 1-63 characters long and match regular
expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a
lowercase letter, and all the following characters must be a dash,
lowercase letter, or digit, except the last character, which cannot be a
dash.

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

### hasName

### clearName

### setName

Name of this peering. Provided by the client when the peering is created.

The name must comply withRFC1035.
Specifically, the name must be 1-63 characters long and match regular
expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a
lowercase letter, and all the following characters must be a dash,
lowercase letter, or digit, except the last character, which cannot be a
dash.

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

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

### getNetwork

The URL of the peer network. It can be either full URL or partial URL. The
peer network may belong to a different project. If the partial URL does not
contain project, it is assumed that the peer network is in the same project
as the current network.

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

### hasNetwork

### clearNetwork

### setNetwork

The URL of the peer network. It can be either full URL or partial URL. The
peer network may belong to a different project. If the partial URL does not
contain project, it is assumed that the peer network is in the same project
as the current network.

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

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

### getPeerMtu

Output only. \[Output Only\] Maximum Transmission Unit in bytes of the peer network.

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

### hasPeerMtu

### clearPeerMtu

### setPeerMtu

Output only. \[Output Only\] Maximum Transmission Unit in bytes of the peer network.

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

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

### getStackType

Which IP version(s) of traffic and routes are allowed to be imported or
exported between peer networks. The default value is IPV4_ONLY.

Check the StackType enum for the list of possible values.

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

### hasStackType

### clearStackType

### setStackType

Which IP version(s) of traffic and routes are allowed to be imported or
exported between peer networks. The default value is IPV4_ONLY.

Check the StackType enum for the list of possible values.

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

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

### getState

Output only. \[Output Only\] State for the peering.

Check the State enum for the list of possible values.

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

### hasState

### clearState

### setState

Output only. \[Output Only\] State for the peering.

Check the State enum for the list of possible values.

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

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

### getStateDetails

Output only. \[Output Only\] Details about the current state of the peering.

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

### hasStateDetails

### clearStateDetails

### setStateDetails

Output only. \[Output Only\] Details about the current state of the peering.

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

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

### getUpdateStrategy

The update strategy determines the semantics for updates and deletes to the
peering connection configuration.

Check the UpdateStrategy enum for the list of possible values.

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

### hasUpdateStrategy

### clearUpdateStrategy

### setUpdateStrategy

The update strategy determines the semantics for updates and deletes to the
peering connection configuration.

Check the UpdateStrategy enum for the list of possible values.

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

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