Method: instances.updateNetworkInterface

Updates an instance's network interface. This method follows PATCH semantics.

HTTP request

PATCH https://www.googleapis.com/compute/beta/projects/{project}/zones/{zone}/instances/{resourceId}/updateNetworkInterface

The URL uses Google API HTTP annotation syntax.

Path parameters

Parameters
project

string

Project ID for this request.

zone

string

The name of the zone for this request.

resourceId

string

The instance name for this request.

Query parameters

Parameters
requestId

string

An optional request ID to identify requests. Specify a unique request ID so that if you must retry your request, the server will know to ignore the request if it has already been completed.

For example, consider a situation where you make an initial request and the request times out. If you make the request again with the same request ID, the server can check if original operation with the same request ID was received, and if so, will ignore the second request. This prevents clients from accidentally creating duplicate commitments.

The request ID must be a valid UUID with the exception that zero UUID is not supported (00000000-0000-0000-0000-000000000000).

networkInterface

string

The name of the network interface to update.

Request body

The request body contains data with the following structure:

JSON representation
{
  "resource": {
    "network": string,
    "subnetwork": string,
    "networkIP": string,
    "name": string,
    "accessConfigs": ,
    "aliasIpRanges": ,
    "fingerprint": string,
    "kind": string
  }
}
Fields
resource

object

The updated network interface with existing fingerprint.

resource.network

string

URL of the 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 network is not specified but the subnetwork is specified, the network is inferred.

This field is optional when creating a firewall rule. If not specified when creating a firewall rule, the default network global/networks/default is used.

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

resource.subnetwork

string

The URL of the Subnetwork resource for this instance. If the network resource is in legacy mode, do not provide this property. If the network is in auto subnet mode, providing the subnetwork is optional. If the network is in custom subnet mode, then this field should be specified. If you specify this property, you can specify the subnetwork as a full or partial URL. For example, the following are all valid URLs:

resource.networkIP

string

An IPv4 internal network 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.

resource.name

string

[Output Only] The name of the network interface, generated by the server. For network devices, these are eth0, eth1, etc.

resource.accessConfigs[]

object

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

resource.accessConfigs[].type

enum

The type of configuration. The default and only option is ONE_TO_ONE_NAT.

resource.accessConfigs[].name

string

The name of this access configuration. The default and recommended name is External NAT but you can use any arbitrary string you would like. For example, My external IP or Network Access.

resource.accessConfigs[].natIP

string

An external IP address associated with this instance. Specify an unused static external IP address available to the project or leave this field undefined to use an IP from a shared ephemeral IP address pool. If you specify a static external IP address, it must live in the same region as the zone of the instance.

resource.accessConfigs[].setPublicPtr

boolean

Specifies whether a public DNS ‘PTR’ record should be created to map the external IP address of the instance to a DNS domain name.

resource.accessConfigs[].publicPtrDomainName

string

The DNS domain name for the public PTR record. This field can only be set when the setPublicPtr field is enabled.

resource.accessConfigs[].networkTier

enum

This signifies the networking tier used for configuring this access configuration and can only take the following values: PREMIUM, STANDARD.

If an AccessConfig is specified without a valid external IP address, an ephemeral IP will be created with this networkTier.

If an AccessConfig with a valid external IP address is specified, it must match that of the networkTier associated with the Address resource owning that IP.

resource.accessConfigs[].kind

string

[Output Only] Type of the resource. Always compute#accessConfig for access configs.

resource.aliasIpRanges[]

object

An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks.

resource.aliasIpRanges[].ipCidrRange

string

The IP CIDR range represented by this alias IP range. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. This range may be a single IP address (e.g. 10.2.3.4), a netmask (e.g. /24) or a CIDR format string (e.g. 10.1.2.0/24).

resource.aliasIpRanges[].subnetworkRangeName

string

Optional subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used.

resource.fingerprint

string (bytes format)

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 the NetworkInterface.

A base64-encoded string.

resource.kind

string

[Output Only] Type of the resource. Always compute#networkInterface for network interfaces.

Response body

If successful, the response body contains data with the following structure:

