/data/NAME
# File lib/chef_zero/endpoints/data_bag_endpoint.rb, line 10 def initialize(server) super(server, 'id') end
# File lib/chef_zero/endpoints/data_bag_endpoint.rb, line 33 def delete(request) key = request.rest_path[3] delete_data_dir(request, request.rest_path, :recursive) json_response(200, { 'chef_type' => 'data_bag', 'json_class' => 'Chef::DataBag', 'name' => key }) end
# File lib/chef_zero/endpoints/data_bag_endpoint.rb, line 24 def get_key(contents) data_bag_item = JSON.parse(contents, :create_additions => false) if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data'] data_bag_item['raw_data']['id'] else data_bag_item['id'] end end
# File lib/chef_zero/endpoints/data_bag_endpoint.rb, line 14 def post(request) key = JSON.parse(request.body, :create_additions => false)[identity_key] response = super(request) if response[0] == 201 already_json_response(201, DataBagItemEndpoint::populate_defaults(request, request.body, request.rest_path[3], key)) else response end end