summaryrefslogtreecommitdiff
path: root/lib/chef_zero/endpoints/policy_endpoint.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef_zero/endpoints/policy_endpoint.rb')
-rw-r--r--lib/chef_zero/endpoints/policy_endpoint.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/policy_endpoint.rb b/lib/chef_zero/endpoints/policy_endpoint.rb
new file mode 100644
index 0000000..d8c1bc8
--- /dev/null
+++ b/lib/chef_zero/endpoints/policy_endpoint.rb
@@ -0,0 +1,24 @@
+require 'chef_zero/chef_data/data_normalizer'
+
+module ChefZero
+ module Endpoints
+ # /organizations/ORG/policies/NAME
+ class PolicyEndpoint < RestBase
+ # GET /organizations/ORG/policies/NAME
+ def get(request)
+ revisions = list_data(request, request.rest_path + ["revisions"])
+ data = { revisions: hashify_list(revisions) }
+ return json_response(200, data)
+ end
+
+ # DELETE /organizations/ORG/policies/NAME
+ def delete(request)
+ revisions = list_data(request, request.rest_path + ["revisions"])
+ data = { revisions: hashify_list(revisions) }
+
+ delete_data_dir(request, nil, :recursive)
+ return json_response(200, data)
+ end
+ end
+ end
+end