pub struct AwsS3Fs { /* private fields */ }
Expand description

Aws s3 file system client

Implementations§

source§

impl AwsS3Fs

source

pub fn new<S: AsRef<str>>(bucket: S) -> Self

Initialize a new AwsS3Fs

source

pub fn region<S: AsRef<str>>(self, region: S) -> Self

Specify region to connect to

source

pub fn endpoint<S: AsRef<str>>(self, endpoint: S) -> Self

Specify custom endpoint This should be used when trying to connect to minio or other API compatible endpoints.

source

pub fn profile<S: AsRef<str>>(self, profile: S) -> Self

Set aws profile. If unset, “default” will be used

source

pub fn new_path_style(self, new_path_style: bool) -> Self

Set whether to use new path style. Required for backends such as MinIO (Default: False)

source

pub fn access_key<S: AsRef<str>>(self, key: S) -> Self

Specify access key for aws connection. If unset, will be read from environment variable AWS_ACCESS_KEY_ID

source

pub fn secret_access_key<S: AsRef<str>>(self, key: S) -> Self

Specify secret access key for aws connection. If unset, will be read from environment variable AWS_SECRET_ACCESS_KEY

source

pub fn security_token<S: AsRef<str>>(self, key: S) -> Self

Specify security token for aws connection. If unset, will be read from environment variable AWS_SECURITY_TOKEN

source

pub fn session_token<S: AsRef<str>>(self, key: S) -> Self

Specify session token for aws connection. If unset, will be read from environment variable AWS_SESSION_TOKEN

source

pub fn bucket(&self) -> Option<&Bucket>

Get a reference to the Bucket struct

Trait Implementations§

source§

impl RemoteFs for AwsS3Fs

source§

fn connect(&mut self) -> RemoteResult<Welcome>

Connect to the remote server and authenticate. Can return banner / welcome message on success. If client has already established connection, then AlreadyConnected error is returned.
source§

fn disconnect(&mut self) -> RemoteResult<()>

Disconnect from the remote server
source§

fn is_connected(&mut self) -> bool

Gets whether the client is connected to remote
source§

fn pwd(&mut self) -> RemoteResult<PathBuf>

Get working directory
source§

fn change_dir(&mut self, dir: &Path) -> RemoteResult<PathBuf>

Change working directory. Returns the realpath of new directory
source§

fn list_dir(&mut self, path: &Path) -> RemoteResult<Vec<File>>

List directory entries at specified path
source§

fn stat(&mut self, path: &Path) -> RemoteResult<File>

Stat file at specified path and return Entry
source§

fn setstat(&mut self, _path: &Path, _metadata: Metadata) -> RemoteResult<()>

Set metadata for file at specifieed path
source§

fn exists(&mut self, path: &Path) -> RemoteResult<bool>

Returns whether file at specified path exists.
source§

fn remove_file(&mut self, path: &Path) -> RemoteResult<()>

Remove file at specified path. Fails if is not a file or doesn’t exist
source§

fn remove_dir(&mut self, path: &Path) -> RemoteResult<()>

Remove directory at specified path Directory is removed only if empty
source§

fn remove_dir_all(&mut self, path: &Path) -> RemoteResult<()>

Removes a directory at this path, after removing all its contents. Use carefully! Read more
source§

fn create_dir(&mut self, path: &Path, _mode: UnixPex) -> RemoteResult<()>

Create a directory at path with specified mode.
Create a symlink at path pointing at target
source§

fn copy(&mut self, _src: &Path, _dest: &Path) -> RemoteResult<()>

Copy src to dest
source§

fn mov(&mut self, _src: &Path, _dest: &Path) -> RemoteResult<()>

move file/directory from src to dest
source§

fn exec(&mut self, _cmd: &str) -> RemoteResult<(u32, String)>

Execute a command on remote host if supported by host. Returns command exit code and output (stdout)
source§

fn append( &mut self, _path: &Path, _metadata: &Metadata ) -> RemoteResult<WriteStream>

Open file at path for appending data. If the file doesn’t exist, the file is created. Read more
source§

fn create( &mut self, _path: &Path, _metadata: &Metadata ) -> RemoteResult<WriteStream>

Create file at path for write. If the file already exists, its content will be overwritten Read more
source§

fn open(&mut self, _path: &Path) -> RemoteResult<ReadStream>

Open file at specified path for read.
source§

fn create_file( &mut self, path: &Path, metadata: &Metadata, reader: Box<dyn Read> ) -> RemoteResult<u64>

Blocking implementation of create This method SHOULD be implemented ONLY when streams are not supported by the current file transfer. The developer using the client should FIRST try with create followed by on_written If the function returns error of kind UnsupportedFeature, then he should call this function. In case of success, returns the amount of bytes written to the remote file Read more
source§

fn open_file( &mut self, src: &Path, dest: Box<dyn Write + Send> ) -> RemoteResult<u64>

Blocking implementation of open This method SHOULD be implemented ONLY when streams are not supported by the current file transfer. (since it would work thanks to the default implementation) The developer using the client should FIRST try with open followed by on_sent If the function returns error of kind UnsupportedFeature, then he should call this function. In case of success, returns the amount of bytes written to the local stream Read more
source§

fn on_written(&mut self, _writable: WriteStream) -> Result<(), RemoteError>

Finalize create_file and append_file methods. This method must be implemented only if necessary; in case you don’t need it, just return Ok(()) The purpose of this method is to finalize the connection with the peer when writing data. This is necessary for some protocols such as FTP. You must call this method each time you want to finalize the write of the remote file. Read more
source§

fn on_read(&mut self, _readable: ReadStream) -> Result<(), RemoteError>

Finalize open_file method. This method must be implemented only if necessary; in case you don’t need it, just return Ok(()) The purpose of this method is to finalize the connection with the peer when reading data. This mighe be necessary for some protocols. You must call this method each time you want to finalize the read of the remote file. Read more
source§

fn append_file( &mut self, path: &Path, metadata: &Metadata, reader: Box<dyn Read> ) -> Result<u64, RemoteError>

Blocking implementation of append This method SHOULD be implemented ONLY when streams are not supported by the current file transfer. The developer using the client should FIRST try with create followed by on_written If the function returns error of kind UnsupportedFeature, then he should call this function. In case of success, returns the amount of bytes written to the remote file Read more
source§

fn find(&mut self, search: &str) -> Result<Vec<File>, RemoteError>

Find files from current directory (in all subdirectories) whose name matches the provided search Search supports wildcards (‘?’, ‘*’)
Search recursively in dir for file matching the wildcard. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.