git clone https://github.com/Dataman-Cloud/omega-client.git
cd omega-client/python-omegaclient/
pip3 install -r requirements.txt
python3 setup.py install
>> from omegaclient import OmegaClient
>> client = OmegaClient(server_url, email, password)
>> client.get_clusters()
>> ...
Fetch user token
arguments: email - user email
passed - user passed
returns: Dicitonary contains token
Retrieve user information
arguments: None
returns: Dictionary contains user information
List all clusters
arguments: None
returns: clusters list
List single cluster's information
arguments: cluster_id
returns: cluster dictionary
Delete cluster
arguments: cluster_id
returns: None
Create new cluster.
arguments: name: cluster name - string
cluster_type: cluster type - 1_master or 3_masters or 5_masters
group_id: - int
returns: None
Updated cluster information. currently only supported modifing the cluster name.
arguments: cluster_id - 1000
kwargs - { "name": "new_cluster_name" }
returns: { "code": 0 }
Generated new node identifier. this identifier will be used for add new node.
arguments: cluster_id
returns: { "identifier": "string" }
List node information
arguments:
cluster_id
node_id
returns: 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"
}
]
}
Updated node information
arguments:
cluster_id
node_id
kwargs
returns:
{
"code": 0
}
status: 200
401
Retrive node metrics
arguments:
cluster_id
node_id
returns: metrics list
Reset or restart service on node
arguments:
cluster_id
node_id
service_name
kwargs
returns: { "code": 0 }
Add new node for cluster identified by `cluster_id`
arguments: `cluster_id` `kwargs`
returns: { "code": 0 }
Delete single node or multiple nodes
arguments: `cluster_id` `args`
returns: { "code": 0 }
List all apps in cluster
arguments: cluster_id
returns: apps list
Created app in cluster
arguments: cluster_id - 100
kwargs: - json object contains all parameters for app creation
returns: app id
Show app information
arguments: cluster_id - 100
app_id - 699
returns: Dictionary contains app information
Delete app
arguments: cluster_id - 100
app_id - 689
returns: None
List all apps belong to a user
arguments: None
returns: List contains all apps
List all app's status
arguments: None
return: List contains all app status
List all history versions for app
arguments: cluster_id - 100
app_id - 101
returns: Dictionary contains all versions
Delete app version
arguments: cluster_id - 100
app_id - 899
version_id - 12
returns: None
Updated app configuration
arguments: cluster_id - 100
app_id - 688
kwargs - json object contains all app configurations
returns: None
List all app instances
arguments: cluster_id - 100
app_id - 999
returns: List contains all versions
List all app events
arguments: cluster_id - 100
app_id - 345
returns: List contains all events
List all projects(images)
arguments: None
returns: List contains all projects
Create new project
arguments: kwargs - json object contains all parameters for project creation
returns: dictionary contains new project information
Build image
arguments: project_id
uid
image_name
returns: None
Delete project
arguments: project_id - 109
returns: None
Show project information
arguments: project_id - 109
returns: Dictionary contains project information
Partially update project's information
arguments: project_id - 109
kwargs - json object contains update information
retuns: None
List all build versions
arguments: project_id
returns: List contains all builds
List all build logs
arguments: project_id - 109
build_num - 88
job_id - 99
returns: List contains all build logs
Retrieve build stream
arguments: project_id - 109
build_num - 99
job_id - 88
returns: build stream
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
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
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.
Created new policy.
arguments: json object contains all parameters for policy creation.
returns: Dictionary contans new policy information.
Updated policy information.
arguments: kwargs -json object
returns: None
Updated policy status.
arguments:policy_id policy identifier
kwargs - json object
returns: None
List policy information.
arguments: policy_id - policy's identifier
returns: Dictionary contains policy information
Delete policy
arguments: policy_id - policy's identifier
returns: None
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.
arguments: cluster_id
app_alias
starttime (optional) - default one hour ahead of the current time in nanosecond
endtime (optional) - default current time in nanosecond
returns: Dictionary contains metrics information.
arguments: cluster_id
app_alias
starttime - start time in nanosecond
endtime - end time in nanosecond
returns: Dictionary contains metrics information.
arguments: cluster_id
app_alias
returns: Dictionary contains metrics information.
arguments: cluster_id
returns: Dictionary contains cluster metrics information.