mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
add ability to replace existing Dyn records
This commit is contained in:
parent
dacd27dbda
commit
0cc7a6f3b6
1 changed files with 6 additions and 2 deletions
|
@ -19,7 +19,7 @@ module Fog
|
|||
true
|
||||
end
|
||||
|
||||
def save
|
||||
def save(replace=false)
|
||||
requires :name, :type, :rdata, :zone
|
||||
|
||||
options = {
|
||||
|
@ -27,7 +27,11 @@ module Fog
|
|||
}
|
||||
options.delete_if {|key, value| value.nil?}
|
||||
|
||||
data = service.post_record(type, zone.identity, name, rdata, options).body['data']
|
||||
if replace
|
||||
data = service.put_record(type, zone.identity, name, rdata, options).body['data']
|
||||
else
|
||||
data = service.post_record(type, zone.identity, name, rdata, options).body['data']
|
||||
end
|
||||
# avoid overwriting zone object with zone string
|
||||
data = data.reject {|key, value| key == 'zone'}
|
||||
merge_attributes(data)
|
||||
|
|
Loading…
Reference in a new issue