JSON representation
{
  "operation": {
    "id": string,
    "creationTimestamp": string,
    "name": string,
    "zone": string,
    "clientOperationId": string,
    "operationType": string,
    "targetLink": string,
    "targetId": string,
    "status": enum,
    "statusMessage": string,
    "user": string,
    "progress": number,
    "insertTime": string,
    "startTime": string,
    "endTime": string,
    "error": {
      "errors": [
        {
          "code": string,
          "location": string,
          "message": string
        }
      ]
    },
    "warnings": {
      "code": enum,
      "message": string,
      "data": [
        {
          "key": string,
          "value": string
        }
      ]
    },
    "httpErrorStatusCode": number,
    "httpErrorMessage": string,
    "selfLink": string,
    "region": string,
    "description": string,
    "kind": string
  }
}
Fields
operation

object

operation.id

string (fixed64 format)

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

operation.creationTimestamp

string

[Deprecated] This field is deprecated.

operation.name

string

[Output Only] Name of the resource.

operation.zone

string

[Output Only] The URL of the zone where the operation resides. Only available when performing per-zone operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.

operation.clientOperationId

string

[Output Only] Reserved for future use.

operation.operationType

string

[Output Only] The type of operation, such as insert, update, or delete, and so on.

operation.targetLink

string

[Output Only] The URL of the resource that the operation modifies. For operations related to creating a snapshot, this points to the persistent disk that the snapshot was created from.

operation.targetId

string (fixed64 format)

[Output Only] The unique target ID, which identifies a specific incarnation of the target resource.

operation.status

enum

[Output Only] The status of the operation, which can be one of the following: PENDING, RUNNING, or DONE.

operation.statusMessage

string

[Output Only] An optional textual description of the current status of the operation.

operation.user

string

[Output Only] User who requested the operation, for example: user@example.com.

operation.progress

number

[Output Only] An optional progress indicator that ranges from 0 to 100. There is no requirement that this be linear or support any granularity of operations. This should not be used to guess when the operation will be complete. This number should monotonically increase as the operation progresses.

operation.insertTime

string

[Output Only] The time that this operation was requested. This value is in RFC3339 text format.

operation.startTime

string

[Output Only] The time that this operation was started by the server. This value is in RFC3339 text format.

operation.endTime

string

[Output Only] The time that this operation was completed. This value is in RFC3339 text format.

operation.error

object

[Output Only] If errors are generated during processing of the operation, this field will be populated.

operation.error.errors[]

object

[Output Only] The array of errors encountered while processing this operation.

operation.error.errors[].code

string

[Output Only] The error type identifier for this error.

operation.error.errors[].location

string

[Output Only] Indicates the field in the request that caused the error. This property is optional.

operation.error.errors[].message

string

[Output Only] An optional, human-readable error message.

operation.warnings[]

object

[Output Only] If warning messages are generated during processing of the operation, this field will be populated.

operation.warnings[].code

enum

[Output Only] A warning code, if applicable. For example, Compute Engine returns NO_RESULTS_ON_PAGE if there are no results in the response.

operation.warnings[].message

string

[Output Only] A human-readable description of the warning code.

operation.warnings[].data[]

object

[Output Only] Metadata about this warning in key: value format. For example:

"data": [  {  "key": "scope",  "value": "zones/us-east1-d"  }

operation.warnings[].data[].key

string

[Output Only] A key that provides more detail on the warning being returned. For example, for warnings where there are no results in a list request for a particular zone, this key might be scope and the key value might be the zone name. Other examples might be a key indicating a deprecated resource and a suggested replacement, or a warning about invalid network settings (for example, if an instance attempts to perform IP forwarding but is not enabled for IP forwarding).

operation.warnings[].data[].value

string

[Output Only] A warning data value corresponding to the key.

operation.httpErrorStatusCode

number

[Output Only] If the operation fails, this field contains the HTTP error status code that was returned. For example, a 404 means the resource was not found.

operation.httpErrorMessage

string

[Output Only] If the operation fails, this field contains the HTTP error message that was returned, such as NOT FOUND.

operation.selfLink

string

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

operation.region

string

[Output Only] The URL of the region where the operation resides. Only available when performing regional operations. You must specify this field as part of the HTTP request URL. It is not settable as a field in the request body.

operation.description

string

[Output Only] A textual description of the operation, which is set when the operation is created.

operation.kind

string

[Output Only] Type of the resource. Always compute#operation for Operation resources.

Authorization Scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/compute
  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Auth Guide.

IAM Permissions

In addition to any permissions specified on the fields above, authorization requires one or more of the following Google IAM permissions:

  • compute.instances.updateNetworkInterface

Send feedback about...

Compute Engine