summaryrefslogtreecommitdiffstats
path: root/lib/puppet
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/network/controller.rb30
-rw-r--r--lib/puppet/network/http.rb18
2 files changed, 48 insertions, 0 deletions
diff --git a/lib/puppet/network/controller.rb b/lib/puppet/network/controller.rb
new file mode 100644
index 000000000..7e4cca643
--- /dev/null
+++ b/lib/puppet/network/controller.rb
@@ -0,0 +1,30 @@
+class Puppet::Network::Controller
+ def initialize(args = {})
+ raise ArgumentError, ":indirection is required" unless args[:indirection]
+ @indirection = args[:indirection]
+ @klass = model_class_from_indirection_name(@indirection)
+ end
+
+ def find(args = {})
+ @klass.find(args)
+ end
+
+ def destroy(args = {})
+ @klass.destroy(args)
+ end
+
+ def search(args = {})
+ @klass.search(args)
+ end
+
+ def save(args = {})
+ instance = @klass.new(args)
+ instance.save
+ end
+
+ private
+
+ def model_class_from_indirection_name
+ Class.new # TODO : FIXME make this the indirection class
+ end
+end
diff --git a/lib/puppet/network/http.rb b/lib/puppet/network/http.rb
new file mode 100644
index 000000000..c46a73159
--- /dev/null
+++ b/lib/puppet/network/http.rb
@@ -0,0 +1,18 @@
+class Puppet::Network::HTTP
+ def self.new(args = {})
+ raise ArgumentError, ":server_type is required" unless args[:server_type]
+ obj = class_for_server_type(args[:server_type]).allocate
+ obj.send :initialize, args.delete_if {|k,v| k == :server_type }
+ obj
+ end
+
+ class << self
+ def class_for_server_type(server_type)
+ Class.new
+ # TODO: this will end up probably: { :webrick => ... }
+
+ end
+ private :class_for_server_type
+ end
+end
+