Jump to: navigation, search

Difference between revisions of "Trove/DatastoreManagementAPI"

(Justifications)
Line 5: Line 5:
 
== Justifications ==
 
== Justifications ==
  
For now ''trove-manage'' utility provides such CLI calls to create datastores and version. The problem is that utility can be accessed only from host where Trove was deployed. Which seems to be a bottleneck for Trove functionality and wide-accessability.
+
For now ''trove-manage'' utility provides CLI to create datastores and version. The problem is that utility can be accessed only from host where Trove was deployed. Which seems to be a bottleneck for Trove functionality and wide-accessability.
  
 
== Benefits ==
 
== Benefits ==

Revision as of 15:36, 30 July 2014

Description

Trove should provide API to create/update datastores and its versions

Justifications

For now trove-manage utility provides CLI to create datastores and version. The problem is that utility can be accessed only from host where Trove was deployed. Which seems to be a bottleneck for Trove functionality and wide-accessability.

Benefits

Proposed changes would provide an ability to manipulated datastores through the Trove API. Datastore/version modifications are available for Admin role.

Impacts

Proposed changes would change the way of datastores and versions are being registered.

Database

None

Configuration

None

API Calls

Create datastore

HTTP request and routeː POST /mgmt/datastores

     {
       "datastore": {
           "name": "Mysql"
       }
     }

HTTP response:

Status: 200 OK

Statusː 403 Forbidden (regular user used)

     {
       "datastore": {
           "id": 1
           "name": "Mysql"
           "versions":  [ ]
       }
     }

Update datastore

HTTP request and routeː PATCH /mgmt/datastores/{id}

     {
       "datastore": {
           "name": "Mysql" # optional
           "datastore_version": "5.5" # optional
       }
     }

HTTP response:

Status: 200 OK

Statusː 403 Forbidden (regular user used)

     {
       "datastore": {
           "id": 1,
           "name": "Mysql",
           "default_version"ː 53eb2b38-eb0d-4fc8-a335-5c2cac6f65fd,
           "datastore_version": [ 
                    {
                       u'name': u'5.5', 
                       u'links': [
                             {
                                   u'href': u'https://172.18.196.44:8779/v1.0/c4f59011dda1426b8c13da0aba707f2d/datastores/versions/53eb2b38-eb0d-4fc8-a335-5c2cac6f65fd',
                                   u'rel': u'self'
                             }, 
                            {
                                   u'href': u'https://172.18.196.44:8779/datastores/versions/53eb2b38-eb0d-4fc8-a335-5c2cac6f65fd', 
                                   u'rel': u'bookmark'
                            }], 
                       u'image': u'32123676-ef2d-488a-9b25-8b75509beae7', 
                       u'active': True, u'packages': u, 
                      u'id': u'53eb2b38-eb0d-4fc8-a335-5c2cac6f65fd'
                    }, ],
       }
     }

Create version

HTTP request and routeː POST /mgmt/datastores/versions

     {
         "version": {
             "name": "5.5"
             "manager": "mysql"
             "packages": "mysql-server-5.5" #optional
             "image_id": 000
             "active": True #optional, default is True
     }

HTTP response:

Status: 200 OK

Statusː 403 Forbidden (regular user used)

     {
       "version": {
           "id": 1
           "name": "5.5"
           "manager": "mysql"
           "packages": "mysql-server-5.5 bc mc gedit" #Typeː String
           "image_id": 000
           "active": True
       }
     }


Update version

HTTP method and routeː PATCH /mgmt/datastores/{datastore_id}/{version_id} # if datastore mentioned HTTP method and routeː PATCH /mgmt/datastores/versions/{uuid} # if no datastore mentioned

     {
         "version": {
              "active": False
     }

HTTP Response:

Status: 200 OK

Statusː 403 Forbidden (regular user used)

     {
       "version": {
           "id": 1
           "name": "5.5"
           "manager": "mysql"
           "packages": "mysql-server-5.5"
           "image_id": 000
           "active": False
       }
     }

CLI view

trove datastore-create {name}

trove datastore-update --name {new_name, optional} --default_version {name/uuid, optional} {name/uuid}

trove datastore-version-create --datastore {name/uuid, required} --manager {manager, required} --packages {packages_list, optional} --image {image_id, required} --active {true/false, optional} {name}

trove datastore-version-update --datastore {name/uuid, optional} --manager {manager, optional} --packages {packages_list, optional} --image {image_id, optional} --active {true/false, optional} --name {new_name, optional} {name/uuid}