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

A network interface resource attached to an instance.

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

## Namespace

Google \\ Cloud \\ Compute \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ access_configs` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.AccessConfig>` An array of configurations for this interface. Currently, only one access config, ONE_TO_ONE_NAT, is supported. If there are noaccessConfigs specified, then this instance will have no external internet access. |
| `↳ alias_ip_ranges` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.AliasIpRange>` An array of alias IP ranges for this network interface. You can only specify this field for network interfaces in VPC networks. |
| `↳ enable_vpc_scoped_dns` | `bool` Optional. If true, DNS resolution will be enabled over this interface. Only valid with network_attachment. |
| `↳ fingerprint` | `string` Fingerprint hash of contents stored in this network interface. This field will be ignored when inserting an Instance or adding a NetworkInterface. An up-to-date fingerprint must be provided in order to update theNetworkInterface. The request will fail with error400 Bad Request if the fingerprint is not provided, or412 Precondition Failed if the fingerprint is out of date. |
| `↳ igmp_query` | `string` Indicate whether igmp query is enabled on the network interface or not. If enabled, also indicates the version of IGMP supported. Check the IgmpQuery enum for the list of possible values. |
| `↳ internal_ipv6_prefix_length` | `int` The prefix length of the primary internal IPv6 range. |
| `↳ ipv6_access_configs` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-compute/latest/V1.AccessConfig>` An array of IPv6 access configurations for this interface. Currently, only one IPv6 access config, DIRECT_IPV6, is supported. If there is no ipv6AccessConfig specified, then this instance will have no external IPv6 Internet access. |
| `↳ ipv6_access_type` | `string` Output only. \[Output Only\] One of EXTERNAL, INTERNAL to indicate whether the IP can be accessed from the Internet. This field is always inherited from its subnetwork. Valid only if stackType is IPV4_IPV6. Check the Ipv6AccessType enum for the list of possible values. |
| `↳ ipv6_address` | `string` An IPv6 internal network address for this network interface. To use a static internal IP address, it must be unused and in the same region as the instance's zone. If not specified, Google Cloud will automatically assign an internal IPv6 address from the instance's subnetwork. |
| `↳ kind` | `string` Output only. \[Output Only\] Type of the resource. Alwayscompute#networkInterface for network interfaces. |
| `↳ name` | `string` \[Output Only\] The name of the network interface, which is generated by the server. For a VM, the network interface uses the nicN naming format. Where N is a value between 0 and7. The default interface value is nic0. |
| `↳ network` | `string` URL of the VPC network resource for this instance. When creating an instance, if neither the network nor the subnetwork is specified, the default network global/networks/default is used. If the selected project doesn't have the default network, you must specify a network or subnet. If the network is not specified but the subnetwork is specified, the network is inferred. If you specify this property, you can specify the network as a full or partial URL. For example, the following are all valid URLs: - <https://www.googleapis.com/compute/v1/projects/project/global/networks/network> - projects/project/global/networks/network - global/networks/default |
| `↳ network_attachment` | `string` The URL of the network attachment that this interface should connect to in the following format: projects/{project_number}/regions/{region_name}/networkAttachments/{network_attachment_name}. |
| `↳ network_i_p` | `string` An IPv4 internal IP address to assign to the instance for this network interface. If not specified by the user, an unused internal IP is assigned by the system. |
| `↳ nic_type` | `string` The type of vNIC to be used on this interface. This may be gVNIC or VirtioNet. Check the NicType enum for the list of possible values. |
| `↳ parent_nic_name` | `string` Name of the parent network interface of a dynamic network interface. |
| `↳ queue_count` | `int` The networking queue count that's specified by users for the network interface. Both Rx and Tx queues will be set to this number. It'll be empty if not specified by the users. |
| `↳ service_class_id` | `string` Optional. Producer Service's Service class Id for the region of this network interface. Can only be used with network_attachment. It is not possible to use on its own however, network_attachment can be used without service_class_id. |
| `↳ stack_type` | `string` The stack type for this network interface. To assign only IPv4 addresses, use IPV4_ONLY. To assign both IPv4 and IPv6 addresses, useIPV4_IPV6. If not specified, IPV4_ONLY is used. This field can be both set at instance creation and update network interface operations. Check the StackType enum for the list of possible values. |
| `↳ subnetwork` | `string` The URL of the Subnetwork resource for this instance. If the network resource is inlegacy mode, do not specify this field. If the network is in auto subnet mode, specifying the subnetwork is optional. If the network is in custom subnet mode, specifying the subnetwork is required. If you specify this field, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs: - <https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork> - regions/region/subnetworks/subnetwork |
| `↳ vlan` | `int` VLAN tag of a dynamic network interface, must be an integer in the range from 2 to 255 inclusively. |

### getAccessConfigs

An array of configurations for this interface. Currently, only one access
config, ONE_TO_ONE_NAT, is supported. If there are noaccessConfigs specified, then this instance will have
no external internet access.

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

