Exemple #1
0
func main() {
	flag.Parse()
	id, err := GetAWSIdentity()
	if err != nil {
		log.Fatalf("Unable to get AWS identity: %v", err)
	}
	ep, err := GetS3Endpoint()
	if err != nil {
		log.Fatalf("Unable to construct endpoint: %v", err)
	}
	bucket := s3.NewBucket(ep, flag.Arg(0))
	err = bucket.DeleteKey(id, flag.Arg(1))
	if err != nil {
		log.Fatalf("Couldn't get key: %v", err)
	}
}
Exemple #2
0
func main() {
	flag.Parse()
	id, err := GetAWSIdentity()
	if err != nil {
		log.Fatalf("Unable to get AWS identity: %v", err)
	}
	ep, err := GetS3Endpoint()
	if err != nil {
		log.Fatalf("Unable to construct endpoint: %v", err)
	}
	bucket := s3.NewBucket(ep, flag.Arg(0))
	o, err := bucket.GetKey(id, flag.Arg(1))
	if err != nil {
		log.Fatalf("Couldn't get key: %v", err)
	}
	io.Copy(os.Stdout, o.Body)
}
Exemple #3
0
func main() {
	flag.Parse()
	id, err := GetAWSIdentity()
	if err != nil {
		log.Fatalf("Unable to get AWS identity: %v\n", err)
	}
	ep, err := GetS3Endpoint()
	if err != nil {
		log.Fatalf("Unable to construct endpoint: %v\n", err)
	}
	bucketName := flag.Arg(0)
	b := s3.NewBucket(ep, bucketName)
	err = b.Create(id)
	if err != nil {
		log.Fatalf("Unable to create bucket: %v\n", err)
	}
}
Exemple #4
0
func main() {
	flag.Parse()
	id, err := GetAWSIdentity()
	if err != nil {
		log.Fatalf("Unable to get AWS identity: %v", err)
	}
	ep, err := GetS3Endpoint()
	if err != nil {
		log.Fatalf("Unable to construct endpoint: %v", err)
	}
	bucket := s3.NewBucket(ep, flag.Arg(0))
	o, err := bucket.ListKeys(id, "", "", "", 1000)
	if err != nil {
		log.Fatalf("Couldn't get key: %v", err)
	}
	for i := range o {
		fmt.Printf("%s\n", o[i].Key)
	}
}
Exemple #5
0
func main() {
	flag.Parse()
	id, err := GetAWSIdentity()
	if err != nil {
		log.Fatalf("Unable to get AWS identity: %v", err)
	}
	ep, err := GetS3Endpoint()
	if err != nil {
		log.Fatalf("Unable to construct endpoint: %v", err)
	}
	bucket := s3.NewBucket(ep, flag.Arg(0))
	rc, ll, err := GetRC()
	if err != nil {
		log.Fatalf("Error reading data for key: %v", err)
	}
	//log.Fatalf("Error reading data for key: %v/%v/%v",rc,ll,err)
	err = bucket.PutKey(id, flag.Arg(1), "", "", ll, rc)
	if err != nil {
		log.Fatalf("Couldn't put key: %v", err)
	}
	//io.Copy(os.Stdout,o.Body)
}