target.apidocs.com.google.api.services.compute.model.Instance.html Maven / Gradle / Ivy
Instance (Compute Engine API v1-rev20200104-1.30.8)
com.google.api.services.compute.model
Class Instance
- java.lang.Object
-
- java.util.AbstractMap<String,Object>
-
- com.google.api.client.util.GenericData
-
- com.google.api.client.json.GenericJson
-
- com.google.api.services.compute.model.Instance
-
public final class Instance
extends GenericJson
Represents an Instance resource.
An instance is a virtual machine that is hosted on Google Cloud Platform. For more information,
read Virtual Machine Instances. (== resource_for {$api_version}.instances ==)
This is the Java data model class that specifies how to parse/serialize into the JSON that is
transmitted over HTTP when working with the Compute Engine API. For a detailed explanation see:
https://developers.google.com/api-client-library/java/google-http-java-client/json
- Author:
- Google, Inc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.api.client.util.GenericData
GenericData.Flags
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
-
Constructor Summary
Constructors
Constructor and Description
Instance()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
Instance
clone()
byte[]
decodeLabelFingerprint()
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking.
Instance
encodeLabelFingerprint(byte[] labelFingerprint)
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking.
Boolean
getCanIpForward()
Allows this instance to send and receive packets with non-matching destination or source IPs.
String
getCpuPlatform()
[Output Only] The CPU platform used by this instance.
String
getCreationTimestamp()
[Output Only] Creation timestamp in RFC3339 text format.
Boolean
getDeletionProtection()
Whether the resource should be protected against deletion.
String
getDescription()
An optional description of this resource.
List<AttachedDisk>
getDisks()
Array of disks associated with this instance.
DisplayDevice
getDisplayDevice()
Enables display device for the instance.
List<AcceleratorConfig>
getGuestAccelerators()
A list of the type and count of accelerator cards attached to the instance.
String
getHostname()
Specifies the hostname of the instance.
BigInteger
getId()
[Output Only] The unique identifier for the resource.
String
getKind()
[Output Only] Type of the resource.
String
getLabelFingerprint()
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking.
Map<String,String>
getLabels()
Labels to apply to this instance.
String
getMachineType()
Full or partial URL of the machine type resource to use for this instance, in the format:
zones/zone/machineTypes/machine-type.
Metadata
getMetadata()
The metadata key/value pairs assigned to this instance.
String
getMinCpuPlatform()
Specifies a minimum CPU platform for the VM instance.
String
getName()
The name of the resource, provided by the client when initially creating the resource.
List<NetworkInterface>
getNetworkInterfaces()
An array of network configurations for this instance.
ReservationAffinity
getReservationAffinity()
Specifies the reservations that this instance can consume from.
Scheduling
getScheduling()
Sets the scheduling options for this instance.
String
getSelfLink()
[Output Only] Server-defined URL for this resource.
List<ServiceAccount>
getServiceAccounts()
A list of service accounts, with their specified scopes, authorized for this instance.
ShieldedInstanceConfig
getShieldedInstanceConfig()
ShieldedInstanceIntegrityPolicy
getShieldedInstanceIntegrityPolicy()
Boolean
getStartRestricted()
[Output Only] Whether a VM has been restricted for start because Compute Engine has detected
suspicious activity.
String
getStatus()
[Output Only] The status of the instance.
String
getStatusMessage()
[Output Only] An optional, human-readable explanation of the status.
Tags
getTags()
Tags to apply to this instance.
String
getZone()
[Output Only] URL of the zone where the instance resides.
Instance
set(String fieldName,
Object value)
Instance
setCanIpForward(Boolean canIpForward)
Allows this instance to send and receive packets with non-matching destination or source IPs.
Instance
setCpuPlatform(String cpuPlatform)
[Output Only] The CPU platform used by this instance.
Instance
setCreationTimestamp(String creationTimestamp)
[Output Only] Creation timestamp in RFC3339 text format.
Instance
setDeletionProtection(Boolean deletionProtection)
Whether the resource should be protected against deletion.
Instance
setDescription(String description)
An optional description of this resource.
Instance
setDisks(List<AttachedDisk> disks)
Array of disks associated with this instance.
Instance
setDisplayDevice(DisplayDevice displayDevice)
Enables display device for the instance.
Instance
setGuestAccelerators(List<AcceleratorConfig> guestAccelerators)
A list of the type and count of accelerator cards attached to the instance.
Instance
setHostname(String hostname)
Specifies the hostname of the instance.
Instance
setId(BigInteger id)
[Output Only] The unique identifier for the resource.
Instance
setKind(String kind)
[Output Only] Type of the resource.
Instance
setLabelFingerprint(String labelFingerprint)
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking.
Instance
setLabels(Map<String,String> labels)
Labels to apply to this instance.
Instance
setMachineType(String machineType)
Full or partial URL of the machine type resource to use for this instance, in the format:
zones/zone/machineTypes/machine-type.
Instance
setMetadata(Metadata metadata)
The metadata key/value pairs assigned to this instance.
Instance
setMinCpuPlatform(String minCpuPlatform)
Specifies a minimum CPU platform for the VM instance.
Instance
setName(String name)
The name of the resource, provided by the client when initially creating the resource.
Instance
setNetworkInterfaces(List<NetworkInterface> networkInterfaces)
An array of network configurations for this instance.
Instance
setReservationAffinity(ReservationAffinity reservationAffinity)
Specifies the reservations that this instance can consume from.
Instance
setScheduling(Scheduling scheduling)
Sets the scheduling options for this instance.
Instance
setSelfLink(String selfLink)
[Output Only] Server-defined URL for this resource.
Instance
setServiceAccounts(List<ServiceAccount> serviceAccounts)
A list of service accounts, with their specified scopes, authorized for this instance.
Instance
setShieldedInstanceConfig(ShieldedInstanceConfig shieldedInstanceConfig)
Instance
setShieldedInstanceIntegrityPolicy(ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicy)
Instance
setStartRestricted(Boolean startRestricted)
[Output Only] Whether a VM has been restricted for start because Compute Engine has detected
suspicious activity.
Instance
setStatus(String status)
[Output Only] The status of the instance.
Instance
setStatusMessage(String statusMessage)
[Output Only] An optional, human-readable explanation of the status.
Instance
setTags(Tags tags)
Tags to apply to this instance.
Instance
setZone(String zone)
[Output Only] URL of the zone where the instance resides.
-
Methods inherited from class com.google.api.client.json.GenericJson
getFactory, setFactory, toPrettyString, toString
-
Methods inherited from class com.google.api.client.util.GenericData
entrySet, equals, get, getClassInfo, getUnknownKeys, hashCode, put, putAll, remove, setUnknownKeys
-
Methods inherited from class java.util.AbstractMap
clear, containsKey, containsValue, isEmpty, keySet, size, values
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, merge, putIfAbsent, remove, replace, replace, replaceAll
-
-
Method Detail
-
getCanIpForward
public Boolean getCanIpForward()
Allows this instance to send and receive packets with non-matching destination or source IPs.
This is required if you plan to use this instance to forward routes. For more information, see
Enabling IP Forwarding.
- Returns:
- value or
null for none
-
setCanIpForward
public Instance setCanIpForward(Boolean canIpForward)
Allows this instance to send and receive packets with non-matching destination or source IPs.
This is required if you plan to use this instance to forward routes. For more information, see
Enabling IP Forwarding.
- Parameters:
canIpForward - canIpForward or null for none
-
getCpuPlatform
public String getCpuPlatform()
[Output Only] The CPU platform used by this instance.
- Returns:
- value or
null for none
-
setCpuPlatform
public Instance setCpuPlatform(String cpuPlatform)
[Output Only] The CPU platform used by this instance.
- Parameters:
cpuPlatform - cpuPlatform or null for none
-
getCreationTimestamp
public String getCreationTimestamp()
[Output Only] Creation timestamp in RFC3339 text format.
- Returns:
- value or
null for none
-
setCreationTimestamp
public Instance setCreationTimestamp(String creationTimestamp)
[Output Only] Creation timestamp in RFC3339 text format.
- Parameters:
creationTimestamp - creationTimestamp or null for none
-
getDeletionProtection
public Boolean getDeletionProtection()
Whether the resource should be protected against deletion.
- Returns:
- value or
null for none
-
setDeletionProtection
public Instance setDeletionProtection(Boolean deletionProtection)
Whether the resource should be protected against deletion.
- Parameters:
deletionProtection - deletionProtection or null for none
-
getDescription
public String getDescription()
An optional description of this resource. Provide this property when you create the resource.
- Returns:
- value or
null for none
-
setDescription
public Instance setDescription(String description)
An optional description of this resource. Provide this property when you create the resource.
- Parameters:
description - description or null for none
-
getDisks
public List<AttachedDisk> getDisks()
Array of disks associated with this instance. Persistent disks must be created before you can
assign them.
- Returns:
- value or
null for none
-
setDisks
public Instance setDisks(List<AttachedDisk> disks)
Array of disks associated with this instance. Persistent disks must be created before you can
assign them.
- Parameters:
disks - disks or null for none
-
getDisplayDevice
public DisplayDevice getDisplayDevice()
Enables display device for the instance.
- Returns:
- value or
null for none
-
setDisplayDevice
public Instance setDisplayDevice(DisplayDevice displayDevice)
Enables display device for the instance.
- Parameters:
displayDevice - displayDevice or null for none
-
getGuestAccelerators
public List<AcceleratorConfig> getGuestAccelerators()
A list of the type and count of accelerator cards attached to the instance.
- Returns:
- value or
null for none
-
setGuestAccelerators
public Instance setGuestAccelerators(List<AcceleratorConfig> guestAccelerators)
A list of the type and count of accelerator cards attached to the instance.
- Parameters:
guestAccelerators - guestAccelerators or null for none
-
getHostname
public String getHostname()
Specifies the hostname of the instance. The specified hostname must be RFC1035 compliant. If
hostname is not specified, the default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when
using the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS.
- Returns:
- value or
null for none
-
setHostname
public Instance setHostname(String hostname)
Specifies the hostname of the instance. The specified hostname must be RFC1035 compliant. If
hostname is not specified, the default hostname is [INSTANCE_NAME].c.[PROJECT_ID].internal when
using the global DNS, and [INSTANCE_NAME].[ZONE].c.[PROJECT_ID].internal when using zonal DNS.
- Parameters:
hostname - hostname or null for none
-
getId
public BigInteger getId()
[Output Only] The unique identifier for the resource. This identifier is defined by the server.
- Returns:
- value or
null for none
-
setId
public Instance setId(BigInteger id)
[Output Only] The unique identifier for the resource. This identifier is defined by the server.
- Parameters:
id - id or null for none
-
getKind
public String getKind()
[Output Only] Type of the resource. Always compute#instance for instances.
- Returns:
- value or
null for none
-
setKind
public Instance setKind(String kind)
[Output Only] Type of the resource. Always compute#instance for instances.
- Parameters:
kind - kind or null for none
-
getLabelFingerprint
public String getLabelFingerprint()
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking. The fingerprint is initially generated by Compute Engine and changes
after every request to modify or update labels. You must always provide an up-to-date
fingerprint hash in order to update or change labels.
To see the latest fingerprint, make get() request to the instance.
- Returns:
- value or
null for none
- See Also:
decodeLabelFingerprint()
-
decodeLabelFingerprint
public byte[] decodeLabelFingerprint()
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking. The fingerprint is initially generated by Compute Engine and changes
after every request to modify or update labels. You must always provide an up-to-date
fingerprint hash in order to update or change labels.
To see the latest fingerprint, make get() request to the instance.
- Returns:
- Base64 decoded value or
null for none
- Since:
- 1.14
- See Also:
getLabelFingerprint()
-
setLabelFingerprint
public Instance setLabelFingerprint(String labelFingerprint)
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking. The fingerprint is initially generated by Compute Engine and changes
after every request to modify or update labels. You must always provide an up-to-date
fingerprint hash in order to update or change labels.
To see the latest fingerprint, make get() request to the instance.
- Parameters:
labelFingerprint - labelFingerprint or null for none
- See Also:
#encodeLabelFingerprint()
-
encodeLabelFingerprint
public Instance encodeLabelFingerprint(byte[] labelFingerprint)
A fingerprint for this request, which is essentially a hash of the label's contents and used
for optimistic locking. The fingerprint is initially generated by Compute Engine and changes
after every request to modify or update labels. You must always provide an up-to-date
fingerprint hash in order to update or change labels.
To see the latest fingerprint, make get() request to the instance.
- Since:
- 1.14
- See Also:
The value is encoded Base64 or {@code null} for none.
-
getLabels
public Map<String,String> getLabels()
Labels to apply to this instance. These can be later modified by the setLabels method.
- Returns:
- value or
null for none
-
setLabels
public Instance setLabels(Map<String,String> labels)
Labels to apply to this instance. These can be later modified by the setLabels method.
- Parameters:
labels - labels or null for none
-
getMachineType
public String getMachineType()
Full or partial URL of the machine type resource to use for this instance, in the format:
zones/zone/machineTypes/machine-type. This is provided by the client when the instance is
created. For example, the following is a valid partial url to a predefined machine type: zones
/us-central1-f/machineTypes/n1-standard-1
To create a custom machine type, provide a URL to a machine type in the following format, where
CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for
this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of
memory is 5120 MB): zones/zone/machineTypes/custom-CPUS-MEMORY
For example: zones/us-central1-f/machineTypes/custom-4-5120
For a full list of restrictions, read the Specifications for custom machine types.
- Returns:
- value or
null for none
-
setMachineType
public Instance setMachineType(String machineType)
Full or partial URL of the machine type resource to use for this instance, in the format:
zones/zone/machineTypes/machine-type. This is provided by the client when the instance is
created. For example, the following is a valid partial url to a predefined machine type: zones
/us-central1-f/machineTypes/n1-standard-1
To create a custom machine type, provide a URL to a machine type in the following format, where
CPUS is 1 or an even number up to 32 (2, 4, 6, ... 24, etc), and MEMORY is the total memory for
this instance. Memory must be a multiple of 256 MB and must be supplied in MB (e.g. 5 GB of
memory is 5120 MB): zones/zone/machineTypes/custom-CPUS-MEMORY
For example: zones/us-central1-f/machineTypes/custom-4-5120
For a full list of restrictions, read the Specifications for custom machine types.
- Parameters:
machineType - machineType or null for none
-
getMetadata
public Metadata getMetadata()
The metadata key/value pairs assigned to this instance. This includes custom metadata and
predefined keys.
- Returns:
- value or
null for none
-
setMetadata
public Instance setMetadata(Metadata metadata)
The metadata key/value pairs assigned to this instance. This includes custom metadata and
predefined keys.
- Parameters:
metadata - metadata or null for none
-
getMinCpuPlatform
public String getMinCpuPlatform()
Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names
of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy
Bridge".
- Returns:
- value or
null for none
-
setMinCpuPlatform
public Instance setMinCpuPlatform(String minCpuPlatform)
Specifies a minimum CPU platform for the VM instance. Applicable values are the friendly names
of CPU platforms, such as minCpuPlatform: "Intel Haswell" or minCpuPlatform: "Intel Sandy
Bridge".
- Parameters:
minCpuPlatform - minCpuPlatform or null for none
-
getName
public String getName()
The name of the resource, provided by the client when initially creating the resource. The
resource name must be 1-63 characters long, and comply with RFC1035. 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:
- value or
null for none
-
setName
public Instance setName(String name)
The name of the resource, provided by the client when initially creating the resource. The
resource name must be 1-63 characters long, and comply with RFC1035. 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.
- Parameters:
name - name or null for none
-
getNetworkInterfaces
public List<NetworkInterface> getNetworkInterfaces()
An array of network configurations for this instance. These specify how interfaces are
configured to interact with other network services, such as connecting to the internet.
Multiple interfaces are supported per instance.
- Returns:
- value or
null for none
-
setNetworkInterfaces
public Instance setNetworkInterfaces(List<NetworkInterface> networkInterfaces)
An array of network configurations for this instance. These specify how interfaces are
configured to interact with other network services, such as connecting to the internet.
Multiple interfaces are supported per instance.
- Parameters:
networkInterfaces - networkInterfaces or null for none
-
getReservationAffinity
public ReservationAffinity getReservationAffinity()
Specifies the reservations that this instance can consume from.
- Returns:
- value or
null for none
-
setReservationAffinity
public Instance setReservationAffinity(ReservationAffinity reservationAffinity)
Specifies the reservations that this instance can consume from.
- Parameters:
reservationAffinity - reservationAffinity or null for none
-
getScheduling
public Scheduling getScheduling()
Sets the scheduling options for this instance.
- Returns:
- value or
null for none
-
setScheduling
public Instance setScheduling(Scheduling scheduling)
Sets the scheduling options for this instance.
- Parameters:
scheduling - scheduling or null for none
-
getSelfLink
public String getSelfLink()
[Output Only] Server-defined URL for this resource.
- Returns:
- value or
null for none
-
setSelfLink
public Instance setSelfLink(String selfLink)
[Output Only] Server-defined URL for this resource.
- Parameters:
selfLink - selfLink or null for none
-
getServiceAccounts
public List<ServiceAccount> getServiceAccounts()
A list of service accounts, with their specified scopes, authorized for this instance. Only one
service account per VM instance is supported.
Service accounts generate access tokens that can be accessed through the metadata server and
used to authenticate applications on the instance. See Service Accounts for more information.
- Returns:
- value or
null for none
-
setServiceAccounts
public Instance setServiceAccounts(List<ServiceAccount> serviceAccounts)
A list of service accounts, with their specified scopes, authorized for this instance. Only one
service account per VM instance is supported.
Service accounts generate access tokens that can be accessed through the metadata server and
used to authenticate applications on the instance. See Service Accounts for more information.
- Parameters:
serviceAccounts - serviceAccounts or null for none
-
getShieldedInstanceConfig
public ShieldedInstanceConfig getShieldedInstanceConfig()
- Returns:
- value or
null for none
-
setShieldedInstanceConfig
public Instance setShieldedInstanceConfig(ShieldedInstanceConfig shieldedInstanceConfig)
- Parameters:
shieldedInstanceConfig - shieldedInstanceConfig or null for none
-
getShieldedInstanceIntegrityPolicy
public ShieldedInstanceIntegrityPolicy getShieldedInstanceIntegrityPolicy()
- Returns:
- value or
null for none
-
setShieldedInstanceIntegrityPolicy
public Instance setShieldedInstanceIntegrityPolicy(ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicy)
- Parameters:
shieldedInstanceIntegrityPolicy - shieldedInstanceIntegrityPolicy or null for none
-
getStartRestricted
public Boolean getStartRestricted()
[Output Only] Whether a VM has been restricted for start because Compute Engine has detected
suspicious activity.
- Returns:
- value or
null for none
-
setStartRestricted
public Instance setStartRestricted(Boolean startRestricted)
[Output Only] Whether a VM has been restricted for start because Compute Engine has detected
suspicious activity.
- Parameters:
startRestricted - startRestricted or null for none
-
getStatus
public String getStatus()
[Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING,
RUNNING, STOPPING, STOPPED, SUSPENDING, SUSPENDED, and TERMINATED.
- Returns:
- value or
null for none
-
setStatus
public Instance setStatus(String status)
[Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING,
RUNNING, STOPPING, STOPPED, SUSPENDING, SUSPENDED, and TERMINATED.
- Parameters:
status - status or null for none
-
getStatusMessage
public String getStatusMessage()
[Output Only] An optional, human-readable explanation of the status.
- Returns:
- value or
null for none
-
setStatusMessage
public Instance setStatusMessage(String statusMessage)
[Output Only] An optional, human-readable explanation of the status.
- Parameters:
statusMessage - statusMessage or null for none
-
getTags
public Tags getTags()
Tags to apply to this instance. Tags are used to identify valid sources or targets for network
firewalls and are specified by the client during instance creation. The tags can be later
modified by the setTags method. Each tag within the list must comply with RFC1035. Multiple
tags can be specified via the 'tags.items' field.
- Returns:
- value or
null for none
-
setTags
public Instance setTags(Tags tags)
Tags to apply to this instance. Tags are used to identify valid sources or targets for network
firewalls and are specified by the client during instance creation. The tags can be later
modified by the setTags method. Each tag within the list must comply with RFC1035. Multiple
tags can be specified via the 'tags.items' field.
- Parameters:
tags - tags or null for none
-
getZone
public String getZone()
[Output Only] URL of the zone where the instance resides. You must specify this field as part
of the HTTP request URL. It is not settable as a field in the request body.
- Returns:
- value or
null for none
-
setZone
public Instance setZone(String zone)
[Output Only] URL of the zone where the instance resides. You must specify this field as part
of the HTTP request URL. It is not settable as a field in the request body.
- Parameters:
zone - zone or null for none
-
set
public Instance set(String fieldName,
Object value)
- Overrides:
set in class GenericJson
-
clone
public Instance clone()
- Overrides:
clone in class GenericJson
Copyright © 2011–2020 Google. All rights reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy