Documentation ¶
Overview ¶
Package remotestorage wraps cloud storage API.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GoogleCloudStorage ¶
GoogleCloudStorage wraps Google Cloud Storage API.
func (*GoogleCloudStorage) UploadDir ¶
func (g *GoogleCloudStorage) UploadDir(bucket, src, dst string, opts ...OpOption) error
UploadDir uploads a directory to Google Cloud Storage.
Example ¶
package main import ( "io/ioutil" "log" "github.com/coreos/dbtester/pkg/remotestorage" ) func main() { kbs, err := ioutil.ReadFile("key.json") if err != nil { log.Fatal(err) } u, err := remotestorage.NewGoogleCloudStorage(kbs, "my-project") if err != nil { log.Fatal(err) } if err := u.UploadDir("test-bucket", "articles", "articles"); err != nil { log.Fatal(err) } }
Output:
func (*GoogleCloudStorage) UploadFile ¶
func (g *GoogleCloudStorage) UploadFile(bucket, src, dst string, opts ...OpOption) error
UploadFile uploads a file to Google Cloud Storage.
Example ¶
package main import ( "io/ioutil" "log" "github.com/coreos/dbtester/pkg/remotestorage" ) func main() { kbs, err := ioutil.ReadFile("key.json") if err != nil { log.Fatal(err) } u, err := remotestorage.NewGoogleCloudStorage(kbs, "my-project") if err != nil { log.Fatal(err) } if err := u.UploadFile("test-bucket", "agent.log", "dir/agent.log", remotestorage.WithContentType("text/plain")); err != nil { log.Fatal(err) } }
Output:
Click to show internal directories.
Click to hide internal directories.