Module: Fog::Openstack

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

Defined Under Namespace

Classes: Planning

Class Method Summary collapse

Class Method Details

.[](service) ⇒ Object



215
216
217
# File 'lib/fog/openstack/planning.rb', line 215

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

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)


219
220
221
222
223
224
225
226
227
# File 'lib/fog/openstack/planning.rb', line 219

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/openstack/#{service}"
    return Fog::Openstack.const_get(service.to_s.capitalize).new(attributes)
  end
  raise ArgumentError, "Openstack has no #{service} service"
end

.servicesObject



229
230
231
232
# File 'lib/fog/openstack/planning.rb', line 229

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