class DropletMetadata
Public Class Methods
auth_key()
click to toggle source
# File lib/droplet_metadata.rb, line 21 def self.auth_key metadata['auth_key'] end
dns()
click to toggle source
# File lib/droplet_metadata.rb, line 37 def self.dns metadata['dns'] end
droplet_id()
click to toggle source
# File lib/droplet_metadata.rb, line 5 def self.droplet_id metadata['droplet_id'] end
floating_ip()
click to toggle source
# File lib/droplet_metadata.rb, line 33 def self.floating_ip metadata['floating_ip'] end
hostname()
click to toggle source
# File lib/droplet_metadata.rb, line 9 def self.hostname metadata['hostname'] end
interfaces()
click to toggle source
# File lib/droplet_metadata.rb, line 29 def self.interfaces metadata['interfaces'] end
metadata()
click to toggle source
# File lib/droplet_metadata.rb, line 45 def self.metadata uri = URI.parse('http://169.254.169.254/metadata/v1.json') http = Net::HTTP.new(uri.host, uri.port) request = Net::HTTP::Get.new(uri.request_uri) response = http.request(request) JSON.parse(response.body) end
public_keys()
click to toggle source
# File lib/droplet_metadata.rb, line 17 def self.public_keys metadata['public_keys'] || [] end
region()
click to toggle source
# File lib/droplet_metadata.rb, line 25 def self.region metadata['region'] end
vendor_data()
click to toggle source
# File lib/droplet_metadata.rb, line 13 def self.vendor_data metadata['vendor_data'] end