# Compute V1 Client - Class NetworkEndpointGroup (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 NetworkEndpointGroup.

Represents a collection of network endpoints.

A network endpoint group (NEG) defines how a set of endpoints should be
reached, whether they are reachable, and where they are located.
For more information about using NEGs for different use cases, seeNetwork endpoint groups overview.
Note: Use the following APIs to manage network endpoint groups:
-
To manage NEGs with zonal scope (such as zonal NEGs, hybrid connectivity
NEGs): zonal
API
-
To manage NEGs with regional scope (such as regional internet NEGs,
serverless NEGs, Private Service Connect NEGs): regional
API
-
To manage NEGs with global scope (such as global internet NEGs):global
API

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

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ annotations` | `array|https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Internal/MapField` Optional. Metadata defined as annotations on the network endpoint group. |
| `↳ app_engine` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.NetworkEndpointGroupAppEngine` Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set. |
| `↳ cloud_function` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.NetworkEndpointGroupCloudFunction` Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set. |
| `↳ cloud_run` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.NetworkEndpointGroupCloudRun` Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set. |
| `↳ creation_timestamp` | `string` Output only. \[Output Only\] Creation timestamp inRFC3339 text format. |
| `↳ default_port` | `int` The default port used if the port number is not specified in the network endpoint. Optional. If the network endpoint type is either GCE_VM_IP,SERVERLESS or PRIVATE_SERVICE_CONNECT, this field must not be specified. |
| `↳ description` | `string` An optional description of this resource. Provide this property when you create the resource. |
| `↳ id` | `int|string` Output only. \[Output Only\] The unique identifier for the resource. This identifier is defined by the server. |
| `↳ kind` | `string` Output only. \[Output Only\] Type of the resource. Alwayscompute#networkEndpointGroup for network endpoint group. |
| `↳ name` | `string` Name of the resource; provided by the client when the resource is created. The name must be 1-63 characters long, and comply withRFC1035. Specifically, the name must be 1-63 characters long and match the regular expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first character must be a lowercase letter, and all 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 network to which all network endpoints in the NEG belong. Uses default project network if unspecified. |
| `↳ network_endpoint_type` | `string` Type of network endpoints in this network endpoint group. Can be one ofGCE_VM_IP, GCE_VM_IP_PORT,NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT,INTERNET_IP_PORT, SERVERLESS,PRIVATE_SERVICE_CONNECT, GCE_VM_IP_PORTMAP. Check the NetworkEndpointType enum for the list of possible values. |
| `↳ psc_data` | `https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.NetworkEndpointGroupPscData` Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT. |
| `↳ psc_target_service` | `string` The target service url used to set up private service connection to a Google API or a PSC Producer Service Attachment. An example value is: asia-northeast3-cloudkms.googleapis.com. Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT. |
| `↳ region` | `string` Output only. \[Output Only\] The URL of theregion where the network endpoint group is located. |
| `↳ self_link` | `string` Output only. \[Output Only\] Server-defined URL for the resource. |
| `↳ size` | `int` Output only. \[Output only\] Number of network endpoints in the network endpoint group. |
| `↳ subnetwork` | `string` Optional URL of the subnetwork to which all network endpoints in the NEG belong. |
| `↳ zone` | `string` Output only. \[Output Only\] The URL of thezone where the network endpoint group is located. |

### getAnnotations

Optional. Metadata defined as annotations on the network endpoint group.

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

### setAnnotations

Optional. Metadata defined as annotations on the network endpoint group.

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

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

### getAppEngine

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

### hasAppEngine

### clearAppEngine

### setAppEngine

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

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

### getCloudFunction

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

### hasCloudFunction

### clearCloudFunction

### setCloudFunction

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

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

### getCloudRun

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

### hasCloudRun

### clearCloudRun

### setCloudRun

Optional. Only valid when networkEndpointType isSERVERLESS. Only one of cloudRun,appEngine or cloudFunction may be set.

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

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

### getCreationTimestamp

Output only. \[Output Only\] Creation timestamp inRFC3339
text format.

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

### hasCreationTimestamp

### clearCreationTimestamp

### setCreationTimestamp

Output only. \[Output Only\] Creation timestamp inRFC3339
text format.

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

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

### getDefaultPort

The default port used if the port number is not specified in the network
endpoint.

Optional. If the network endpoint type is either GCE_VM_IP,SERVERLESS or PRIVATE_SERVICE_CONNECT, this
field must not be specified.

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

### hasDefaultPort

