hetzner-cloud-api-net
hetzner-cloud-api-net copied to clipboard
the project is a .NET library to access the Hetzner Cloud
Hetzner Cloud API for .NET
Here you can find a .NET library for the Hetzner Cloud API, with which all functions of the endpoints can be used.
The current version is provided as .NET Standard 2.0, currently I am working on a new version for .NET 6 (with features like dependency injection, etc.)
Hetzner Cloud API Client for .NET
installation
see the getting started page here https://github.com/lk-code/hetzner-cloud-api-net/wiki/getting-started
demo
see the demo projects here https://github.com/lk-code/hetzner-cloud-api-net-demo
documentation
see the documentation on https://github.com/lk-code/hetzner-cloud-api-net/wiki
informations :)
see the demo projects here https://github.com/lk-code/hetzner-cloud-api-net-demo
New Documentation for Hetzner Cloud API Client (based on v3-Client)
installation
The v3 client is currently only available as a prerelease. Accordingly, the "Include Prerelease" flag must be set in the NuGet search.
dotnet add package hetznercloudapi
usage
initialization
API Token via AppSettings
add the following block to your AppSettings:
{
"HetznerCloud": {
"ApiToken": "YOUR_API_TOKEN"
}
}
Load API Token dynamically
Alternatively, the API token can also be set dynamically:
IHetznerCloudService _hetznerCloudService = {get instance via DI};
...
_hetznerCloudService.LoadApiToken("{YOUR_API_TOKEN}");
Server
Access via IServerService
Get all servers
Definition:
Task<Page<Server>> GetAllAsync(int page = 1,
int itemsPerPage = 25,
List<IFilter>? filter = null,
Sorting<ServerSortField>? sorting = null,
CancellationToken cancellationToken = default);