1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/google/requests/compute/get_region.rb

37 lines
977 B
Ruby
Executable file

module Fog
module Compute
class Google
class Mock
def get_region(identity)
rname = identity.split('/')[-1]
region = self.data[:regions][rname] || {
"error" => {
"errors" => [
{
"domain" => "global",
"reason" => "notFound",
"message" => "The resource 'projects/#{project}/regions/#{rname}' was not found"
}
],
"code" => 404,
"message" => "The resource 'projects/#{project}/regions/#{rname}' was not found"
}
}
build_excon_response(region)
end
end
class Real
def get_region(identity)
api_method = @compute.regions.get
parameters = {
'project' => @project,
'region' => identity.split('/')[-1],
}
request(api_method, parameters)
end
end
end
end
end