oss-uni

module
v0.0.0-...-40fbf91 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2018 License: MIT

README

ossuni

阿里云与腾讯云存储的统一接口,

为了方便在两个云之间做切换

Install & Update

# Install
go get github.com/lily-lee/oss-uni/ossuni

# Update
go get -u github.com/lily-lee/oss-uni/ossuni

Usage

package main

import (
    "github.com/lily-lee/oss-uni/ossuni"
    "log"
)

// example
func main() {
	ossType := ossuni.OssType(ossuni.ALIYUN)
	client := ossuni.NewClient(ossType)
	client.Init(ossuni.Config{
		OssType:     ossType,
		Scheme:      "https",
		AppID:       "QCloud APPID",
		SecretID:    "QCloud SecretID",
		SecretKey:   "QCloud SecretKey",
		AuthExpired: 600,

		Endpoint:        "Aliyun OSS endpoint",
		AccessKeyID:     "Aliyun OSS AccessKeyID",
		AccessKeySecret: "Aliyun OSS AccessKeySecret",
	})
	param := ossuni.ObjectParam{
		Bucket: "Your Bucket Name",
		Key:    "readme",
		Region: "Your Bucket Region", // only for qcloud cos
	}
	e := client.PutObjectFromFile(param, "../README.md")
	log.Println(e)
}

LICENSE

MIT License

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL