Class: Fog::AWS::Mock
- Inherits:
-
Object
- Object
- Fog::AWS::Mock
- Defined in:
- lib/fog/aws.rb
Class Method Summary collapse
- .availability_zone ⇒ Object
- .box_usage ⇒ Object
- .console_output ⇒ Object
- .etag ⇒ Object
- .image ⇒ Object
- .image_id ⇒ Object
- .instance_id ⇒ Object
- .ip_address ⇒ Object
- .kernel_id ⇒ Object
- .key_fingerprint ⇒ Object
- .key_material ⇒ Object
- .owner_id ⇒ Object
- .ramdisk_id ⇒ Object
- .request_id ⇒ Object
- .reservation_id ⇒ Object
- .snapshot_id ⇒ Object
- .volume_id ⇒ Object
Class Method Details
.availability_zone ⇒ Object
23 24 25 |
# File 'lib/fog/aws.rb', line 23 def self.availability_zone "us-east-1" << random_selection('abcd', 1) end |
.box_usage ⇒ Object
27 28 29 |
# File 'lib/fog/aws.rb', line 27 def self.box_usage sprintf("%0.10f", rand / 100).to_f end |
.console_output ⇒ Object
31 32 33 |
# File 'lib/fog/aws.rb', line 31 def self.console_output 'This is my console. There are many like it, but this one is mine. My console is my best friend. It is my life. I must master it as I master my life. My console, without me, is useless. Without my console, I am useless.' end |
.etag ⇒ Object
35 36 37 |
# File 'lib/fog/aws.rb', line 35 def self.etag hex(32) end |
.image ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/aws.rb', line 39 def self.image path = [] (rand(3) + 2).times do path << letters(rand(9) + 8) end { "imageOwnerId" => letters(rand(5) + 4), "productCodes" => [], "kernelId" => kernel_id, "ramdiskId" => ramdisk_id, "imageState" => "available", "imageId" => image_id, "architecture" => "i386", "isPublic" => true, "imageLocation" => path.join('/'), "imageType" => "machine" } end |
.image_id ⇒ Object
58 59 60 |
# File 'lib/fog/aws.rb', line 58 def self.image_id "ami-#{hex(8)}" end |
.instance_id ⇒ Object
74 75 76 |
# File 'lib/fog/aws.rb', line 74 def self.instance_id "i-#{hex(8)}" end |
.ip_address ⇒ Object
78 79 80 81 82 83 84 |
# File 'lib/fog/aws.rb', line 78 def self.ip_address ip = [] 4.times do ip << numbers(rand(3) + 1).to_i.to_s # remove leading 0 end ip.join('.') end |
.kernel_id ⇒ Object
86 87 88 |
# File 'lib/fog/aws.rb', line 86 def self.kernel_id "aki-#{hex(8)}" end |
.key_fingerprint ⇒ Object
62 63 64 65 66 67 68 |
# File 'lib/fog/aws.rb', line 62 def self.key_fingerprint fingerprint = [] 20.times do fingerprint << hex(2) end fingerprint.join(':') end |
.key_material ⇒ Object
90 91 92 93 94 95 96 97 98 |
# File 'lib/fog/aws.rb', line 90 def self.key_material key_material = ['-----BEGIN RSA PRIVATE KEY-----'] 20.times do key_material << base64(76) end key_material << base64(67) + '=' key_material << '-----END RSA PRIVATE KEY-----' key_material.join("\n") end |
.owner_id ⇒ Object
100 101 102 |
# File 'lib/fog/aws.rb', line 100 def self.owner_id numbers(12) end |
.ramdisk_id ⇒ Object
104 105 106 |
# File 'lib/fog/aws.rb', line 104 def self.ramdisk_id "ari-#{hex(8)}" end |
.request_id ⇒ Object
108 109 110 111 112 113 114 115 116 |
# File 'lib/fog/aws.rb', line 108 def self.request_id request_id = [] request_id << hex(8) 3.times do request_id << hex(4) end request_id << hex(12) request_id.join('-') end |
.reservation_id ⇒ Object
118 119 120 |
# File 'lib/fog/aws.rb', line 118 def self.reservation_id "r-#{hex(8)}" end |
.snapshot_id ⇒ Object
122 123 124 |
# File 'lib/fog/aws.rb', line 122 def self.snapshot_id "snap-#{hex(8)}" end |
.volume_id ⇒ Object
126 127 128 |
# File 'lib/fog/aws.rb', line 126 def self.volume_id "vol-#{hex(8)}" end |