Module: Fog::Openstack

Defined in:
lib/fog/openstack/version.rb,
lib/fog/planning/openstack.rb,
lib/fog/planning/openstack/models/plan.rb,
lib/fog/planning/openstack/models/role.rb,
lib/fog/planning/openstack/models/plans.rb,
lib/fog/planning/openstack/models/roles.rb,
lib/fog/planning/openstack/requests/get_plan.rb,
lib/fog/planning/openstack/requests/list_plans.rb,
lib/fog/planning/openstack/requests/list_roles.rb,
lib/fog/planning/openstack/requests/patch_plan.rb,
lib/fog/planning/openstack/requests/delete_plan.rb,
lib/fog/planning/openstack/requests/create_plan.rb,
lib/fog/planning/openstack/requests/add_role_to_plan.rb,
lib/fog/planning/openstack/requests/get_plan_templates.rb,
lib/fog/planning/openstack/requests/remove_role_from_plan.rb

Defined Under Namespace

Classes: Planning

Constant Summary collapse

VERSION =
"0.1.17"

Class Method Summary collapse

Class Method Details

.[](service) ⇒ Object

TODO: get rid of inconform self.[] & self.new & self.services


130
131
132
# File 'lib/fog/planning/openstack.rb', line 130

def self.[](service)
  new(:service => service)
end

.included(base) ⇒ Object


5
6
7
8
9
# File 'lib/fog/openstack/version.rb', line 5

def self.included(base)
  if RUBY_VERSION < "2"
    puts "DEPRECATION WARNING - Support for Ruby 1.9 will be dropped in fog-openstack 0.2 and higher. Please upgrade to Ruby 2 or above."
  end
end

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)

134
135
136
137
138
139
140
141
142
# File 'lib/fog/planning/openstack.rb', line 134

def self.new(attributes)
  attributes = attributes.dup # Prevent delete from having side effects
  service = attributes.delete(:service).to_s.downcase.to_sym
  if services.include?(service)
    require "fog/#{service}/openstack"
    return Fog::Openstack.const_get(service.to_s.capitalize).new(attributes)
  end
  raise ArgumentError, "Openstack has no #{service} service"
end

.servicesObject


144
145
146
147
# File 'lib/fog/planning/openstack.rb', line 144

def self.services
  # Ruby 1.8.7 compatibility for select returning Array of Arrays (pairs)
  Hash[Fog.services.select { |_service, providers| providers.include?(:openstack) }].keys
end