class ChefZero::Endpoints::OrganizationValidatorKeyEndpoint

/organizations/NAME/_validator_key

Public Instance Methods

post(request) click to toggle source
# File lib/chef_zero/endpoints/organization_validator_key_endpoint.rb, line 9
def post(request)
  org_name = request.rest_path[-2]
  validator_path = [ "organizations", org_name, "clients", "#{org_name}-validator"]
  validator = FFI_Yajl::Parser.parse(get_data(request, validator_path))
  private_key, public_key = server.gen_key_pair
  validator["public_key"] = public_key
  set_data(request, validator_path, FFI_Yajl::Encoder.encode(validator, pretty: true))
  json_response(200, { "private_key" => private_key })
end