SftpGo 0.0.5
dotnet add package SftpGo --version 0.0.5
NuGet\Install-Package SftpGo -Version 0.0.5
<PackageReference Include="SftpGo" Version="0.0.5" />
paket add SftpGo --version 0.0.5
#r "nuget: SftpGo, 0.0.5"
// Install SftpGo as a Cake Addin #addin nuget:?package=SftpGo&version=0.0.5 // Install SftpGo as a Cake Tool #tool nuget:?package=SftpGo&version=0.0.5
SftpGo
.NET client for SftpGo, an SFTP server, written in C#.
Functionality
The SftpGoClient
supports the following objects (and methods):
- ApiKeys (List, Create, Delete)
- Users (List, Get, Create, Update, Delete, Enable, Disable)
- Event Rules (List, Get, Create, Update, Delete, Enable, Disable)
- Event Actions (List, Get, Create, Update, Delete)
- Version (Get)
- Service Status (Get)
Installing via NuGet
Package is published in the NuGet gallery.
From the command-line:
> dotnet add package SftpGo
From within Visual Studio using Package Manager Console:
PM> Install-Package SftpGo
Getting started
In the startup of your application, configure the DI container as follows:
using SftpGo;
builder.Services.AddOptions();
builder.Services.AddHttpClient<SftpGoClient>();
builder.Services.Configure<SftpGoClientOptions>( o =>
{
o.ApiUrl = Environment.GetEnvironmentVariable( "SFTPGO_APIURL" )!;
o.ApiKey = Environment.GetEnvironmentVariable( "SFTPGO_APIKEY" );
} );
builder.Services.AddTransient<ISftpGo, SftpGoClient>()
Auth: Mostly API key, but sometimes AuthToken
Most objects in the REST API can use an API key, but there are a few objects (namely API Keys) which can only be invoked using an Access Token. Moreover, the SFTPGo admin web application does not currently implement any UI to manage API keys. The only manner is through the REST API.
As such, the necessary flow is as follows:
- In SFTPGo admin web, go to the admin user and check the "API key authentication" option. This will allow the use of API keys associated with that admin user
- Authenticate as an admin (using username/password/OTP), using
Authenticate
- Set the access token on the client instance, using
UseAuthToken
- Create an API key, using
ApiKeyCreate
- Persist the API key: it is only visible once -- as a result of key create operation
- Set the API key on the client instance, using
UseApiKey
- Use the rest of the API (e.g. users, services, etc)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net8.0
- Microsoft.AspNetCore.WebUtilities (>= 8.0.13)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Text.Json (>= 9.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.