package main
import (
"bufio"
"bytes"
"errors"
"fmt"
"github.com/astaxie/beego"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"io"
"os"
)
type CephMgmt struct {
host string `ceph host`
DoName string `ceph doname`
bucket_id string `bucket_id`
PathStyle bool `ceph url style, true means you can use host directly, false means bucket_id.doname will be used`
AccessKey string `aws s3 aceessKey`
SecretKey string `aws s3 secretKey`
block_size int64 `block_size`
}
var Ceph CephMgmt
type MyProvider struct{}
func (m *MyProvider) Retrieve() (credentials.Value, error) {
return credentials.Value{
AccessKeyID: Ceph.AccessKey, //"9YGYCFH1V3QUT4B9KZD1",
SecretAccessKey: Ceph.SecretKey, //"9hdiwSjCfyrZPKGObH8Kctdur8PiBPJu3B4zGYaZ",
}, nil
}
func (m *MyProvider) IsExpired() bool { return false }
func (this *CephMgmt) Init() error {
// "http://s3.devopscloud.com"
this.host = beego.AppConfig.String("ceph::host")
if len(this.host) <= 0 {
return errors.New("ceph conf host is nil")
}
this.bucket_id = beego.AppConfig.String("ceph::bucket_id")
if len(this.bucket_id) <= 0 {
return errors.New(&
使用go sdk进行ceph s3 分片上传和分段下载
最新推荐文章于 2024-07-14 12:04:38 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)