mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
F rage4 bulk update endpoint (#3917)
Add new api endpoint to fog for bulk updates of priority in rage4 class
This commit is contained in:
parent
66f448784f
commit
5cb43829c0
3 changed files with 51 additions and 0 deletions
|
@ -27,6 +27,7 @@ module Fog
|
|||
request :list_geo_regions
|
||||
request :create_record
|
||||
request :update_record
|
||||
request :bulk_update_records
|
||||
request :list_records
|
||||
request :delete_record
|
||||
request :set_record_failover
|
||||
|
|
38
lib/fog/rage4/requests/dns/bulk_update_records.rb
Normal file
38
lib/fog/rage4/requests/dns/bulk_update_records.rb
Normal file
|
@ -0,0 +1,38 @@
|
|||
module Fog
|
||||
module DNS
|
||||
class Rage4
|
||||
class Real
|
||||
# Updates existing records in bulk
|
||||
# ==== Parameters
|
||||
# * zone_id <~Integer> Need to specify the zone id
|
||||
# * options <~Hash> Options should contain the body for the post
|
||||
# in the following format.
|
||||
# data = [{:id=><record_id>, :priority=>2}, {:id=><record_id>, :priority=>2}]
|
||||
# options => { :body => data.to_json }
|
||||
# ==== Returns
|
||||
# * response<~Excon::Response>:
|
||||
# * body<~Hash>:
|
||||
# * 'status'<~Boolean>
|
||||
# * 'id'<~Integer>
|
||||
# * 'error'<~String>
|
||||
|
||||
# https://secure.rage4.com//rapi/SetRecordState/<zone_id>/
|
||||
|
||||
def bulk_update_records(zone_id, options = {})
|
||||
path = "/rapi/SetRecordState/#{zone_id}"
|
||||
body = options[:body] if options[:body].present?
|
||||
|
||||
request(
|
||||
:expects => 200,
|
||||
:method => 'POST',
|
||||
:body => body,
|
||||
:path => path,
|
||||
:headers => {
|
||||
'Content-Type' => "application/json; charset=UTF-8",
|
||||
},
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -107,6 +107,18 @@ Shindo.tests('Fog::DNS[:rage4] | DNS requests', ['rage4', 'dns']) do
|
|||
|
||||
end
|
||||
|
||||
test("bulk_update_records") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
data = { :id => @record_id, :priority => 1 }
|
||||
response = Fog::DNS[:rage4].bulk_update_records(@zone_id, { :body => data.to_json } )
|
||||
|
||||
returns(200) { response.status }
|
||||
returns(true) {response.body['status']}
|
||||
returns(@domain_id) {response.body['id']}
|
||||
returns("") {response.body['error'] }
|
||||
end
|
||||
|
||||
test("show_current_usage") do
|
||||
pending if Fog.mocking?
|
||||
|
||||
|
|
Loading…
Reference in a new issue