mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
get_record, single.
This commit is contained in:
parent
c685a08c77
commit
a9fdddbc1b
2 changed files with 36 additions and 2 deletions
|
@ -36,9 +36,26 @@ module Fog
|
|||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
|
||||
if record_id = options[:record_id]
|
||||
if record_id = options['record_id']
|
||||
raise Fog::Dynect::DNS::NotFound unless record = zone[:records][type].first { |record| record[:record_id] == record_id }
|
||||
response.body = {}
|
||||
response.body = {
|
||||
"status" => "success",
|
||||
"data" => {
|
||||
"zone" => record[:zone][:zone],
|
||||
"ttl" => record[:ttl],
|
||||
"fqdn" => record[:fqdn],
|
||||
"record_type" => type,
|
||||
"rdata" => record[:rdata],
|
||||
"record_id" => record[:record_id]
|
||||
},
|
||||
"job_id" => Fog::Dynect::Mock.job_id,
|
||||
"msgs" => [{
|
||||
"INFO" => "get: Found the record",
|
||||
"SOURCE" => "API-B",
|
||||
"ERR_CD" => nil,
|
||||
"LVL" => "INFO"
|
||||
}]
|
||||
}
|
||||
else
|
||||
records = zone[:records][type].select { |record| record[:fqdn] == fqdn }
|
||||
response.body = {
|
||||
|
|
|
@ -110,6 +110,23 @@ Shindo.tests('Dynect::dns | DNS requests', ['dynect', 'dns']) do
|
|||
data
|
||||
end
|
||||
|
||||
get_record_format = shared_format.merge({
|
||||
'data' => {
|
||||
'zone' => String,
|
||||
'ttl' => Integer,
|
||||
'fqdn' => String,
|
||||
'record_type' => String,
|
||||
'rdata' => {
|
||||
'address' => String
|
||||
},
|
||||
'record_id' => Integer
|
||||
}
|
||||
})
|
||||
|
||||
tests("get_record('A', '#{@domain}', '#{@fqdn}', 'record_id' => '#{@record_id}')").formats(get_record_format) do
|
||||
@dns.get_record('A', @domain, @fqdn, 'record_id' => @record_id).body
|
||||
end
|
||||
|
||||
delete_record_format = shared_format.merge({
|
||||
'data' => {}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue