Class: Fog::HP::Mock
- Inherits:
-
Object
- Object
- Fog::HP::Mock
- Defined in:
- lib/fog/hp/core.rb
Class Method Summary collapse
- .etag ⇒ Object
- .instance_id ⇒ Object
- .ip_address ⇒ Object
- .key_fingerprint ⇒ Object
- .key_material ⇒ Object
- .mac_address ⇒ Object
- .user_id ⇒ Object
- .uuid ⇒ Object
Class Method Details
.etag ⇒ Object
300 301 302 |
# File 'lib/fog/hp/core.rb', line 300 def self.etag Fog::Mock.random_hex(32) end |
.instance_id ⇒ Object
322 323 324 |
# File 'lib/fog/hp/core.rb', line 322 def self.instance_id Fog::Mock.random_numbers(6) end |
.ip_address ⇒ Object
326 327 328 329 330 331 332 |
# File 'lib/fog/hp/core.rb', line 326 def self.ip_address ip = [] 4.times do ip << Fog::Mock.random_numbers(rand(3) + 1).to_i.to_s # remove leading 0 end ip.join('.') end |
.key_fingerprint ⇒ Object
304 305 306 307 308 309 310 |
# File 'lib/fog/hp/core.rb', line 304 def self.key_fingerprint fingerprint = [] 20.times do fingerprint << Fog::Mock.random_hex(2) end fingerprint.join(':') end |
.key_material ⇒ Object
312 313 314 315 316 |
# File 'lib/fog/hp/core.rb', line 312 def self.key_material private_key = OpenSSL::PKey::RSA.generate(1024) public_key = private_key.public_key return private_key.to_s, public_key.to_s end |
.mac_address ⇒ Object
343 344 345 346 347 348 349 |
# File 'lib/fog/hp/core.rb', line 343 def self.mac_address mac_add = [] 6.times do mac_add << Fog::Mock.random_hex(2) end mac_add.join(':') end |
.user_id ⇒ Object
318 319 320 |
# File 'lib/fog/hp/core.rb', line 318 def self.user_id "dev_" + Fog::Mock.random_numbers(14) end |
.uuid ⇒ Object
334 335 336 337 338 339 340 341 |
# File 'lib/fog/hp/core.rb', line 334 def self.uuid # pattern of 8-4-4-4-12 hexadecimal digits uuid = [] [8,4,4,4,12].each do |x| uuid << Fog::Mock.random_hex(x) end uuid.join('-') end |