Basic design doc for API Service
design document for API service which includes the class-diagram and database table design. Change-Id: I3ed8c405713dfb927297aa60ac546ae0b6e8b027 Implements: blueprint api-service-design
This commit is contained in:
parent
606ca663b0
commit
3f789ad8d9
BIN
doc/images/api-service-class-diagram.png
Normal file
BIN
doc/images/api-service-class-diagram.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
57
doc/source/api-service-class-diagram.pu
Normal file
57
doc/source/api-service-class-diagram.pu
Normal file
@ -0,0 +1,57 @@
|
||||
@startuml
|
||||
|
||||
title API Service Class Diagram
|
||||
|
||||
class wsgi.Controller{
|
||||
|
||||
}
|
||||
|
||||
|
||||
class ProvidersController extends wsgi.Controller{
|
||||
+index(self, req):[]Provider
|
||||
+show(self, req, provider_id:String):Provider
|
||||
}
|
||||
|
||||
class CheckpointsController extends wsgi.Controller{
|
||||
+index(self, req, provider_id:String):[]Checkpoint
|
||||
+create(self, req, body:JSON, provider_id:String):Checkpoint
|
||||
+show(self, req, provider_id:String, checkpoint_id:String):):Checkpoint
|
||||
+delete(self, req, provider_id:String, checkpoint_id:String):):void
|
||||
}
|
||||
|
||||
class ProtectablesController extends wsgi.Controller{
|
||||
+index(self, req):[]Protectable
|
||||
+show(self, req, protectable_type:String):[]Protectable
|
||||
+index_instances(self, req, protectable_type:String):[]Resource
|
||||
}
|
||||
|
||||
class PlansController extends wsgi.Controller{
|
||||
+create(self, req, body:JSON):Plan
|
||||
+index(self, req):[]Plan
|
||||
+show(self, req, id:String):Plan
|
||||
+update(self, req, id:String):Plan
|
||||
+delete(self, req, id:String):void
|
||||
}
|
||||
|
||||
class ScheduledOperationsController extends wsgi.Controller{
|
||||
+create(self, req, body:JSON):ScheduledOperation
|
||||
+index(self, req):[]ScheduledOperation
|
||||
+show(self, req, id:String):ScheduledOperation
|
||||
+delete(self, req, id:String):void
|
||||
}
|
||||
|
||||
|
||||
class RestorationsController extends wsgi.Controller{
|
||||
+create(self, req, body:JSON):Restoration
|
||||
+index(self, req):[]Restoration
|
||||
+show(self, req, id:String):Restoration
|
||||
}
|
||||
|
||||
class TriggersController extends wsgi.Controller{
|
||||
+create(self, req, body:JSON):Trigger
|
||||
+index(self, req):[]Trigger
|
||||
+show(self, req, id:String):Trigger
|
||||
+delete(self, req, id:String):void
|
||||
}
|
||||
|
||||
@enduml
|
195
doc/source/specs/api-service.rst
Normal file
195
doc/source/specs/api-service.rst
Normal file
@ -0,0 +1,195 @@
|
||||
..
|
||||
This work is licensed under a Creative Commons Attribution 3.0 Unported
|
||||
License.
|
||||
|
||||
http://creativecommons.org/licenses/by/3.0/legalcode
|
||||
|
||||
====================================
|
||||
API Service
|
||||
====================================
|
||||
|
||||
https://review.openstack.org/#/c/266338/
|
||||
|
||||
The APIs expose Application Data Protection services to the Smaug user.
|
||||
|
||||
The purpose of the services is to maximize flexibility and accommodate
|
||||
for (hopefully) any kind of protection for any type of resource, whether
|
||||
it is a basic OpenStack resource (such as a VM, Volume, Image, etc.) or
|
||||
some ancillary resource within an application system that is not managed
|
||||
in OpenStack (such as a hardware device, an external database, etc.).
|
||||
|
||||
|
||||
|
||||
====================================
|
||||
WSGI Resources Controller
|
||||
====================================
|
||||
|
||||
The WSGI Controller handles incoming web requests that are dispatched
|
||||
from the WSGI application APIRouter.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/openstack/smaug/master/doc/images/api-service-class-diagram.png
|
||||
|
||||
From the module class graph, api service basically have following
|
||||
resources Controller:
|
||||
|
||||
Provider Controller
|
||||
---------------------------
|
||||
Enables the Smaug user to list available providers and get parameters and
|
||||
result schema super-set for all plugins of a specific Provider.
|
||||
|
||||
|
||||
Checkpoint Controller
|
||||
---------------------------
|
||||
Enables the Smaug user to access and manage the checkpoints stored
|
||||
in the protection provider.
|
||||
|
||||
|
||||
Protectable Controller
|
||||
---------------------------
|
||||
|
||||
Enables the Smaug user to access information about which resource types
|
||||
are protectable (i.e. can be protected by Smaug).
|
||||
In addition, enables the user to get additional information on each
|
||||
resource type, such as a list of actual instances and their dependencies.
|
||||
|
||||
Plan Controller
|
||||
---------------------------
|
||||
|
||||
This API enables the Smaug user to access the protection Plan registry
|
||||
and do the following operations:
|
||||
- Plan CRUD.
|
||||
- List Plans.
|
||||
- Starting and suspending of plans.
|
||||
|
||||
|
||||
Scheduled Operation Controller
|
||||
--------------------------
|
||||
|
||||
This API enables the Smaug user to manage Scheduled Operations:
|
||||
|
||||
- Operation CRUD.
|
||||
- List Operations.
|
||||
|
||||
Trigger Controller
|
||||
--------------------------
|
||||
|
||||
This API enables the Smaug user to manage Triggers:
|
||||
A trigger only can be deleted when it isn't used in any of the
|
||||
scheduled operation.
|
||||
- Trigger CRUD.
|
||||
- List Triggers.
|
||||
|
||||
|
||||
Restore Controller
|
||||
---------------------------
|
||||
|
||||
This API enables the Smaug user restore a checkpoint on to a restore target:
|
||||
|
||||
- Create restored system from a checkpoint.
|
||||
|
||||
|
||||
====================================
|
||||
API Service Data base tables
|
||||
====================================
|
||||
|
||||
|
||||
|
||||
time_triggers and scheduled_operations database tables are the same as
|
||||
tables in the operation engine design.
|
||||
|
||||
1. plans
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
| id | varchar(36) | NO | PRI | NULL | |
|
||||
| name | varchar(255) | NO | | NULL | |
|
||||
| provider_id | varchar(36) | NO | | NULL | |
|
||||
| project_id | varchar(255) | NO | | NULL | |
|
||||
| status | varchar(64) | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
|
||||
2. resources
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
| id | Integer | NO | PRI | NULL | |
|
||||
| plan_id | varchar(255) | NO | FOR | NULL | |
|
||||
| resource_id | varchar(36) | NO | | NULL | |
|
||||
| resource_type | varchar(64) | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+-------------------------+--------------+------+-----+---------+-------+
|
||||
|
||||
3. restores
|
||||
+-----------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+-----------------+--------------+------+-----+---------+-------+
|
||||
| id | varchar(36) | NO | PRI | NULL | |
|
||||
| project_id | varchar(255) | NO | | NULL | |
|
||||
| provider_id | varchar(36) | NO | | NULL | |
|
||||
| checkpoint_id | varchar(36) | NO | | NULL | |
|
||||
| restore_target | varchar(255) | NO | | NULL | |
|
||||
| parameters | varchar(255) | NO | | NULL | |
|
||||
| status | varchar(64) | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+-----------------+--------------+------+-----+---------+-------+
|
||||
|
||||
4. triggers
|
||||
+--------------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+--------------------+--------------+------+-----+---------+-------+
|
||||
| id | varchar(36) | NO | PRI | NULL | |
|
||||
| name | varchar(255) | NO | | NULL | |
|
||||
| project_id | varchar(255) | NO | | NULL | |
|
||||
| type | varchar(64) | NO | | NULL | |
|
||||
| properties | TEXT | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+--------------------+--------------+------+-----+---------+-------+
|
||||
|
||||
5. scheduled_operations
|
||||
+----------------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+----------------------+--------------+------+-----+---------+-------+
|
||||
| id | varchar(36) | NO | PRI | NULL | |
|
||||
| name | varchar(255) | NO | | NULL | |
|
||||
| operation_type | varchar(64) | NO | | NULL | |
|
||||
| project_id | varchar(255) | NO | | NULL | |
|
||||
| trigger_id | varchar(36) | NO | | NULL | |
|
||||
| operation_definition | TEXT | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+----------------------+--------------+------+-----+---------+-------+
|
||||
|
||||
5. services
|
||||
+----------------------+--------------+------+-----+---------+-------+
|
||||
| Field | Type | Null | Key | Default | Extra |
|
||||
+----------------------+--------------+------+-----+---------+-------+
|
||||
| id | Integer | NO | PRI | NULL | |
|
||||
| host | varchar(255) | NO | | NULL | |
|
||||
| binary | varchar(255) | NO | | NULL | |
|
||||
| topic | varchar(255) | NO | | NULL | |
|
||||
| report_count | Integer | NO | | NULL | |
|
||||
| disabled | Boolean | NO | | NULL | |
|
||||
| disabled_reason | varchar(255) | NO | | NULL | |
|
||||
| modified_at | Datetime | NO | | NULL | |
|
||||
| rpc_current_version | varchar(36) | NO | | NULL | |
|
||||
| rpc_available_version| varchar(36) | NO | | NULL | |
|
||||
| created_at | Datetime | YES | | NULL | |
|
||||
| updated_at | Datetime | YES | | NULL | |
|
||||
| deleted_at | Datetime | YES | | NULL | |
|
||||
| deleted | Boolean | NO | | NULL | |
|
||||
+--------------------+--------------+------+-----+---------+-------+
|
@ -25,6 +25,12 @@ Smaug Specs
|
||||
This section contains detailed specification documents for
|
||||
different features inside Smaug.
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 3
|
||||
|
||||
api-service
|
||||
|
||||
Spec Template
|
||||
--------------
|
||||
|
Loading…
Reference in New Issue
Block a user