Beispiel #1
0
func CopyObject(c *oss.Client, dst, src string) {
	err := c.CopyObject(dst, src)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Copy object ok")
}
Beispiel #2
0
func DeleteObject(c *oss.Client, opath string) {
	err := c.DeleteObject(opath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Delete object ok")
}
Beispiel #3
0
func PutBucketACL(c *oss.Client, bname string, acl string) {
	err := c.PutBucketACL(bname, acl)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Put bucket acl ok")
}
Beispiel #4
0
func GetBucketACL(c *oss.Client, bname string) {
	acl, err := c.GetBucketACL(bname)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", acl)
}
Beispiel #5
0
func PutBucket(c *oss.Client, bname string) {
	err := c.PutBucket(bname)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Put bucket ok")
}
Beispiel #6
0
func GetBucket(c *oss.Client, bname string) {
	lbr, err := c.GetBucket(bname, "", "", "", "")
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", lbr)
}
Beispiel #7
0
func ListParts(c *oss.Client, opath, uploadId string) {
	lpr, err := c.ListParts(opath, uploadId)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", lpr)
}
Beispiel #8
0
func GetService(c *oss.Client) {
	lar, err := c.GetService()
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", lar)
}
Beispiel #9
0
func PutLargeObject(c *oss.Client, opath, fpath string) {
	err := c.PutLargeObject(opath, fpath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("put large object ok")
}
Beispiel #10
0
func ListMultipartUpload(c *oss.Client, bname string) {
	lmur, err := c.ListMultipartUpload(bname, nil)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", lmur)
}
Beispiel #11
0
func AbortMultipartUpload(c *oss.Client, opath, uploadId string) {
	err := c.AbortMultipartUpload(opath, uploadId)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("abort multipart upload ok")
}
Beispiel #12
0
func GetObjectGroupIndex(c *oss.Client, gpath string) {
	fg, err := c.GetObjectGroupIndex(gpath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", fg)
}
Beispiel #13
0
func PostObjectGroup(c *oss.Client, cfg oss.CreateFileGroup, gpath string) {
	cofg, err := c.PostObjectGroup(cfg, gpath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", cofg)
}
Beispiel #14
0
func DeleteMultipleObject(c *oss.Client, bname string, keys []string) {
	err := c.DeleteMultipleObject(bname, keys)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Delete multiple object ok")
}
Beispiel #15
0
func HeadObject(c *oss.Client, opath string) {
	header, err := c.HeadObject(opath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", header)
}
Beispiel #16
0
func GetObject(c *oss.Client, fpath, opath string) {
	bytes, err := c.GetObject(opath, -1, -1)
	if err != nil {
		log.Fatalln(err)
	}

	file, err := os.Create(fpath)
	if err != nil {
		log.Fatalln(err)
	}
	defer file.Close()
	file.Write(bytes)
	fmt.Println("Get object ok")
}