Server side of portal shavit
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
- pyhton - Python v3.8.2
- GET /api/v1/shavit/resources/users
- GET /api/v1/shavit/resources/servers
- GET /api/v1/shavit/resources/servers?serverGroupName=<SERVER_GROUP_NAME>
- GET /api/v1/shavit/resources/servers/services?serverGroupName=<SERVER_GROUP_NAME>
- GET /api/v1/shavit/actions/servers/service?serverName=<SERVER_NAME>&serviceName=<SERVICE_NAME>&actionType=<ACTION_TYPE>
- GET /api/v1/shavit/dbs
- GET /api/v1/shavit/dbs?dbType=<DB_NAME>
- GET /api/v1/shavit/dbs/backup_files?dbType=<DB_NAME>&resourceType=<RESOURCE_TYPE>
- GET /api/v1/shavit/dbs/backup?dbType=<DB_NAME>
- GET /api/v1/shavit/dbs/restore?dbType=<DB_NAME>
- GET /api/v1/shavit/dbs/create?dbType=<DB_TYPE>&dbName=<DB_NAME>
- GET /api/v1/shavit/ocp/login/infra
- GET /api/v1/shavit/ocp/projects
- GET /api/v1/shavit/ocp/services?project=<PROJECT_NAME>
Example: http://localhost:5000/api/v1/shavit/resources/users
Response body:
[
"user1",
"user2",
"user3"
]
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"
}]
}
........
]
Example: http://localhost:5000/api/v1/shavit/resources/servers?serverGroupName=postgres
Response body:
[
"pg1",
"pg2"
]
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>
Response body:
active \ started \ stoped \ restarted
Example: http://localhost:5000/api/v1/shavit/dbs
Response body:
[
"postgres",
"mongo",
"oracle"
]
Example: http://localhost:5000/api/v1/shavit/dbs?dbType=postgres
Response body:
[
"postgres",
"template1",
"template0"
]
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"
]
Example: http://localhost:5000/api/v1/shavit/dbs/backup?dbType=postgres
Response body:
'<DB_NAME> backup of all dbs is done!' /OR/ 'ERROR'
Example: http://localhost:5000/api/v1/shavit/dbs/restore?dbType=postgres
Response body:
'<DB_NAME> restore of all dbs is done!' /OR/ 'ERROR'
Example: http://localhost:5000/api/v1/shavit/dbs/create?dbType=postgres&dbName=testdb
Response body:
'done!'
Example: http://localhost:5000/api/v1/shavit/ocp/login/infra
Response body:
'Login succeeded! Logged in as infra .......'
Example: http://localhost:5000/api/v1/shavit/ocp/projects
Response body:
[
"myproject",
"myproject2",
"myproject3"
]
Example: http://localhost:5000/api/v1/shavit/ocp/services?project=myproject
Response body:
[
"mysql",
"ruby-hello-world"
]