Class: Google::Apis::ComputeV1::Instance

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
generated/google/apis/compute_v1/classes.rb,
generated/google/apis/compute_v1/representations.rb,
generated/google/apis/compute_v1/representations.rb

Overview

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 ==)

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Google::Apis::Core::JsonObjectSupport

#to_json

Methods included from Google::Apis::Core::Hashable

process_value, #to_h

Constructor Details

#initialize(**args) ⇒ Instance

Returns a new instance of Instance.



9869
9870
9871
# File 'generated/google/apis/compute_v1/classes.rb', line 9869

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#can_ip_forwardBoolean Also known as: can_ip_forward?

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. Corresponds to the JSON property canIpForward

Returns:

  • (Boolean)


9679
9680
9681
# File 'generated/google/apis/compute_v1/classes.rb', line 9679

def can_ip_forward
  @can_ip_forward
end

#cpu_platformString

[Output Only] The CPU platform used by this instance. Corresponds to the JSON property cpuPlatform

Returns:

  • (String)


9685
9686
9687
# File 'generated/google/apis/compute_v1/classes.rb', line 9685

def cpu_platform
  @cpu_platform
end

#creation_timestampString

[Output Only] Creation timestamp in RFC3339 text format. Corresponds to the JSON property creationTimestamp

Returns:

  • (String)


9690
9691
9692
# File 'generated/google/apis/compute_v1/classes.rb', line 9690

def creation_timestamp
  @creation_timestamp
end

#deletion_protectionBoolean Also known as: deletion_protection?

Whether the resource should be protected against deletion. Corresponds to the JSON property deletionProtection

Returns:

  • (Boolean)


9695
9696
9697
# File 'generated/google/apis/compute_v1/classes.rb', line 9695

def deletion_protection
  @deletion_protection
end

#descriptionString

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

Returns:

  • (String)


9702
9703
9704
# File 'generated/google/apis/compute_v1/classes.rb', line 9702

def description
  @description
end

#disksArray<Google::Apis::ComputeV1::AttachedDisk>

Array of disks associated with this instance. Persistent disks must be created before you can assign them. Corresponds to the JSON property disks



9708
9709
9710
# File 'generated/google/apis/compute_v1/classes.rb', line 9708

def disks
  @disks
end

#display_deviceGoogle::Apis::ComputeV1::DisplayDevice

A set of Display Device options Corresponds to the JSON property displayDevice



9713
9714
9715
# File 'generated/google/apis/compute_v1/classes.rb', line 9713

def display_device
  @display_device
end

#guest_acceleratorsArray<Google::Apis::ComputeV1::AcceleratorConfig>

A list of the type and count of accelerator cards attached to the instance. Corresponds to the JSON property guestAccelerators



9718
9719
9720
# File 'generated/google/apis/compute_v1/classes.rb', line 9718

def guest_accelerators
  @guest_accelerators
end

#hostnameString

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. Corresponds to the JSON property hostname

Returns:

  • (String)


9726
9727
9728
# File 'generated/google/apis/compute_v1/classes.rb', line 9726

def hostname
  @hostname
end

#idFixnum

[Output Only] The unique identifier for the resource. This identifier is defined by the server. Corresponds to the JSON property id

Returns:

  • (Fixnum)


9732
9733
9734
# File 'generated/google/apis/compute_v1/classes.rb', line 9732

def id
  @id
end

#kindString

[Output Only] Type of the resource. Always compute#instance for instances. Corresponds to the JSON property kind

Returns:

  • (String)


9737
9738
9739
# File 'generated/google/apis/compute_v1/classes.rb', line 9737

def kind
  @kind
end

#label_fingerprintString

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. Corresponds to the JSON property labelFingerprint NOTE: Values are automatically base64 encoded/decoded in the client library.

Returns:

  • (String)


9748
9749
9750
# File 'generated/google/apis/compute_v1/classes.rb', line 9748

def label_fingerprint
  @label_fingerprint
end

#labelsHash<String,String>

Labels to apply to this instance. These can be later modified by the setLabels method. Corresponds to the JSON property labels

Returns:

  • (Hash<String,String>)


9754
9755
9756
# File 'generated/google/apis/compute_v1/classes.rb', line 9754

def labels
  @labels
end

#machine_typeString

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. Corresponds to the JSON property machineType

Returns:

  • (String)


9771
9772
9773
# File 'generated/google/apis/compute_v1/classes.rb', line 9771

def machine_type
  @machine_type
end

#metadataGoogle::Apis::ComputeV1::Metadata

A metadata key/value entry. Corresponds to the JSON property metadata



9776
9777
9778
# File 'generated/google/apis/compute_v1/classes.rb', line 9776

def 
  @metadata
end

#min_cpu_platformString

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". Corresponds to the JSON property minCpuPlatform

Returns:

  • (String)


9783
9784
9785
# File 'generated/google/apis/compute_v1/classes.rb', line 9783

def min_cpu_platform
  @min_cpu_platform
end

#nameString

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. Corresponds to the JSON property name

Returns:

  • (String)


9794
9795
9796
# File 'generated/google/apis/compute_v1/classes.rb', line 9794

def name
  @name
end

#network_interfacesArray<Google::Apis::ComputeV1::NetworkInterface>

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. Corresponds to the JSON property networkInterfaces



9801
9802
9803
# File 'generated/google/apis/compute_v1/classes.rb', line 9801

def network_interfaces
  @network_interfaces
end

#reservation_affinityGoogle::Apis::ComputeV1::ReservationAffinity

