https://github.com/dataman-cloud/omega-client
https://github.com/dataman-cloud/omega-client
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/dataman-cloud/omega-client
- Owner: Dataman-Cloud
- License: apache-2.0
- Created: 2016-04-07T07:49:22.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-08-12T06:09:25.000Z (almost 9 years ago)
- Last Synced: 2025-01-07T21:43:53.576Z (5 months ago)
- Language: Python
- Size: 82 KB
- Stars: 0
- Watchers: 17
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# omega-Client
## Install
```
git clone https://github.com/Dataman-Cloud/omega-client.git
cd omega-client/python-omegaclient/
pip3 install -r requirements.txt
python3 setup.py install
```
## Use```
>> from omegaclient import OmegaClient
>> client = OmegaClient(server_url, email, password)
>> client.get_clusters()
>> ...
```
## APIS### Auth
#### get_token
```
Fetch user token
```
```
arguments: email - user email
passed - user passed
returns: Dicitonary contains token
```### User
```
Retrieve user information
```
```
arguments: Nonereturns: Dictionary contains user information
```### Cluster
#### get_clusters
```
List all clustersarguments: None
returns: clusters list
```
#### get_cluster```
List single cluster's informationarguments: cluster_id
returns: cluster dictionary
```
#### delete_cluster```
Delete clusterarguments: cluster_id
returns: None
```
#### create_cluster```
Create new cluster.arguments: name: cluster name - string
cluster_type: cluster type - 1_master or 3_masters or 5_masters
group_id: - intreturns: None
```
#### update_cluster
```
Updated cluster information. currently only supported modifing the cluster name.
arguments: cluster_id - 1000
kwargs - { "name": "new_cluster_name" }
returns: { "code": 0 }
```#### get_node_identifier
```
Generated new node identifier. this identifier will be used for add new node.arguments: cluster_id
returns: { "identifier": "string" }
```#### get_cluster_node
```
List node informationarguments:
cluster_id
node_idreturns: dictionary contans node information
{
"cluster": {
"id": 0,
"name": "string",
"cluster_type": "string"
},
"id": "string",
"name": "string",
"status": "string",
"created_at": "string",
"ip": "string",
"services": [
{
"name": "string",
"status": "string"
}
]
}
```#### update_cluster_node
```
Updated node informationarguments:
cluster_id
node_id
kwargsreturns:
{
"code": 0
}
status: 200
401
```#### get_node_metrics
```
Retrive node metricsarguments:
cluster_id
node_idreturns: metrics list
```#### update_node_service
```
Reset or restart service on nodearguments:
cluster_id
node_id
service_name
kwargsreturns: { "code": 0 }
```#### create_node
```
Add new node for cluster identified by `cluster_id`
arguments: `cluster_id` `kwargs`returns: { "code": 0 }
```#### delete_nodes
```
Delete single node or multiple nodesarguments: `cluster_id` `args`
returns: { "code": 0 }
```
### App#### get_cluster_apps
```
List all apps in cluster
```
```
arguments: cluster_idreturns: apps list
```#### create_cluster_apps
```
Created app in cluster
```
```
arguments: cluster_id - 100
kwargs: - json object contains all parameters for app creationreturns: app id
```#### get_cluster_app
```
Show app information
```
```
arguments: cluster_id - 100
app_id - 699
returns: Dictionary contains app information
```#### delete_cluster_app
```
Delete app
```
```
arguments: cluster_id - 100
app_id - 689
returns: None
```
#### get_user_apps
```
List all apps belong to a user
```
```
arguments: Nonereturns: List contains all apps
```#### get_user_apps_status
```
List all app's status
```
```
arguments: Nonereturn: List contains all app status
```
#### get_app_versions
```
List all history versions for app
```
```
arguments: cluster_id - 100
app_id - 101
returns: Dictionary contains all versions
```
#### delete_app_version
```
Delete app version
```
```
arguments: cluster_id - 100
app_id - 899
version_id - 12
returns: None
```#### update_cluster_app
```
Updated app configuration
```
```
arguments: cluster_id - 100
app_id - 688
kwargs - json object contains all app configurationsreturns: None
```
#### get_app_instances
```
List all app instances
```
```
arguments: cluster_id - 100
app_id - 999
returns: List contains all versions
```#### get_app_events
```
List all app events
```
```
arguments: cluster_id - 100
app_id - 345
returns: List contains all events
```### Project
#### get_projects
```
List all projects(images)
```
```
arguments: Nonereturns: List contains all projects
```#### create_project
```
Create new project
```
```
arguments: kwargs - json object contains all parameters for project creationreturns: dictionary contains new project information
```
#### build_project
```
Build image
```
```
arguments: project_id
uid
image_name
returns: None
```
#### delete_project
```
Delete project
```
```
arguments: project_id - 109returns: None
```#### get_project
```
Show project information
```
```
arguments: project_id - 109returns: Dictionary contains project information
```#### update_project
```
Partially update project's information
```
```
arguments: project_id - 109
kwargs - json object contains update informationretuns: None
```
#### get_project_builds
```
List all build versions
```
```
arguments: project_idreturns: List contains all builds
```#### get_project_build_logs
```
List all build logs
```
```
arguments: project_id - 109
build_num - 88
job_id - 99
returns: List contains all build logs
```#### get_project_build_stream
```
Retrieve build stream
```
```
arguments: project_id - 109
build_num - 99
job_id - 88
returns: build stream
```### Logs
#### get_app_logs
```
List all app runtime logs
```
```
arguments: kwargs - json object contains the following keys:
userid - user id
clusterid - cluster id
appname - app name
start - start time
end - end time
from - offset for page pagination
size - log counts for page pagination
keyword - keyword for search
returns: dictionary contains all app logs
```
`from` and `size` are used for page pagination#### get_app_context
```
List all app context
```
```
arguments: charges - json object contains the following keys:
userid
clusterid
appname
timestamp
ipport
counter
source
returns: dictionary contains all app context
```### Alert
#### get_tasks
```
Lists all the policies that the user created.
```
```
arguments: kwargs(optinal) - json object contains all query parameters:
keyword - search keyword
sort_by - sort field
order - ascending or descending
per_page - entries per page
page - page offset
returns: List contains all user policies.
```
`per_page` and `page` are used for page pagination.#### create_task
```
Created new policy.
```
```
arguments: json object contains all parameters for policy creation.returns: Dictionary contans new policy information.
```#### put_task
```
Updated policy information.
```
```
arguments: kwargs -json objectreturns: None
```
#### patch_task
```
Updated policy status.
```
```
arguments:policy_id policy identifier
kwargs - json objectreturns: None
```#### get_task
```
List policy information.
```
```
arguments: policy_id - policy's identifierreturns: Dictionary contains policy information
```#### delete_task
```
Delete policy
```
```
arguments: policy_id - policy's identifierreturns: None
```
#### get_events
```
List all alarm event's histories.
```
```
arguments: kwargs(optinal) - json object contains all query parameters:
keyword - search keyword
sort_by - sort field
order - ascending or descending
per_page - entries per page
page - page offset
returns: List contains all alarm events.
```
`per_page` and `page` are used for page pagination.### Metrics
#### get_app_history_metrics
```
arguments: cluster_id
app_alias
starttime (optional) - default one hour ahead of the current time in nanosecond
endtime (optional) - default current time in nanosecondreturns: Dictionary contains metrics information.
```#### get_app_requests
```
arguments: cluster_id
app_alias
starttime - start time in nanosecond
endtime - end time in nanosecondreturns: Dictionary contains metrics information.
```
#### get_app_live_metrics
```
arguments: cluster_id
app_aliasreturns: Dictionary contains metrics information.
```#### get_cluster_resource_metrics
```
arguments: cluster_idreturns: Dictionary contains cluster metrics information.
```