Page Menu
Home
GRNET
Search
Configure Global Search
Log In
Files
F1614853
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Mar 21, 9:01 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Mon, Mar 23, 9:01 AM (18 h, 2 m)
Engine
blob
Format
Raw Data
Handle
353510
Attached To
rARCHIVING archiving
View Options
diff --git a/app/controllers/api/v1/clients_controller.rb b/app/controllers/api/v1/clients_controller.rb
index a092958..066142e 100644
--- a/app/controllers/api/v1/clients_controller.rb
+++ b/app/controllers/api/v1/clients_controller.rb
@@ -1,31 +1,46 @@
class Api::V1::ClientsController < Api::BaseController
before_action :require_api_login
# GET /api/clients
def index
hosts = current_api_user.hosts.in_bacula
api_render(hosts)
end
# GET /api/clients/1
def show
host = current_api_user.hosts.in_bacula.find(params[:id])
api_render(host)
end
# POST /api/clients/1/backup
def backup
host = current_api_user.hosts.in_bacula.find(params[:id])
job = host.job_templates.enabled.backup.find(params[:job_id])
if job.backup_now
message = 'Job is scheduled for backup'
else
message = 'Job can not be scheduled'
end
render json: { message: message }, status: :ok
end
+
+ # POST /api/clients/1/restore
+ def restore
+ host = current_api_user.hosts.in_bacula.find(params[:id])
+ fileset = host.client.file_sets.find(params[:fileset_id])
+ location = params[:location].blank? ? '/tmp/bacula_restore' : params[:location]
+
+ if host.restore(fileset.id, location)
+ message = 'Restore is scheduled'
+ else
+ message = 'Restore not scheduled'
+ end
+
+ render json: { message: message }, status: :ok
+ end
end
Event Timeline
Log In to Comment