mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
support alias records in the route53 models
This commit is contained in:
parent
6aee48a173
commit
7006cc4d59
2 changed files with 18 additions and 7 deletions
|
@ -9,13 +9,14 @@ module Fog
|
|||
deprecate :ip, :value
|
||||
deprecate :ip=, :value=
|
||||
|
||||
identity :name, :aliases => ['Name']
|
||||
identity :name, :aliases => ['Name']
|
||||
|
||||
attribute :value, :aliases => ['ResourceRecords']
|
||||
attribute :ttl, :aliases => ['TTL']
|
||||
attribute :type, :aliases => ['Type']
|
||||
attribute :status, :aliases => ['Status']
|
||||
attribute :created_at, :aliases => ['SubmittedAt']
|
||||
attribute :value, :aliases => ['ResourceRecords']
|
||||
attribute :ttl, :aliases => ['TTL']
|
||||
attribute :type, :aliases => ['Type']
|
||||
attribute :status, :aliases => ['Status']
|
||||
attribute :created_at, :aliases => ['SubmittedAt']
|
||||
attribute :alias_target, :aliases => ['AliasTarget']
|
||||
|
||||
def initialize(attributes={})
|
||||
self.ttl ||= 3600
|
||||
|
@ -61,11 +62,13 @@ module Fog
|
|||
end
|
||||
|
||||
def attributes_to_options(action)
|
||||
requires :name, :ttl, :type, :value, :zone
|
||||
requires :name, :ttl, :type, :zone
|
||||
requires_one :value, :alias_target
|
||||
{
|
||||
:action => action,
|
||||
:name => name,
|
||||
:resource_records => [*value],
|
||||
:alias_target => symbolize_keys(alias_target),
|
||||
:ttl => ttl,
|
||||
:type => type
|
||||
}
|
||||
|
|
|
@ -42,6 +42,14 @@ module Fog
|
|||
MultiJson.encode(attributes)
|
||||
end
|
||||
|
||||
def symbolize_keys(hash)
|
||||
return nil if hash.nil?
|
||||
hash.inject({}) do |options, (key, value)|
|
||||
options[(key.to_sym rescue key) || key] = value
|
||||
options
|
||||
end
|
||||
end
|
||||
|
||||
def wait_for(timeout=Fog.timeout, interval=1, &block)
|
||||
reload
|
||||
retries = 3
|
||||
|
|
Loading…
Reference in a new issue