Specifies the reservations that this instance can consume from. Corresponds to the JSON property reservationAffinity



9806
9807
9808
# File 'generated/google/apis/compute_v1/classes.rb', line 9806

def reservation_affinity
  @reservation_affinity
end

#schedulingGoogle::Apis::ComputeV1::Scheduling

Sets the scheduling options for an Instance. NextID: 9 Corresponds to the JSON property scheduling



9811
9812
9813
# File 'generated/google/apis/compute_v1/classes.rb', line 9811

def scheduling
  @scheduling
end

[Output Only] Server-defined URL for this resource. Corresponds to the JSON property selfLink

Returns:

  • (String)


9816
9817
9818
# File 'generated/google/apis/compute_v1/classes.rb', line 9816

def self_link
  @self_link
end

#service_accountsArray<Google::Apis::ComputeV1::ServiceAccount>

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. Corresponds to the JSON property serviceAccounts



9825
9826
9827
# File 'generated/google/apis/compute_v1/classes.rb', line 9825

def service_accounts
  @service_accounts
end

#shielded_instance_configGoogle::Apis::ComputeV1::ShieldedInstanceConfig

A set of Shielded Instance options. Corresponds to the JSON property shieldedInstanceConfig



9830
9831
9832
# File 'generated/google/apis/compute_v1/classes.rb', line 9830

def shielded_instance_config
  @shielded_instance_config
end

#shielded_instance_integrity_policyGoogle::Apis::ComputeV1::ShieldedInstanceIntegrityPolicy

The policy describes the baseline against which Instance boot integrity is measured. Corresponds to the JSON property shieldedInstanceIntegrityPolicy



9836
9837
9838
# File 'generated/google/apis/compute_v1/classes.rb', line 9836

def shielded_instance_integrity_policy
  @shielded_instance_integrity_policy
end

#start_restrictedBoolean Also known as: start_restricted?

[Output Only] Whether a VM has been restricted for start because Compute Engine has detected suspicious activity. Corresponds to the JSON property startRestricted

Returns:

  • (Boolean)


9842
9843
9844
# File 'generated/google/apis/compute_v1/classes.rb', line 9842

def start_restricted
  @start_restricted
end

#statusString

[Output Only] The status of the instance. One of the following values: PROVISIONING, STAGING, RUNNING, STOPPING, STOPPED, SUSPENDING, SUSPENDED, and TERMINATED. Corresponds to the JSON property status

Returns:

  • (String)


9850
9851
9852
# File 'generated/google/apis/compute_v1/classes.rb', line 9850

def status
  @status
end

#status_messageString

[Output Only] An optional, human-readable explanation of the status. Corresponds to the JSON property statusMessage

Returns:

  • (String)


9855
9856
9857
# File 'generated/google/apis/compute_v1/classes.rb', line 9855

def status_message
  @status_message
end

#tagsGoogle::Apis::ComputeV1::Tags

A set of instance tags. Corresponds to the JSON property tags



9860
9861
9862
# File 'generated/google/apis/compute_v1/classes.rb', line 9860

def tags
  @tags
end

#zoneString

[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. Corresponds to the JSON property zone

Returns:

  • (String)


9867
9868
9869
# File 'generated/google/apis/compute_v1/classes.rb', line 9867

def zone
  @zone
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
# File 'generated/google/apis/compute_v1/classes.rb', line 9874

def update!(**args)
  @can_ip_forward = args[:can_ip_forward] if args.key?(:can_ip_forward)
  @cpu_platform = args[:cpu_platform] if args.key?(:cpu_platform)
  @creation_timestamp = args[:creation_timestamp] if args.key?(:creation_timestamp)
  @deletion_protection = args[:deletion_protection] if args.key?(:deletion_protection)
  @description = args[:description] if args.key?(:description)
  @disks = args[:disks] if args.key?(:disks)
  @display_device = args[:display_device] if args.key?(:display_device)
  @guest_accelerators = args[:guest_accelerators] if args.key?(:guest_accelerators)
  @hostname = args[:hostname] if args.key?(:hostname)
  @id = args[:id] if args.key?(:id)
  @kind = args[:kind] if args.key?(:kind)
  @label_fingerprint = args[:label_fingerprint] if args.key?(:label_fingerprint)
  @labels = args[:labels] if args.key?(:labels)
  @machine_type = args[:machine_type] if args.key?(:machine_type)
  @metadata = args[:metadata] if args.key?(:metadata)
  @min_cpu_platform = args[:min_cpu_platform] if args.key?(:min_cpu_platform)
  @name = args[:name] if args.key?(:name)
  @network_interfaces = args[:network_interfaces] if args.key?(:network_interfaces)
  @reservation_affinity = args[:reservation_affinity] if args.key?(:reservation_affinity)
  @scheduling = args[:scheduling] if args.key?(:scheduling)
  @self_link = args[:self_link] if args.key?(:self_link)
  @service_accounts = args[:service_accounts] if args.key?(:service_accounts)
  @shielded_instance_config = args[:shielded_instance_config] if args.key?(:shielded_instance_config)
  @shielded_instance_integrity_policy = args[:shielded_instance_integrity_policy] if args.key?(:shielded_instance_integrity_policy)
  @start_restricted = args[:start_restricted] if args.key?(:start_restricted)
  @status = args[:status] if args.key?(:status)
  @status_message = args[:status_message] if args.key?(:status_message)
  @tags = args[:tags] if args.key?(:tags)
  @zone = args[:zone] if args.key?(:zone)
end