Created
April 20, 2016 14:29
-
-
Save elight/490664c2c3bf18f17d23e54f4d8a8300 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def params(action:, domain:, target:, type:) | |
body = { | |
change: { | |
:action => action, | |
"resource-record-set" => { | |
:name => domain | |
} | |
} | |
}.tap do |b| | |
case type | |
when "CNAME" | |
b[:change].merge!( | |
:type => "CNAME", | |
:ttl => "600", | |
"resource-records" => [ | |
{ | |
value: target | |
} | |
] | |
) | |
when "ALIAS" | |
b[:change].merge!( | |
:type => "A", | |
"alias-target" => { | |
"dns-name" => target, | |
"evaluate-target-health" => false | |
} | |
) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment