opConfig Credential Sets API
From opConfig 4.3.2, a new API with CRUD operations for credential sets is available under:
http://server/en/omk/opConfig/api/v1/credential_set
Please note, that credential sets can also be managed in the opConfig GUI and the opconfig cli.
Summary
| Operation | Method | API |
|---|---|---|
| Get a list of Credential Set | GET | http://server/en/omk/opConfig/api/v1/credential_set |
| Get a Credential Set | GET | http://server/en/omk/opConfig/api/v1/credential_set/NAME |
| Create a Credential Set | POST | http://server/en/omk/opConfig/api/v1/credential_set |
| Update a Credential Set | PUT | http://server/en/omk/opConfig/api/v1/credential_set |
| Delete a Credential Set | DELETE | http://server/en/omk/opConfig/api/v1/credential_set |
| Assign a Credential Set to a node | POST | http://server/en/omk/opConfig/api/v1/credential_set/NAME/NODE |
| Unassigns a Credential Set from a node | DELETE | http://server/en/omk/opConfig/api/v1/credential_set/NAME/NODE |
Methods
Get
GET http://server/en/omk/opConfig/api/v1/credential_set
Returns a list of credential set (With the password obscured).
Response:
{
asgard: {
always_privileged: "0",
description: "",
lastupdate: 1631098471,
password: "*****",
password_privileged: "*****",
setname: "asgard",
ssh_key: "",
username: "admin"
},
nmis: {
always_privileged: "0",
description: "the default nmis user",
lastupdate: 1625045906,
password: "*****",
password_privileged: "*****",
setname: "nmis",
ssh_key: "",
username: "nmis"
}
}
Get
GET http://server/en/omk/opConfig/api/v1/credential_set/nmis
Returns the credential set (With the password obscured).
Response:
{
always_privileged: "0",
description: "the default nmis user",
lastupdate: 1625045906,
password: "*****",
password_privileged: "*****",
setname: "nmis",
ssh_key: "",
username: "nmis"
}
Create
POST http://server/en/omk/opConfig/api/v1/credential_set
Successful Response
HTTP Status | Body | Description |
|---|---|---|
| 200 | JSON object | Returns the credential set (With the password obscured). |
Unsuccessful Response
HTTP Status | Body | Description |
|---|---|---|
| 422 Unprocessable Entity | String with an error message | Example: A resource called "router1credentials" already exists! |
Request example:
{"always_privileged": "0",
"description": "the default nmis user",
"setname": "nmis",
"ssh_key": "",
"username": "nmis",
"setname": "testapi2",
"password": "v&SYI2,LQiQ4ZSgCQa"
}
Response:
{
"always_privileged": "0",
"description": "the default nmis user",
"lastupdate": 1645007389,
"password": "*****",
"setname": "testapi2",
"ssh_key": "",
"username": "nmis"
}
Update
PUT http://server/en/omk/opConfig/api/v1/credential_set/nmis
The name of the credential set is the setname property in the create.
Returns the credential set (With the password obscured).
Request example:
{"always_privileged": "0",
"description": "new description",
"lastupdate": 1625045906,
"setname": "nmis",
"ssh_key": "",
"username": "nmis",
"setname": "testapi",
"password": "1234"
}
Response:
{
"always_privileged": "0",
"description": "new description",
"lastupdate": 1645007389,
"password": "*****",
"setname": "testapi",
"ssh_key": "",
"username": "nmis"
}
Remove
DELETE http://server/en/omk/opConfig/api/v1/credential_set/nmis
Returns ok/error.
Response example:
"Cannot update nonexistent resource \"testapi2\"!"
Assign a credential set to a node
POST http://server/en/omk/opConfig/api/v1/credential_set/nmis/mynode
We can use the node name or the uuid
Returns ok/error.
Response example:
"Successfully assigned credential set"
Unassign a credential set from a node
DELETE http://server/en/omk/opConfig/api/v1/credential_set/nmis/mynode
We can use the node name or the uuid
Returns ok/error.
Response example:
"Successfully unassigned credential set"