Belt v0.2.0 Belt.Provider.SFTP

Summary

Types

Public key or public key fingerprint

Options for creating an SFTP provider

Private key or private key PEM string

Functions

Creates a new SFTP provider configuration with default credentials

Implementation of the Provider.delete/3 callback

Implementation of the Provider.delete_all/2 callback

Implementation of the Provider.delete_scope/3 callback

Implementation of the Provider.get_info/3 callback

Implementation of the Belt.Provider.get_url/3 callback

Implementation of the Belt.Provider.list_files/2 callback

Creates a new SFTP provider configuration

Implementation of the Provider.store/3 callback

Types

host_key()
host_key() :: :public_key.public_key | String.t

Public key or public key fingerprint.

sftp_option()
sftp_option ::
  {:host, String.t} |
  {:port, integer} |
  {:user, String.t} |
  {:password, String.t} |
  {:user_key, user_key} |
  {:host_key, host_key} |
  {:verify_host_key, boolean} |
  {:directory, String.t} |
  {:base_url, String.t}

Options for creating an SFTP provider.

user_key()
user_key() :: :public_key.private_key | String.t

Private key or private key PEM string.

Functions

default(options \\ [])
default([sftp_option]) ::
  {:ok, Belt.Provider.configuration} |
  {:error, term}

Creates a new SFTP provider configuration with default credentials.

Any provided options override the default settings which are retrieved from the application configuration.

Example

# config.exs
config :belt, Belt.Provider.SFTP,
default: [
  host: "example.org",
  user: "foo",
  password: "bar"]
delete(config, identifier, options)

Implementation of the Provider.delete/3 callback.

delete_all(config, options)

Implementation of the Provider.delete_all/2 callback.

delete_scope(config, scope, options)

Implementation of the Provider.delete_scope/3 callback.

get_info(config, identifier, options)

Implementation of the Provider.get_info/3 callback.

get_remote_hashes(channel, path, hashes)
get_url(arg1, identifier, arg3)

Implementation of the Belt.Provider.get_url/3 callback.

list_files(config, options)

Implementation of the Belt.Provider.list_files/2 callback.

new(opts)

Creates a new SFTP provider configuration.

Options

  • base_url - String.t: Used for generating file URLs.
  • directory - String.t: Directory on the SFTP server. Defaults to “.” which refers to the working directory set by the server.
  • host - String.t: Hostname of the SFTP server.
  • host_key - Belt.Provider.SFTP.host_key: Fingerprint of the SFTP server. Can be traditional colon-separated MD5 fingerprint string or an OpenSSL-formatted string such as "SHA256:aZGX[…]JePQ".
  • password - String.t: Password for authentication. Needs to be combined with user option.
  • port - integer: Port of the SFTP server. Defaults to 22.
  • verify_host_key - boolean: Whether the host key should be verified. Defaults to true.
  • user - String.t: Username for authentication. Needs to be combined with password option.
  • user_key - Belt.Provider.SFTP.user_key: Private key for authentication. Can be a :public_key.private_key record or a PEM certificate string.
store(config, file_source, options)

Implementation of the Provider.store/3 callback.