Skip to content
DocsTry Aspire
DocsTry

SftpHostingExtensions Methods

ClassMethods4 members
Provides extension methods for adding an SFTP resource to an Hosting.IDistributedApplicationBuilder.
AddSftp(IDistributedApplicationBuilder, string, int?)Section titled AddSftp(IDistributedApplicationBuilder, string, int?)extensionIResourceBuilder<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)
{
// ...
}
}
builderIDistributedApplicationBuilderThe Hosting.IDistributedApplicationBuilder to add the resource to.
namestringThe name of the resource.
portint?optionalThe SFTP port number for the atmoz SFTP container.
IResourceBuilder<SftpContainerResource>A reference to the ApplicationModel.IResourceBuilder`1.
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)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<SftpContainerResource>The resource builder.
keyFilestringThe path to the host key file.
keyTypeKeyTypeThe type of the host key.
IResourceBuilder<SftpContainerResource>The ApplicationModel.IResourceBuilder`1.
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)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<SftpContainerResource>The resource builder.
usernamestringThe user whose public key is being bind mounted
keyFilestringThe public key file of the specified user (will be bind mounted on the server).
keyTypeKeyTypeThe type of the host key.
IResourceBuilder<SftpContainerResource>The ApplicationModel.IResourceBuilder`1.
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)extensionIResourceBuilder<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)
{
// ...
}
}
builderIResourceBuilder<SftpContainerResource>The resource builder.
usersFilestringThe path to the users.conf file.
IResourceBuilder<SftpContainerResource>The ApplicationModel.IResourceBuilder`1.
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();