All Projects → bisohns → waihona

bisohns / waihona

Licence: MIT license
Rust crate for performing cloud storage CRUD actions across major cloud providers e.g aws

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to waihona

Streamx
kafka-connect-s3 : Ingest data from Kafka to Object Stores(s3)
Stars: ✭ 96 (+108.7%)
Mutual labels:  s3, gcp
BlobHelper
BlobHelper is a common, consistent storage interface for Microsoft Azure, Amazon S3, Komodo, Kvpbase, and local filesystem written in C#.
Stars: ✭ 23 (-50%)
Mutual labels:  s3, blob-storage
esop
Cloud-enabled backup and restore tool for Apache Cassandra
Stars: ✭ 40 (-13.04%)
Mutual labels:  s3, gcp
Seaweedfs
SeaweedFS is a fast distributed storage system for blobs, objects, files, and data lake, for billions of files! Blob store has O(1) disk seek, cloud tiering. Filer supports Cloud Drive, cross-DC active-active replication, Kubernetes, POSIX FUSE mount, S3 API, S3 Gateway, Hadoop, WebDAV, encryption, Erasure Coding.
Stars: ✭ 13,380 (+28986.96%)
Mutual labels:  s3, blob-storage
Rust S3
Rust library for interfacing with AWS S3 and other API compatible services
Stars: ✭ 177 (+284.78%)
Mutual labels:  s3, rust-library
terraform-dcos
DC/OS Terraform Installation and Upgrading Scripts
Stars: ✭ 64 (+39.13%)
Mutual labels:  cloud-providers, gcp
Cloud-Service-Providers-Free-Tier-Overview
Comparing the free tier offers of the major cloud providers like AWS, Azure, GCP, Oracle etc.
Stars: ✭ 226 (+391.3%)
Mutual labels:  cloud-providers, gcp
kafka-connect-fs
Kafka Connect FileSystem Connector
Stars: ✭ 107 (+132.61%)
Mutual labels:  s3, gcp
hush gcp secret manager
A Google Secret Manager Provider for Hush
Stars: ✭ 17 (-63.04%)
Mutual labels:  gcp
gcp-serviceaccount-controller
This is a controller to automatically create gcp service accounts an save them into kubernetes secrets
Stars: ✭ 14 (-69.57%)
Mutual labels:  gcp
mailparse
Rust library to parse mail files
Stars: ✭ 148 (+221.74%)
Mutual labels:  rust-library
webbrowser-rs
Rust library to open URLs in the web browsers available on a platform
Stars: ✭ 150 (+226.09%)
Mutual labels:  rust-library
sdk
Home of the JupiterOne SDK
Stars: ✭ 21 (-54.35%)
Mutual labels:  gcp
awesome-bigquery-views
Useful SQL queries for Blockchain ETL datasets in BigQuery.
Stars: ✭ 325 (+606.52%)
Mutual labels:  gcp
bigflow
A Python framework for data processing on GCP.
Stars: ✭ 96 (+108.7%)
Mutual labels:  gcp
rdp
A library providing FFI access to fast Ramer–Douglas–Peucker and Visvalingam-Whyatt line simplification algorithms
Stars: ✭ 20 (-56.52%)
Mutual labels:  rust-library
s3recon
Amazon S3 bucket finder and crawler.
Stars: ✭ 111 (+141.3%)
Mutual labels:  s3
pinto
Query builder (SQL) in Rust
Stars: ✭ 23 (-50%)
Mutual labels:  rust-library
Amazon
Simple access to Amazon's web services.
Stars: ✭ 20 (-56.52%)
Mutual labels:  s3
muxfys
High performance multiplexed user fuse mounting
Stars: ✭ 20 (-56.52%)
Mutual labels:  s3

waihona

mythra

Crates.io Build Status Publish Status

Usage

All cloud providers are on by default, to specify a single provider e.g aws:

[dependencies]
waihona={version = "0.0.3", features = ["aws"], default-features = false }

Rust library for cloud storage across major cloud providers It aims to provide simple to use functions to perform CRUD operations on buckets and blobs. Waihona simply means storage in Hawaiian

Feature Flags

The following feature flags exist for this crate

  • aws: Enable aws provider and dependencies
  • gcp: Enable gcp provider and dependencies
  • azure: Enable azure provider and dependencies

Traits

Three major traits control behaviour for each provider

Buckets -> Bucket -> Blob

