Documentation ¶
Overview ¶
Example (S3stub) ¶
package main import ( "github.com/davecgh/go-spew/spew" "github.com/sqjian/go-kit/oss" ) func main() { checkErr := func(err error) { if err != nil { panic(err) } } stub, err := oss.NewS3Stub( "12345678", "12345678", "http://x.x.x.x:xxxx", ) checkErr(err) buckets, err := stub.ListBuckets() checkErr(err) spew.Dump(buckets) for _, bucket := range buckets { objs, err := stub.ListObjects(*bucket.Name) checkErr(err) spew.Printf("bucket:%v,objs:%v", *bucket.Name, objs) } }
Output:
Index ¶
- type S3Stub
- func (s *S3Stub) BucketExists(bucketName string) (bool, error)
- func (s *S3Stub) CopyToFolder(bucketName string, objectKey string, folderName string) error
- func (s *S3Stub) CreateBucket(name string, region string) error
- func (s *S3Stub) DeleteBucket(bucketName string) error
- func (s *S3Stub) DeleteObjects(bucketName string, objectKeys []string) error
- func (s *S3Stub) DownloadFile(bucketName string, objectKey string, fileName string) error
- func (s *S3Stub) DownloadLargeObject(bucketName string, objectKey string) ([]byte, error)
- func (s *S3Stub) ListBuckets() ([]types.Bucket, error)
- func (s *S3Stub) ListObjects(bucketName string) ([]types.Object, error)
- func (s *S3Stub) UploadFile(bucketName string, objectKey string, fileName string) error
- func (s *S3Stub) UploadLargeObject(bucketName string, objectKey string, largeObject []byte) error
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type S3Stub ¶
type S3Stub struct {
// contains filtered or unexported fields
}
func (*S3Stub) BucketExists ¶
BucketExists checks whether a bucket exists in the current account.
func (*S3Stub) CopyToFolder ¶
CopyToFolder copies an object in a bucket to a subfolder in the same bucket.
func (*S3Stub) CreateBucket ¶
CreateBucket creates a bucket with the specified name in the specified Region.
func (*S3Stub) DeleteBucket ¶
DeleteBucket deletes a bucket. The bucket must be empty or an error is returned.
func (*S3Stub) DeleteObjects ¶
DeleteObjects deletes a list of objects from a bucket.
func (*S3Stub) DownloadFile ¶
DownloadFile gets an object from a bucket and stores it in a local file.
func (*S3Stub) DownloadLargeObject ¶
DownloadLargeObject uses a download manager to download an object from a bucket. The download manager gets the data in parts and writes them to a buffer until all the data has been downloaded.
func (*S3Stub) ListBuckets ¶
ListBuckets lists the buckets in the current account.
func (*S3Stub) ListObjects ¶
ListObjects lists the objects in a bucket.
func (*S3Stub) UploadFile ¶
UploadFile reads from a file and puts the data into an object in a bucket.