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



155
156
157
# File 'lib/fog/openstack/planning.rb', line 155

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

.new(attributes) ⇒ Object

Raises:

  • (ArgumentError)


159
160
161
162
163
164
165
166
167
# File 'lib/fog/openstack/planning.rb', line 159

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



169
170
171
172
# File 'lib/fog/openstack/planning.rb', line 169

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