Skip to content

ilan07m/Portal-Shavit-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Portal-Shavit-Server

Server side of portal shavit

Installation

Use the package manager pip to install: flask, flask_swagger_ui, paramiko, psycopg2, pymongo.

pip install flask paramiko flask_swagger_ui psycopg2 pymongo

From the main folder run:

python app.py

Built With

List Of Requests

API Resources

GET /api/v1/shavit/resources/users

Example: http://localhost:5000/api/v1/shavit/resources/users

Response body:

[
    "user1", 
    "user2", 
    "user3"
]

GET /api/v1/shavit/resources/servers

Example: http://localhost:5000/api/v1/shavit/resources/servers

Response body:

[
    {
        "OPENSHIFT": [
            {
                "name": "openshift-server1"
            }, 
            {
                "name": "openshift-server2"
            }, 
            {
                "name": "openshift-server3"
            }]
    }, 
    {
        "POSTGRES": [
            {
                "name": "pg1"
            }, 
            {
                "name": "pg2"
            }]
    }, 
    {
        "MONGO": [
            {
                "name": "mongo1"
            }, 
            {
                "name": "mongo2"
            }]
    }
    ........
]

GET /api/v1/shavit/resources/servers?serverGroupName=<SERVER_GROUP_NAME>

Example: http://localhost:5000/api/v1/shavit/resources/servers?serverGroupName=postgres

Response body:

[
    "pg1", 
    "pg2"
]

GET /api/v1/shavit/resources/servers/services?serverGroupName=<SERVER_GROUP_NAME>

Example: http://localhost:5000/api/v1/shavit/resources/servers/services?serverGroupName=openshift

Response body:

[
    "atomic-openshift-node", 
    "docker",
    "firewalld",
    "iptables"
]

GET /api/v1/shavit/actions/servers/service?serverName=<SERVER_NAME>&serviceName=<SERVICE_NAME>&actionType=<ACTION_TYPE>

Example: http://localhost:5000/api/v1/shavit/actions/servers/service?serverName=myserver.com&serviceName=docker&actionType=start

Response body:

active \ started \ stoped \ restarted

GET /api/v1/shavit/dbs

Example: http://localhost:5000/api/v1/shavit/dbs

Response body:

[
  "postgres", 
  "mongo", 
  "oracle"
]

GET /api/v1/shavit/dbs?dbType=<DB_NAME>

Example: http://localhost:5000/api/v1/shavit/dbs?dbType=postgres

Response body:

[
  "postgres", 
  "template1", 
  "template0"
]

GET /api/v1/shavit/dbs/backup_files?dbType=<DB_NAME>&resourceType=<RESOURCE_TYPE>

Example: http://localhost:5000/api/v1/shavit/dbs/backup_files?dbType=postgres&resourceType=schema

Resource types:

all \ db \ schema \ collection

Response body:

[
    "pgschema1.dmp", 
    "pgschema2.dmp", 
    "pgschema3.dmp"
]

GET /api/v1/shavit/dbs/backup?dbType=<DB_NAME>

Example: http://localhost:5000/api/v1/shavit/dbs/backup?dbType=postgres

Response body:

'<DB_NAME> backup of all dbs is done!' /OR/ 'ERROR'

GET /api/v1/shavit/dbs/restore?dbType=<DB_NAME>

Example: http://localhost:5000/api/v1/shavit/dbs/restore?dbType=postgres

Response body:

'<DB_NAME> restore of all dbs is done!' /OR/ 'ERROR'

GET /api/v1/shavit/dbs/create?dbType=<DB_TYPE>&dbName=<DB_NAME>

Example: http://localhost:5000/api/v1/shavit/dbs/create?dbType=postgres&dbName=testdb

Response body:

'done!'

GET /api/v1/shavit/ocp/login/infra

Example: http://localhost:5000/api/v1/shavit/ocp/login/infra

Response body:

'Login succeeded! Logged in as infra .......'

GET /api/v1/shavit/ocp/projects

Example: http://localhost:5000/api/v1/shavit/ocp/projects

Response body:

[
  "myproject", 
  "myproject2", 
  "myproject3"
]

GET /api/v1/shavit/ocp/services?project=<PROJECT_NAME>

Example: http://localhost:5000/api/v1/shavit/ocp/services?project=myproject

Response body:

[
    "mysql", 
    "ruby-hello-world"
]

About

Server side of portal shavit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages