Documentation ¶
Overview ¶
Package clients contains all clients or client wrappers used by Luci-config.
Index ¶
- Variables
- func NewGitilesClient(ctx context.Context, host, luciProject string) (gitilespb.GitilesClient, error)
- func WithGsClient(ctx context.Context, client GsClient) context.Context
- type GsClient
- type MockGsClient
- func (m *MockGsClient) Delete(ctx context.Context, bucket, object string) error
- func (m *MockGsClient) EXPECT() *MockGsClientMockRecorder
- func (m *MockGsClient) Read(ctx context.Context, bucket, object string, decompressive bool) ([]byte, error)
- func (m *MockGsClient) SignedURL(bucket, object string, opts *storage.SignedURLOptions) (string, error)
- func (m *MockGsClient) Touch(ctx context.Context, bucket, object string) error
- func (m *MockGsClient) UploadIfMissing(ctx context.Context, bucket, object string, data []byte, ...) (bool, error)
- type MockGsClientMockRecorder
- func (mr *MockGsClientMockRecorder) Delete(ctx, bucket, object interface{}) *gomock.Call
- func (mr *MockGsClientMockRecorder) Read(ctx, bucket, object, decompressive interface{}) *gomock.Call
- func (mr *MockGsClientMockRecorder) SignedURL(bucket, object, opts interface{}) *gomock.Call
- func (mr *MockGsClientMockRecorder) Touch(ctx, bucket, object interface{}) *gomock.Call
- func (mr *MockGsClientMockRecorder) UploadIfMissing(ctx, bucket, object, data, attrsModifyFn interface{}) *gomock.Call
Constants ¶
This section is empty.
Variables ¶
var MockGitilesClientKey = "mock gitiles clients key for testing only"
Functions ¶
func NewGitilesClient ¶
func NewGitilesClient(ctx context.Context, host, luciProject string) (gitilespb.GitilesClient, error)
NewGitilesClient returns a Gitiles client with the authority of the given luciProject or the current service if luciProject is empty.
Types ¶
type GsClient ¶
type GsClient interface { // UploadIfMissing upload data with attrs to the bucket-to-object path if it // does not exist. Return true, if the upload operation is made this time. UploadIfMissing(ctx context.Context, bucket, object string, data []byte, attrsModifyFn func(*storage.ObjectAttrs)) (bool, error) // Read reads data from the give bucket-to-object path. // If decompressive is true, it will read with decompressive transcoding: // https://cloud.google.com/storage/docs/transcoding#decompressive_transcoding Read(ctx context.Context, bucket, object string, decompressive bool) ([]byte, error) // Touch updates the custom time of the object to the current timestamp. // // Returns storage.ErrObjectNotExist if object is not found. Touch(ctx context.Context, bucket, object string) error // SignedURL is used to generate a signed url for a given GCS object. SignedURL(bucket, object string, opts *storage.SignedURLOptions) (string, error) // Delete deletes the give object. Delete(ctx context.Context, bucket, object string) error }
GsClient is an interface for interacting with Cloud Storage.
func GetGsClient ¶
GetGsClient returns the GsClient installed in the current context.
type MockGsClient ¶
type MockGsClient struct {
// contains filtered or unexported fields
}
MockGsClient is a mock of GsClient interface.
func NewMockGsClient ¶
func NewMockGsClient(ctrl *gomock.Controller) *MockGsClient
NewMockGsClient creates a new mock instance.
func (*MockGsClient) Delete ¶
func (m *MockGsClient) Delete(ctx context.Context, bucket, object string) error
Delete mocks base method.
func (*MockGsClient) EXPECT ¶
func (m *MockGsClient) EXPECT() *MockGsClientMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockGsClient) Read ¶
func (m *MockGsClient) Read(ctx context.Context, bucket, object string, decompressive bool) ([]byte, error)
Read mocks base method.
func (*MockGsClient) SignedURL ¶
func (m *MockGsClient) SignedURL(bucket, object string, opts *storage.SignedURLOptions) (string, error)
SignedURL mocks base method.
func (*MockGsClient) Touch ¶
func (m *MockGsClient) Touch(ctx context.Context, bucket, object string) error
Touch mocks base method.
func (*MockGsClient) UploadIfMissing ¶
func (m *MockGsClient) UploadIfMissing(ctx context.Context, bucket, object string, data []byte, attrsModifyFn func(*storage.ObjectAttrs)) (bool, error)
UploadIfMissing mocks base method.
type MockGsClientMockRecorder ¶
type MockGsClientMockRecorder struct {
// contains filtered or unexported fields
}
MockGsClientMockRecorder is the mock recorder for MockGsClient.
func (*MockGsClientMockRecorder) Delete ¶
func (mr *MockGsClientMockRecorder) Delete(ctx, bucket, object interface{}) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockGsClientMockRecorder) Read ¶
func (mr *MockGsClientMockRecorder) Read(ctx, bucket, object, decompressive interface{}) *gomock.Call
Read indicates an expected call of Read.
func (*MockGsClientMockRecorder) SignedURL ¶
func (mr *MockGsClientMockRecorder) SignedURL(bucket, object, opts interface{}) *gomock.Call
SignedURL indicates an expected call of SignedURL.
func (*MockGsClientMockRecorder) Touch ¶
func (mr *MockGsClientMockRecorder) Touch(ctx, bucket, object interface{}) *gomock.Call
Touch indicates an expected call of Touch.
func (*MockGsClientMockRecorder) UploadIfMissing ¶
func (mr *MockGsClientMockRecorder) UploadIfMissing(ctx, bucket, object, data, attrsModifyFn interface{}) *gomock.Call
UploadIfMissing indicates an expected call of UploadIfMissing.