Class: UltraDNSUpdater::Strategies::UpdateStrategy
- Inherits:
-
Object
- Object
- UltraDNSUpdater::Strategies::UpdateStrategy
- Includes:
- Preconditions
- Defined in:
- lib/ultradns_updater/strategies/update_strategy.rb
Overview
Copyright 2012 NeuStar, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Direct Known Subclasses
Instance Method Summary collapse
- #iface_ip(strategy_config) ⇒ Object
-
#initialize(ultradns, strategy_section, logger = ::Logger.new(STDOUT)) ⇒ UpdateStrategy
constructor
A new instance of UpdateStrategy.
- #strategy_config ⇒ Object
- #strategy_to_use ⇒ Object
- #ultradns ⇒ Object
-
#update ⇒ Object
update ultradns based on the configuration provided returns: the hostname applied or else nil.
Methods included from Preconditions
Constructor Details
#initialize(ultradns, strategy_section, logger = ::Logger.new(STDOUT)) ⇒ UpdateStrategy
Returns a new instance of UpdateStrategy.
18 19 20 21 22 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 18 def initialize(ultradns, strategy_section, logger = ::Logger.new(STDOUT)) @ultradns = ultradns @strategy_section = strategy_section @logger = logger end |
Instance Method Details
#iface_ip(strategy_config) ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 40 def iface_ip(strategy_config) ip = nil if strategy_config[:iface] == 'auto' ip = UltraDNSUpdater::IpInfo.local_ipv4 else ip = UltraDNSUpdater::IpInfo.ipv4_for_iface(strategy_config[:iface]) end ip end |
#strategy_config ⇒ Object
36 37 38 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 36 def strategy_config @strategy_section[strategy_to_use.to_sym].merge({:logger => @logger}) rescue nil end |
#strategy_to_use ⇒ Object
32 33 34 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 32 def strategy_to_use @strategy_section[:use] end |
#ultradns ⇒ Object
28 29 30 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 28 def ultradns @ultradns end |
#update ⇒ Object
update ultradns based on the configuration provided returns: the hostname applied or else nil
26 |
# File 'lib/ultradns_updater/strategies/update_strategy.rb', line 26 def update(); end |