In this page
s3
@library("s3", "0.0.0");
Introduction
The S3 Plugin for GreyCat 7.x provides an interface for interacting with S3-compatible storage services such as MinIO and Amazon S3. It allows users to manage buckets and objects with simple API calls.
Plugin availability
| Platform | Availability | 
|---|---|
| arm64-apple | Yes | 
| arm64-freebsd | No | 
| arm64-linux | Yes | 
| arm64-windows | No | 
| x64-apple | Yes | 
| x64-freebsd | No | 
| x64-linux | Yes | 
| x64-windows | Yes | 
S3
The S3 type manages connections to an S3-compatible server.
Properties
When creating an instance, the following properties are required:
- host: String: Specifies the hostname or the IP address of the S3 server (example:- http://localhost:9000)
- credentials: S3BasicCredentials: Specifies the credentials for the connection
Creating a bucket
Creates a new bucket with the specified name.
s3.create_bucket(bucket: String): String?
Listing all buckets
Retrieves a list of all available buckets.
s3.list_buckets(): Array<S3Bucket>
Listing a bucket content
Lists the contents of a specified bucket, optionally filtering by prefix and time range.
s3.list(bucket: String, prefix: String?, from: time?, to: time?): Array<S3Object>
Uploading a file
Uploads a file from a local path to the specified bucket under the given key.
s3.put(bucket: String, key: String, local_path: String)
Downloading a file
Downloads a file from the specified bucket and saves it to the given local path.
s3.get(bucket: String, key: String, output_path: String)
Removes a file from the specified bucket.
Deleting a file
s3.delete(bucket: String, key: String)
S3BasicCredentials
The S3BasicCredentials type is used for access key-based authentication.
- access_key: String: Specifies the access key
- secret_key: String: Specifies the secret key
S3Bucket
The S3Bucket type represents a S3 Bucket.
- name: String: Specifies its name
- creation_date: time: Specifies its creation time (UTC)
S3Object
Represents an object (file) stored in an S3 bucket.
- key: String: Specifies the key
- last_modified: time: Specifies the last modification time (UTC)
- size: int: Specifies its size in bytes
- etag: String: Specifies its E-Tag signature
External dependencies
This library does not rely on any external dependency