Update Backup Service api-ref

Add Backup Service API v2 reference.

Change-Id: Ib56c0a87c92c48daa705b75c09e1c5b3b1c3cd5a
This commit is contained in:
Cai Hui 2018-10-25 06:53:06 -04:00
parent 796c41ac7d
commit cee24d3acd
31 changed files with 1531 additions and 37 deletions

View File

@ -16,9 +16,9 @@
:tocdepth: 3
===============================
Backup Service API v1 (CURRENT)
===============================
======================
Backup Service API v1
======================
.. rest_expand_all::

View File

@ -0,0 +1,244 @@
=================
Actions (actions)
=================
Actions allow users to execute backups and restore operations on one node
or more. Actions are stored through the api in the database. It is included
in the job, every job contains set of actions that carry out the backup/restore
job.
Lists Actions(v2)
=================
.. rest_method:: GET /v2/{project_id}/actions
Lists actions.
This operation lists actions in a project.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
------------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml
- limit: limit
- offset: marker
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- actions: actions
Response Example
----------------
.. literalinclude:: samples/actions-list-response.json
:language: javascript
Creates action(v2)
==================
.. rest_method:: POST /v2/{project_id}/actions
Creates an action.
This operation creates a new action in a project.
The ``body`` attribute specifies contains a set of actions that gets created
one the job is submitted.
The ``description`` is the name that you give to the job. The name must not
exceed 64 bytes in length.
The ``job_schedule`` is very important to schedule the job or it will run only
once. also you can provide ``event`` which can automatically start/stop the
job.
The ``freezer_action`` holds the actual action parameters. ``freezer_action``
differs from action to another as it depends what this action is doing (backup,
restore, admin, info)
Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
------------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml
- freezer_action: freezer_action
- max_retries: max_retries
- max_retries_interval: max_retries_interval
Request Example
---------------
.. literalinclude:: samples/actions-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- action_id: action_id
Response Example
----------------
.. literalinclude:: samples/actions-create-response.json
:language: javascript
Show actions(v2)
================
.. rest_method:: GET /v2/{project_id}/actions/{action_id}
Shows a action in a project.
This operation shows a certain action. The action details.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- action_id: action_id_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- freezer_action: freezer_action
- max_retries: max_retries
- max_retries_interval: max_retries_interval
- user_id: user_id
- action_id: action_id
Response Example
----------------
.. literalinclude:: samples/actions-get-response.json
:language: javascript
Updates actions(v2)
===================
.. rest_method:: POST /v2/{project_id}/actions/{action_id}
Updates an action in a project.
This operation updates or replaces an existing action.
Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- action_id: action_id_path
Response Parameters
--------------------
.. rest_parameters:: parameters.yaml
- freezer_action: freezer_action
- max_retries: max_retries
- max_retries_interval: max_retries_interval
- action_id: action_id
Request Example
---------------
.. literalinclude:: samples/actions-update-request.json
:language: javascript
Response Example
----------------
.. literalinclude:: samples/actions-update-response.json
:language: javascript
Delete actions(v2)
==================
.. rest_method:: DELETE /v2/{project_id}/actions/{action_id}
Delete actions in a project.
This operation deletes a certain action.
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- action_id: action_id_path
There is no response for this operation.

View File

@ -5,8 +5,9 @@ Backups (backups)
Backups allow users to record their backups and metadata information about
those backups and when backups were taken. It holds the backup information.
List backups
============
List backups(v2)
================
.. rest_method:: GET /v2/{project_id}/backups
@ -22,15 +23,16 @@ Error response codes:
- Unauthorized (401)
- Forbidden (403)
Request Parameters
------------------
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Query Parameters
-----------------
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml

View File

@ -0,0 +1,178 @@
=================
Clients (clients)
=================
Clients allow freezer schedulers or users to create a client to be able to
create, update, show or delete job. The client is required to record you
backups on freezer api.
Lists clients(v2)
=================
.. rest_method:: GET /v2/{project_id}/clients
Lists clients.
This operation lists clients.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml
- limit: limit
- offset: marker
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- clients: clients
Response Example
----------------
.. literalinclude:: samples/clients-list-response.json
:language: javascript
Creates Client(v2)
==================
.. rest_method:: POST /v2/{project_id}/clients
Creates a client.
This operation creates a new client.
Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
------------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml
- hostname: hostname
- uuid: uuid
- client_id: client_id
Request Example
---------------
.. literalinclude:: samples/clients-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- client_id: client_id
Response Example
----------------
.. literalinclude:: samples/clients-create-response.json
:language: javascript
Show clients(v2)
================
.. rest_method:: GET /v2/{project_id}/clients/{client_id}
Show clients.
This operation shows a certain client . It displays all client details.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- client_id: client_id_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- user_id: user_id
- client_id: client_id
- hostname: hostname
- uuid: uuid
Response Example
----------------
.. literalinclude:: samples/client-get-response.json
:language: javascript
Delete clients(v2)
==================
.. rest_method:: DELETE /v2/{project_id}/clients/{client_id}
Delete clients.
This operation deletes a certain client.
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- client_id: client_id_path
There is no response for this operation.

View File

@ -16,9 +16,9 @@
:tocdepth: 3
====================================
Backup Service API v2 (EXPERIMENTAL)
====================================
======================
Backup Service API v2
======================
.. rest_expand_all::

View File

@ -1,20 +1,20 @@
===========
=================
Jobs (jobs)
===========
=================
Jobs allow users to schedule and execute backup jobs on one node or more. Jobs
are stored through the api in the database. Every job contains set of actions
that carry out the backup job.
List jobs
=========
Lists jobs(v2)
==============
.. rest_method:: GET /v2/{project_id}/jobs
Lists jobs v2.
Lists jobs.
This operation lists jobs for the project. The jobs are sorted alphabetically
by name.
This operation lists jobs for the project.
Normal response codes: 200
@ -23,20 +23,20 @@ Error response codes:
- Unauthorized (401)
- Forbidden (403)
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- limit: limit
- marker: marker
- offset: marker
Response Parameters
-------------------
@ -53,19 +53,19 @@ Response Example
:language: javascript
Create job
==========
Creates job(v2)
===============
.. rest_method:: POST /v2/{project_id}/jobs
Creates a job v2.
Creates a job.
This operation creates a new job.
The ``body`` attribute specifies contains a set of actions that gets created
one the job is submitted.
``description`` is the name that you give to the job. The name must not
The ``description`` is the name that you give to the job. The name must not
exceed 64 bytes in length.
The ``job_schedule`` is very important to schedule the job or it will run only
@ -78,11 +78,19 @@ Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
------------------
@ -91,7 +99,6 @@ Request Parameters
- description: job_description_req
- job_schedule: job_schedule_req
- job_actions: job_actions_req
- project_id: project_id_path
Request Example
---------------
@ -101,3 +108,135 @@ Request Example
This operation does not return a response body.
Show jobs(v2)
=============
.. rest_method:: GET /v2/{project_id}/jobs/{job_id}
Shows a job.
This operation shows a certain job. It displays all job details with actions
inside the job.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- job_id: job_id_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- user_id: user_id
- description: job_description_req
- job_schedule: job_schedule_req
- client_id: client_id
- job_actions: job_actions_req
- job_id: job_id
Response Example
----------------
.. literalinclude:: samples/job-get-response.json
:language: javascript
Updates jobs(v2)
================
.. rest_method:: PATCH /v2/{project_id}/jobs/{job_id}
Updates a job.
This operation creates a new job.
The ``body`` attribute specifies contains a set of actions that gets updated
once the job is submitted.
The ``description`` is the name that you give to the job. The name should not
exceed 64 bytes in length.
The ``job_schedule`` is very important to schedule the job or it will run only
once. also you can provide ``event`` which can automatically start/stop the
job.
The ``job_actions`` the actual backup or restore action to be done.
Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- job_id: job_id_path
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- description: job_description_req
- job_schedule: job_schedule_req
- job_actions: job_actions_req
Request Example
---------------
.. literalinclude:: samples/job-update-request.json
:language: javascript
Response Example
----------------
.. literalinclude:: samples/job-update-response.json
:language: javascript
Delete jobs(v2)
===============
.. rest_method:: DELETE /v2/{project_id}/jobs/{job_id}
Delete jobs.
This operation deletes a certain job .
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- job_id: job_id_path
There is no response for this operation.

View File

