/usr/lib/ruby/vendor_ruby/chef_zero/endpoints/policies_endpoint.rb is in chef-zero 4.5.0-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | require 'chef_zero/chef_data/data_normalizer'
module ChefZero
module Endpoints
# /organizations/ORG/policies
class PoliciesEndpoint < RestBase
# GET /organizations/ORG/policies
def get(request)
response_data = {}
policy_names = list_data(request)
policy_names.each do |policy_name|
policy_path = request.rest_path + [policy_name]
policy_uri = build_uri(request.base_uri, policy_path)
revisions = list_data(request, policy_path + ["revisions"])
response_data[policy_name] = {
uri: policy_uri,
revisions: hashify_list(revisions)
}
end
return json_response(200, response_data)
end
end
end
end
|