mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Merge pull request #783 from thommay/route53-model-alias
support alias records in the route53 models
This commit is contained in:
commit
1ad508a599
2 changed files with 18 additions and 7 deletions
|
@ -9,13 +9,14 @@ module Fog
|
||||||
deprecate :ip, :value
|
deprecate :ip, :value
|
||||||
deprecate :ip=, :value=
|
deprecate :ip=, :value=
|
||||||
|
|
||||||
identity :name, :aliases => ['Name']
|
identity :name, :aliases => ['Name']
|
||||||
|
|
||||||
attribute :value, :aliases => ['ResourceRecords']
|
attribute :value, :aliases => ['ResourceRecords']
|
||||||
attribute :ttl, :aliases => ['TTL']
|
attribute :ttl, :aliases => ['TTL']
|
||||||
attribute :type, :aliases => ['Type']
|
attribute :type, :aliases => ['Type']
|
||||||
attribute :status, :aliases => ['Status']
|
attribute :status, :aliases => ['Status']
|
||||||
attribute :created_at, :aliases => ['SubmittedAt']
|
attribute :created_at, :aliases => ['SubmittedAt']
|
||||||
|
attribute :alias_target, :aliases => ['AliasTarget']
|
||||||
|
|
||||||
def initialize(attributes={})
|
def initialize(attributes={})
|
||||||
self.ttl ||= 3600
|
self.ttl ||= 3600
|
||||||
|
@ -61,11 +62,13 @@ module Fog
|
||||||
end
|
end
|
||||||
|
|
||||||
def attributes_to_options(action)
|
def attributes_to_options(action)
|
||||||
requires :name, :ttl, :type, :value, :zone
|
requires :name, :ttl, :type, :zone
|
||||||
|
requires_one :value, :alias_target
|
||||||
{
|
{
|
||||||
:action => action,
|
:action => action,
|
||||||
:name => name,
|
:name => name,
|
||||||
:resource_records => [*value],
|
:resource_records => [*value],
|
||||||
|
:alias_target => symbolize_keys(alias_target),
|
||||||
:ttl => ttl,
|
:ttl => ttl,
|
||||||
:type => type
|
:type => type
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,14 @@ module Fog
|
||||||
MultiJson.encode(attributes)
|
MultiJson.encode(attributes)
|
||||||
end
|
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)
|
def wait_for(timeout=Fog.timeout, interval=1, &block)
|
||||||
reload
|
reload
|
||||||
retries = 3
|
retries = 3
|
||||||
|
|
Loading…
Add table
Reference in a new issue