Hi,
I like to build stuff - and I have built a .NET Core ZFS library.
This library I have used in a .NET Core ZFS REST API service, so it provides a restful interface for manipulating zfs - which would allow someone to build a UI to control ZFS on a given server.
The API does not have to run on the server that has the ZFS pool by itself, but then it will use ssh and passwordless sudo to invoke commands - it runs perfectly both on Windows and Linux.
If its running on the server where the ZFS lives, then it uses linux PAM to authenticate the user, but still uses the service account to interface with ZFS.
The plan is to pass on the credentials used and invoke the ZFS command in the context of the user, but I just need to figure out how to do that.
The API is by all means not fully complete, but right now I have the following implemented:
An example on how to use the API from the command like would be:
Which would return the following:
Or if you wanted to set a single property:
This post is merely to gauge interest in an API like this and if someone would like to build a UI based on this - obviously a web ui could use the rest api directly, but it is also possible to build a desktop UI using the ZFS library I built directly (.NET Core)
Please PM me if you are interested.
P.S. Right now all the source code is hosted on my own private git repository, so I have no easy way of sharing the source code, but if enough interest exist, then I am happy to make a public github repository with the source code - although I will probably have to clean it up a bit, so I will not be too embarrased to show the code :-D
P.P.S - I can probably open up for testing the API directly on my own server, if you just want to play around with the API - right now it uses basic authentication, since its simple.
API code is on github
ZFS Library code is also on github
I like to build stuff - and I have built a .NET Core ZFS library.
This library I have used in a .NET Core ZFS REST API service, so it provides a restful interface for manipulating zfs - which would allow someone to build a UI to control ZFS on a given server.
The API does not have to run on the server that has the ZFS pool by itself, but then it will use ssh and passwordless sudo to invoke commands - it runs perfectly both on Windows and Linux.
If its running on the server where the ZFS lives, then it uses linux PAM to authenticate the user, but still uses the service account to interface with ZFS.
The plan is to pass on the credentials used and invoke the ZFS command in the context of the user, but I just need to figure out how to do that.
The API is by all means not fully complete, but right now I have the following implemented:
An example on how to use the API from the command like would be:
Bash:
curl -X 'GET' \
'http://zfsdev.root.dom:5000/api/zfs/datasets/tank%2Fmyds/properties/atime' \
-H 'accept: text/plain'
JavaScript:
{
"data": {
"name": "atime",
"value": "on",
"source": "local"
},
"status": 0,
"errorText": null
}
Bash:
curl -X 'POST' \
'http://zfsdev.root.dom:5000/api/zfs/datasets/tank%2Fmyds/properties' \
-H 'accept: text/plain' \
-H 'Content-Type: application/json' \
-d '[
{
"name": "atime",
"value": "off"
}
]'
Please PM me if you are interested.
P.S. Right now all the source code is hosted on my own private git repository, so I have no easy way of sharing the source code, but if enough interest exist, then I am happy to make a public github repository with the source code - although I will probably have to clean it up a bit, so I will not be too embarrased to show the code :-D
P.P.S - I can probably open up for testing the API directly on my own server, if you just want to play around with the API - right now it uses basic authentication, since its simple.
API code is on github
ZFS Library code is also on github
Last edited: