aliyun-oss-golang-sdk

module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2015 License: Apache-2.0

README

#aliyun-oss-golang-sdk Build Status Coverage Status linthub

Aliyun OSS Golang SDK is a wrap for Aliyun OSS Web API on Golang. To use this SDK you should install golang first, see how to install golang .The following articles assume that golang has been installed.

Use go get commands to get Aliyun OSS Golang SDK and it's command tools "osscmd".

go get github.com/cz-it/aliyun-oss-golang-sdk/ossapi
go get github.com/cz-it/aliyun-oss-golang-sdk/osscmd

After installed SDK and command tool ,you can use command

osscmd -v 

To test if installed success.

Or you can import github.com/cz-it/aliyun-oss-golang-sdk/ossapi and invoke the Version() fucntion .

package main

import (
	"fmt"
	"github.com/cz-it/aliyun-oss-golang-sdk/ossapi"
) 

func main() {
	fmt.Println(ossapi.Version())
}

After testing installed successful.You can use API like demo this.

package main

import (
	"fmt"
	"github.com/cz-it/aliyun-oss-golang-sdk/ossapi"
	"github.com/cz-it/aliyun-oss-golang-sdk/ossapi/service"
)

func main () {
	err := ossapi.Init("v8P430U3UcILP", "EB9v8yL2aM07YOgtO1BdfrXtdxa4")
	if err != nil {
		fmt.Println(err.Error())
		return 
	}
	
	info, e := service.GetServiceDefault()
	if e != nil {
		fmt.Println(e.Error())
		return
	}
	fmt.Println("Owner:", info.Owner.DisplayName)
	for idx, bucket := range info.Buckets.Bucket {
		fmt.Printf("	Bucket[%v]:", idx)
		fmt.Println(bucket)
	}
}

Use go run may get output like this:

Owner: 1415982622007927
	Bucket[0]:{python-sdk-test 2015-10-21T12:31:32.000Z oss-cn-hangzhou}
	Bucket[1]:{python-sdk-test2 2015-10-21T12:31:50.000Z oss-cn-hangzhou}
	Bucket[2]:{test-cors 2015-10-27T17:38:40.000Z oss-cn-hangzhou}

Here use "Init" with your Access Key ID and Access Secret to init ossapi. Then use "GetServiceDefault" to list all your buckets.

What Next?

API Referece

Also Godoc

Directories

Path Synopsis
Package ossapi is a golang implementation for aliyun's oss Package ossapi is oss sdk of golang * * Author: CZ cz.theng@gmail.com
Package ossapi is a golang implementation for aliyun's oss Package ossapi is oss sdk of golang * * Author: CZ cz.theng@gmail.com
bucket
Package bucket is for buckets * * Author: CZ cz.theng@gmail.com Package bucket is for buckets
Package bucket is for buckets * * Author: CZ cz.theng@gmail.com Package bucket is for buckets
cors
Package cors is for cors * * Author: CZ cz.theng@gmail.com * CORS allow remote domain to access resources.
Package cors is for cors * * Author: CZ cz.theng@gmail.com * CORS allow remote domain to access resources.
log
Package log is a wraper for log Package log is a logger wraper * * Author: CZ cz.theng@gmail.com
Package log is a wraper for log Package log is a logger wraper * * Author: CZ cz.theng@gmail.com
mupload
Package mupload is for mupload * * Author: CZ cz.theng@gmail.com
Package mupload is for mupload * * Author: CZ cz.theng@gmail.com
object
Package object is for object * * Author: CZ cz.theng@gmail.com
Package object is for object * * Author: CZ cz.theng@gmail.com

Jump to

Keyboard shortcuts

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