Class: OracleBMC::Core::Models::LaunchInstanceDetails
- Inherits:
-
Object
- Object
- OracleBMC::Core::Models::LaunchInstanceDetails
- Defined in:
- lib/oraclebmc/core/models/launch_instance_details.rb
Instance Attribute Summary collapse
-
#availability_domain ⇒ String
The Availability Domain of the instance.
-
#compartment_id ⇒ String
The OCID of the compartment.
-
#display_name ⇒ String
A user-friendly name.
-
#hostname_label ⇒ String
The hostname for the VNIC that is created during instance launch.
-
#image_id ⇒ String
The OCID of the image used to boot the instance.
-
#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
The shape of an instance.
-
#subnet_id ⇒ String
The OCID of the subnet.
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
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 152 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[:'hostnameLabel'] self.hostname_label = attributes[:'hostnameLabel'] end if attributes[:'imageId'] self.image_id = attributes[:'imageId'] end if attributes[:'ipxeScript'] self.ipxe_script = attributes[:'ipxeScript'] end if attributes[:'metadata'] self. = attributes[:'metadata'] end if attributes[:'shape'] self.shape = attributes[:'shape'] end if attributes[:'subnetId'] self.subnet_id = attributes[:'subnetId'] end end |
Instance Attribute Details
#availability_domain ⇒ String
The Availability Domain of the instance.
Example: ‘Uocm:PHX-AD-1`
12 13 14 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 12 def availability_domain @availability_domain end |
#compartment_id ⇒ String
The OCID of the compartment.
16 17 18 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 16 def compartment_id @compartment_id end |
#display_name ⇒ String
A user-friendly name. Does not have to be unique, and it’s changeable.
Example: ‘My bare metal instance`
23 24 25 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 23 def display_name @display_name end |
#hostname_label ⇒ String
The hostname for the VNIC that is created during instance launch. Used for DNS. The value is the hostname portion of the instance’s fully qualified domain name (FQDN) (e.g., ‘bminstance-1` in FQDN `bminstance-1.subnet123.vcn1.oraclevcn.com`). Must be unique across all VNICs in the subnet and comply with [RFC 952](tools.ietf.org/html/rfc952) and [RFC 1123](tools.ietf.org/html/rfc1123). The value cannot be changed, and it can be retrieved from the Vnic.
For more information, see [DNS in Your Virtual Cloud Network](docs.us-phoenix-1.oraclecloud.com/Content/Network/Concepts/dns.htm).
Example: ‘bminstance-1`
41 42 43 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 41 def hostname_label @hostname_label end |
#image_id ⇒ String
The OCID of the image used to boot the instance.
45 46 47 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 45 def image_id @image_id end |
#ipxe_script ⇒ String
This is an advanced option.
When an Oracle Bare Metal Cloud Services 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 instanceu2019s local boot volume over iSCSI and performs a network boot. If you use a custom iPXE script and want to network-boot from the instanceu2019s 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 Bare Metal Cloud Services, see [Bring Your Own Image](docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/bringyourownimage.htm).
For more information about iPXE, see ipxe.org.
73 74 75 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 73 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.
135 136 137 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 135 def @metadata end |
#shape ⇒ String
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.
143 144 145 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 143 def shape @shape end |
#subnet_id ⇒ String
The OCID of the subnet.
147 148 149 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 147 def subnet_id @subnet_id end |
Instance Method Details
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 199 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 && hostname_label == other_object.hostname_label && image_id == other_object.image_id && ipxe_script == other_object.ipxe_script && == other_object. && shape == other_object.shape && subnet_id == other_object.subnet_id end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 228 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.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| OracleBMC::Internal::Util.convert_to_type($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", OracleBMC::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
215 216 217 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 215 def eql?(other_object) self == other_object end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
221 222 223 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 221 def hash [availability_domain, compartment_id, display_name, hostname_label, image_id, ipxe_script, , shape, subnet_id].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
253 254 255 256 257 258 259 260 261 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 253 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
247 248 249 |
# File 'lib/oraclebmc/core/models/launch_instance_details.rb', line 247 def to_s to_hash.to_s end |