Class: Fog::QingCloud::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/qingcloud/core.rb

Class Method Summary collapse

Class Method Details

.address_idObject



142
143
144
# File 'lib/fog/qingcloud/core.rb', line 142

def self.address_id
  "eip-#{Fog::Mock.random_hex(8)}"
end

.imageObject



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/fog/qingcloud/core.rb', line 105

def self.image
  {
    'status' => 'available',
    'processor_type' => '64bit',
    'image_id' => image_id,
    'sub_code' => 1,
    'transition_status' => '',
    'recommended_type' => 'small_b',
    'image_name' => '',
    'visibility' => 'private',
    'platform' => 'linux',
    'create_time' => '2013-08-07T18:16:32Z',
    'os_family' => 'centos',
    'provider' => 'self',
    'owner' => 'usr-1234abcd',
    'status_time' => '2013-08-17T08:16:33Z',
    'size' => 20,
    'description' => nil
  }
end

.image_idObject



126
127
128
# File 'lib/fog/qingcloud/core.rb', line 126

def self.image_id
  "img-#{Fog::Mock.random_hex(8)}"
end

.instance_idObject



134
135
136
# File 'lib/fog/qingcloud/core.rb', line 134

def self.instance_id
  "i-#{Fog::Mock.random_hex(8)}"
end

.ip_addressObject



138
139
140
# File 'lib/fog/qingcloud/core.rb', line 138

def self.ip_address
  Fog::Mock.random_ip
end

.job_idObject



146
147
148
# File 'lib/fog/qingcloud/core.rb', line 146

def self.job_id
  "j-#{Fog::Mock.random_hex(8)}"
end

.key_idObject



176
177
178
# File 'lib/fog/qingcloud/core.rb', line 176

def self.key_id
  "kp-#{Fog::Mock.random_hex(8)}"
end

.key_materialObject



154
155
156
# File 'lib/fog/qingcloud/core.rb', line 154

def self.key_material
  OpenSSL::PKey::RSA.generate(1024).to_s
end

.macObject



130
131
132
# File 'lib/fog/qingcloud/core.rb', line 130

def self.mac
  Fog::Mock.random_hex(12).scan(/.{2}/).join(':')
end

.private_ip_addressObject



150
151
152
# File 'lib/fog/qingcloud/core.rb', line 150

def self.private_ip_address
  "192.168.1.#{Fog::Mock.random_numbers(2)}"
end

.public_keyObject



158
159
160
161
162
# File 'lib/fog/qingcloud/core.rb', line 158

def self.public_key
<<-EOS
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5w3Cr/6b3lDQpX3XukEu0pM6vbMdfEWhoWTdiLpU4Gl7P+PyKlFqv528eU8/XIBqEIRBw/WCHAtY5mE7eo6ZxHvUWf/i3Mzy/3/xWHqkKjyTdZDP86xGmP0cQcN4xZ4oNgVu3bChFXvCxUj3X0EQHhED090ePQOQYPPw+sAKLngilaPAYGfzX30HXknRYWzCo/ucn8bl/k3lYEyjSb8orD4HeW/lhv0fUVgbbrvYBd3RVuQVNzso/gN7p/7O3BApkWdufq7iWPi84iQgYkeNFH4bWT4wl4NEkd23gymWF3IwvM0/JOjOdlzLnbhko9Q6eiY400d2/tcsNlf5qLGaz starrysky@sky
EOS
end

.security_group_idObject



168
169
170
# File 'lib/fog/qingcloud/core.rb', line 168

def self.security_group_id
  "sg-#{Fog::Mock.random_hex(8)}"
end

.security_group_rule_idObject



180
181
182
# File 'lib/fog/qingcloud/core.rb', line 180

def self.security_group_rule_id
  "sgr-#{Fog::Mock.random_hex(8)}"
end

.volume_idObject



164
165
166
# File 'lib/fog/qingcloud/core.rb', line 164

def self.volume_id
  "vol-#{Fog::Mock.random_hex(8)}"
end

.vxnet_idObject



172
173
174
# File 'lib/fog/qingcloud/core.rb', line 172

def self.vxnet_id
  "vxnet-#{Fog::Mock.random_hex(8)}"
end

.zone(region) ⇒ Object



101
102
103
# File 'lib/fog/qingcloud/core.rb', line 101

def self.zone(region)
  "pek1"
end