diff options
author | John Keiser <john@johnkeiser.com> | 2015-12-04 16:05:31 -0800 |
---|---|---|
committer | Chris Doherty <cdoherty@chef.io> | 2015-12-07 14:33:18 -0800 |
commit | 7ad8a34c9b1100a932374a12e567c7d077622e48 (patch) | |
tree | 10812f7217e26e65f02bf37761b5baacee50d905 /lib/chef_zero/endpoints/policy_revision_endpoint.rb | |
parent | 82407750aa4b872c73baeae8afce42465b870a48 (diff) | |
download | chef-zero-7ad8a34c9b1100a932374a12e567c7d077622e48.tar.gz |
Split policy endpoints into separate endpoints
Diffstat (limited to 'lib/chef_zero/endpoints/policy_revision_endpoint.rb')
-rw-r--r-- | lib/chef_zero/endpoints/policy_revision_endpoint.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/policy_revision_endpoint.rb b/lib/chef_zero/endpoints/policy_revision_endpoint.rb new file mode 100644 index 0000000..6a77d26 --- /dev/null +++ b/lib/chef_zero/endpoints/policy_revision_endpoint.rb @@ -0,0 +1,23 @@ +require 'chef_zero/chef_data/data_normalizer' + +module ChefZero + module Endpoints + # /organizations/ORG/policies/NAME/revisions/REVISION + class PolicyRevisionEndpoint < RestBase + # GET /organizations/ORG/policies/NAME/revisions/REVISION + def get(request) + data = parse_json(get_data(request)) + data = ChefData::DataNormalizer.normalize_policy(data, request.rest_path[3], request.rest_path[5]) + return json_response(200, data) + end + + # DELETE /organizations/ORG/policies/NAME/revisions/REVISION + def delete(request) + policyfile_data = parse_json(get_data(request)) + policyfile_data = ChefData::DataNormalizer.normalize_policy(policyfile_data, request.rest_path[3], request.rest_path[5]) + delete_data(request) + return json_response(200, policyfile_data) + end + end + end +end |