client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: MPL-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package client contains the Waypoint client implementation.

The Waypoint client exposes a slightly higher level of abstraction than direct a API client for performing operations on an application. The primary consumer of this package is the CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestApp

func TestApp(t testing.T, c *Project) string

TestApp returns an app reference that can be used for testing.

Types

type App

type App struct {
	UI terminal.UI
	// contains filtered or unexported fields
}

App is used for application-specific operations.

func (*App) Auth

func (c *App) Auth(ctx context.Context, op *pb.Job_AuthOp) (*pb.Job_AuthResult, error)

func (*App) Build

func (c *App) Build(ctx context.Context, op *pb.Job_BuildOp) (*pb.Job_BuildResult, error)

func (*App) ConfigSync added in v0.2.0

func (c *App) ConfigSync(ctx context.Context, op *pb.Job_ConfigSyncOp) (*pb.Job_ConfigSyncResult, error)

func (*App) Deploy

func (c *App) Deploy(ctx context.Context, op *pb.Job_DeployOp) (*pb.Job_DeployResult, error)

func (*App) Destroy

func (c *App) Destroy(ctx context.Context, op *pb.Job_DestroyOp) error

func (*App) Docs

func (c *App) Docs(ctx context.Context, op *pb.Job_DocsOp) (*pb.Job_DocsResult, error)

func (*App) Exec added in v0.3.0

func (c *App) Exec(ctx context.Context, op *pb.Job_ExecOp, mon chan pb.Job_State) error

func (*App) Logs

func (*App) Noop

func (c *App) Noop(ctx context.Context) error

Noop executes a noop operation. This is primarily for testing but is exported since it has its uses in verifying a runner is functioning properly.

A noop operation will exercise the full logic of queueing a job, assigning it to a runner, dequeueing as a runner, executing, etc. It will use real remote runners if the client is configured to do so.

func (*App) PushBuild

func (c *App) PushBuild(ctx context.Context, op *pb.Job_PushOp) error

func (*App) Ref

func (c *App) Ref() *pb.Ref_Application

Ref returns the application reference that this client is using.

func (*App) Release

func (c *App) Release(ctx context.Context, op *pb.Job_ReleaseOp) (*pb.Job_ReleaseResult, error)

func (*App) StatusReport added in v0.4.0

func (c *App) StatusReport(ctx context.Context, op *pb.Job_StatusReportOp) (*pb.Job_StatusReportResult, error)

func (*App) Up added in v0.3.0

func (c *App) Up(ctx context.Context, op *pb.Job_UpOp) (*pb.Job_Result, error)

type Option

type Option func(*Project, *config) error

func WithClient

func WithClient(client pb.WaypointClient) Option

WithClient sets the client directly. In this case, the runner won't attempt any connection at all regardless of other configuration (env vars or waypoint config file). This will be used.

func WithClientConnect

func WithClientConnect(opts ...serverclient.ConnectOption) Option

WithClientConnect specifies the options for connecting to a client. If WithClient is specified, that client is always used.

If WithLocal is set and no client is specified and no server creds can be found, then an in-process server will be created.

func WithLabels

func WithLabels(m map[string]string) Option

WithLabels sets the labels or any operations.

func WithLocal

func WithLocal() Option

WithLocal puts the client in local exec mode. In this mode, the client will spin up a per-operation runner locally and reference the local on-disk data for all operations.

func WithLogger

func WithLogger(log hclog.Logger) Option

WithLogger sets the logger for the client.

func WithProjectRef

func WithProjectRef(ref *pb.Ref_Project) Option

WithProjectRef sets the project reference for all operations performed.

func WithSourceOverrides

func WithSourceOverrides(m map[string]string) Option

WithSourceOverrides sets the data source overrides for queued jobs.

func WithUI

func WithUI(ui terminal.UI) Option

WithUI sets the UI to use for the client.

func WithWorkspaceRef

func WithWorkspaceRef(ref *pb.Ref_Workspace) Option

WithWorkspaceRef sets the workspace reference for all operations performed. If this isn't set, the default workspace will be used.

type Project

type Project struct {
	UI terminal.UI
	// contains filtered or unexported fields
}

Project is the primary structure for interacting with a Waypoint server as a client. The client exposes a slightly higher level of abstraction over the server API for performing operations locally and remotely.

func New

func New(ctx context.Context, opts ...Option) (*Project, error)

New initializes a new client.

func TestProject

func TestProject(t testing.T, opts ...Option) *Project

TestProject returns an initialized client pointing to an in-memory test server. This will close automatically on test completion.

This will also change the working directory to a temporary directory so that any side effect file creation doesn't impact the real working directory. If you need to use your working directory, query it before calling this.

func (*Project) App

func (c *Project) App(n string) *App

App returns the app-specific operations client.

func (*Project) Client

func (c *Project) Client() pb.WaypointClient

Client returns the raw Waypoint server API client.

func (*Project) Close

func (c *Project) Close() error

Close should be called to clean up any resources that the client created.

func (*Project) Local

func (c *Project) Local() bool

Local is true if the server is an in-process just-in-time server.

func (*Project) LocalRunnerId added in v0.3.0

func (c *Project) LocalRunnerId() (string, bool)

LocalRunnerId returns the id of the runner that this project started This is used to target jobs specifically at this runner.

func (*Project) Ref

func (c *Project) Ref() *pb.Ref_Project

Ref returns the raw Waypoint server API client.

func (*Project) ServerVersion added in v0.3.1

func (c *Project) ServerVersion() *pb.VersionInfo

ServerVersion returns the server version that this client is connected to.

func (*Project) Validate

func (c *Project) Validate(ctx context.Context, op *pb.Job_ValidateOp) (*pb.Job_ValidateResult, error)

func (*Project) WorkspaceRef

func (c *Project) WorkspaceRef() *pb.Ref_Workspace

WorkspaceRef returns the application reference that this client is using.

Jump to

Keyboard shortcuts

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