### clearDefaultPort

### setDefaultPort

The default port used if the port number is not specified in the network
endpoint.

Optional. If the network endpoint type is either GCE_VM_IP,SERVERLESS or PRIVATE_SERVICE_CONNECT, this
field must not be specified.

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

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

### getDescription

An optional description of this resource. Provide this property when you
create the resource.

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

### hasDescription

### clearDescription

### setDescription

An optional description of this resource. Provide this property when you
create the resource.

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

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

### getId

Output only. \[Output Only\] The unique identifier for the resource. This identifier is
defined by the server.

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

### hasId

### clearId

### setId

Output only. \[Output Only\] The unique identifier for the resource. This identifier is
defined by the server.

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

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

### getKind

Output only. \[Output Only\] Type of the resource. Alwayscompute#networkEndpointGroup for network endpoint group.

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

### hasKind

### clearKind

### setKind

Output only. \[Output Only\] Type of the resource. Alwayscompute#networkEndpointGroup for network endpoint group.

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

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

### getName

Name of the resource; provided by the client when the resource is created.

The name must be 1-63 characters long, and comply withRFC1035.
Specifically, the name must be 1-63 characters long and match the regular
expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first
character must be a lowercase letter, and all 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 the resource; provided by the client when the resource is created.

The name must be 1-63 characters long, and comply withRFC1035.
Specifically, the name must be 1-63 characters long and match the regular
expression `[a-z]([-a-z0-9]*[a-z0-9])?` which means the first
character must be a lowercase letter, and all 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 network to which all network endpoints in the NEG belong.

Uses default project network if unspecified.

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

### hasNetwork

### clearNetwork

### setNetwork

The URL of the network to which all network endpoints in the NEG belong.

Uses default project network if unspecified.

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

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

### getNetworkEndpointType

Type of network endpoints in this network endpoint group. Can be one ofGCE_VM_IP, GCE_VM_IP_PORT,NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT,INTERNET_IP_PORT, SERVERLESS,PRIVATE_SERVICE_CONNECT, GCE_VM_IP_PORTMAP.

Check the NetworkEndpointType enum for the list of possible values.

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

### hasNetworkEndpointType

### clearNetworkEndpointType

### setNetworkEndpointType

Type of network endpoints in this network endpoint group. Can be one ofGCE_VM_IP, GCE_VM_IP_PORT,NON_GCP_PRIVATE_IP_PORT, INTERNET_FQDN_PORT,INTERNET_IP_PORT, SERVERLESS,PRIVATE_SERVICE_CONNECT, GCE_VM_IP_PORTMAP.

Check the NetworkEndpointType enum for the list of possible values.

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

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

### getPscData

Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT.

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

### hasPscData

### clearPscData

### setPscData

Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT.

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

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

### getPscTargetService

The target service url used to set up private service connection to
a Google API or a PSC Producer Service Attachment.

An example value is: asia-northeast3-cloudkms.googleapis.com.
Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT.

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

### hasPscTargetService

### clearPscTargetService

### setPscTargetService

The target service url used to set up private service connection to
a Google API or a PSC Producer Service Attachment.

An example value is: asia-northeast3-cloudkms.googleapis.com.
Optional. Only valid when networkEndpointType isPRIVATE_SERVICE_CONNECT.

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

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

### getRegion

Output only. \[Output Only\] The URL of theregion
where the network endpoint group is located.

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

### hasRegion

### clearRegion

### setRegion

Output only. \[Output Only\] The URL of theregion
where the network endpoint group is located.

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

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

### getSelfLink

Output only. \[Output Only\] Server-defined URL for the resource.

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

### hasSelfLink

### clearSelfLink

### setSelfLink

Output only. \[Output Only\] Server-defined URL for the resource.

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

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

### getSize

Output only. \[Output only\] Number of network endpoints in the network endpoint group.

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

### hasSize

### clearSize

### setSize

Output only. \[Output only\] Number of network endpoints in the network endpoint group.

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

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

### getSubnetwork

Optional URL of the subnetwork to which all network endpoints in the NEG
belong.

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

### hasSubnetwork

### clearSubnetwork

### setSubnetwork

Optional URL of the subnetwork to which all network endpoints in the NEG
belong.

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

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

### getZone

Output only. \[Output Only\] The URL of thezone
where the network endpoint group is located.

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

### hasZone

### clearZone

### setZone

Output only. \[Output Only\] The URL of thezone
where the network endpoint group is located.

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

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