]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - 3rdparty/modules/aviator/lib/puppet/feature/aviator/openstack/compute/requests/v2/admin/list_hosts.rb
add aimonb/aviator to 3rdparty
[dsa-puppet.git] / 3rdparty / modules / aviator / lib / puppet / feature / aviator / openstack / compute / requests / v2 / admin / list_hosts.rb
diff --git a/3rdparty/modules/aviator/lib/puppet/feature/aviator/openstack/compute/requests/v2/admin/list_hosts.rb b/3rdparty/modules/aviator/lib/puppet/feature/aviator/openstack/compute/requests/v2/admin/list_hosts.rb
new file mode 100644 (file)
index 0000000..8c47aa8
--- /dev/null
@@ -0,0 +1,44 @@
+module Aviator
+
+  define_request :list_hosts, :inherit => [:openstack, :common, :v2, :admin, :base] do
+
+    meta :service, :compute
+
+    link 'documentation',
+         'http://api.openstack.org/api-ref.html#ext-os-hosts'
+
+    link 'documentation bug',
+         'https://bugs.launchpad.net/nova/+bug/1224763'
+
+    param :service, :required => false
+    param :zone,    :required => false
+
+
+    def headers
+      super
+    end
+
+
+    def http_method
+      :get
+    end
+
+
+    def url
+      url = "#{ base_url }/os-hosts"
+
+      filters = []
+
+      optional_params.each do |param_name|
+        filters << "#{ param_name }=#{ params[param_name] }" if params[param_name]
+      end
+
+      url += "?#{ filters.join('&') }" unless filters.empty?
+
+      url
+    end
+
+  end
+
+end
+