SftpHostingExtensions Methods
Class Methods 4 members
Provides extension methods for adding an SFTP resource to an
Hosting.IDistributedApplicationBuilder. AddSftp(IDistributedApplicationBuilder, string, int?) Section titled AddSftp(IDistributedApplicationBuilder, string, int?) extension IResourceBuilder<SftpContainerResource> Adds atmoz SFTP to the application model.
public static class SftpHostingExtensions{ public static IResourceBuilder<SftpContainerResource> AddSftp( this IDistributedApplicationBuilder builder, string name, int? port = null) { // ... }}Parameters
builder IDistributedApplicationBuilder The Hosting.IDistributedApplicationBuilder to add the resource to. name string The name of the resource. port int? optional The SFTP port number for the atmoz SFTP container. Returns
IResourceBuilder<SftpContainerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
Add an SFTP container to the application model with users configuration in the specified file.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddSftp("sftp");
builder.Build().Run();WithHostKeyFile(IResourceBuilder<SftpContainerResource>, string, KeyType) Section titled WithHostKeyFile(IResourceBuilder<SftpContainerResource>, string, KeyType) extension IResourceBuilder<SftpContainerResource> Adds a bind mount for the specified host key file to an SFTP container resource.
public static class SftpHostingExtensions{ public static IResourceBuilder<SftpContainerResource> WithHostKeyFile( this IResourceBuilder<SftpContainerResource> builder, string keyFile, KeyType keyType) { // ... }}Parameters
builder IResourceBuilder<SftpContainerResource> The resource builder. keyFile string The path to the host key file. keyType KeyType The type of the host key. Returns
IResourceBuilder<SftpContainerResource> The ApplicationModel.IResourceBuilder`1. Remarks
Add an SFTP container to the application model with the host key in the specified file.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddSftp( "sftp").WithHostKeyFile("./etc/ssh/ssh_host_ed25519_key", KeyType.Ed25519);
builder.Build().Run();WithUserKeyFile(IResourceBuilder<SftpContainerResource>, string, string, KeyType) Section titled WithUserKeyFile(IResourceBuilder<SftpContainerResource>, string, string, KeyType) extension IResourceBuilder<SftpContainerResource> Adds a bind mount for the public key file of the specified user to an SFTP container resource.
public static class SftpHostingExtensions{ public static IResourceBuilder<SftpContainerResource> WithUserKeyFile( this IResourceBuilder<SftpContainerResource> builder, string username, string keyFile, KeyType keyType) { // ... }}Parameters
builder IResourceBuilder<SftpContainerResource> The resource builder. username string The user whose public key is being bind mounted keyFile string The public key file of the specified user (will be bind mounted on the server). keyType KeyType The type of the host key. Returns
IResourceBuilder<SftpContainerResource> The ApplicationModel.IResourceBuilder`1. Remarks
Add an SFTP container to the application model with the host key in the specified file.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddSftp( "sftp").WithUserKeyFile("foo", "./home/foo/.ssh/keys/id_rsa.pub", KeyType.Rsa);
builder.Build().Run();WithUsersFile(IResourceBuilder<SftpContainerResource>, string) Section titled WithUsersFile(IResourceBuilder<SftpContainerResource>, string) extension IResourceBuilder<SftpContainerResource> Adds a bind mount for the users.conf file to an SFTP container resource.
public static class SftpHostingExtensions{ public static IResourceBuilder<SftpContainerResource> WithUsersFile( this IResourceBuilder<SftpContainerResource> builder, string usersFile) { // ... }}Parameters
builder IResourceBuilder<SftpContainerResource> The resource builder. usersFile string The path to the users.conf file. Returns
IResourceBuilder<SftpContainerResource> The ApplicationModel.IResourceBuilder`1. Remarks
Add an SFTP container to the application model with users configuration in the specified file.
var builder = DistributedApplication.CreateBuilder(args);
builder.AddSftp("sftp").WithUsersFile("./etc/sftp/users.conf");
builder.Build().Run();