hpecp-python-library
hpecp-python-library copied to clipboard
Implement client.role.list()
Implement client.role.list() (see GatewayController.list() for an example)
GET /api/v1/role HTTP/1.1
Host: 127.0.0.1:8080
Accept-Encoding: gzip, deflate
...
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Length: 516
Content-Type: application/json
Date: Mon, 18 May 2020 17:44:01 GMT
Server: BlueData EPIC 5.0
{
"_links": {
"self": {
"href": "/api/v1/role"
}
},
"_embedded": {
"roles": [
{
"_links": {
"self": {
"href": "/api/v1/role/1"
}
},
"label": {
"name": "Site Admin",
"description": "Role for Site Admin"
}
},
{
"_links": {
"self": {
"href": "/api/v1/role/4"
}
},
"label": {
"name": "K8S Admin",
"description": "Role for Kubernetes Admin"
}
},
{
"_links": {
"self": {
"href": "/api/v1/role/3"
}
},
"label": {
"name": "Member",
"description": "Role for Tenant Member"
}
},
{
"_links": {
"self": {
"href": "/api/v1/role/2"
}
},
"label": {
"name": "Admin",
"description": "Role for Tenant Admin"
}
}
]
}
}
I've created a mock rest api server to test this. You can start it with:
/opt/SoapUI-5.5.0/bin/mockservicerunner.sh -m "REST MockService" tests/HPECP-REST-API-SOAPUI.xml
You can then install the CLI with:
pip3 install -e .
After that, configure the cli:
cat > ~/.hpecp.conf <<EOF
[default]
api_host = localhost
api_port = 8080
use_ssl = False
verify_ssl = False
warn_ssl = False
username = admin
password = admin123
EOF
and finally, run the cli:
hpecp role list
This should make the call to the mock rest service. It will fail initially because you need to implement the logic! :)
Using the mock rest service is documented in the developer docs