@ -1,4 +1,32 @@
############################### Response ####################################
############################### Query ####################################
action_id_path:
type: string
in: query
required: true
description: |
The action UUID.
backup_id_path:
type: string
in: query
required: true
description: |
The UUID of the backup.
client_id_path:
type: string
in: query
required: true
description: |
The client ID.
job_id_path:
type: string
in: query
required: true
description: |
The job UUID.
limit:
description: |
@ -27,11 +55,79 @@ project_id_path:
The UUID of the project. A project was also known as
a tenant.
session_id_path:
type: string
in: query
required: true
description: |
The session UUID.
############################### Body ####################################
action_id:
type: string
in: body
required: true
description: |
The action UUID.
actions:
type: list
in: body
required: true
description: |
A list of actions.
backup_id:
type: string
in: body
required: true
description: |
The UUID of the backup.
backup_metadata:
type: list
in: body
required: true
description: |
A list of backup metada information. This contains the backup details.
like ``path_to_backup``, ``backup_name``, ``hostname``, ``job_id``,
``storage``, ...
backups:
type: list
in: body
description: |
A list of backups
A list of backups.
client_id:
type: string
in: body
required: true
description: |
The client UUID.
clients:
type: list
in: body
required: true
description: |
A list of clients.
freezer_action:
type: dict
in: body
required: true
description: |
Action parameters. It depends on the actual action (backup, restore,
admin, info) so the parameters differ.
hostname:
type: string
in: body
required: true
description: |
The hostname of the machine that client is running on.
job_actions_req:
type: list
@ -45,20 +141,136 @@ job_description_req:
in: body
required: true
description: |
The name of the job
The name of the job.
job_id:
type: string
in: body
required: true
description: |
The job UUID.
job_schedule_req:
type: dict
in: body
required: true
description: |
The schedule information of the job
The schedule information of the job.
jobs:
type: list
in: body
description: |
A list of jobs
A list of jobs.
max_retries:
type: int
in: body
description: |
A number of times freezer should retry to execute the action.
max_retries_interval:
type: int
in: body
description: |
The time that freezer should wait between diferrent retrials to execute
the action.
result:
type: string
in: body
description: |
A string represents if the operation was successful ``success`` or failed.
session_description:
type: string
in: body
required: true
description: |
A description of the session.
session_event:
type: string
in: body
description: |
The event is being used to start or stop a session.
session_hold_off:
type: int
in: body
required: true
description: |
Amount of time to wait before re-running the same session again.
session_id:
type: string
in: body
required: true
description: |
The session UUID.
session_schedule:
type: dict
in: body
required: true
description: |
A dictionary that holds the session secheduling information. It's the
same like job_schedule. it contains ``schedule_interval``, ``status``
and ``event``.
session_schedule_internval:
type: string
in: body
description: |
The scheduling information of the session. for examples "2 hours" it
means the session will be executed every 2 hours.
session_status:
type: string
in: body
description: |
The status of the session. Default is ``active``.
session_tag:
type: string
in: body
required: true
description: |
The event is being used to start or stop a session.
sessions:
type: list
in: body
description: |
A list of existing sessions.
user_id:
type: string
in: body
required: true
description: |
The user UUID.
username:
type: string
in: body
required: true
description: |
The username.
uuid:
type: string
in: body
required: true
description: |
The client UUID.
version_doc:
type: int
in: body
required: true
description: |
The document version.
versions:
type: list

View File

@ -0,0 +1,15 @@
{
"freezer_action":
{
"backup_name": "production_backup",
"container": "prod_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"snapshot": true,
"action": "backup",
"remove_older_than": 365,
"log_file": "/var/log/freezer/job0001.log"
},
"max_retries": 5,
"max_retries_interval": 6
}

View File

@ -0,0 +1,4 @@
{
"action_id": "1fc414f091b84263b45d7e1f1f85e5bf"
}

View File

@ -0,0 +1,19 @@
{
"freezer_action":
{
"backup_name": "production_backup",
"container": "prod_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"snapshot": true,
"action": "backup",
"remove_older_than": 365,
"log_file": "/var/log/freezer/job0001.log"
},
"max_retries_interval": 6,
"_version": 1,
"max_retries": 5,
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"action_id": "1fc414f091b84263b45d7e1f1f85e5bf",
"project_id": "752d8bd43d654e7a840bbfda77ce41af"
}

