Пример #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")
}
Пример #2
0
func DeleteObject(c *oss.Client, opath string) {
	err := c.DeleteObject(opath)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Delete object ok")
}
Пример #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")
}
Пример #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)
}
Пример #5
0
func PutBucket(c *oss.Client, bname string) {
	err := c.PutBucket(bname)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Println("Put bucket ok")
}
Пример #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)
}
Пример #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)
}
Пример #8
0
func GetService(c *oss.Client) {
	lar, err := c.GetService()
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%+v\n", lar)
}
Пример #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")
}
Пример #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)
}
Пример #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")
}
Пример #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)
}
Пример #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)
}
Пример #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")
}
Пример #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)
}
Пример #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")
}