All Projects → NoXF → oss-rust-sdk

NoXF / oss-rust-sdk

Licence: other
Aliyun OSS SDK for Rust

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to oss-rust-sdk

yii2-aliyun-oss
Yii2 Aliyun OSS Yii2 阿里云 OSS
Stars: ✭ 41 (-30.51%)
Mutual labels:  oss, aliyun-oss
aliyun-oss-deploy
🙈 一个 nodejs 命令行工具,用于部署静态资源到 aliyun oss,支持代码方式和 CLI 方式!
Stars: ✭ 31 (-47.46%)
Mutual labels:  oss, aliyun-oss
Ali Oss
Aliyun OSS(open storage service) JavaScript SDK for the browser and Node.js
Stars: ✭ 1,579 (+2576.27%)
Mutual labels:  oss, aliyun-oss
android-oss-best-practices
Best practices on creating Android OSS library projects [JA]
Stars: ✭ 32 (-45.76%)
Mutual labels:  oss
webpack-alioss-upload-plugin
A flexible webpack plugin to upload files to aliyun oss, which supports multiple optional upload methods and parameters.
Stars: ✭ 14 (-76.27%)
Mutual labels:  aliyun-oss
which-licenses-i-have
📝 Learn about the licenses around your package
Stars: ✭ 29 (-50.85%)
Mutual labels:  oss
guli-mall
尚硅谷-谷粒商城代码及文档https://www.yuque.com/zhangshuaiyin/guli-mall
Stars: ✭ 233 (+294.92%)
Mutual labels:  oss
aliyun-oss-laravel
Laravel 的 Aliyun OSS 扩展, 支持 Laravel 9. Alibaba Cloud Object Storage Service For Laravel.
Stars: ✭ 91 (+54.24%)
Mutual labels:  oss
caesar
持续集成
Stars: ✭ 40 (-32.2%)
Mutual labels:  aliyun-oss
aliyun-oss-uploader-plugin
Aliyun/AliCloud OSS uploader
Stars: ✭ 26 (-55.93%)
Mutual labels:  aliyun-oss
katla
Indonesian version of Wordle
Stars: ✭ 121 (+105.08%)
Mutual labels:  oss
v-editor
📝Write md or rich text easily
Stars: ✭ 22 (-62.71%)
Mutual labels:  oss
ElUploader-OSS-Solution
ElementUI - Upload 组件结合 OSS 的封装
Stars: ✭ 28 (-52.54%)
Mutual labels:  oss
file-upload
koa2 middleware support upload to cos/oss/obs/aws/local
Stars: ✭ 28 (-52.54%)
Mutual labels:  oss
free-fs
✨Free-Fs 开源文件管理系统:基于 SpringBoot2.x + MyBatisPlus + MySQL + Shiro+ Layui 等搭配七牛云,阿里云OSS实现的云存储管理系统。包含文件上传、删除、预览、云资源列表查询、下载、文件移动、重命名、目录管理、登录、注册、以及权限控制等功能。
Stars: ✭ 49 (-16.95%)
Mutual labels:  oss
nbox
基于阿里云OSS的网盘客户端程序!
Stars: ✭ 31 (-47.46%)
Mutual labels:  oss
awesome-indoor-farming
A curated list of awesome dataset, technologies, companies, and media about Indoor Farming.
Stars: ✭ 52 (-11.86%)
Mutual labels:  oss
webpack-oss
webpack静态资源一键上传阿里云OSS插件,兼容webpack3.x/4.x
Stars: ✭ 29 (-50.85%)
Mutual labels:  oss
Emojions
Embeddable Emoji Bar
Stars: ✭ 15 (-74.58%)
Mutual labels:  oss
Getting-Started-With-Contributing-to-Open-Sources
This has useful links to help you get started with contributing to open sources.
Stars: ✭ 44 (-25.42%)
Mutual labels:  oss

Getting Started

List your_Buckets

use oss_rust_sdk::prelude::*;
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let list_your_Buckets = oss_instance.list_your_Bucket(None).unwrap();

let id = list_your_Buckets.id();
let your_Buckets = list_your_Buckets.your_Buckets();
let your_Bucket_names: Vec<&str> = your_Buckets.iter().map(|obj| obj.name()).collect();

Get Object

use oss_rust_sdk::prelude::*;
use std::collections::HashMap;

let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");

/// if have extra header
let mut extra_header = HashMap::new();
extra_header.insert("content-type", "text/plain");
/// if have oss_sub_resource
let mut oss_sub_resource = HashMap::new();
oss_sub_resource.insert("acl", None);
oss_sub_resource.insert("response-content-type", Some("ContentType"));

let result = oss_instance.get_object("object", extar_header, oss_sub_resource);
/// or you may just get object
/// let result = oss_instance.get_object("object", None, None);
assert_eq!(result.is_ok(), true);
let buffer = result.unwrap();

Get Object async

use oss_rust_sdk::oss::OSS;
use oss_rust_sdk::async_object::*;
use tokio::runtime::Runtime;

fn async_get_object_demo() {
    let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");

    let mut rt = Runtime::new().expect("failed to start runtime");

    rt.block_on(async move {
        let _ = oss_instance.get_object("objectName", None::<HashMap<&str, &str>>, None).await.unwrap();
        println!("buffer = {:?}", String::from_utf8(result.unwrap()));
    });
}

or

async fn async_get_object_demo() -> Reuslt<String, Error> {
    let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
    let buf = oss_instance.async_get_object("objectName", None, None).await?;
    String::from_utf8(buf)?
}

Put Object by file

use oss_rust_sdk::prelude::*;
let filename = "filename";
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let result = oss_instance.put_object_from_file(filename, "object", None, None);
assert_eq!(result.is_ok(), true)

Put Ojbect by buffer

let buffer = "some thing you want put to oss";
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let result = oss_instance.put_object_from_buffer(buffer.as_bytes(), "object", None, None);
assert_eq!(result.is_ok(), true)

Pub Object Async

use oss_rust_sdk::oss::OSS;
use oss_rust_sdk::async_object::*;

let buffer = "test async put object from buffer";
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let mut headers = HashMap::new();
headers.insert("content-type", "text/plain");

oss_instance.put_object(buffer.as_bytes(),"your_object_name", headers,None).await?;

Copy Object

use oss_rust_sdk::prelude::*;
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let result = oss_instance.copy_object_from_object("src_object", "dest_object", None, None);
assert_eq!(result.is_ok(), true)

Delete Ojbect

use oss_rust_sdk::prelude::*;
let oss_instance = OSS::new("your_AccessKeyId", "your_AccessKeySecret", "your_Endpoint", "your_Bucket");
let result = oss_instance.delete_object("object");
assert_eq!(result.is_ok(), true)

You can use oss_instance.set_your_Bucket("your_Bucket") to change your_Bucket if you want change your_Bucket after instance a oss

TODO:

  • complete object api
  • complete your_Bucket api
  • support async api

License

  • Apache License 2.0.
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].