{"id":21541977,"url":"https://github.com/bisohns/waihona","last_synced_at":"2025-04-10T04:24:36.581Z","repository":{"id":57671837,"uuid":"336526939","full_name":"bisohns/waihona","owner":"bisohns","description":"Rust crate for performing cloud storage CRUD actions across major cloud providers e.g aws","archived":false,"fork":false,"pushed_at":"2022-03-26T20:54:32.000Z","size":139,"stargazers_count":52,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T05:43:40.341Z","etag":null,"topics":["aws","azure","blob-storage","cloud-providers","gcp","rust-library","s3","storage"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/waihona","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bisohns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-06T11:58:02.000Z","updated_at":"2025-02-22T02:41:45.000Z","dependencies_parsed_at":"2022-08-30T16:00:29.298Z","dependency_job_id":null,"html_url":"https://github.com/bisohns/waihona","commit_stats":null,"previous_names":["bisoncorps/waihona"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bisohns%2Fwaihona","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bisohns%2Fwaihona/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bisohns%2Fwaihona/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bisohns%2Fwaihona/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bisohns","download_url":"https://codeload.github.com/bisohns/waihona/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248155974,"owners_count":21056744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","azure","blob-storage","cloud-providers","gcp","rust-library","s3","storage"],"created_at":"2024-11-24T05:08:09.725Z","updated_at":"2025-04-10T04:24:36.564Z","avatar_url":"https://github.com/bisohns.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# waihona\n\u003c!-- markdownlint-disable-next-line --\u003e\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/bisoncorps/waihona/raw/main/assets/waihona.png\" alt=\"mythra\" height=\"100px\"\u003e\u003c/p\u003e\n\n[![Crates.io](https://img.shields.io/crates/v/waihona.svg)](https://crates.io/crates/waihona)\n[![Build Status](https://github.com/bisoncorps/waihona/workflows/Build%20and%20Test/badge.svg)](https://github.com/bisoncorps/waihona/actions)\n[![Publish Status](https://github.com/bisoncorps/waihona/workflows/Publish%20to%20Cargo/badge.svg)](https://github.com/bisoncorps/waihona/actions)\n\n\n## Usage\n\nAll cloud providers are on by default, to specify a single provider e.g aws:\n\n```toml\n[dependencies]\nwaihona={version = \"0.0.3\", features = [\"aws\"], default-features = false }\n```\n\nRust library for cloud storage across major cloud providers\nIt aims to provide simple to use functions to perform CRUD operations on\nbuckets and blobs.\nWaihona simply means storage in Hawaiian\n\n ## Feature Flags\n\n The following feature flags exist for this crate\n - [x] `aws`: Enable aws provider and dependencies\n - [x] `gcp`: Enable gcp provider and dependencies\n - [x] `azure`: Enable azure provider and dependencies\n\n ## Traits\n\n Three major traits control behaviour for each provider\n\n Buckets -\u003e Bucket -\u003e Blob\n\n```rust\n// all methods of traits are async\n use bytes::Bytes;\n\n trait Buckets\u003cT, P\u003e\n     where T: Bucket\u003cP\u003e, P: Blob{\n         fn open(\u0026mut self, bucket_name: \u0026str);\n         fn create(\u0026mut self, bucket_name: \u0026str, location: Option\u003cString\u003e);\n         fn list(\u0026mut self);\n         fn delete(\u0026mut self, bucket_name: \u0026str);\n         fn exists(\u0026mut self, bucket_name: \u0026str);\n    }\n\ntrait Bucket\u003cP\u003e\n    where P: Blob{\n        fn list_blobs(\u0026self, marker: Option\u003cString\u003e);\n        fn get_blob(\u0026self, blob_path: \u0026str, content_range: Option\u003cString\u003e);\n        fn copy_blob(\u0026self, blob_path: \u0026str, blob_destination_path: \u0026str, content_type: Option\u003cString\u003e);\n        fn write_blob(\u0026self, blob_name: \u0026str, content: Option\u003cBytes\u003e);\n        fn delete_blob(\u0026self, blob_path: \u0026str);\n    }\n\n trait Blob {\n     fn delete(\u0026self);\n     fn copy(\u0026self, blob_destination_path: \u0026str, content_type: Option\u003cString\u003e );\n     fn write(\u0026self, content: Option\u003cBytes\u003e);\n     fn read(\u0026mut self);\n    }\n\n```\n\n### Examples\n\nThese quick examples will show you how to make use of the\nlibrary for basic actions\n\n\nList buckets from project waihona on GCP\n\n\n```rust\n// ensure to export service credential using GOOGLE_APPLICATION_CREDENTIALS\n#[cfg(feature = \"gcp\")]\nuse waihona::providers::gcp::GcpBucket;\n\n#[tokio::test]\n#[cfg(feature = \"gcp\")]\nasync fn test_list_buckets() -\u003e Vec\u003cGcpBucket\u003e {\n   // Import Buckets trait from crate\n   use waihona::types::bucket::{Buckets};\n   use waihona::providers::gcp;\n   let mut gcp_buckets = providers::gcp::GcpBuckets::new(\n       \"waihona\"\n       );\n   // Returns (Vec\u003cGcpBucket, Option\u003cString\u003e)\n   // where Option\u003cString\u003e is the cursor for the token for next page listing\n   let resp = gcp_buckets.list().await;\n   resp[0]\n}\n```\n\n\nCheck bucket waihona exists on AWS\n\n```rust\n\n#[tokio::test]\n#[cfg(feature = \"aws\")]\nasync fn test_bucket_exists() -\u003e bool {\n   use waihona::types::bucket::{Buckets};\n   use waihona::providers;\n   let mut aws_buckets = providers::aws::AwsBuckets::new(\n       \"us-east-2\"\n       );\n   let resp = aws_buckets.exists(\n       \"waihona\"\n       ).await;\n       // OR you can do\n   let resp = providers::aws::AwsBucket::exists(\n       \"us-east-2\",\n       \"waihona\"\n       ).await;\n   resp\n}\n```\n\nWrite content to a blob \"example.txt\" in waihona bucket on Azure\n\n```rust\n#[cfg(feature = \"azure\")]\nuse waihona::providers::azure::AzureBlob;\n\n\n\n#[tokio::test]\n#[cfg(feature = \"azure\")]\nasync fn test_create_blob() -\u003e AzureBlob {\n   use waihona::types::bucket::{Buckets, Bucket};\n   use waihona::types::blob::{Blob};\n   use waihona::providers;\n   use bytes::Bytes;\n   let mut azure_buckets = providers::azure::AzureBuckets::new(\"waihona\".to_owned());\n   let waihona = azure_buckets.open(\n       \"waihona\",\n       ).await.unwrap();\n   let mut blob = waihona.write_blob(\n       \"example.txt\",\n        Some(Bytes::from(\"Hello world\"))\n       ).await\n       .unwrap();\n    let read = blob.read().await.unwrap();\n    assert!(read.eq(\u0026Bytes::from(\"Hello world\")));\n }\n```\n\n Copy file content from \"example.txt\" blob on AWS to blob on GCP\n and delete AWS blob afterwards\n assuming waihona buckets exist on both platforms\n\n```rust\n#[cfg(feature = \"gcp\")]\nuse waihona::providers::gcp::GcpBlob;\n\n\n#[tokio::test]\n#[cfg(all(feature = \"gcp\", feature = \"aws\" ))]\nasync fn test_transfer_blob() -\u003e GcpBlob {\n   use waihona::types::bucket::{Buckets, Bucket};\n   use waihona::types::blob::{Blob};\n   use waihona::providers;\n   use bytes::Bytes;\n   let mut aws_blob = providers::aws::AwsBlob::get(\n       \"us-east-2\", // Region\n       \"waihona\", // Bucket name\n       \"example.txt\", // Blob name\n       None // Content range\n       ).await\n       .unwrap();\n   let mut gcp_blob = providers::gcp::GcpBlob::get(\n       \"gcp-project-name\", // Project name\n       \"waihona\", // Bucket name\n       \"example.txt\", // Blob name\n       None // Content range\n       ).await\n       .unwrap();\n   let content: Bytes = aws_blob.read().unwrap();\n   gcp_blob.write(Some(content)).await.unwrap();\n    aws_blob.delete().unwrap();\n    gcp_blob\n }\n```\n\n## License\n\nThis project is opened under the [MIT License](./LICENSE) which allows very broad use for both academic and commercial purposes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbisohns%2Fwaihona","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbisohns%2Fwaihona","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbisohns%2Fwaihona/lists"}