diff options
author | Andrew Brown <anbrown@blackberry.com> | 2015-08-12 08:52:25 -0400 |
---|---|---|
committer | Andrew Brown <anbrown@blackberry.com> | 2015-08-12 08:52:25 -0400 |
commit | 3197fc49cacb71c9c55de40935a5e08303afb7a3 (patch) | |
tree | a291011c455b191e98d32ef3db1246d2e99cf926 /lib/chef_zero/endpoints | |
parent | ae7634c600535ba3f64ce8af31afc6fef9dab31c (diff) | |
download | chef-zero-3197fc49cacb71c9c55de40935a5e08303afb7a3.tar.gz |
Preliminary support for _identifiers API
Adding preliminary support for the _identifiers REST endpoint.
Diffstat (limited to 'lib/chef_zero/endpoints')
-rw-r--r-- | lib/chef_zero/endpoints/node_identifiers_endpoint.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/chef_zero/endpoints/node_identifiers_endpoint.rb b/lib/chef_zero/endpoints/node_identifiers_endpoint.rb new file mode 100644 index 0000000..9f89a98 --- /dev/null +++ b/lib/chef_zero/endpoints/node_identifiers_endpoint.rb @@ -0,0 +1,22 @@ +require 'ffi_yajl' +require 'chef_zero/rest_base' +require 'uuidtools' + +module ChefZero + module Endpoints + # /organizations/NAME/nodes/NAME/_identifiers + class NodeIdentifiersEndpoint < RestBase + def get(request) + if get_data(request, request.rest_path[0..3]) + result = { + :id => UUIDTools::UUID.parse_raw(request.rest_path[0..4].to_s).to_s.gsub('-',''), + :authz_id => '0'*32, + :org_id => UUIDTools::UUID.parse_raw(request.rest_path[0..1].to_s).to_s.gsub('-','') } + json_response(200, result) + else + raise RestErrorResponse.new(404, "Object not found: #{build_uri(request.base_uri, request.rest_path)}") + end + end + end + end +end |