summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJay Mundrawala <jdmundrawala@gmail.com>2015-02-09 09:05:13 -0800
committerJay Mundrawala <jdmundrawala@gmail.com>2015-03-20 14:38:02 -0700
commitc7dfc4fdaeca26716ab684a7b7bdebd747fc72ec (patch)
tree7122f4e9bfc15e2204dd1de83f1d2c075ee7b954 /lib
parent757a5af82c600771c5143fbb7843d3f8c387b031 (diff)
downloadchef-c7dfc4fdaeca26716ab684a7b7bdebd747fc72ec.tar.gz
Added dsc_resource resource
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/resource/dsc_resource.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
new file mode 100644
index 0000000000..059044b378
--- /dev/null
+++ b/lib/chef/resource/dsc_resource.rb
@@ -0,0 +1,56 @@
+#
+# Author:: Adam Edwards (<adamed@getchef.com>)
+#
+# Copyright:: 2014, Opscode, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+class Chef
+ class Resource
+ class DscResource < Chef::Resource
+
+ provides :dsc_resource, platform: "windows"
+
+ attr_reader :properties
+
+ def initialize(name, run_context)
+ super
+ @properties = {}
+ @resource_name = :dsc_resource
+ @resource = nil
+ @allowed_actions.push(:set)
+ @action = :set
+ end
+
+ def resource(value=nil)
+ if value
+ @resource = value
+ else
+ @resource
+ end
+ end
+
+ def property(property_name, value=nil)
+ if not property_name.is_a?(Symbol)
+ raise TypeError, "A property name of type Symbol must be specified, '#{property_name.to_s}' of type #{property_name.class.to_s} was given"
+ end
+
+ if value.nil?
+ @properties[property_name]
+ else
+ @properties[property_name] = value
+ end
+ end
+ end
+ end
+end