View File

@ -0,0 +1,44 @@
{
"actions":
[
{
"freezer_action":
{
"backup_name": "test0001_backup",
"container": "test0001_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"snapshot": true,
"action": "backup",
"remove_older_than": 365,
"log_file": "/home/saad/job0001.log"
},
"max_retries": 5,
"max_retries_interval": 6,
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"action_id": "061f7657350a4bddbfabf8d2a25dad96",
"project_id": "752d8bd43d654e7a840bbfda77ce41af"
},
{
"freezer_action":
{
"backup_name": "test0001_backup",
"container": "/tmp/test0001_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"storage": "local",
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"snapshot": false,
"action": "backup",
"remove_older_than": 365,
"log_file": "/home/saad/job0001.log"
},
"max_retries": 5,
"max_retries_interval": 6,
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"action_id": "317f8bc1fbbe49819d1b60f4b4387e63",
"project_id": "752d8bd43d654e7a840bbfda77ce41af"
}
]
}

View File

@ -0,0 +1,15 @@
{
"freezer_action":
{
"backup_name": "production_backup",
"container": "prod_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"snapshot": true,
"action": "backup",
"remove_older_than": 365,
"log_file": "/var/log/freezer/job0001.log"
},
"max_retries": 5,
"max_retries_interval": 6
}

View File

@ -0,0 +1,5 @@
{
"version": 2,
"action_id": "1fc414f091b84263b45d7e1f1f85e5bf"
}

View File

@ -0,0 +1,39 @@
{
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"backup_id": "96a5946a6e994a38a3d1008fbc6f3406",
"user_name": "demo",
"backup_metadata":
{
"ssh_port": 22,
"consistency_checksum": "",
"curr_backup_level": 0,
"backup_name": "test0001_backup",
"container": "/tmp/test0001_container",
"compression": "gzip",
"dry_run": "",
"hostname": "szaher",
"storage": "local",
"vol_snap_path": "/etc/",
"os_auth_version": "",
"client_os": "linux2",
"time_stamp": 1493052022,
"container_segments": "",
"ssh_username": "",
"path_to_backup": "/etc/",
"ssh_key": "",
"proxy": "",
"job_id": "0ae284d514eb47dd84154748b5056749",
"always_level": "",
"max_level": "",
"backup_media": "fs",
"ssh_host": "",
"mode": "fs",
"fs_real_path": "/etc/",
"action": "backup",
"client_version": "5.0.0",
"log_file": "/home/saad/job0001.log"
},
"_version": 1
}

View File

@ -0,0 +1,15 @@
{
"client":
{
"client":
{
"hostname": "szaher01",
"uuid": "c4031a4885384376a717a238de975a9c"
},
"user_id": "5cd44cafcdb5386b94a04b33d56a5ff6",
"uuid": "6f588392aa864c96b4af96a4eae005ce",
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher01"
},
"user_id": "0cd44caf6db5486b94a04b33256a5ff4"
}

View File

@ -0,0 +1,8 @@
{
"client":
{
"hostname": "szaher01",
"uuid": "c4031a4885384376a717a238de975a9c"
},
"client_id": "752d8cd43d654e7a840bbfd277ce41af_szaher01"
}

View File

@ -0,0 +1 @@
{"client_id": "752d8cd43d654e7a840bbfd277ce41af_szaher01"}

View File

@ -0,0 +1,28 @@
{
"clients":
[
{
"client":
{
"client":
{
"hostname": "szaher01",
"uuid": "c4031a4885384376a717a238de975a9c"
},
"user_id": "5cd44cafcdb5386b94a04b33d56a5ff6",
"uuid": "6f588392aa864c96b4af96a4eae005ce",
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher01"
},
"user_id": "0cd44caf6db5486b94a04b33256a5ff4"
},
{
"client":
{
"hostname": "szaher",
"uuid": "c4031a9885384376a717a238ae975d9b",
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher"
},
"user_id": "0cd44caf6db5486b94a04b33256a5ff4"
}
]
}

View File

