bcsgo

package module
v0.0.0-...-16689aa Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

README

bcsgo

Golang Baidu BCS SDK

百度云存储服务Go语言SDK

Build Status

Baidu Official BCS Doc: http://developer.baidu.com/wiki/index.php?title=docs/cplat/bcs

Go Walker 文档

后续想法:

  1. 基于此SDK的Go语言版本的免费云网盘客户端
  2. 高可用性的开放图床WebApp,支持用户自定义防盗链
  3. 图片较多的静态站点和图片收集和分析

Bitdeli Badge

Documentation

Index

Constants

View Source
const (
	GET    = "GET"
	POST   = "POST"
	PUT    = "PUT"
	HEAD   = "HEAD"
	DELETE = "DELETE"
)
View Source
const (
	ACL_PRIVATE           = "private"
	ACL_PUBLIC_READ       = "public-read"
	ACL_PUBLIC_WRITE      = "public-write"
	ACL_PUBLIC_READ_WRITE = "public-read-write"
	ACL_PUBLIC_CONTROL    = "public-control"
)
View Source
const (
	HEADER_COPY_SOURCE = "x-bs-copy-source"
	HEADER_ACL         = "X-Bs-Acl"
	HEADER_VERSION     = "X-Bs-Version"
	HEADER_FILESIZE    = "X-Bs-File-Size"
	HEADER_ETAG        = "Etag"
	HEADER_CONTENT_MD5 = "Content-Md5"
)
View Source
const (
	BCS_HOST = "http://bcs.duapp.com"
)

Variables

View Source
var DEBUG bool = false
View Source
var DEBUG_REQUEST_BODY = false

Functions

This section is empty.

Types

type BCS

type BCS struct {
	// contains filtered or unexported fields
}

func NewBCS

func NewBCS(ak, sk string) *BCS

func (*BCS) Bucket

func (this *BCS) Bucket(bucketName string) *Bucket

func (*BCS) ListBuckets

func (this *BCS) ListBuckets() ([]*Bucket, error)

type Bucket

type Bucket struct {
	Name string `json:"bucket_name"`
	// contains filtered or unexported fields
}

func (*Bucket) Create

func (this *Bucket) Create() error

func (*Bucket) CreateWithACL

func (this *Bucket) CreateWithACL(acl string) error

func (*Bucket) Delete

func (this *Bucket) Delete() error

func (*Bucket) GetACL

func (this *Bucket) GetACL() (string, error)

func (*Bucket) ListObjects

func (this *Bucket) ListObjects(prefix string, start, limit int) (*ObjectCollection, error)

func (*Bucket) Object

func (this *Bucket) Object(absolutePath string) *Object

func (*Bucket) SetACL

func (this *Bucket) SetACL(acl string) error

func (*Bucket) Superfile

func (this *Bucket) Superfile(absolutePath string, objects []*Object) *Superfile

type HttpClient

type HttpClient struct {
	// contains filtered or unexported fields
}

func NewHttpClient

func NewHttpClient() *HttpClient

func (*HttpClient) Delete

func (this *HttpClient) Delete(url string) (*http.Response, []byte, error)

func (*HttpClient) Get

func (this *HttpClient) Get(url string) (*http.Response, []byte, error)

func (*HttpClient) Head

func (this *HttpClient) Head(url string) (*http.Response, []byte, error)

func (*HttpClient) Put

func (this *HttpClient) Put(url string, data io.Reader, size int64, modifyHeader func(header *http.Header)) (*http.Response, []byte, error)

type Object

type Object struct {
	VersionKey   string `json:"version_key"`
	AbsolutePath string `json:"object"`
	Superfile    string `json:"superfile"`
	Size         int64  `json:"size,string"`
	ParentDir    string `json:"parent_dir"`
	IsDir        string `json:"is_dir"`
	MDatetime    string `json:"mdatetime"`
	RefKey       string `json:"ref_key"`
	ContentMD5   string `json:"content_md5"`
	// contains filtered or unexported fields
}

func (*Object) CopyTo

func (this *Object) CopyTo(target *Object) (*Object, error)

func (*Object) Delete

func (this *Object) Delete() error

func (*Object) Get

func (this *Object) Get() (body []byte, err error)

func (*Object) GetACL

func (this *Object) GetACL() (string, error)

func (*Object) Head

func (this *Object) Head() error
func (this *Object) Link() string
func (this *Object) PublicLink() string

func (*Object) Put

func (this *Object) Put(file io.Reader, size int64) (*Object, error)

func (*Object) PutFile

func (this *Object) PutFile(localFile string) (*Object, error)

func (*Object) PutFileWithACL

func (this *Object) PutFileWithACL(localFile, acl string) (*Object, error)

func (*Object) SetACL

func (this *Object) SetACL(acl string) error

type ObjectCollection

type ObjectCollection struct {
	ObjectTotal int       `json:"object_total"`
	Start       int       `json:"start"`
	Limit       int       `json:"limit"`
	Bucket      string    `json:"bucket"`
	Objects     []*Object `json:"object_list"`
}

type Superfile

type Superfile struct {
	Object
	Objects []*Object
}

func (*Superfile) Put

func (this *Superfile) Put() error

Jump to

Keyboard shortcuts

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