Class: OCI::Core::Models::Instance
- Inherits:
-
Object
- Object
- OCI::Core::Models::Instance
- Defined in:
- lib/oci/core/models/instance.rb
Constant Summary collapse
- LIFECYCLE_STATE_ENUM =
[LIFECYCLE_STATE_PROVISIONING = 'PROVISIONING', LIFECYCLE_STATE_RUNNING = 'RUNNING', LIFECYCLE_STATE_STARTING = 'STARTING', LIFECYCLE_STATE_STOPPING = 'STOPPING', LIFECYCLE_STATE_STOPPED = 'STOPPED', LIFECYCLE_STATE_CREATING_IMAGE = 'CREATING_IMAGE', LIFECYCLE_STATE_TERMINATING = 'TERMINATING', LIFECYCLE_STATE_TERMINATED = 'TERMINATED', LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
Instance Attribute Summary collapse
-
#availability_domain ⇒ String
The Availability Domain the instance is running in.
-
#compartment_id ⇒ String
The OCID of the compartment that contains the instance.
-
#display_name ⇒ String
A user-friendly name.
-
#extended_metadata ⇒ Hash<String, Object>
Additional metadata key/value pairs that you provide.
-
#id ⇒ String
The OCID of the instance.
-
#image_id ⇒ String
Deprecated.
-
#ipxe_script ⇒ String
When a bare metal or virtual machine instance boots, the iPXE firmware that runs on the instance is configured to run an iPXE script to continue the boot process.
-
#lifecycle_state ⇒ String
The current state of the instance.
-
#metadata ⇒ Hash<String, String>
Custom metadata that you provide.
-
#region ⇒ String
The region that contains the Availability Domain the instance is running in.
-
#shape ⇒ String
The shape of the instance.
-
#source_details ⇒ OCI::Core::Models::InstanceSourceDetails
Details for creating an instance.
-
#time_created ⇒ DateTime
The date and time the instance was created, in the format defined by RFC3339.
Instance Method Summary collapse
-
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other_object) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Instance
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ Instance
Initializes the object
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/oci/core/models/instance.rb', line 117 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} if attributes[:'availabilityDomain'] self.availability_domain = attributes[:'availabilityDomain'] end if attributes[:'compartmentId'] self.compartment_id = attributes[:'compartmentId'] end if attributes[:'displayName'] self.display_name = attributes[:'displayName'] end if attributes[:'extendedMetadata'] self. = attributes[:'extendedMetadata'] end if attributes[:'id'] self.id = attributes[:'id'] end if attributes[:'imageId'] self.image_id = attributes[:'imageId'] end if attributes[:'ipxeScript'] self.ipxe_script = attributes[:'ipxeScript'] end if attributes[:'lifecycleState'] self.lifecycle_state = attributes[:'lifecycleState'] end if attributes[:'metadata'] self. = attributes[:'metadata'] end if attributes[:'region'] self.region = attributes[:'region'] end if attributes[:'shape'] self.shape = attributes[:'shape'] end if attributes[:'sourceDetails'] self.source_details = attributes[:'sourceDetails'] end if attributes[:'timeCreated'] self.time_created = attributes[:'timeCreated'] end end |
Instance Attribute Details
#availability_domain ⇒ String
The Availability Domain the instance is running in.
Example: ‘Uocm:PHX-AD-1`
23 24 25 |
# File 'lib/oci/core/models/instance.rb', line 23 def availability_domain @availability_domain end |
#compartment_id ⇒ String
The OCID of the compartment that contains the instance.
27 28 29 |
# File 'lib/oci/core/models/instance.rb', line 27 def compartment_id @compartment_id end |
#display_name ⇒ String
A user-friendly name. Does not have to be unique, and it’s changeable. Avoid entering confidential information.
Example: ‘My bare metal instance`
35 36 37 |
# File 'lib/oci/core/models/instance.rb', line 35 def display_name @display_name end |
#extended_metadata ⇒ Hash<String, Object>
Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the ‘metadata’ object.
They are distinguished from ‘metadata’ fields in that these can be nested JSON objects (whereas ‘metadata’ fields are string/string maps only).
If you don’t need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead.
44 45 46 |
# File 'lib/oci/core/models/instance.rb', line 44 def end |
#id ⇒ String
The OCID of the instance.
48 49 50 |
# File 'lib/oci/core/models/instance.rb', line 48 def id @id end |
#image_id ⇒ String
Deprecated. Use ‘sourceDetails` instead.
53 54 55 |
# File 'lib/oci/core/models/instance.rb', line 53 def image_id @image_id end |
#ipxe_script ⇒ String
When a bare metal or virtual machine instance boots, the iPXE firmware that runs on the instance is configured to run an iPXE script to continue the boot process.
If you want more control over the boot process, you can provide your own custom iPXE script that will run when the instance boots; however, you should be aware that the same iPXE script will run every time an instance boots; not only after the initial LaunchInstance call.
The default iPXE script connects to the instance’s local boot volume over iSCSI and performs a network boot. If you use a custom iPXE script and want to network-boot from the instance’s local boot volume over iSCSI the same way as the default iPXE script, you should use the following iSCSI IP address: 169.254.0.2, and boot volume IQN: iqn.2015-02.oracle.boot.
For more information about the Bring Your Own Image feature of Oracle Cloud Infrastructure, see [Bring Your Own Image](docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/bringyourownimage.htm).
For more information about iPXE, see ipxe.org.
79 80 81 |
# File 'lib/oci/core/models/instance.rb', line 79 def ipxe_script @ipxe_script end |
#lifecycle_state ⇒ String
The current state of the instance.
83 84 85 |
# File 'lib/oci/core/models/instance.rb', line 83 def lifecycle_state @lifecycle_state end |
#metadata ⇒ Hash<String, String>
Custom metadata that you provide.
87 88 89 |
# File 'lib/oci/core/models/instance.rb', line 87 def end |
#region ⇒ String
The region that contains the Availability Domain the instance is running in.
Example: ‘phx`
94 95 96 |
# File 'lib/oci/core/models/instance.rb', line 94 def region @region end |
#shape ⇒ String
The shape of the instance. The shape determines the number of CPUs and the amount of memory allocated to the instance. You can enumerate all available shapes by calling list_shapes.
101 102 103 |
# File 'lib/oci/core/models/instance.rb', line 101 def shape @shape end |
#source_details ⇒ OCI::Core::Models::InstanceSourceDetails
Details for creating an instance
105 106 107 |
# File 'lib/oci/core/models/instance.rb', line 105 def source_details @source_details end |
#time_created ⇒ DateTime
The date and time the instance was created, in the format defined by RFC3339.
Example: ‘2016-08-25T21:10:29.600Z`
112 113 114 |
# File 'lib/oci/core/models/instance.rb', line 112 def time_created @time_created end |
Instance Method Details
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/oci/core/models/instance.rb', line 189 def ==(other_object) return true if self.equal?(other_object) self.class == other_object.class && availability_domain == other_object.availability_domain && compartment_id == other_object.compartment_id && display_name == other_object.display_name && == other_object. && id == other_object.id && image_id == other_object.image_id && ipxe_script == other_object.ipxe_script && lifecycle_state == other_object.lifecycle_state && == other_object. && region == other_object.region && shape == other_object.shape && source_details == other_object.source_details && time_created == other_object.time_created end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 |
# File 'lib/oci/core/models/instance.rb', line 222 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.public_send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.public_send("#{key}=", OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other_object) ⇒ Boolean
209 210 211 |
# File 'lib/oci/core/models/instance.rb', line 209 def eql?(other_object) self == other_object end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
215 216 217 |
# File 'lib/oci/core/models/instance.rb', line 215 def hash [availability_domain, compartment_id, display_name, , id, image_id, ipxe_script, lifecycle_state, , region, shape, source_details, time_created].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
247 248 249 250 251 252 253 254 255 |
# File 'lib/oci/core/models/instance.rb', line 247 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_send(attr) next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
241 242 243 |
# File 'lib/oci/core/models/instance.rb', line 241 def to_s to_hash.to_s end |