Class: OCI::Core::Models::LaunchInstanceDetails
- Inherits:
-
Object
- Object
- OCI::Core::Models::LaunchInstanceDetails
- Defined in:
- lib/oci/core/models/launch_instance_details.rb
Overview
Instance launch details. Use the ‘sourceDetails` parameter to specify whether a boot volume or an image should be used to launch a new instance.
Instance Attribute Summary collapse
-
#availability_domain ⇒ String
[Required] The Availability Domain of the instance.
-
#compartment_id ⇒ String
[Required] The OCID of the compartment.
-
#create_vnic_details ⇒ OCI::Core::Models::CreateVnicDetails
Details for the primary VNIC, which is automatically created and attached when the instance is launched.
-
#defined_tags ⇒ Hash<String, Hash<String, Object>>
Defined tags for this resource.
-
#display_name ⇒ String
A user-friendly name.
-
#extended_metadata ⇒ Hash<String, Object>
Additional metadata key/value pairs that you provide.
-
#freeform_tags ⇒ Hash<String, String>
Free-form tags for this resource.
-
#hostname_label ⇒ String
Deprecated.
-
#image_id ⇒ String
Deprecated.
-
#ipxe_script ⇒ String
This is an advanced option.
-
#metadata ⇒ Hash<String, String>
Custom metadata key/value pairs that you provide, such as the SSH public key required to connect to the instance.
-
#shape ⇒ String
[Required] The shape of an instance.
-
#source_details ⇒ OCI::Core::Models::InstanceSourceDetails
Details for creating an instance.
-
#subnet_id ⇒ String
Deprecated.
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 = {}) ⇒ LaunchInstanceDetails
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 = {}) ⇒ LaunchInstanceDetails
Initializes the object
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 202 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 raise 'You cannot provide both :availabilityDomain and :availability_domain' if attributes.key?(:'availabilityDomain') && attributes.key?(:'availability_domain') if attributes[:'availability_domain'] self.availability_domain = attributes[:'availability_domain'] end if attributes[:'compartmentId'] self.compartment_id = attributes[:'compartmentId'] end raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') if attributes[:'compartment_id'] self.compartment_id = attributes[:'compartment_id'] end if attributes[:'createVnicDetails'] self.create_vnic_details = attributes[:'createVnicDetails'] end raise 'You cannot provide both :createVnicDetails and :create_vnic_details' if attributes.key?(:'createVnicDetails') && attributes.key?(:'create_vnic_details') if attributes[:'create_vnic_details'] self.create_vnic_details = attributes[:'create_vnic_details'] end if attributes[:'definedTags'] self. = attributes[:'definedTags'] end raise 'You cannot provide both :definedTags and :defined_tags' if attributes.key?(:'definedTags') && attributes.key?(:'defined_tags') if attributes[:'defined_tags'] self. = attributes[:'defined_tags'] end if attributes[:'displayName'] self.display_name = attributes[:'displayName'] end raise 'You cannot provide both :displayName and :display_name' if attributes.key?(:'displayName') && attributes.key?(:'display_name') if attributes[:'display_name'] self.display_name = attributes[:'display_name'] end if attributes[:'extendedMetadata'] self. = attributes[:'extendedMetadata'] end raise 'You cannot provide both :extendedMetadata and :extended_metadata' if attributes.key?(:'extendedMetadata') && attributes.key?(:'extended_metadata') if attributes[:'extended_metadata'] self. = attributes[:'extended_metadata'] end if attributes[:'freeformTags'] self. = attributes[:'freeformTags'] end raise 'You cannot provide both :freeformTags and :freeform_tags' if attributes.key?(:'freeformTags') && attributes.key?(:'freeform_tags') if attributes[:'freeform_tags'] self. = attributes[:'freeform_tags'] end if attributes[:'hostnameLabel'] self.hostname_label = attributes[:'hostnameLabel'] end raise 'You cannot provide both :hostnameLabel and :hostname_label' if attributes.key?(:'hostnameLabel') && attributes.key?(:'hostname_label') if attributes[:'hostname_label'] self.hostname_label = attributes[:'hostname_label'] end if attributes[:'imageId'] self.image_id = attributes[:'imageId'] end raise 'You cannot provide both :imageId and :image_id' if attributes.key?(:'imageId') && attributes.key?(:'image_id') if attributes[:'image_id'] self.image_id = attributes[:'image_id'] end if attributes[:'ipxeScript'] self.ipxe_script = attributes[:'ipxeScript'] end raise 'You cannot provide both :ipxeScript and :ipxe_script' if attributes.key?(:'ipxeScript') && attributes.key?(:'ipxe_script') if attributes[:'ipxe_script'] self.ipxe_script = attributes[:'ipxe_script'] end if attributes[:'metadata'] self. = attributes[:'metadata'] end if attributes[:'shape'] self.shape = attributes[:'shape'] end if attributes[:'sourceDetails'] self.source_details = attributes[:'sourceDetails'] end raise 'You cannot provide both :sourceDetails and :source_details' if attributes.key?(:'sourceDetails') && attributes.key?(:'source_details') if attributes[:'source_details'] self.source_details = attributes[:'source_details'] end if attributes[:'subnetId'] self.subnet_id = attributes[:'subnetId'] end raise 'You cannot provide both :subnetId and :subnet_id' if attributes.key?(:'subnetId') && attributes.key?(:'subnet_id') if attributes[:'subnet_id'] self.subnet_id = attributes[:'subnet_id'] end end |
Instance Attribute Details
#availability_domain ⇒ String
[Required] The Availability Domain of the instance.
Example: ‘Uocm:PHX-AD-1`
15 16 17 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 15 def availability_domain @availability_domain end |
#compartment_id ⇒ String
[Required] The OCID of the compartment.
19 20 21 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 19 def compartment_id @compartment_id end |
#create_vnic_details ⇒ OCI::Core::Models::CreateVnicDetails
Details for the primary VNIC, which is automatically created and attached when the instance is launched.
25 26 27 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 25 def create_vnic_details @create_vnic_details end |
#defined_tags ⇒ Hash<String, Hash<String, Object>>
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
Example: ‘{"CostCenter": "42"}`
33 34 35 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 33 def @defined_tags 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`
41 42 43 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 41 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.
50 51 52 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 50 def @extended_metadata end |
#freeform_tags ⇒ Hash<String, String>
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see [Resource Tags](docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/resourcetags.htm).
Example: ‘"Finance"`
59 60 61 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 59 def @freeform_tags end |
#hostname_label ⇒ String
Deprecated. Instead use ‘hostnameLabel` in CreateVnicDetails. If you provide both, the values must match.
66 67 68 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 66 def hostname_label @hostname_label end |
#image_id ⇒ String
Deprecated. Use ‘sourceDetails` with instance_source_via_image_details source type instead. If you specify values for both, the values must match.
72 73 74 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 72 def image_id @image_id end |
#ipxe_script ⇒ String
This is an advanced option.
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.
100 101 102 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 100 def ipxe_script @ipxe_script end |
#metadata ⇒ Hash<String, String>
Custom metadata key/value pairs that you provide, such as the SSH public key required to connect to the instance.
A metadata service runs on every launched instance. The service is an HTTP endpoint listening on 169.254.169.254. You can use the service to:
-
Provide information to [Cloud-Init](cloudinit.readthedocs.org/en/latest/) to be used for various system initialization tasks.
-
Get information about the instance, including the custom metadata that you provide when you launch the instance.
**Providing Cloud-Init Metadata**
You can use the following metadata key names to provide information to
Cloud-Init:
**\"ssh_authorized_keys\"** - Provide one or more public SSH keys to be
included in the `~/.ssh/authorized_keys` file for the default user on the
instance. Use a newline character to separate multiple keys. The SSH
keys must be in the format necessary for the `authorized_keys` file, as shown
in the example below.
**\"user_data\"** - Provide your own base64-encoded data to be used by
Cloud-Init to run custom scripts or provide custom Cloud-Init configuration. For
information about how to take advantage of user data, see the
[Cloud-Init Documentation](http://cloudinit.readthedocs.org/en/latest/topics/format.html).
**Note:** Cloud-Init does not pull this data from the `http://169.254.169.254/opc/v1/instance/metadata/`
path. When the instance launches and either of these keys are provided, the key values are formatted as
OpenStack metadata and copied to the following locations, which are recognized by Cloud-Init:
`http://169.254.169.254/openstack/latest/meta_data.json` - This JSON blob
contains, among other things, the SSH keys that you provided for
**\"ssh_authorized_keys\"**.
`http://169.254.169.254/openstack/latest/user_data` - Contains the
base64-decoded data that you provided for **\"user_data\"**.
**Metadata Example**
\"metadata\" : {
\"quake_bot_level\" : \"Severe\",
\"ssh_authorized_keys\" : \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCZ06fccNTQfq+xubFlJ5ZR3kt+uzspdH9tXL+lAejSM1NXM+CFZev7MIxfEjas06y80ZBZ7DUTQO0GxJPeD8NCOb1VorF8M4xuLwrmzRtkoZzU16umt4y1W0Q4ifdp3IiiU0U8/WxczSXcUVZOLqkz5dc6oMHdMVpkimietWzGZ4LBBsH/LjEVY7E0V+a0sNchlVDIZcm7ErReBLcdTGDq0uLBiuChyl6RUkX1PNhusquTGwK7zc8OBXkRuubn5UKXhI3Ul9Nyk4XESkVWIGNKmw8mSpoJSjR8P9ZjRmcZVo8S+x4KVPMZKQEor== [email protected]
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAzJSAtwEPoB3Jmr58IXrDGzLuDYkWAYg8AsLYlo6JZvKpjY1xednIcfEVQJm4T2DhVmdWhRrwQ8DmayVZvBkLt+zs2LdoAJEVimKwXcJFD/7wtH8Lnk17HiglbbbNXsemjDY0hea4JUE5CfvkIdZBITuMrfqSmA4n3VNoorXYdvtTMoGG8fxMub46RPtuxtqi9bG9Zqenordkg5FJt2mVNfQRqf83CWojcOkklUWq4CjyxaeLf5i9gv1fRoBo4QhiA8I6NCSppO8GnoV/6Ox6TNoh9BiifqGKC9VGYuC89RvUajRBTZSK2TK4DPfaT+2R+slPsFrwiT/oPEhhEK1S5Q== rsa-key-20160227\",
\"user_data\" : \"SWYgeW91IGNhbiBzZWUgdGhpcywgdGhlbiBpdCB3b3JrZWQgbWF5YmUuCg==\"
}
**Getting Metadata on the Instance**
To get information about your instance, connect to the instance using SSH and issue any of the
following GET requests:
curl http://169.254.169.254/opc/v1/instance/
curl http://169.254.169.254/opc/v1/instance/metadata/
curl http://169.254.169.254/opc/v1/instance/metadata/<any-key-name>
You'll get back a response that includes all the instance information; only the metadata information; or
the metadata information for the specified key name, respectively.
162 163 164 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 162 def @metadata end |
#shape ⇒ String
[Required] The shape of an instance. The shape determines the number of CPUs, amount of memory, and other resources allocated to the instance.
You can enumerate all available shapes by calling list_shapes.
170 171 172 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 170 def shape @shape end |
#source_details ⇒ OCI::Core::Models::InstanceSourceDetails
Details for creating an instance. Use this parameter to specify whether a boot volume or an image should be used to launch a new instance.
176 177 178 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 176 def source_details @source_details end |
#subnet_id ⇒ String
Deprecated. Instead use ‘subnetId` in CreateVnicDetails. At least one of them is required; if you provide both, the values must match.
183 184 185 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 183 def subnet_id @subnet_id end |
Instance Method Details
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 340 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 && create_vnic_details == other_object.create_vnic_details && == other_object. && display_name == other_object.display_name && == other_object. && == other_object. && hostname_label == other_object.hostname_label && image_id == other_object.image_id && ipxe_script == other_object.ipxe_script && == other_object. && shape == other_object.shape && source_details == other_object.source_details && subnet_id == other_object.subnet_id end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 374 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_method("#{key}=").call(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_method("#{key}=").call(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
361 362 363 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 361 def eql?(other_object) self == other_object end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
367 368 369 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 367 def hash [availability_domain, compartment_id, create_vnic_details, , display_name, , , hostname_label, image_id, ipxe_script, , shape, source_details, subnet_id].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
399 400 401 402 403 404 405 406 407 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 399 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call 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
393 394 395 |
# File 'lib/oci/core/models/launch_instance_details.rb', line 393 def to_s to_hash.to_s end |