client

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	Token string
	Scope string // user or team ID
}

Auth is used to supply the client with authorization credentials.

type Client

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

Client provides the client api.

func NewClient

func NewClient(target string, creds credentials.TransportCredentials) (*Client, error)

NewClient starts the client.

func (*Client) AddProject

func (c *Client) AddProject(ctx context.Context, name string, auth Auth) (*pb.GetProjectReply, error)

AddProject add a new project under the given scope.

func (*Client) AddTeam

func (c *Client) AddTeam(ctx context.Context, name string, auth Auth) (*pb.AddTeamReply, error)

AddTeam add a new team.

func (*Client) AddToken

func (c *Client) AddToken(ctx context.Context, project string, auth Auth) (*pb.AddTokenReply, error)

AddToken add a new app token under the given project.

func (*Client) Close

func (c *Client) Close() error

Close closes the client's grpc connection and cancels any active requests.

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, name string, auth Auth) (*pb.GetProjectReply, error)

GetProject returns a project by name.

func (*Client) GetTeam

func (c *Client) GetTeam(ctx context.Context, teamID string, auth Auth) (*pb.GetTeamReply, error)

GetTeam returns a team by ID.

func (*Client) InviteToTeam

func (c *Client) InviteToTeam(ctx context.Context, teamID, email string, auth Auth) (*pb.InviteToTeamReply, error)

InviteToTeam invites the given email to a team by ID.

func (*Client) LeaveTeam

func (c *Client) LeaveTeam(ctx context.Context, teamID string, auth Auth) error

LeaveTeam removes the authorized user from a team by ID.

func (*Client) ListBucketPath

func (c *Client) ListBucketPath(ctx context.Context, project, pth string, auth Auth) (*pb.ListBucketPathReply, error)

ListBucketPath returns information about a bucket path.

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, auth Auth) (*pb.ListProjectsReply, error)

ListProjects returns a list of all authorized projects.

func (*Client) ListTeams

func (c *Client) ListTeams(ctx context.Context, auth Auth) (*pb.ListTeamsReply, error)

ListTeams returns a list of authorized teams.

func (*Client) ListTokens

func (c *Client) ListTokens(ctx context.Context, project string, auth Auth) (*pb.ListTokensReply, error)

ListTokens returns a list of all app tokens for the given project.

func (*Client) Login

func (c *Client) Login(ctx context.Context, email string) (*pb.LoginReply, error)

Login currently gets or creates a user for the given email address, and then waits for email-based verification. @todo: Create a dedicated signup flow that collects more info like name, etc.

func (*Client) Logout

func (c *Client) Logout(ctx context.Context, auth Auth) error

Logout deletes a remote session.

func (*Client) PullBucketPath

func (c *Client) PullBucketPath(
	ctx context.Context,
	bucketPath string,
	writer io.Writer,
	auth Auth,
	opts ...PullBucketPathOption,
) error

PullBucketPath pulls the bucket path, writing it to writer if it's a file.

func (*Client) PushBucketPath

func (c *Client) PushBucketPath(
	ctx context.Context,
	project, bucketPath string,
	reader io.Reader,
	auth Auth,
	opts ...PushBucketPathOption,
) (result path.Resolved, root path.Path, err error)

PushBucketPath pushes a file to a bucket path. The bucket and any directory paths will be created if they don't exist. This will return the resolved path and the bucket's new root path.

func (*Client) RemoveBucketPath

func (c *Client) RemoveBucketPath(ctx context.Context, pth string, auth Auth) error

RemoveBucketPath removes the file or directory at path. Bucket files and directories will be unpinned. If the resulting bucket is empty, it will also be removed.

func (*Client) RemoveProject

func (c *Client) RemoveProject(ctx context.Context, name string, auth Auth) error

RemoveProject removes a project by ID.

func (*Client) RemoveTeam

func (c *Client) RemoveTeam(ctx context.Context, teamID string, auth Auth) error

RemoveTeam removes a team by ID.

func (*Client) RemoveToken

func (c *Client) RemoveToken(ctx context.Context, tokenID string, auth Auth) error

RemoveToken removes an app token by ID.

func (*Client) Switch

func (c *Client) Switch(ctx context.Context, auth Auth) error

Switch changes session scope.

func (*Client) Whoami

func (c *Client) Whoami(ctx context.Context, auth Auth) (*pb.WhoamiReply, error)

Whoami returns session info.

type PullBucketPathOption

type PullBucketPathOption func(*PullBucketPathOptions)

PullBucketPathOption specifies an option for pulling a bucket path.

func WithPullProgress

func WithPullProgress(ch chan<- int64) PullBucketPathOption

WithPullProgress writes progress updates to the given channel.

type PullBucketPathOptions

type PullBucketPathOptions struct {
	Progress chan<- int64
}

PullBucketPathOptions defines options for pulling a bucket path.

type PushBucketPathOption

type PushBucketPathOption func(*PushBucketPathOptions)

PushBucketPathOption specifies an option for pushing a bucket path.

func WithPushProgress

func WithPushProgress(ch chan<- int64) PushBucketPathOption

WithPushProgress writes progress updates to the given channel.

type PushBucketPathOptions

type PushBucketPathOptions struct {
	Progress chan<- int64
}

PushBucketPathOptions defines options for pushing a bucket path.

Jump to

Keyboard shortcuts

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