// all methods of traits are async
 use bytes::Bytes;

 trait Buckets<T, P>
     where T: Bucket<P>, P: Blob{
         fn open(&mut self, bucket_name: &str);
         fn create(&mut self, bucket_name: &str, location: Option<String>);
         fn list(&mut self);
         fn delete(&mut self, bucket_name: &str);
         fn exists(&mut self, bucket_name: &str);
    }

trait Bucket<P>
    where P: Blob{
        fn list_blobs(&self, marker: Option<String>);
        fn get_blob(&self, blob_path: &str, content_range: Option<String>);
        fn copy_blob(&self, blob_path: &str, blob_destination_path: &str, content_type: Option<String>);
        fn write_blob(&self, blob_name: &str, content: Option<Bytes>);
        fn delete_blob(&self, blob_path: &str);
    }

 trait Blob {
     fn delete(&self);
     fn copy(&self, blob_destination_path: &str, content_type: Option<String> );
     fn write(&self, content: Option<Bytes>);
     fn read(&mut self);
    }

Examples

These quick examples will show you how to make use of the library for basic actions

List buckets from project waihona on GCP

// ensure to export service credential using GOOGLE_APPLICATION_CREDENTIALS
#[cfg(feature = "gcp")]
use waihona::providers::gcp::GcpBucket;

#[tokio::test]
#[cfg(feature = "gcp")]
async fn test_list_buckets() -> Vec<GcpBucket> {
   // Import Buckets trait from crate
   use waihona::types::bucket::{Buckets};
   use waihona::providers::gcp;
   let mut gcp_buckets = providers::gcp::GcpBuckets::new(
       "waihona"
       );
   // Returns (Vec<GcpBucket, Option<String>)
   // where Option<String> is the cursor for the token for next page listing
   let resp = gcp_buckets.list().await;
   resp[0]
}

Check bucket waihona exists on AWS

#[tokio::test]
#[cfg(feature = "aws")]
async fn test_bucket_exists() -> bool {
   use waihona::types::bucket::{Buckets};
   use waihona::providers;
   let mut aws_buckets = providers::aws::AwsBuckets::new(
       "us-east-2"
       );
   let resp = aws_buckets.exists(
       "waihona"
       ).await;
       // OR you can do
   let resp = providers::aws::AwsBucket::exists(
       "us-east-2",
       "waihona"
       ).await;
   resp
}

Write content to a blob "example.txt" in waihona bucket on Azure

#[cfg(feature = "azure")]
use waihona::providers::azure::AzureBlob;



#[tokio::test]
#[cfg(feature = "azure")]
async fn test_create_blob() -> AzureBlob {
   use waihona::types::bucket::{Buckets, Bucket};
   use waihona::types::blob::{Blob};
   use waihona::providers;
   use bytes::Bytes;
   let mut azure_buckets = providers::azure::AzureBuckets::new("waihona".to_owned());
   let waihona = azure_buckets.open(
       "waihona",
       ).await.unwrap();
   let mut blob = waihona.write_blob(
       "example.txt",
        Some(Bytes::from("Hello world"))
       ).await
       .unwrap();
    let read = blob.read().await.unwrap();
    assert!(read.eq(&Bytes::from("Hello world")));
 }

Copy file content from "example.txt" blob on AWS to blob on GCP and delete AWS blob afterwards assuming waihona buckets exist on both platforms

#[cfg(feature = "gcp")]
use waihona::providers::gcp::GcpBlob;


#[tokio::test]
#[cfg(all(feature = "gcp", feature = "aws" ))]
async fn test_transfer_blob() -> GcpBlob {
   use waihona::types::bucket::{Buckets, Bucket};
   use waihona::types::blob::{Blob};
   use waihona::providers;
   use bytes::Bytes;
   let mut aws_blob = providers::aws::AwsBlob::get(
       "us-east-2", // Region
       "waihona", // Bucket name
       "example.txt", // Blob name
       None // Content range
       ).await
       .unwrap();
   let mut gcp_blob = providers::gcp::GcpBlob::get(
       "gcp-project-name", // Project name
       "waihona", // Bucket name
       "example.txt", // Blob name
       None // Content range
       ).await
       .unwrap();
   let content: Bytes = aws_blob.read().unwrap();
   gcp_blob.write(Some(content)).await.unwrap();
    aws_blob.delete().unwrap();
    gcp_blob
 }

License

This project is opened under the MIT License which allows very broad use for both academic and commercial purposes

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].