### setAccessConfigs

An array of configurations for this interface. Currently, only one access
config, ONE_TO_ONE_NAT, is supported. If there are noaccessConfigs specified, then this instance will have
no external internet access.

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

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

### getAliasIpRanges

An array of alias IP ranges for this network interface.

You can only specify this field for network interfaces in VPC networks.

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

### setAliasIpRanges

An array of alias IP ranges for this network interface.

You can only specify this field for network interfaces in VPC networks.

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

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

### getEnableVpcScopedDns

Optional. If true, DNS resolution will be enabled over this interface. Only valid
with network_attachment.

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

### hasEnableVpcScopedDns

### clearEnableVpcScopedDns

### setEnableVpcScopedDns

Optional. If true, DNS resolution will be enabled over this interface. Only valid
with network_attachment.

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

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

### getFingerprint

Fingerprint hash of contents stored in this network interface.

This field will be ignored when inserting an Instance or
adding a NetworkInterface. An up-to-date
fingerprint must be provided in order to update theNetworkInterface. The request will fail with error400 Bad Request if the fingerprint is not provided, or412 Precondition Failed if the fingerprint is out of date.

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

### hasFingerprint

### clearFingerprint

### setFingerprint

Fingerprint hash of contents stored in this network interface.

This field will be ignored when inserting an Instance or
adding a NetworkInterface. An up-to-date
fingerprint must be provided in order to update theNetworkInterface. The request will fail with error400 Bad Request if the fingerprint is not provided, or412 Precondition Failed if the fingerprint is out of date.

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

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

### getIgmpQuery

Indicate whether igmp query is enabled on the network interface
or not. If enabled, also indicates the version of IGMP supported.

Check the IgmpQuery enum for the list of possible values.

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

### hasIgmpQuery

### clearIgmpQuery

### setIgmpQuery

Indicate whether igmp query is enabled on the network interface
or not. If enabled, also indicates the version of IGMP supported.

Check the IgmpQuery enum for the list of possible values.

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

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

### getInternalIpv6PrefixLength

The prefix length of the primary internal IPv6 range.

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

### hasInternalIpv6PrefixLength

### clearInternalIpv6PrefixLength

### setInternalIpv6PrefixLength

The prefix length of the primary internal IPv6 range.

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

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

### getIpv6AccessConfigs

An array of IPv6 access configurations for this interface. Currently, only
one IPv6 access config, DIRECT_IPV6, is supported. If there
is no ipv6AccessConfig specified, then this instance will
have no external IPv6 Internet access.

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

### setIpv6AccessConfigs

An array of IPv6 access configurations for this interface. Currently, only
one IPv6 access config, DIRECT_IPV6, is supported. If there
is no ipv6AccessConfig specified, then this instance will
have no external IPv6 Internet access.

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

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

### getIpv6AccessType

Output only. \[Output Only\] One of EXTERNAL, INTERNAL to indicate whether the IP can be
accessed from the Internet. This field is always inherited from its
subnetwork.

Valid only if stackType is IPV4_IPV6.
Check the Ipv6AccessType enum for the list of possible values.

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

### hasIpv6AccessType

### clearIpv6AccessType

### setIpv6AccessType

Output only. \[Output Only\] One of EXTERNAL, INTERNAL to indicate whether the IP can be
accessed from the Internet. This field is always inherited from its
subnetwork.

Valid only if stackType is IPV4_IPV6.
Check the Ipv6AccessType enum for the list of possible values.

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

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

### getIpv6Address

An IPv6 internal network address for this network interface. To
use a static internal IP address, it must be unused and in the same region
as the instance's zone. If not specified, Google Cloud will automatically
assign an internal IPv6 address from the instance's subnetwork.

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

### hasIpv6Address

### clearIpv6Address

### setIpv6Address

An IPv6 internal network address for this network interface. To
use a static internal IP address, it must be unused and in the same region
as the instance's zone. If not specified, Google Cloud will automatically
assign an internal IPv6 address from the instance's subnetwork.

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

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

### getKind

Output only. \[Output Only\] Type of the resource. Alwayscompute#networkInterface for network interfaces.

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

### hasKind

### clearKind

### setKind

Output only. \[Output Only\] Type of the resource. Alwayscompute#networkInterface for network interfaces.

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

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

### getName

\[Output Only\] The name of the network interface, which is generated by the
server. For a VM, the network interface uses the nicN naming
format. Where N is a value between 0 and7. The default interface value is nic0.

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

### hasName

### clearName

### setName

\[Output Only\] The name of the network interface, which is generated by the
server. For a VM, the network interface uses the nicN naming
format. Where N is a value between 0 and7. The default interface value is nic0.

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

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

### getNetwork

URL of the VPC network resource for this instance. When creating an
instance, if neither the network nor the subnetwork is specified, the
default network global/networks/default is used. If the
selected project doesn't have the default network, you must specify a
network or subnet. If the network is not specified but the subnetwork is
specified, the network is inferred.

