mantik.remote_file_service.s3_file_service¶
Attributes¶
Classes¶
Client that allows transferring files between s3 and |
Module Contents¶
- class mantik.remote_file_service.s3_file_service.S3Credentials[source]¶
-
- classmethod get_credentials(connection_id: uuid.UUID | None = None) S3Credentials [source]¶
- class mantik.remote_file_service.s3_file_service.S3FileService(aws_access_key_id: str, aws_secret_access_key: str, local_base_path: str = '.')[source]¶
Bases:
mantik.remote_file_service.abstract_file_service.AbstractFileService
Client that allows transferring files between s3 and the local machine.
To specify that a path is remote, start the path with s3:// E.g. client.copy_file(“/path/local.file”, “s3://path/local.file”) This would upload the file from local to s3.
- abstract change_permissions(target: FilePath, new_permissions: mantik.remote_file_service.abstract_file_service.FileMeta) None [source]¶
Change metadata (permissions) of a file.
Note: bash chmod
- copy_directory(source: FilePath, target: FilePath) mantik.remote_file_service.abstract_file_service.Directory [source]¶
Copy directory.
Note: bash cp
- copy_file(source: FilePath, target: FilePath) mantik.remote_file_service.abstract_file_service.File [source]¶
Copy file.
Note: bash cp
- create_directory(target: FilePath) mantik.remote_file_service.abstract_file_service.Directory [source]¶
Make a new directory.
Note: bash mkdir
- create_file_if_not_exists(target=FilePath) mantik.remote_file_service.abstract_file_service.File [source]¶
Create (empty) file if not exists.
Note: bash touch
- classmethod from_env(connection_id: uuid.UUID | None = None) S3FileService [source]¶
Instantiate with environment variables.
Credentials are either fetched from mantik api or passed in through end vars.
- classmethod get_bucket_name(path: FilePath) str [source]¶
Extracts bucket name from an S3 url s3://<bucket-name>/resource/…
- list_directory(target: FilePath) List[mantik.remote_file_service.abstract_file_service.Directory | mantik.remote_file_service.abstract_file_service.File] [source]¶
List content of directory.
Note: bash ls