gs

package
v0.0.0-...-650f6e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package gs is a generated GoMock package.

Package gs contains functionality related to Google Cloud Storage of the AuthDB.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPath

func GetPath(ctx context.Context) (string, error)

GetPath returns the sanitized Google Storage path from settings.cfg.

func IsValidPath

func IsValidPath(path string) bool

IsValidPath returns whether the given path is considered a valid Google Storage path, where:

  • the path is not empty; and
  • the path has no trailing "/", as object paths are constructed assuming this.

func NewGSClient

func NewGSClient(ctx context.Context) (*gsClient, error)

NewGSClient creates a new production Google Storage client; i.e. this client is actually Google Storage, not a mock.

func UpdateReaders

func UpdateReaders(ctx context.Context, readers stringset.Set, dryRun bool) (retErr error)

UpdateReaders updates which users have read access to the latest signed AuthDB and AuthDBRevision in Google Storage.

func UploadAuthDB

func UploadAuthDB(ctx context.Context, signedAuthDB *protocol.SignedAuthDB, revision *protocol.AuthDBRevision, readers stringset.Set, dryRun bool) (retErr error)

UploadAuthDB uploads the signed AuthDB and AuthDBRevision to Google Storage.

Types

type Client

type Client interface {
	// Close closes the connection to Google Storage.
	Close() error

	// UpdateReadACL updates the object ACLs to grant read access to the
	// given readers; readers must be user emails.
	UpdateReadACL(ctx context.Context, objectPath string, readers stringset.Set) error

	// WriteFile writes the given data to the GS path with the object ACLs
	// provided.
	WriteFile(ctx context.Context, objectPath, contentType string, data []byte, acls []storage.ACLRule) error
}

Client abstracts functionality to connect with and use Google Storage.

Non-production implementations are used primarily for testing.

type MockClient

type MockClient struct {
	// contains filtered or unexported fields
}

MockClient is a mock of Client interface.

func NewMockClient

func NewMockClient(ctrl *gomock.Controller) *MockClient

NewMockClient creates a new mock instance.

func (*MockClient) Close

func (m *MockClient) Close() error

Close mocks base method.

func (*MockClient) EXPECT

func (m *MockClient) EXPECT() *MockClientMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockClient) UpdateReadACL

func (m *MockClient) UpdateReadACL(ctx context.Context, objectPath string, readers stringset.Set) error

UpdateReadACL mocks base method.

func (*MockClient) WriteFile

func (m *MockClient) WriteFile(ctx context.Context, objectPath, contentType string, data []byte, acls []storage.ACLRule) error

WriteFile mocks base method.

type MockClientMockRecorder

type MockClientMockRecorder struct {
	// contains filtered or unexported fields
}

MockClientMockRecorder is the mock recorder for MockClient.

func (*MockClientMockRecorder) Close

func (mr *MockClientMockRecorder) Close() *gomock.Call

Close indicates an expected call of Close.

func (*MockClientMockRecorder) UpdateReadACL

func (mr *MockClientMockRecorder) UpdateReadACL(ctx, objectPath, readers interface{}) *gomock.Call

UpdateReadACL indicates an expected call of UpdateReadACL.

func (*MockClientMockRecorder) WriteFile

func (mr *MockClientMockRecorder) WriteFile(ctx, objectPath, contentType, data, acls interface{}) *gomock.Call

WriteFile indicates an expected call of WriteFile.

type MockedClient

type MockedClient struct {
	Client *MockClient
	Ctx    context.Context
}

MockedClient is a mocked Google Storage client for testing. It wraps a MockClient and a context with the mocked client

func NewMockedClient

func NewMockedClient(ctx context.Context, ctl *gomock.Controller) *MockedClient

NewMockedClient returns a new MockedClient for testing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL