Documentation
¶
Overview ¶
Copyright 2021 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Copyright 2021 The Chromium Authors Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
Index ¶
- type Client
- type FakeClient
- func (f *FakeClient) Download(gsPath gs.Path, localPath string) error
- func (f *FakeClient) DownloadWithGsutil(_ context.Context, gsPath gs.Path, localPath string) error
- func (f *FakeClient) List(_ context.Context, bucket string, prefix string) ([]string, error)
- func (f *FakeClient) Read(gsPath gs.Path) ([]byte, error)
- func (f *FakeClient) SetMetadata(ctx context.Context, gsPath gs.Path, key, value string) error
- func (f *FakeClient) SetTTL(_ context.Context, gsPath gs.Path, ttl time.Duration) error
- func (f *FakeClient) WriteFileToGS(gsPath gs.Path, data []byte) error
- type ProdClient
- func (g *ProdClient) Download(gsPath gs.Path, localPath string) error
- func (g *ProdClient) DownloadWithGsutil(ctx context.Context, gsPath gs.Path, localPath string) error
- func (g *ProdClient) List(ctx context.Context, bucket string, prefix string) ([]string, error)
- func (g *ProdClient) Read(gsPath gs.Path) ([]byte, error)
- func (g *ProdClient) SetMetadata(ctx context.Context, gsPath gs.Path, key, value string) error
- func (g *ProdClient) SetTTL(ctx context.Context, gsPath gs.Path, ttl time.Duration) error
- func (g *ProdClient) WriteFileToGS(gsPath gs.Path, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { WriteFileToGS(gsPath gs.Path, data []byte) error Download(gsPath gs.Path, localPath string) error DownloadWithGsutil(ctx context.Context, gsPath gs.Path, localPath string) error Read(gsPath gs.Path) ([]byte, error) SetTTL(ctx context.Context, gsPath gs.Path, ttl time.Duration) error SetMetadata(ctx context.Context, gsPath gs.Path, key, value string) error List(ctx context.Context, bucket string, prefix string) ([]string, error) }
type FakeClient ¶
type FakeClient struct { T *testing.T // ExpectedLists is indexed by bucket and then by prefix. ExpectedLists map[string]map[string][]string ExpectedWrites map[string][]byte ExpectedDownloads map[string][]byte ExpectedReads map[string][]byte ExpectedSetTTL map[string]time.Duration ExpectedMetadata map[string]map[string]string }
func (*FakeClient) DownloadWithGsutil ¶
func (*FakeClient) SetMetadata ¶
func (*FakeClient) WriteFileToGS ¶
func (f *FakeClient) WriteFileToGS(gsPath gs.Path, data []byte) error
WriteFileToGS writes the specified data to the specified gs path.
type ProdClient ¶
type ProdClient struct {
// contains filtered or unexported fields
}
func NewProdClient ¶
func (*ProdClient) Download ¶
func (g *ProdClient) Download(gsPath gs.Path, localPath string) error
Download reads the specified path from gs to the specified local path.
func (*ProdClient) DownloadWithGsutil ¶
func (g *ProdClient) DownloadWithGsutil(ctx context.Context, gsPath gs.Path, localPath string) error
DownloadWithGsutil reads the specified path from gs to the specified local path by shelling out to `gsutil` (which must exist on the client's path). This function is used in contexts where OAuth-based authentication is not available.
func (*ProdClient) Read ¶
func (g *ProdClient) Read(gsPath gs.Path) ([]byte, error)
Read reads the specified path from gs and returns its contents.
func (*ProdClient) SetMetadata ¶
SetMetadata sets object metadata for an arbitrary key-value pair.
func (*ProdClient) WriteFileToGS ¶
func (g *ProdClient) WriteFileToGS(gsPath gs.Path, data []byte) error
WriteFileToGS writes the specified data to the specified gs path.