Module: UltraDNSUpdater::Strategies

Defined in:
lib/ultradns_updater/strategies.rb,
lib/ultradns_updater/strategies.rb,
lib/ultradns_updater/strategies/ec2.rb,
lib/ultradns_updater/strategies/hostname.rb,
lib/ultradns_updater/strategies/multiple.rb,
lib/ultradns_updater/strategies/openstack.rb,
lib/ultradns_updater/strategies/configured.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.

Defined Under Namespace

Classes: Configured, Ec2, Hostname, Multiple, Openstack, UpdateStrategy

Class Method Summary collapse

Class Method Details

.strategy(strategy_name) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ultradns_updater/strategies.rb', line 27

def self.strategy(strategy_name)
  if strategy_name.kind_of?(Array)
    strategies = {}
    strategy_name.each do |strategy_item|
      strategies[strategy_item] = strategy(strategy_item)
    end
    UltraDNSUpdater::Strategies::Multiple.factory(strategies)
  else
    strategy_sym = strategy_name.to_sym rescue nil
    case strategy_sym
    when :ec2
      UltraDNSUpdater::Strategies::Ec2
    when :openstack
      UltraDNSUpdater::Strategies::Openstack
    when :hostname
      UltraDNSUpdater::Strategies::Hostname
    when :configured
      UltraDNSUpdater::Strategies::Configured
    else
      raise "No strategy found for: #{strategy_name}"
    end
  end
end