Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

flask based RESTful API wrapper around project linchpin

License

Notifications You must be signed in to change notification settings

CentOS-PaaS-SIG/restylinchpin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

restylinchpin

flask based RESTful API wrapper built around project linchpin

Table Of Contents

Overview

HTTP RESTful API.

Requests pass data via JSON encoded bodies except for GET requests where data will be passed via URL and excecute them on linchpin Command Line Interface to provision workspaces and return a JSON response to the user.

A user can currently make use of following supported features:

  • Create Workspaces : Users can create a new worskpace locally.
  • List Workspaces : Users can list all existing workspace within a config directory.
  • Delete Workspaces : Users can delete workspace by name.
  • Fetch Workspaces from a remote URL : Users can fetch remote workspaces from git or web directory locally.
  • Provision workspaces : Users can provision workspaces across multiple cloud providers.
  • Destroy Workspaces : Users can teardown the resources provisioned after using them.

User Management

api_key based authentication for user operations

creating users
endpoint:
/users
methodtype: POST
request:
{
"username":"username",
"password":"password",
"email":"email"
}
response:
{
username=username,
admin=boolean indicating created as admin user or not
email=email,
status="username created successfully"
}

Login
endpoint:
/login
User has to send a basic authentication header with username and password generated above, an autogenerated (hashed) api_key will be returned to the user for resource access.
Response:
{
"api_key":"api_key value"
}
This api_key will be verified by passing a key:api_key and value: api_key value obtained above,in the request headers during each of the API calls including user and workspace actions to grant resource access by determining the access rights of the current user. Admin users can access all resources whereas other resources are only accessible to the owner of that resource.

Reset api key
methodType: POST
endpoint:
/api/v1.0/users/username/reset
Response: {api_key= value, message = "reset successfully"}

listing users
One user:
(Admin user only)
endpoint:
/users/username
methodType: GET
response:
{
username=username,
api_key=api_key,
admin=boolean indicating created as admin user or not
}

All users:
(Admin user only)
endpoint:
/users
methodType: GET
response:
{
[user1: {username: username, password: password(hashed), api_key:api_key} ]
status=200 OK
}

Promote users to admin status
(Admin user only)
endpoint:
methodType: PUT
/api/v1.0/users/username/promote
Response: {user has been promoted as an admin}

Update user fields
endpoint:
methodType: PUT
/api/v1.0/users/username
request:
{ "username":"username",
"password":"password",
"email":"email"
}
response:
{ username=username,
password= hashed_password,
email=email,
status=OK
}

Upload/create credentials
POST /users/username/credentials
RequestBody:
{ file : text or attached file
file_name : name,
encrypted: boolean,
vault_pass: ansible vault password
}
return : response with successful credential upload status

List credentials
GET /users/username/credentials/file_name
return : response with encrypted credentials from file

Delete credentials
DELETE /users/username/credentials/file-name
return : response with successful delete status

Update credentials
PUT /users/username/credentials/file_name
RequestBody: { file : updated text or updated attached file
encrypted: boolean,
vault_pass: ansible vault password
}
return : response with successful credential update status

Linchpin Project

LinchPin is a simple cloud orchestration tool. Its intended purpose is managing cloud resources across multiple infrastructures. These resources can be provisioned, decommissioned, and configured all using declarative data and a simple command-line interface.

Refer to Linchpin Repository for detailed information: https://github.com/CentOS-PaaS-SIG/linchpin

Deployment

restylinchpin will be deployed and available on Openshift.
Start using restylicnhpin with pypi: pip install restylinchpin

Documenation (In progress)

Swagger
ReadTheDocs