@ -0,0 +1,41 @@
{
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"description": "Test-0001",
"_version": 83,
"job_schedule":
{
"schedule_interval": "2 minutes",
"status": "scheduled",
"time_started": 1493119341,
"time_created": 1493051865,
"time_ended": 1493119342,
"result": "success",
"current_pid": 10058,
"event": ""
},
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher",
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"job_actions":
[
{
"freezer_action":
{
"backup_name": "test0001_backup",
"container": "/tmp/test0001_container",
"no_incremental": true,
"path_to_backup": "/etc/",
"storage": "local",
"log_file": "/home/saad/job0001.log",
"snapshot": false,
"action": "backup",
"remove_older_than": 365,
"project_id": "752d8bd43d654e7a840bbfda77ce41af"
},
"max_retries": 5,
"max_retries_interval": 6,
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"action_id": "280d51d041ce4d4da8a386e96263f759"
}
],
"job_id": "0ae284d514eb47dd84154748b5056749"
}

View File

@ -0,0 +1,27 @@
{
"description": "Test-0001",
"job_schedule": {
"schedule_interval": "5 minutes",
"status": "scheduled",
"event": "stop"
},
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"job_actions": [
{
"max_retries": 10,
"max_retries_interval": 10,
"freezer_action": {
"backup_name": "test0001_backup",
"container": "/tmp/xyzxyzxyz",
"storage": "local",
"no_incremental": true,
"path_to_backup": "/etc/",
"log_file": "/home/saad/job0001.log",
"snapshot": false,
"action": "backup",
"remove_older_than": 365,
"project_id": "752d8bd43d654e7a840bbfda77ce41af"
}
}
]
}

View File

@ -0,0 +1 @@
{"job_id": "0ae284d514eb47dd84154748b5056749", "version": "3"}

View File

@ -0,0 +1,6 @@
{
"start":{
"job_id":"",
"current_tag":20
}
}

View File

@ -0,0 +1,4 @@
{
"result": "success",
"session_tag": 21
}

View File

@ -0,0 +1,10 @@
{
"session_tag":20,
"description":"Webapp Database backup ",
"hold_off":30,
"schedule":{
"schedule_interval":"1 hours",
"status":"scheduled",
"event":"start"
}
}

View File

@ -0,0 +1,4 @@
{
"session_id": "79eba555449d4cfe8ef66f34cb096295"
}

View File

@ -0,0 +1,16 @@
{
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"description": "Instance Database backup ",
"schedule":
{
"schedule_interval": "1 days",
"status": "scheduled",
"event": "start"
},
"_version": 2,
"session_tag": 250,
"session_id": "79eba555449d4cfe8ef66f34cb096295",
"hold_off": 50
}

View File

@ -0,0 +1,26 @@
{
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"description": "Instance Database backup ",
"schedule":
{
"schedule_interval": "1 days",
"status": "scheduled",
"event": "start"
},
"_version": 3,
"session_tag": 250,
"session_id": "79eba555449d4cfe8ef66f34cb096295",
"jobs":
{
"0ae284d514eb47dd84154748b5056749":
{
"time_ended": 1493119342,
"status": "scheduled",
"result": "success",
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher",
"time_started": 1493119341
}
},
"hold_off": 50
}

View File

@ -0,0 +1,30 @@
{
"sessions":
[
{
"project_id": "752d8bd43d654e7a840bbfda77ce41af",
"user_id": "0cd44caf6db5486b94a04b33256a5ff4",
"description": "Instance Database backup ",
"schedule":
{
"schedule_interval": "1 days",
"status": "scheduled",
"event": "start"
},
"session_tag": 250,
"session_id": "79eba555449d4cfe8ef66f34cb096295",
"jobs":
{
"0ae284d514eb47dd84154748b5056749":
{
"time_ended": 1493119342,
"status": "scheduled",
"result": "success",
"client_id": "752d8bd43d654e7a840bbfda77ce41af_szaher",
"time_started": 1493119341
}
},
"hold_off": 50
}
]
}

View File

@ -0,0 +1,10 @@
{
"session_tag": 250,
"description": "Instance Database backup ",
"hold_off": 50,
"schedule": {
"schedule_interval": "1 days",
"status": "scheduled",
"event": "start"
}
}

View File

@ -0,0 +1,5 @@
{
"version": 5,
"session_id": "0ec2c71697464d63813b419d2282a43a"
}

View File

@ -0,0 +1,346 @@
===================
Sessions (sessions)
===================
A session is a group of jobs which share the same scheduling time. A session
is identified by its ``session_id`` and has a numeric tag (session_tag) which
is incremented each time that a new session is started. The purpose of the
``session_tag`` is that of identifying a group of jobs which have been
executed together and which therefore represent a snapshot of a distributed
system.
When a ``job`` is added to a session, the scheduling time of the session is
copied into the job data structure, so that any job belonging to the same
session will start at the same time.
Lists Sessions(v2)
==================
.. rest_method:: GET /v2/{project_id}/sessions
Lists sessions.
This operation lists sessions in a project.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
-------------------
.. rest_parameters:: parameters.yaml
- limit: limit
- offset: marker
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- sessions: sessions
Response Example
----------------
.. literalinclude:: samples/sessions-list-response.json
:language: javascript
Creates session(v2)
===================
.. rest_method:: POST /v2/{project_id}/sessions
Creates a session.
This operation creates a new session in a project.
Normal response codes: 201
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- description: session_description
- hold_off: session_hold_off
- session_tag: session_tag
- schedule: session_schedule
- schedule_internval: session_schedule_internval
- event: session_event
Request Example
---------------
.. literalinclude:: samples/sessions-create-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- session_id: session_id
Response Example
----------------
.. literalinclude:: samples/sessions-create-response.json
:language: javascript
Show sessions(v2)
=================
.. rest_method:: GET /v2/{project_id}/sessions/{session_id}
Shows sessions.
This operation shows a certain session in a project. It displays
all session details with jobs included in this session.
Normal response codes: 200
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- session_id: session_id_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- user_id: user_id
- description: session_description
- schedule: session_schedule
- session_tag: session_tag
- session_id: session_id
- hold_off: session_hold_off
Response Example
----------------
.. literalinclude:: samples/sessions-get-response.json
:language: javascript
.. literalinclude:: samples/sessions-get-with-job-response.json
:language: javascript
Updates a session(v2)
=====================
.. rest_method:: PATCH /v2/{project_id}/sessions
Updates a session.
This operation updates a new session in a project.
Normal response codes: 200
Error response codes:
- Syntax Error (753)
- BadRequest (400)
- Unauthorized (401)
- ServiceUnavailable (503)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
Request Parameters
------------------
.. rest_parameters:: parameters.yaml
- description: session_description
- hold_off: session_hold_off
- session_tag: session_tag
- schedule: session_schedule
- schedule_internval: session_schedule_internval
- event: session_event
- session_id: session_id_path
Request Example
---------------
.. literalinclude:: samples/sessions-update-request.json
:language: javascript
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- session_id: session_id
- version: version_doc
Response Example
----------------
.. literalinclude:: samples/sessions-update-response.json
:language: javascript
Add jobs(v2)
============
.. rest_method:: PUT /v2/{project_id}/sessions/{session_id}/jobs/{job_id}
attaches job to a session.
This operation adds a certain job to a session. The api will load the job
and the session and add the job to session document.
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- session_id: session_id_path
- job_id: job_id_path
No response will be returned for this job.
Remove jobs(v2)
===============
.. rest_method:: DELETE /v2/{project_id}/sessions/{session_id}/jobs/{job_id}
Removes a job from a session.
This operation will remove a certain job to a session in a project.
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- session_id: session_id_path
- job_id: job_id_path
No response will be returned for this job.
Start sessions(v2)
==================
.. rest_method:: POST /v2/{project_id}/sessions/{session_id}/actions
Removes a job from a session.
This operation will remove a certain job to a session in a project.
Normal response codes: 202
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- session_id: session_id_path
Response Parameters
-------------------
.. rest_parameters:: parameters.yaml
- result: result
- session_tag: session_tag
Response Example
----------------
.. literalinclude:: samples/session-start-response.json
:language: javascript
Remove sessions(v2)
====================
.. rest_method:: DELETE /v2/{project_id}/sessions/{session_id}
Removes a session.
This operation will remove a certain a session in a project.
Normal response codes: 204
Error response codes:
- Unauthorized (401)
- Forbidden (403)
Query Parameters
-----------------
.. rest_parameters:: parameters.yaml
- project_id: project_id_path
- session_id: session_id_path
No response will be returned for this job.