If you specify this property, you can specify the network as
a full or partial URL. For example, the following are all valid URLs:

- <https://www.googleapis.com/compute/v1/projects/project/global/networks/network>
- projects/project/global/networks/network
- global/networks/default

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

### hasNetwork

### clearNetwork

### setNetwork

URL of the VPC network resource for this instance. When creating an
instance, if neither the network nor the subnetwork is specified, the
default network global/networks/default is used. If the
selected project doesn't have the default network, you must specify a
network or subnet. If the network is not specified but the subnetwork is
specified, the network is inferred.

If you specify this property, you can specify the network as
a full or partial URL. For example, the following are all valid URLs:

- <https://www.googleapis.com/compute/v1/projects/project/global/networks/network>
- projects/project/global/networks/network
- global/networks/default

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

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

### getNetworkAttachment

The URL of the network attachment that this interface should connect
to in the following format:
projects/{project_number}/regions/{region_name}/networkAttachments/{network_attachment_name}.

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

### hasNetworkAttachment

### clearNetworkAttachment

### setNetworkAttachment

The URL of the network attachment that this interface should connect
to in the following format:
projects/{project_number}/regions/{region_name}/networkAttachments/{network_attachment_name}.

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

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

### getNetworkIP

An IPv4 internal IP address to assign to the instance for this network
interface. If not specified by the user, an unused internal IP is
assigned by the system.

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

### hasNetworkIP

### clearNetworkIP

### setNetworkIP

An IPv4 internal IP address to assign to the instance for this network
interface. If not specified by the user, an unused internal IP is
assigned by the system.

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

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

### getNicType

The type of vNIC to be used on this interface. This may be gVNIC or
VirtioNet.

Check the NicType enum for the list of possible values.

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

### hasNicType

### clearNicType

### setNicType

The type of vNIC to be used on this interface. This may be gVNIC or
VirtioNet.

Check the NicType enum for the list of possible values.

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

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

### getParentNicName

Name of the parent network interface of a dynamic network interface.

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

### hasParentNicName

### clearParentNicName

### setParentNicName

Name of the parent network interface of a dynamic network interface.

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

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

### getQueueCount

The networking queue count that's specified by users for the network
interface. Both Rx and Tx queues will be set to this number. It'll be empty
if not specified by the users.

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

### hasQueueCount

### clearQueueCount

### setQueueCount

The networking queue count that's specified by users for the network
interface. Both Rx and Tx queues will be set to this number. It'll be empty
if not specified by the users.

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

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

### getServiceClassId

Optional. Producer Service's Service class Id for the region of this network
interface. Can only be used with network_attachment. It is not possible to
use on its own however, network_attachment can be used without
service_class_id.

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

### hasServiceClassId

### clearServiceClassId

### setServiceClassId

Optional. Producer Service's Service class Id for the region of this network
interface. Can only be used with network_attachment. It is not possible to
use on its own however, network_attachment can be used without
service_class_id.

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

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

### getStackType

The stack type for this network interface. To assign only IPv4 addresses,
use IPV4_ONLY. To assign both IPv4 and IPv6 addresses, useIPV4_IPV6. If not specified, IPV4_ONLY is used.

This field can be both set at instance creation and update network
interface operations.
Check the StackType enum for the list of possible values.

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

### hasStackType

### clearStackType

### setStackType

The stack type for this network interface. To assign only IPv4 addresses,
use IPV4_ONLY. To assign both IPv4 and IPv6 addresses, useIPV4_IPV6. If not specified, IPV4_ONLY is used.

This field can be both set at instance creation and update network
interface operations.
Check the StackType enum for the list of possible values.

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

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

### getSubnetwork

The URL of the Subnetwork resource for this instance. If the network
resource is inlegacy
mode, do not specify this field. If the network is in auto subnet
mode, specifying the subnetwork is optional. If the network is in custom
subnet mode, specifying the subnetwork is required. If you specify this
field, you can specify the subnetwork as a full or partial URL. For
example, the following are all valid URLs:

- <https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork>
  - regions/region/subnetworks/subnetwork

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

### hasSubnetwork

### clearSubnetwork

### setSubnetwork

The URL of the Subnetwork resource for this instance. If the network
resource is inlegacy
mode, do not specify this field. If the network is in auto subnet
mode, specifying the subnetwork is optional. If the network is in custom
subnet mode, specifying the subnetwork is required. If you specify this
field, you can specify the subnetwork as a full or partial URL. For
example, the following are all valid URLs:

- <https://www.googleapis.com/compute/v1/projects/project/regions/region/subnetworks/subnetwork>
  - regions/region/subnetworks/subnetwork

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

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

### getVlan

VLAN tag of a dynamic network interface, must be an integer in the range
from 2 to 255 inclusively.

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

### hasVlan

### clearVlan

### setVlan

VLAN tag of a dynamic network interface, must be an integer in the range
from 2 to 255 inclusively.

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

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