mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
obfuscate more data
This commit is contained in:
parent
0da5e75431
commit
d64e084d16
3 changed files with 26 additions and 19 deletions
|
@ -15,23 +15,28 @@ module Fog
|
|||
|
||||
class Mock
|
||||
def list_entities(options={})
|
||||
account_id = Fog::Mock.random_numbers(6).to_s
|
||||
server_id = Fog::Rackspace::MockData.uuid
|
||||
entity_id = Fog::Mock.random_letters(10)
|
||||
entity_label = Fog::Mock.random_letters(10)
|
||||
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
"values"=> [
|
||||
{
|
||||
"id" => "foo_id",
|
||||
"label" => "foo_label",
|
||||
"id" => entity_id,
|
||||
"label" => entity_label,
|
||||
"ip_addresses" => {
|
||||
"access_ip0_v6" => "::1",
|
||||
"public0_v4" => "1.1.1.1",
|
||||
"public1_v6" => "::1",
|
||||
"access_ip1_v4" => "1.1.1.1",
|
||||
"private0_v4" => "10.10.10.1"
|
||||
"access_ip0_v6" => Fog::Rackspace::MockData.ipv6_address,
|
||||
"public0_v4" => Fog::Rackspace::MockData.ipv4_address,
|
||||
"public1_v6" => Fog::Rackspace::MockData.ipv6_address,
|
||||
"access_ip1_v4" => Fog::Rackspace::MockData.ipv4_address,
|
||||
"private0_v4" => Fog::Rackspace::MockData.ipv4_address
|
||||
},
|
||||
"metadata" => nil,
|
||||
"managed" => false,
|
||||
"uri" => "https://ord.servers.api.rackspacecloud.com/55555/servers/B0791A1C-E798-4D55-A24C-28EE0305245C",
|
||||
"uri" => "https://ord.servers.api.rackspacecloud.com/" + account_id + "/servers/" + server_id,
|
||||
"agent_id" => nil,
|
||||
"created_at" => Time.now.to_i - 1,
|
||||
"updated_at" => Time.now.to_i
|
||||
|
@ -52,7 +57,7 @@ module Fog
|
|||
"X-RateLimit-Remaining" => "49627",
|
||||
"X-RateLimit-Window" => "24 hours",
|
||||
"X-RateLimit-Type" => "global",
|
||||
"X-Response-Id" =>" j23jlk234jl2j34j",
|
||||
"X-Response-Id" => "j23jlk234jl2j34j",
|
||||
"X-LB" => "dfw1-maas-prod-api0",
|
||||
"Vary" => "Accept-Encoding",
|
||||
"Transfer-Encoding" => "chunked"
|
||||
|
|
|
@ -66,13 +66,13 @@ module Fog
|
|||
"X-RateLimit-Remaining" => "49627",
|
||||
"X-RateLimit-Window" => "24 hours",
|
||||
"X-RateLimit-Type" => "global",
|
||||
"X-Response-Id" =>" zsdvasdtrq345",
|
||||
"X-Response-Id" => "zsdvasdtrq345",
|
||||
"X-LB" => "dfw1-maas-prod-api0",
|
||||
"Vary" => "Accept-Encoding",
|
||||
"Transfer-Encoding" => "chunked"
|
||||
}
|
||||
|
||||
response.remote_ip = "1.1.1.1"
|
||||
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
|
||||
response
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,20 +3,22 @@ module Fog
|
|||
class Monitoring
|
||||
class Real
|
||||
|
||||
def update_check(entity_id, id, options)
|
||||
def update_check(entity_id, check_id, options)
|
||||
request(
|
||||
:body => JSON.encode(options),
|
||||
:expects => [204],
|
||||
:method => 'PUT',
|
||||
:path => "entities/#{entity_id}/checks/#{id}"
|
||||
:path => "entities/#{entity_id}/checks/#{check_id}"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
class Mock
|
||||
def update_check(entity_id, id, options)
|
||||
def update_check(entity_id, check_id, options)
|
||||
|
||||
if options[:testing] == "Bar"
|
||||
account_id = Fog::Mock.random_numbers(6).to_s
|
||||
|
||||
if entity_id == -1 || check_id == -1 || options[:testing]
|
||||
raise Fog::Rackspace::Monitoring::NotFound
|
||||
end
|
||||
|
||||
|
@ -25,18 +27,18 @@ module Fog
|
|||
response.body = ""
|
||||
response.headers = {
|
||||
"Date" => Time.now.utc.to_s,
|
||||
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/55555/entities/" + entity_id + "/checks/mock_id",
|
||||
"X-Object-ID" => "mock_id",
|
||||
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/entities/" + entity_id + "/checks/" + check_id,
|
||||
"X-Object-ID" => check_id,
|
||||
"X-RateLimit-Limit" => "50000",
|
||||
"X-RateLimit-Remaining" => "49627",
|
||||
"X-RateLimit-Window" => "24 hours",
|
||||
"X-RateLimit-Type" => "global",
|
||||
"X-Response-Id" => ".rh-lHJL.h-ord1-maas-prod-api1.r-AGRIH406.c-4085336.ts-1377785008661.v-e602877",
|
||||
"X-Response-Id" => "owbgowb989wno73ubgvw89",
|
||||
"X-LB" => "ord1-maas-prod-api1",
|
||||
"Content-Length" => "0",
|
||||
"Content-Type" => "text/plain",
|
||||
}
|
||||
response.remote_ip = "1.1.1.1"
|
||||
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
|
||||
response
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue