Skip to content

Instantly share code, notes, and snippets.

@elight
Created April 20, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elight/490664c2c3bf18f17d23e54f4d8a8300 to your computer and use it in GitHub Desktop.
Save elight/490664c2c3bf18f17d23e54f4d8a8300 to your computer and use it in GitHub Desktop.
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